]> granicus.if.org Git - php/commitdiff
Do not set PR_SET_DUMPABLE by default
authorJakub Zelenka <bukka@php.net>
Wed, 7 Mar 2018 18:12:56 +0000 (18:12 +0000)
committerAnatol Belski <ab@php.net>
Tue, 27 Mar 2018 12:18:01 +0000 (14:18 +0200)
sapi/fpm/fpm/fpm_conf.c
sapi/fpm/fpm/fpm_conf.h
sapi/fpm/fpm/fpm_unix.c
sapi/fpm/php-fpm.conf.in

index a4d28a64786c527b179366d662b02e4dfde5aef6..d77bf062f610a0b4ff73d9f54b9b1de3b0f2188f 100644 (file)
@@ -132,6 +132,7 @@ static struct ini_value_parser_s ini_fpm_pool_options[] = {
        { "listen.mode",               &fpm_conf_set_string,      WPO(listen_mode) },
        { "listen.allowed_clients",    &fpm_conf_set_string,      WPO(listen_allowed_clients) },
        { "process.priority",          &fpm_conf_set_integer,     WPO(process_priority) },
+       { "process.dumpable",          &fpm_conf_set_boolean,     WPO(process_dumpable) },
        { "pm",                        &fpm_conf_set_pm,          WPO(pm) },
        { "pm.max_children",           &fpm_conf_set_integer,     WPO(pm_max_children) },
        { "pm.start_servers",          &fpm_conf_set_integer,     WPO(pm_start_servers) },
@@ -613,6 +614,7 @@ static void *fpm_worker_pool_config_alloc() /* {{{ */
        wp->config->listen_backlog = FPM_BACKLOG_DEFAULT;
        wp->config->pm_process_idle_timeout = 10; /* 10s by default */
        wp->config->process_priority = 64; /* 64 means unset */
+       wp->config->process_dumpable = 0;
        wp->config->clear_env = 1;
 
        if (!fpm_worker_all_pools) {
@@ -1602,6 +1604,7 @@ static void fpm_conf_dump() /* {{{ */
                } else {
                        zlog(ZLOG_NOTICE, "\tprocess.priority = %d", wp->config->process_priority);
                }
+               zlog(ZLOG_NOTICE, "\tprocess.dumpable = %s",           BOOL2STR(wp->config->process_dumpable));
                zlog(ZLOG_NOTICE, "\tpm = %s",                         PM2STR(wp->config->pm));
                zlog(ZLOG_NOTICE, "\tpm.max_children = %d",            wp->config->pm_max_children);
                zlog(ZLOG_NOTICE, "\tpm.start_servers = %d",           wp->config->pm_start_servers);
index 540b22795df3404000cad88b7e90acf4ddd3933d..4021cbc2e3be16d0d6f4d36e9bf89a788c97c14f 100644 (file)
@@ -64,6 +64,7 @@ struct fpm_worker_pool_config_s {
        char *listen_mode;
        char *listen_allowed_clients;
        int process_priority;
+       int process_dumpable;
        int pm;
        int pm_max_children;
        int pm_start_servers;
index f0d45734833a4d6bab8260b9158680f0d79c417b..7c78487df7c60a66c92e5f3c9408456b39669905 100644 (file)
@@ -398,7 +398,7 @@ int fpm_unix_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
        }
 
 #ifdef HAVE_PRCTL
-       if (0 > prctl(PR_SET_DUMPABLE, 1, 0, 0, 0)) {
+       if (wp->config->process_dumpable && 0 > prctl(PR_SET_DUMPABLE, 1, 0, 0, 0)) {
                zlog(ZLOG_SYSERROR, "[pool %s] failed to prctl(PR_SET_DUMPABLE)", wp->config->name);
        }
 #endif
index dd037db768ea92e0c61266b1b376df7f6c697775..39c8a2d4880ae1b7a85a217d105dea95fe20ab0f 100644 (file)
@@ -197,6 +197,12 @@ listen = 127.0.0.1:9000
 ; Default Value: no set
 ; process.priority = -19
 
+; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user
+; or group is differrent than the master process user. It allows to create process
+; core dump and ptrace the process for the pool user.
+; Default Value: no
+; process.dumpable = yes
+
 ; Choose how the process manager will control the number of child processes.
 ; Possible Values:
 ;   static  - a fixed number (pm.max_children) of child processes;