[openssl] master update

Richard Levitte levitte at openssl.org
Wed Apr 24 05:58:15 UTC 2019


The branch master has been updated
       via  bacc3081309ef4489b78d1ee8bf04122785ba588 (commit)
      from  0109e030db9207a47e195b4c3a3b13e9017f0ed2 (commit)


- Log -----------------------------------------------------------------
commit bacc3081309ef4489b78d1ee8bf04122785ba588
Author: Richard Levitte <levitte at openssl.org>
Date:   Wed Apr 17 22:30:03 2019 +0200

    Recognise clang -fsanitize options and translate them
    
    Because we depend on knowing if clang's address, memory or undefinedbehavior
    sanitizers are enabled, we make an extra effort to detect them among the
    C flags, and adjust the %disabled values accordingly.
    
    Reviewed-by: Bernd Edlinger <bernd.edlinger at hotmail.de>
    (Merged from https://github.com/openssl/openssl/pull/8778)

-----------------------------------------------------------------------

Summary of changes:
 Configure | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/Configure b/Configure
index f9533bd..8b6d237 100755
--- a/Configure
+++ b/Configure
@@ -1340,6 +1340,27 @@ unless ($disabled{threads}) {
     }
 }
 
+# Find out if clang's sanitizers have been enabled with -fsanitize
+# flags and ensure that the corresponding %disabled elements area
+# removed to reflect that the sanitizers are indeed enabled.
+my %detected_sanitizers = ();
+foreach (grep /^-fsanitize=/, @{$config{CFLAGS} || []}) {
+    (my $checks = $_) =~ s/^-fsanitize=//;
+    foreach (split /,/, $checks) {
+        my $d = { address       => 'asan',
+                  undefined     => 'ubsan',
+                  memory        => 'msan' } -> {$_};
+        next unless defined $d;
+
+        $detected_sanitizers{$d} = 1;
+        if (defined $disabled{$d}) {
+            die "***** Conflict between disabling $d and enabling $_ sanitizer"
+                if $disabled{$d} ne "default";
+            delete $disabled{$d};
+        }
+    }
+}
+
 # If threads still aren't disabled, add a C macro to ensure the source
 # code knows about it.  Any other flag is taken care of by the configs.
 unless($disabled{threads}) {
@@ -1367,12 +1388,12 @@ if ($disabled{"dynamic-engine"}) {
         $config{dynamic_engines} = 1;
 }
 
-unless ($disabled{asan}) {
+unless ($disabled{asan} || defined $detected_sanitizers{asan}) {
     push @{$config{cflags}}, "-fsanitize=address";
     push @{$config{cxxflags}}, "-fsanitize=address" if $config{CXX};
 }
 
-unless ($disabled{ubsan}) {
+unless ($disabled{ubsan} || defined $detected_sanitizers{ubsan}) {
     # -DPEDANTIC or -fnosanitize=alignment may also be required on some
     # platforms.
     push @{$config{cflags}}, "-fsanitize=undefined", "-fno-sanitize-recover=all";
@@ -1380,7 +1401,7 @@ unless ($disabled{ubsan}) {
         if $config{CXX};
 }
 
-unless ($disabled{msan}) {
+unless ($disabled{msan} || defined $detected_sanitizers{msan}) {
   push @{$config{cflags}}, "-fsanitize=memory";
   push @{$config{cxxflags}}, "-fsanitize=memory" if $config{CXX};
 }


More information about the openssl-commits mailing list