]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mod_unixd: Make CoreDumpDirectory work for FreeBSD 11+. PR 65819.
authorYann Ylavic <ylavic@apache.org>
Thu, 20 Jan 2022 20:03:04 +0000 (20:03 +0000)
committerYann Ylavic <ylavic@apache.org>
Thu, 20 Jan 2022 20:03:04 +0000 (20:03 +0000)
FreeBSD 11+ coredumping requires tracing enabled via procctl(PROC_TRACE_CTL).

Submitted by: David CARLIER <devnexen gmail.com>
Reviewed by: ylavic (by inspection)

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897269 13f79535-47bb-0310-9956-ffa450edef68

changes-entries/CoreDumpDirectory-freebsd11.txt [new file with mode: 0644]
configure.in
docs/log-message-tags/next-number
modules/arch/unix/mod_unixd.c

diff --git a/changes-entries/CoreDumpDirectory-freebsd11.txt b/changes-entries/CoreDumpDirectory-freebsd11.txt
new file mode 100644 (file)
index 0000000..e200f0c
--- /dev/null
@@ -0,0 +1,2 @@
+  *) mod_unixd: CoreDumpDirectory requires enabling tracing on FreeBSD 11+.
+     PR 65819.  [David CARLIER <devnexen gmail.com>]
index 9ba3ad46e66429055e1a67d7f1df18a3b2891616..d049ae9253e129230d96976cf4dade0bc0ebbb04 100644 (file)
@@ -476,6 +476,7 @@ pwd.h \
 grp.h \
 strings.h \
 sys/prctl.h \
+sys/procctl.h \
 sys/processor.h \
 sys/sem.h \
 sys/sdt.h \
@@ -533,6 +534,7 @@ getgrnam \
 initgroups \
 bindprocessor \
 prctl \
+procctl \
 timegm \
 getpgid \
 fopen64 \
index 427e445179fec18cd9642173f936caabbcbfb3e1..daf369612ba6429b0a66809712eaaf00e24f4060 100644 (file)
@@ -1 +1 @@
-10369
+10370
index 09343d368e2286d68c1369f3953336bc5f9dce6d..4ce279856f944301389d5f1956d6b49876d456cc 100644 (file)
@@ -50,6 +50,9 @@
 #ifdef HAVE_SYS_PRCTL_H
 #include <sys/prctl.h>
 #endif
+#ifdef HAVE_SYS_PROCCTL_H
+#include <sys/procctl.h>
+#endif
 
 #ifndef DEFAULT_USER
 #define DEFAULT_USER "#-1"
@@ -201,6 +204,19 @@ AP_DECLARE(int) ap_unixd_setup_child(void)
         }
     }
 #endif
+#if defined(HAVE_PROCCTL) && defined(PROC_TRACE_CTL)
+    /* FreeBSD 11 and above */
+    if (ap_coredumpdir_configured) {
+        int enablecoredump = PROC_TRACE_CTL_ENABLE;
+        if (procctl(P_PID, 0, PROC_TRACE_CTL, &enablecoredump) != 0) {
+            rv = errno;
+            ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, APLOGNO(10369)
+                         "set dumpable failed - this child will not coredump"
+                         " after software errors");
+            return rv;
+        }
+    }
+#endif
 
     return OK;
 }