From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030910 Firebird/0.6.1+ Description of problem: Normally, setuid() programs can't dump core. However, a setuid() program should be able to use prctl() (man prctl) to enable coredumps. Under this kernel, that doesn't seem to be the case. Basically, the end result is one cannot do any debugging of setuid programs, which is a serious hinderance to the use of Linux as a development platform. Here is a test script: #include <stdio.h> #include <sys/prctl.h> int main(int argc, char* argv[]) { setuid(9); prctl(PR_SET_DUMPABLE, 1, 0, 0, 0); printf("sleeping for 20 seconds; kill me now\n"); sleep(20); exit(0); } Version-Release number of selected component (if applicable): kernel-2.4.20-20.9 How reproducible: Always Steps to Reproduce: 1. ulimit -c unlimited 2. gcc t.c 3. ./a.out & 3. kill -SEGV <pid> Actual Results: Program dies, no core file is left Expected Results: Program dies, core file is left Additional info: Possibly related to this problem: http://www.ussg.iu.edu/hypermail/linux/kernel/0305.1/0232.html http://www.ussg.iu.edu/hypermail/linux/kernel/0304.3/0434.html
*** Bug 98825 has been marked as a duplicate of this bug. ***
This affects current 7.3 through 9 kernels. Simple repro case: #include <sys/types.h> #include <sys/prctl.h> #include <unistd.h> #include <stdio.h> #include <signal.h> int main(int argc, char **argv) { if (prctl(PR_SET_DUMPABLE, 0) || prctl(PR_SET_DUMPABLE, 1)) { perror("prctl(PR_SET_DUMPABLE)"); return 1; } if (prctl(PR_GET_DUMPABLE) != 1) { fprintf(stderr, "prctl(PR_SET_DUMPABLE, 1) was ignored.\n"); return 1; } printf("OK.\n"); return 0; }
The fix is as simple as below IIRC: --- kernel/sys.c.orig Tue Dec 2 10:30:02 2003 +++ kernel/sys.c Tue Dec 2 10:30:29 2003 @@ -1242,7 +1242,6 @@ error = -EINVAL; break; } - if (is_dumpable(current)) current->mm->dumpable = arg2; break; case PR_SET_UNALIGN: