get core dumps on Linux

Peter Waechtler peter at
Tue Apr 27 09:40:15 GMT 2004

The problem described in the nice SAMBA-HOWTO-Collection
that one does not get a core dump on Linux for programs that
did switch uid can be circumvented in user space.
I added the following code snippets to our SMB fileserver PCShare.

I tried to convince the great dictator^H^H^H Linus but failed;)

BTW, the kill() in the sighandler is for SIGABRT - SEGV and BUS
will return to the faulting instruction and immediatly trap again but
not when sending a "kill -11" or likewise.

#if defined(__linux__)
#include <sys/prctl.h>

static void fatal_sighandler(int signum)
	/* ensure the core dump is owned by root, but Linux has a flaw here */
        signal(signum, SIG_DFL);

#if defined(__linux__)
        signal(SIGSEGV, fatal_sighandler);
        signal(SIGABRT, fatal_sighandler);
        signal(SIGBUS, fatal_sighandler);

More information about the samba-technical mailing list