mirror of
https://github.com/php/php-src.git
synced 2026-03-24 08:12:21 +01:00
fpm allow to ptrace/make the the process dumpable for FreeBSD. (#7375)
This commit is contained in:
@@ -25,6 +25,18 @@ AC_DEFUN([AC_FPM_PRCTL],
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_FPM_PROCCTL],
|
||||
[
|
||||
AC_MSG_CHECKING([for procctl])
|
||||
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/procctl.h>]], [[procctl(0, 0, 0, 0);]])], [
|
||||
AC_DEFINE([HAVE_PROCCTL], 1, [do we have procctl?])
|
||||
AC_MSG_RESULT([yes])
|
||||
], [
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_FPM_CLOCK],
|
||||
[
|
||||
have_clock_gettime=no
|
||||
@@ -494,6 +506,7 @@ if test "$PHP_FPM" != "no"; then
|
||||
|
||||
AC_FPM_STDLIBS
|
||||
AC_FPM_PRCTL
|
||||
AC_FPM_PROCCTL
|
||||
AC_FPM_CLOCK
|
||||
AC_FPM_TRACE
|
||||
AC_FPM_BUILTIN_ATOMIC
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
#include <sys/prctl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PROCCTL
|
||||
#include <sys/procctl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_APPARMOR
|
||||
#include <sys/apparmor.h>
|
||||
#endif
|
||||
@@ -409,6 +413,13 @@ int fpm_unix_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PROCCTL
|
||||
int dumpable = PROC_TRACE_CTL_ENABLE;
|
||||
if (wp->config->process_dumpable && -1 == procctl(P_PID, getpid(), PROC_TRACE_CTL, &dumpable)) {
|
||||
zlog(ZLOG_SYSERROR, "[pool %s] failed to procctl(PROC_TRACE_CTL)", wp->config->name);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (0 > fpm_clock_init()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,8 @@ 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
|
||||
; Set the process dumpable flag (PR_SET_DUMPABLE prctl for Linux or
|
||||
; PROC_TRACE_CTL procctl for FreeBSD) even if the process user
|
||||
; or group is different than the master process user. It allows to create process
|
||||
; core dump and ptrace the process for the pool user.
|
||||
; Default Value: no
|
||||
|
||||
Reference in New Issue
Block a user