Skip to content

Add zend.dlopen_deepbind php.ini directive #11094

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Zend/zend.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ static ZEND_INI_MH(OnUpdateFiberStackSize) /* {{{ */
ZEND_INI_BEGIN()
ZEND_INI_ENTRY("error_reporting", NULL, ZEND_INI_ALL, OnUpdateErrorReporting)
STD_ZEND_INI_ENTRY("zend.assertions", "1", ZEND_INI_ALL, OnUpdateAssertions, assertions, zend_executor_globals, executor_globals)
STD_ZEND_INI_BOOLEAN("zend.dlopen_deepbind", "1", ZEND_INI_SYSTEM, OnUpdateBool, dlopen_deepbind, zend_compiler_globals, compiler_globals)
ZEND_INI_ENTRY3_EX("zend.enable_gc", "1", ZEND_INI_ALL, OnUpdateGCEnabled, NULL, NULL, NULL, zend_gc_enabled_displayer_cb)
STD_ZEND_INI_BOOLEAN("zend.multibyte", "0", ZEND_INI_PERDIR, OnUpdateBool, multibyte, zend_compiler_globals, compiler_globals)
ZEND_INI_ENTRY("zend.script_encoding", NULL, ZEND_INI_ALL, OnUpdateScriptEncoding)
Expand Down
2 changes: 2 additions & 0 deletions Zend/zend_globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ struct _zend_compiler_globals {

bool ini_parser_unbuffered_errors;

bool dlopen_deepbind;

zend_llist open_files;

struct _zend_ini_parser_param *ini_parser_param;
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_portability.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
# if defined(RTLD_GROUP) && defined(RTLD_WORLD) && defined(RTLD_PARENT)
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL | RTLD_GROUP | RTLD_WORLD | RTLD_PARENT)
# elif defined(RTLD_DEEPBIND) && !defined(__SANITIZE_ADDRESS__) && !__has_feature(memory_sanitizer)
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL | RTLD_DEEPBIND)
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL | (CG(dlopen_deepbind) ? RTLD_DEEPBIND : 0))
# else
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL)
# endif
Expand Down
6 changes: 6 additions & 0 deletions php.ini-development
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,12 @@ zend.exception_ignore_args = Off
; Production Value: 0
zend.exception_string_param_max_len = 15

; Decides whether to use the dlopen(3) flag RTLD_DEEPBIND, if available, when
; loading shared libraries. This ensures symbol lookup will prefer symbols from
; the shared object itself over global ones. Conflicts with the use of custom
; memory allocators.
zend.dlopen_deepbind = On

;;;;;;;;;;;;;;;;;
; Miscellaneous ;
;;;;;;;;;;;;;;;;;
Expand Down
6 changes: 6 additions & 0 deletions php.ini-production
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,12 @@ zend.exception_ignore_args = On
; of sensitive information in stack traces.
zend.exception_string_param_max_len = 0

; Decides whether to use the dlopen(3) flag RTLD_DEEPBIND, if available, when
; loading shared libraries. This ensures symbol lookup will prefer symbols from
; the shared object itself over global ones. Conflicts with the use of custom
; memory allocators.
zend.dlopen_deepbind = On

;;;;;;;;;;;;;;;;;
; Miscellaneous ;
;;;;;;;;;;;;;;;;;
Expand Down