com php-src: Disable RTLD_DEEPBIND when compiling with AddressSanitizer (-fsanitize=address).: NEWS Zend/zend_portability.h
| From: | Nikita Popov | Date: | Thu, 16 Feb 2017 16:35:29 +0000 |
| Subject: | com php-src: Disable RTLD_DEEPBIND when compiling with AddressSanitizer (-fsanitize=address).: NEWS Zend/zend_portability.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-97129@lists.php.net to get a copy of this message | ||
Commit: 61e59db99d29cd028336b66884b3a8e69b46cf71
Author: Ondřej Surý <ondrej@sury.org> Thu, 16 Feb 2017 08:57:30 +0100
Committer: Nikita Popov <nikita.ppv@gmail.com> Thu, 16 Feb 2017 17:35:29 +0100
Parents: cf3ef363232af040b9ec63ecd23b603f7acf3751
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src..git;a=commitdiff;h=61e59db99d29cd028336b66884b3a8e69b46cf71
Log:
Disable RTLD_DEEPBIND when compiling with AddressSanitizer (-fsanitize=address).
The AddressSanitizer doesn't support RTLD_DEEPBIND resulting in
erratic errors when deinitializing phar module and possibly others..
Clang use __has_feature() macro to indicate compilation with
AddressSanitizer while gcc uses __SANITIZE_ADDRESS__ define.
Fixes bug #73677.
Bugs:
https://bugs.php.net/73677
Changed paths:
M NEWS
M Zend/zend_portability.h
Diff:
diff --git a/NEWS b/NEWS
index 9b9b452..4c73dbf 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,8 @@ PHP NEWS
get_object_vars). (mhagstrand)
. Fixed bug #73954 (NAN check fails on Alpine Linux with musl). (Andrea)
. Fixed bug #74039 (is_infinite(-INF) returns false). (Christian Schmidt)
+ . Fixed bug #73677 (Generating phar.phar core dump with gcc ASAN enabled
+ build). (ondrej)
- Apache:
. Fixed bug #61471 (Incomplete POST does not timeout but is passed to PHP).
diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h
index cce55b7..9914621 100644
--- a/Zend/zend_portability.h
+++ b/Zend/zend_portability.h
@@ -131,6 +131,12 @@
#if defined(HAVE_LIBDL) && !defined(ZEND_WIN32)
+# if defined(__has_feature)
+# if __has_feature(address_sanitizer)
+# define __SANITIZE_ADDRESS__
+# endif
+# endif
+
# ifndef RTLD_LAZY
# define RTLD_LAZY 1 /* Solaris 1, FreeBSD's (2.1.7.1 and older) */
# endif
@@ -141,7 +147,7 @@
# if defined(RTLD_GROUP) && defined(RTLD_WORLD) && defined(RTLD_PARENT)
# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_GROUP | RTLD_WORLD |
RTLD_PARENT)
-# elif defined(RTLD_DEEPBIND)
+# elif defined(RTLD_DEEPBIND) && !defined(__SANITIZE_ADDRESS__)
# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_DEEPBIND)
# else
# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL)