mirror of https://github.com/mkerrisk/man-pages
prctl.2: PR_SET_DUMPABLE makes process non-ptrace-attachable
We've recently discovered that GDB will fail to attach to any process that sets itself non-dumpable. Tested on kernel 2.6.32, with: int main(int argc, char *argv[]) { if (prctl(PR_SET_DUMPABLE, 0, 0, 0) != 0) { perror("prctl"); } printf("Run gdb %s %d\n", argv[0], getpid()); sleep(20); abort(); } ./a.out Run gdb ./a.out 30476 gdb -q ./a.out 30476 Reading symbols from /tmp/a.out...done. Attaching to program: /tmp/a.out, process 30476 ptrace: Operation not permitted. /tmp/30476: No such file or directory. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
2e781e2082
commit
cadcf1b16b
|
@ -43,7 +43,7 @@
|
||||||
.\" FIXME: Document PR_TASK_PERF_EVENTS_DISABLE and
|
.\" FIXME: Document PR_TASK_PERF_EVENTS_DISABLE and
|
||||||
.\" PR_TASK_PERF_EVENTS_ENABLE (new in 2.6.32)
|
.\" PR_TASK_PERF_EVENTS_ENABLE (new in 2.6.32)
|
||||||
.\"
|
.\"
|
||||||
.TH PRCTL 2 2010-05-13 "Linux" "Linux Programmer's Manual"
|
.TH PRCTL 2 2011-09-17 "Linux" "Linux Programmer's Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
prctl \- operations on a process
|
prctl \- operations on a process
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
@ -120,6 +120,9 @@ for security reasons, this feature has been removed.
|
||||||
.I /proc/sys/fs/suid_dumpable
|
.I /proc/sys/fs/suid_dumpable
|
||||||
in
|
in
|
||||||
.BR proc (5).)
|
.BR proc (5).)
|
||||||
|
Processes that are not dumpable can not be attached via
|
||||||
|
.BR ptrace(2)
|
||||||
|
.BR PTRACE_ATTACH .
|
||||||
.TP
|
.TP
|
||||||
.BR PR_GET_DUMPABLE " (since Linux 2.3.20)"
|
.BR PR_GET_DUMPABLE " (since Linux 2.3.20)"
|
||||||
Return (as the function result) the current state of the calling
|
Return (as the function result) the current state of the calling
|
||||||
|
|
Loading…
Reference in New Issue