Linux – Do segfaults *always* try to dump core

linuxsegmentation-fault

We have an in-house daemon running on a few RHEL 5 boxes which periodically segfaults. Our developers want a core file to help with debugging but I can't provoke it into producing one.

$ sudo grep segfault /var/log/messages.1
Aug 11 21:04:13 pal108 kernel: brokend[28692]: segfault at 00000000000000a8
rip 00000031d020f908 rsp 00007fff9c60f3f0 error 4

The daemon is started using daemon from /etc/init.d/functions, so adding

DAEMON_COREFILE_LIMIT=unlimited

to its sysconfig file should set ulimit accordingly. This seems to be the case, according to procfs:

$ sudo grep core /proc/$(cat /var/run/brokend.pid)/limits
Max core file size        unlimited            unlimited            bytes  

And the core file pattern points to a location that exists:

$ cat /proc/sys/kernel/core_pattern
"/tmp/core_%p_%e_%t"

Yet it still won't produce a core file. Any ideas what might could be stopping this? Does a segfault always mean the OS will attempt to produce a core file or does it rely on some application-specific coding to do so?

Best Answer

Is the daemon setuid? setuid processes won't dump core files by default.

Run sysctl fs.suid_dumpable=1 to enable setuid dumps.