]> granicus.if.org Git - php/commitdiff
Disable ifunc resolvers if memory sanitizer is used
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 28 Jun 2019 15:15:56 +0000 (17:15 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 28 Jun 2019 15:15:56 +0000 (17:15 +0200)
Just marking them as no_sanitize("memory") is unforunately not
sufficient, as the function still gets instrumented -- the attribute
only disables reporting.

Zend/zend_cpuinfo.h
Zend/zend_portability.h

index 87bc75c39a42cec57d42a5e9f6bc3ebec2935962..009944e7129d97d9626e81d4f9520e2b9fbaca69 100644 (file)
@@ -111,11 +111,7 @@ ZEND_API int zend_cpu_supports(zend_cpu_feature feature);
  * CPU support helpers from asan.
  * See also https://github.com/google/sanitizers/issues/342. */
 #if __has_attribute(no_sanitize_address)
-# if __has_feature(memory_sanitizer)
-#  define ZEND_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address)) __attribute__((no_sanitize("memory")))
-# else
-#  define ZEND_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
-# endif
+# define ZEND_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
 #else
 # define ZEND_NO_SANITIZE_ADDRESS
 #endif
index aae08a49c16d048f5d039efbf616661f4d861e6a..9416a362e3636a1f27d30473bd234bcc58b1d400 100644 (file)
@@ -524,6 +524,14 @@ static zend_always_inline double _zend_get_nan(void) /* {{{ */
 
 /* Intrinsics macros start. */
 
+/* Memory sanitizer is incompatible with ifunc resolvers. Even if the resolver
+ * is marked as no_sanitize("memory") it will still be instrumented and crash. */
+#if defined(__has_feature)
+# if __has_feature(memory_sanitizer)
+#  undef HAVE_FUNC_ATTRIBUTE_IFUNC
+# endif
+#endif
+
 #if defined(HAVE_FUNC_ATTRIBUTE_IFUNC) && defined(HAVE_FUNC_ATTRIBUTE_TARGET)
 # define ZEND_INTRIN_HAVE_IFUNC_TARGET 1
 #endif