Skip to content

Commit d20bebf

Browse files
bukkaweltling
authored andcommitted
Do not set PR_SET_DUMPABLE by default
1 parent 3db7427 commit d20bebf

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

sapi/fpm/fpm/fpm_conf.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ static struct ini_value_parser_s ini_fpm_pool_options[] = {
132132
{ "listen.mode", &fpm_conf_set_string, WPO(listen_mode) },
133133
{ "listen.allowed_clients", &fpm_conf_set_string, WPO(listen_allowed_clients) },
134134
{ "process.priority", &fpm_conf_set_integer, WPO(process_priority) },
135+
{ "process.dumpable", &fpm_conf_set_boolean, WPO(process_dumpable) },
135136
{ "pm", &fpm_conf_set_pm, WPO(pm) },
136137
{ "pm.max_children", &fpm_conf_set_integer, WPO(pm_max_children) },
137138
{ "pm.start_servers", &fpm_conf_set_integer, WPO(pm_start_servers) },
@@ -613,6 +614,7 @@ static void *fpm_worker_pool_config_alloc() /* {{{ */
613614
wp->config->listen_backlog = FPM_BACKLOG_DEFAULT;
614615
wp->config->pm_process_idle_timeout = 10; /* 10s by default */
615616
wp->config->process_priority = 64; /* 64 means unset */
617+
wp->config->process_dumpable = 0;
616618
wp->config->clear_env = 1;
617619

618620
if (!fpm_worker_all_pools) {
@@ -1602,6 +1604,7 @@ static void fpm_conf_dump() /* {{{ */
16021604
} else {
16031605
zlog(ZLOG_NOTICE, "\tprocess.priority = %d", wp->config->process_priority);
16041606
}
1607+
zlog(ZLOG_NOTICE, "\tprocess.dumpable = %s", BOOL2STR(wp->config->process_dumpable));
16051608
zlog(ZLOG_NOTICE, "\tpm = %s", PM2STR(wp->config->pm));
16061609
zlog(ZLOG_NOTICE, "\tpm.max_children = %d", wp->config->pm_max_children);
16071610
zlog(ZLOG_NOTICE, "\tpm.start_servers = %d", wp->config->pm_start_servers);

sapi/fpm/fpm/fpm_conf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ struct fpm_worker_pool_config_s {
6464
char *listen_mode;
6565
char *listen_allowed_clients;
6666
int process_priority;
67+
int process_dumpable;
6768
int pm;
6869
int pm_max_children;
6970
int pm_start_servers;

sapi/fpm/fpm/fpm_unix.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ int fpm_unix_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
398398
}
399399

400400
#ifdef HAVE_PRCTL
401-
if (0 > prctl(PR_SET_DUMPABLE, 1, 0, 0, 0)) {
401+
if (wp->config->process_dumpable && 0 > prctl(PR_SET_DUMPABLE, 1, 0, 0, 0)) {
402402
zlog(ZLOG_SYSERROR, "[pool %s] failed to prctl(PR_SET_DUMPABLE)", wp->config->name);
403403
}
404404
#endif

sapi/fpm/php-fpm.conf.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,12 @@ listen = 127.0.0.1:9000
197197
; Default Value: no set
198198
; process.priority = -19
199199

200+
; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user
201+
; or group is differrent than the master process user. It allows to create process
202+
; core dump and ptrace the process for the pool user.
203+
; Default Value: no
204+
; process.dumpable = yes
205+
200206
; Choose how the process manager will control the number of child processes.
201207
; Possible Values:
202208
; static - a fixed number (pm.max_children) of child processes;

0 commit comments

Comments
 (0)