Skip to content

Commit 5919d0b

Browse files
committed
Use a sapi config instead
1 parent ced06f8 commit 5919d0b

File tree

4 files changed

+27
-5
lines changed

4 files changed

+27
-5
lines changed

Zend/zend_portability.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,12 @@
164164

165165
# if defined(RTLD_GROUP) && defined(RTLD_WORLD) && defined(RTLD_PARENT)
166166
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL | RTLD_GROUP | RTLD_WORLD | RTLD_PARENT)
167-
# elif defined(RTLD_DEEPBIND) && !defined(__SANITIZE_ADDRESS__) && !__has_feature(memory_sanitizer) && (!defined(LM_ID_NEWLM) || defined(PHP_USE_RTLD_DEEPBIND))
168-
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL | RTLD_DEEPBIND)
167+
# elif defined(RTLD_DEEPBIND) && !defined(__SANITIZE_ADDRESS__) && !__has_feature(memory_sanitizer)
168+
# if defined(LM_ID_NEWLM)
169+
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL | (sapi_module.isolate_symbols ? RTLD_DEEPBIND : 0))
170+
# else
171+
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL | RTLD_DEEPBIND)
172+
# endif
169173
# else
170174
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL)
171175
# endif

main/SAPI.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ struct _sapi_module_struct {
287287
const char *ini_entries;
288288
const zend_function_entry *additional_functions;
289289
unsigned int (*input_filter_init)(void);
290+
291+
bool isolate_symbols;
290292
};
291293

292294
struct _sapi_post_entry {
@@ -337,6 +339,7 @@ END_EXTERN_C()
337339
0, /* phpinfo_as_text; */ \
338340
NULL, /* ini_entries; */ \
339341
NULL, /* additional_functions */ \
340-
NULL /* input_filter_init */
342+
NULL, /* input_filter_init */ \
343+
false /* isolate_symbols */
341344

342345
#endif /* SAPI_H */

sapi/apache2handler/config.m4

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ PHP_ARG_WITH([apxs2],
77
[no])
88

99
if test "$PHP_APXS2" != "no"; then
10-
AC_DEFINE(PHP_USE_RTLD_DEEPBIND, 1, [ Use dlopen with RTLD_DEEPBIND instead of delegating isolation to the user via dlmopen ])
1110
AS_VAR_IF([PHP_APXS2], [yes], [
1211
APXS=apxs
1312
$APXS -q CFLAGS >/dev/null 2>&1

sapi/apache2handler/sapi_apache2.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,23 @@ static sapi_module_struct apache2_sapi_module = {
415415
php_apache_sapi_get_request_time, /* Request Time */
416416
NULL, /* Child Terminate */
417417

418-
STANDARD_SAPI_MODULE_PROPERTIES
418+
NULL, /* php_ini_path_override */
419+
NULL, /* default_post_reader */
420+
NULL, /* treat_data */
421+
NULL, /* executable_location */
422+
0, /* php_ini_ignore */
423+
0, /* php_ini_ignore_cwd */
424+
NULL, /* get_fd */
425+
NULL, /* force_http_10 */
426+
NULL, /* get_target_uid */
427+
NULL, /* get_target_gid */
428+
NULL, /* input_filter */
429+
NULL, /* ini_defaults */
430+
0, /* phpinfo_as_text; */
431+
NULL, /* ini_entries; */
432+
NULL, /* additional_functions */
433+
NULL, /* input_filter_init */
434+
true /* isolate_symbols */
419435
};
420436

421437
static apr_status_t php_apache_server_shutdown(void *tmp)

0 commit comments

Comments
 (0)