| 1 |
.\" Copyright 2002-2015, Michael Kerrisk <[email protected]> |
| 2 |
.\" Copyright, the authors of the Linux man-pages project |
| 3 |
.\" |
| 4 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 5 |
.\" |
| 6 |
.TH PR_SET_DUMPABLE 2const 2026-02-08 "Linux man-pages 6.18" |
| 7 |
.SH NAME |
| 8 |
PR_SET_DUMPABLE |
| 9 |
\- |
| 10 |
set the "dumpable" attribute of the calling process |
| 11 |
.SH LIBRARY |
| 12 |
Standard C library |
| 13 |
.RI ( libc ,\~ \-lc ) |
| 14 |
.SH SYNOPSIS |
| 15 |
.nf |
| 16 |
.BR "#include <linux/prctl.h>" " /* Definition of " PR_* " constants */" |
| 17 |
.B #include <sys/prctl.h> |
| 18 |
.P |
| 19 |
.BI "int prctl(PR_SET_DUMPABLE, long " dumpable ); |
| 20 |
.fi |
| 21 |
.SH DESCRIPTION |
| 22 |
Set the state of the "dumpable" attribute, |
| 23 |
which determines whether core dumps are produced for the calling process |
| 24 |
upon delivery of a signal whose default behavior is to produce a core dump. |
| 25 |
.P |
| 26 |
.I dumpable |
| 27 |
must be either |
| 28 |
.B 0L |
| 29 |
.RB ( SUID_DUMP_DISABLE , |
| 30 |
process is not dumpable) or |
| 31 |
.B 1L |
| 32 |
.RB ( SUID_DUMP_USER , |
| 33 |
process is dumpable). |
| 34 |
.P |
| 35 |
Normally, the "dumpable" attribute is set to 1. |
| 36 |
However, it is reset to the current value contained in the file |
| 37 |
.I /proc/sys/fs/\:suid_dumpable |
| 38 |
(which by default has the value 0), |
| 39 |
in the following circumstances: |
| 40 |
.\" See kernel/cred.c::commit_creds() (Linux 3.18 sources) |
| 41 |
.IP \[bu] 3 |
| 42 |
The process's effective user or group ID is changed. |
| 43 |
.IP \[bu] |
| 44 |
The process's filesystem user or group ID is changed (see |
| 45 |
.BR credentials (7)). |
| 46 |
.IP \[bu] |
| 47 |
The process executes |
| 48 |
.RB ( execve (2)) |
| 49 |
a set-user-ID or set-group-ID program, resulting in a change |
| 50 |
of either the effective user ID or the effective group ID. |
| 51 |
.IP \[bu] |
| 52 |
The process executes |
| 53 |
.RB ( execve (2)) |
| 54 |
a program that has file capabilities (see |
| 55 |
.BR capabilities (7)), |
| 56 |
.\" See kernel/cred.c::commit_creds() |
| 57 |
but only if the permitted capabilities |
| 58 |
gained exceed those already permitted for the process. |
| 59 |
.\" Also certain namespace operations; |
| 60 |
.P |
| 61 |
Processes that are not dumpable can not be attached via |
| 62 |
.BR ptrace (2) |
| 63 |
.BR PTRACE_ATTACH ; |
| 64 |
see |
| 65 |
.BR ptrace (2) |
| 66 |
for further details. |
| 67 |
.P |
| 68 |
If a process is not dumpable, |
| 69 |
the ownership of files in the process's |
| 70 |
.IR /proc/ pid |
| 71 |
directory is affected as described in |
| 72 |
.BR proc_pid (5). |
| 73 |
.SH RETURN VALUE |
| 74 |
On success, |
| 75 |
0 is returned. |
| 76 |
On error, \-1 is returned, and |
| 77 |
.I errno |
| 78 |
is set to indicate the error. |
| 79 |
.SH ERRORS |
| 80 |
.TP |
| 81 |
.B EINVAL |
| 82 |
.I arg2 |
| 83 |
is neither |
| 84 |
.B SUID_DUMP_DISABLE |
| 85 |
nor |
| 86 |
.BR SUID_DUMP_USER . |
| 87 |
.SH FILES |
| 88 |
.TP |
| 89 |
.I /proc/sys/fs/\:suid_dumpable |
| 90 |
.TP |
| 91 |
.IR /proc/ pid / |
| 92 |
.SH STANDARDS |
| 93 |
Linux. |
| 94 |
.SH HISTORY |
| 95 |
Linux 2.3.20. |
| 96 |
.P |
| 97 |
Between Linux 2.6.13 and Linux 2.6.17, |
| 98 |
.\" commit abf75a5033d4da7b8a7e92321d74021d1fcfb502 |
| 99 |
the value |
| 100 |
.B 2L |
| 101 |
was also permitted, |
| 102 |
which caused any binary which normally would not be dumped |
| 103 |
to be dumped readable by root only; |
| 104 |
for security reasons, this feature has been removed. |
| 105 |
.\" See http://marc.theaimsgroup.com/?l=linux-kernel&m=115270289030630&w=2 |
| 106 |
.\" Subject: Fix prctl privilege escalation (CVE-2006-2451) |
| 107 |
.\" From: Marcel Holtmann <marcel () holtmann ! org> |
| 108 |
.\" Date: 2006-07-12 11:12:00 |
| 109 |
(See also the description of |
| 110 |
.I /proc/sys/fs/\:suid_dumpable |
| 111 |
in |
| 112 |
.BR proc_sys_fs (5).) |
| 113 |
.SH SEE ALSO |
| 114 |
.BR prctl (2), |
| 115 |
.BR PR_SET_DUMPABLE (2const) |