[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/maint-0.2.7] Make clang asan work with FORTIFIED_SOURCE again.



commit 67e5d49d8a995c6d3b8bf4177046271a7d4dd157
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Mon Feb 22 14:07:58 2016 -0500

    Make clang asan work with FORTIFIED_SOURCE again.
    
    Short version: clang asan hates the glibc strcmp macro in
    bits/string2.h if you are passing it a constant string argument of
    length two or less.  (I could be off by one here, but that's the
    basic idea.)
    
    Closes issue 14821.
---
 changes/bug14821    | 4 ++++
 src/common/compat.h | 9 +++++++++
 2 files changed, 13 insertions(+)

diff --git a/changes/bug14821 b/changes/bug14821
new file mode 100644
index 0000000..0920d1f
--- /dev/null
+++ b/changes/bug14821
@@ -0,0 +1,4 @@
+  o Major bugfixes (compilation):
+    - Correctly repair hardened builds under the clang compiler. Previously,
+      our use of _FORTIFY_SOURCE would conflict with clang's address
+      sanitizer. Closes ticket 14821.
diff --git a/src/common/compat.h b/src/common/compat.h
index c7c468c..66cc079 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -42,6 +42,15 @@
 #include <netinet6/in6.h>
 #endif
 
+#if defined(__has_feature)
+#  if __has_feature(address_sanitizer)
+/* Some of the fancy glibc strcmp() macros include references to memory that
+ * clang rejects because it is off the end of a less-than-3. Clang hates this,
+ * even though those references never actually happen. */
+#    undef strcmp
+#  endif
+#endif
+
 #include <stdio.h>
 #include <errno.h>
 

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits