Skip to content

Do not use RTLD_DEEPBIND if dlmopen is available #18612

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 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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_extensions.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include "zend_extensions.h"
#include "zend_system_id.h"
#include "SAPI.h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You still have this include, but I don't understand why you still need this?


ZEND_API zend_llist zend_extensions;
ZEND_API uint32_t zend_extension_flags = 0;
Expand Down
6 changes: 5 additions & 1 deletion Zend/zend_portability.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,11 @@
# 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)
# if defined(LM_ID_NEWLM)
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL | (sapi_module.isolate_symbols ? RTLD_DEEPBIND : 0))
# else
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL | RTLD_DEEPBIND)
# endif
# else
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL)
# endif
Expand Down
5 changes: 4 additions & 1 deletion main/SAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ struct _sapi_module_struct {
const char *ini_entries;
const zend_function_entry *additional_functions;
unsigned int (*input_filter_init)(void);

bool isolate_symbols;
};

struct _sapi_post_entry {
Expand Down Expand Up @@ -337,6 +339,7 @@ END_EXTERN_C()
0, /* phpinfo_as_text; */ \
NULL, /* ini_entries; */ \
NULL, /* additional_functions */ \
NULL /* input_filter_init */
NULL, /* input_filter_init */ \
false /* isolate_symbols */

#endif /* SAPI_H */
18 changes: 17 additions & 1 deletion sapi/apache2handler/sapi_apache2.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,23 @@ static sapi_module_struct apache2_sapi_module = {
php_apache_sapi_get_request_time, /* Request Time */
NULL, /* Child Terminate */

STANDARD_SAPI_MODULE_PROPERTIES
NULL, /* php_ini_path_override */
NULL, /* default_post_reader */
NULL, /* treat_data */
NULL, /* executable_location */
0, /* php_ini_ignore */
0, /* php_ini_ignore_cwd */
NULL, /* get_fd */
NULL, /* force_http_10 */
NULL, /* get_target_uid */
NULL, /* get_target_gid */
NULL, /* input_filter */
NULL, /* ini_defaults */
0, /* phpinfo_as_text; */
NULL, /* ini_entries; */
NULL, /* additional_functions */
NULL, /* input_filter_init */
true /* isolate_symbols */
};

static apr_status_t php_apache_server_shutdown(void *tmp)
Expand Down