Skip to content

Commit 736172d

Browse files
committed
Disable RTLD_DEEPBIND under memory sanitizer
This was already done for address sanitizer.
1 parent 3c47290 commit 736172d

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

Zend/zend_cpuinfo.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,6 @@ ZEND_API int zend_cpu_supports(zend_cpu_feature feature);
103103
#ifndef __has_attribute
104104
# define __has_attribute(x) 0
105105
#endif
106-
#ifndef __has_feature
107-
# define __has_feature(x) 0
108-
#endif
109106

110107
/* Address sanitizer is incompatible with ifunc resolvers, so exclude the
111108
* CPU support helpers from asan.

Zend/zend_portability.h

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@
8686
#ifndef __has_builtin
8787
# define __has_builtin(x) 0
8888
#endif
89+
#ifndef __has_feature
90+
# define __has_feature(x) 0
91+
#endif
8992

9093
#if defined(ZEND_WIN32) && !defined(__clang__)
9194
# define ZEND_ASSUME(c) __assume(c)
@@ -123,10 +126,8 @@
123126

124127
#if defined(HAVE_LIBDL) && !defined(ZEND_WIN32)
125128

126-
# if defined(__has_feature)
127-
# if __has_feature(address_sanitizer)
128-
# define __SANITIZE_ADDRESS__
129-
# endif
129+
# if __has_feature(address_sanitizer)
130+
# define __SANITIZE_ADDRESS__
130131
# endif
131132

132133
# ifndef RTLD_LAZY
@@ -145,7 +146,7 @@
145146

146147
# if defined(RTLD_GROUP) && defined(RTLD_WORLD) && defined(RTLD_PARENT)
147148
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL | RTLD_GROUP | RTLD_WORLD | RTLD_PARENT)
148-
# elif defined(RTLD_DEEPBIND) && !defined(__SANITIZE_ADDRESS__)
149+
# elif defined(RTLD_DEEPBIND) && !defined(__SANITIZE_ADDRESS__) && !__has_feature(memory_sanitizer)
149150
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL | RTLD_DEEPBIND)
150151
# else
151152
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL)
@@ -526,10 +527,8 @@ static zend_always_inline double _zend_get_nan(void) /* {{{ */
526527

527528
/* Memory sanitizer is incompatible with ifunc resolvers. Even if the resolver
528529
* 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
530+
#if __has_feature(memory_sanitizer)
531+
# undef HAVE_FUNC_ATTRIBUTE_IFUNC
533532
#endif
534533

535534
#if defined(HAVE_FUNC_ATTRIBUTE_IFUNC) && defined(HAVE_FUNC_ATTRIBUTE_TARGET)

0 commit comments

Comments
 (0)