Skip to content

Commit 2c8819b

Browse files
committed
Disable ifunc resolvers if memory sanitizer is used
Just marking them as no_sanitize("memory") is unforunately not sufficient, as the function still gets instrumented -- the attribute only disables reporting.
1 parent cf29c0f commit 2c8819b

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Zend/zend_cpuinfo.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,7 @@ ZEND_API int zend_cpu_supports(zend_cpu_feature feature);
111111
* CPU support helpers from asan.
112112
* See also https://github.com/google/sanitizers/issues/342. */
113113
#if __has_attribute(no_sanitize_address)
114-
# if __has_feature(memory_sanitizer)
115-
# define ZEND_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address)) __attribute__((no_sanitize("memory")))
116-
# else
117-
# define ZEND_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
118-
# endif
114+
# define ZEND_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
119115
#else
120116
# define ZEND_NO_SANITIZE_ADDRESS
121117
#endif

Zend/zend_portability.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,14 @@ static zend_always_inline double _zend_get_nan(void) /* {{{ */
524524

525525
/* Intrinsics macros start. */
526526

527+
/* Memory sanitizer is incompatible with ifunc resolvers. Even if the resolver
528+
* is marked as no_sanitize("memory") it will still be instrumented and crash. */
529+
#if defined(__has_feature)
530+
# if __has_feature(memory_sanitizer)
531+
# undef HAVE_FUNC_ATTRIBUTE_IFUNC
532+
# endif
533+
#endif
534+
527535
#if defined(HAVE_FUNC_ATTRIBUTE_IFUNC) && defined(HAVE_FUNC_ATTRIBUTE_TARGET)
528536
# define ZEND_INTRIN_HAVE_IFUNC_TARGET 1
529537
#endif

0 commit comments

Comments
 (0)