uwrap: Add support for running with address sanitizer.
authorAndreas Schneider <asn@samba.org>
Fri, 23 Jan 2015 14:22:18 +0000 (15:22 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 28 Jan 2015 16:17:07 +0000 (17:17 +0100)
The address sanitzer will complain about our hack with variable function
attributes. This disables the checking of it.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/uid_wrapper/uid_wrapper.c
lib/uid_wrapper/wscript

index 8e3a7d312051d0537821abbc354f3f362bd8d01d..97e10267b5b8429a24c9de549cee46e42cd3e1ff 100644 (file)
 #define DESTRUCTOR_ATTRIBUTE
 #endif /* HAVE_DESTRUCTOR_ATTRIBUTE */
 
+#ifdef HAVE_ADDRESS_SANITIZER_ATTRIBUTE
+#define DO_NOT_SANITIZE_ADDRESS_ATTRIBUTE __attribute__((no_sanitize_address))
+#else /* DO_NOT_SANITIZE_ADDRESS_ATTRIBUTE */
+#define DO_NOT_SANITIZE_ADDRESS_ATTRIBUTE
+#endif /* DO_NOT_SANITIZE_ADDRESS_ATTRIBUTE */
+
 /* GCC have printf type attribute check. */
 #ifdef HAVE_FUNCTION_ATTRIBUTE_FORMAT
 #define PRINTF_ATTRIBUTE(a,b) __attribute__ ((__format__ (__printf__, a, b)))
@@ -472,6 +478,7 @@ static int libc_setgroups(size_t size, const gid_t *list)
 }
 
 #ifdef HAVE_SYSCALL
+DO_NOT_SANITIZE_ADDRESS_ATTRIBUTE
 static long int libc_vsyscall(long int sysno, va_list va)
 {
        long int args[8];
index 49c23d26109121811cad6d8240a0e6a1618a2575..61b54b94f0dfb457fddb7e06b17aa8a26cbb1143 100644 (file)
@@ -1,5 +1,6 @@
 #!/usr/bin/env python
 
+import Options
 import os
 
 VERSION="1.0.1"
@@ -68,6 +69,25 @@ def configure(conf):
             addmain=False,
             msg='Checking for library destructor support')
 
+        if Options.options.address_sanitizer:
+            # check HAVE_ADDRESS_SANITIZER_ATTRIBUTE
+            conf.CHECK_CODE('''
+                void test_address_sanitizer_attribute(void) __attribute__((no_sanitize_address));
+
+                void test_address_sanitizer_attribute(void)
+                {
+                    return;
+                }
+
+                int main(void) {
+                    return 0;
+                }
+                ''',
+                'HAVE_ADDRESS_SANITIZER_ATTRIBUTE',
+                addmain=False,
+                cflags='-Wall -Wextra -Werror',
+                msg='Checking for address sanitizer attribute')
+
         # check HAVE_FUNCTION_ATTRIBUTE_FORMAT
         conf.CHECK_CODE('''
             void log_fn(const char *format, ...) __attribute__ ((format (printf, 1, 2)));