]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
backport the following change from 2.1:
authorGreg Ames <gregames@apache.org>
Thu, 15 May 2003 20:28:18 +0000 (20:28 +0000)
committerGreg Ames <gregames@apache.org>
Thu, 15 May 2003 20:28:18 +0000 (20:28 +0000)
    Enable coredumps on Linux 2.4+ if CoreDumpDirectory is coded

I tried to clarify the doc, but it still looks like geek-speak.  Any ideas
on how to better explain this to users would be appreciated.

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

CHANGES
STATUS
configure.in
include/mpm_common.h
os/unix/unixd.c
server/mpm_common.c

diff --git a/CHANGES b/CHANGES
index da78ad8ec6816611b1ea94027c5b305fa5079d19..f2dc9d4bd3527807965b7191fa525515a3f65b27 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,9 @@
 Changes with Apache 2.0.46
 
+  *) Linux 2.4+: If Apache is started as root and you code 
+     CoreDumpDirectory, coredumps are enabled via the prctl() syscall.
+     [Greg Ames]
+
   *) ap_get_mime_headers_core: allocate space for the trailing null
      when folding is in effect.
      PR 18170 [Peter Mayne <PeterMayne@SPAM_SUX.ap.spherion.com>]
diff --git a/STATUS b/STATUS
index b27989e936a561c51a7a2be27b2e49c2ba21e082..66a15c915a64f2320dfef2d5f14f70ee09957476 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -1,5 +1,5 @@
 APACHE 2.0 STATUS:                                              -*-text-*-
-Last modified at [$Date: 2003/05/15 18:08:38 $]
+Last modified at [$Date: 2003/05/15 20:28:16 $]
 
 Release:
 
@@ -187,19 +187,6 @@ PATCHES TO PORT FROM 2.1
                (above) will look at this independently
       DELETE ME when the SSLC 2.3 compatibility entry above is removed
 
-    * Enable coredumps on Linux 2.4+ if CoreDumpDirectory is coded
-      os/unix/unixd.c                 r1.57
-      configure.in                    r1.245   
-      docs/manual/mod/mpm_common.xml  r1.23
-      include/mpm_common.h            r1.41
-      server/mpm_common.c             r1.104
-      +1: gregames, trawick, jim, nd
-      (trawick volunteers to regenerate/commit/site-update the html
-      corresponding to mpm_common.xml if that isn't something you're
-      comfortable with doing)
-      (the docs should explain the thing better. Currently it's not
-       really understandable for users. If nobody else does, nd tries to.)
-
     * Ensure that ssl-std.conf is generated at configure time, and switch
       to using the expanded config variables to work the same as 
       httpd-std.conf PR: 19611
index 08e075352f580449ff0ff3dcb8fe61420ab9641d..bdc381cf93d21e87222e7433bbc3cae8e20a0b83 100644 (file)
@@ -275,6 +275,7 @@ sys/socket.h \
 pwd.h \
 grp.h \
 strings.h \
+sys/prctl.h \
 sys/processor.h \
 sys/sem.h
 )
@@ -296,6 +297,7 @@ getpwnam \
 getgrnam \
 initgroups \
 bindprocessor \
+prctl \
 timegm \
 )
 
index 1c598b480755099f840729ca64f0e5d820212390..59616800897f73a2eae9e89f043b7a693e9eff0c 100644 (file)
@@ -276,6 +276,7 @@ const char *ap_mpm_set_scoreboard(cmd_parms *cmd, void *dummy,
  */
 #ifdef AP_MPM_WANT_SET_COREDUMPDIR
 extern char ap_coredump_dir[MAX_STRING_LEN];
+extern int ap_coredumpdir_configured;
 const char *ap_mpm_set_coredumpdir(cmd_parms *cmd, void *dummy,
                                    const char *arg);
 #endif
index 4f8b60bd34a105a4c0663b812cdad65330f7b6c6..11feda653c327f32d97cf23d8a3169e4659829ca 100644 (file)
@@ -89,6 +89,9 @@
 #ifdef HAVE_SYS_SEM_H
 #include <sys/sem.h>
 #endif
+#ifdef HAVE_SYS_PRCTL_H
+#include <sys/prctl.h>
+#endif
 
 unixd_config_rec unixd_config;
 
@@ -181,6 +184,18 @@ AP_DECLARE(int) unixd_setup_child(void)
                     (long) unixd_config.user_id);
        return -1;
     }
+#if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE) 
+    /* this applies to Linux 2.4+ */
+#ifdef AP_MPM_WANT_SET_COREDUMPDIR
+    if (ap_coredumpdir_configured) {
+        if (prctl(PR_SET_DUMPABLE, 1)) {
+            ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
+                         "set dumpable failed - this child will not coredump"
+                         " after software errors");
+        }
+    }
+#endif
+#endif
 #endif
     return 0;
 }
index 120a705960711da4c643bb5bf12ce5cfa781bc87..c7fbff9e53d12ce5e19e01c8f73e34985969644a 100644 (file)
@@ -634,6 +634,7 @@ const char *ap_mpm_set_max_requests(cmd_parms *cmd, void *dummy,
 
 #ifdef AP_MPM_WANT_SET_COREDUMPDIR
 char ap_coredump_dir[MAX_STRING_LEN];
+int ap_coredumpdir_configured;
 
 const char *ap_mpm_set_coredumpdir(cmd_parms *cmd, void *dummy,
                                    const char *arg)
@@ -660,6 +661,7 @@ const char *ap_mpm_set_coredumpdir(cmd_parms *cmd, void *dummy,
                            " is not a directory", NULL);
     }
     apr_cpystrn(ap_coredump_dir, fname, sizeof(ap_coredump_dir));
+    ap_coredumpdir_configured = 1;
     return NULL;
 }
 #endif