Add no_sanitize_address to ffi code to avoid bogus ASan reports.
authorMaxim Ostapenko <m.ostapenko@samsung.com>
Mon, 5 Dec 2016 14:55:27 +0000 (17:55 +0300)
committerMaxim Ostapenko <m.ostapenko@samsung.com>
Mon, 5 Dec 2016 14:55:27 +0000 (17:55 +0300)
Change-Id: I9e66b30a0fbdb15664f2c324b3746aee008bedcb

Modules/_ctypes/libffi/src/x86/ffi64.c

index 2014af24c655c9a0b0fd0bbb8bd86e9ca014ff52..88962423005c051ab83e4165e9dbaaab0c36383d 100644 (file)
@@ -415,6 +415,16 @@ ffi_prep_cif_machdep (ffi_cif *cif)
   return FFI_OK;
 }
 
+#ifndef __SANITIZE_ADDRESS__
+# ifdef __clang__
+#  if __has_feature(address_sanitizer)
+#   define __SANITIZE_ADDRESS__
+#  endif
+# endif
+#endif
+#ifdef __SANITIZE_ADDRESS__
+__attribute__((noinline, no_sanitize_address))
+#endif
 void
 ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
 {
@@ -564,6 +574,16 @@ ffi_prep_closure_loc (ffi_closure* closure,
   return FFI_OK;
 }
 
+#ifndef __SANITIZE_ADDRESS__
+# ifdef __clang__
+#  if __has_feature(address_sanitizer)
+#   define __SANITIZE_ADDRESS__
+#  endif
+# endif
+#endif
+#ifdef __SANITIZE_ADDRESS__
+__attribute__((noinline, no_sanitize_address))
+#endif
 int
 ffi_closure_unix64_inner(ffi_closure *closure, void *rvalue,
                         struct register_args *reg_args, char *argp)