.\" Copyright 2002, 2006, 2008, 2012, 2013, 2015, Michael Kerrisk <mtk.manpages@gmail.com>
+.\" Copyright 2024, Alejandro Colomar <alx@kernel.org>
.\"
.\" SPDX-License-Identifier: Linux-man-pages-copyleft
.\"
-.\" Modified 27 Jun 02, Michael Kerrisk
-.\" Added PR_SET_DUMPABLE
-.\"
.TH PR_SET_DUMPABLE 2const (date) "Linux man-pages (unreleased)"
.SH NAME
PR_SET_DUMPABLE
.nf
.B #include <sys/prctl.h>
.P
-.BI "int prctl(int " op ", ..."
-.BI " \fR/*\fP unsigned long " arg2 ", unsigned long " arg3 ,
-.BI " unsigned long " arg4 ", unsigned long " arg5 " \fR*/\fP );"
+.BI "int prctl(PR_SET_DUMPABLE, long " dumpable ", 0L, 0L, 0L);"
.fi
.SH DESCRIPTION
-.TP
-.BR PR_SET_DUMPABLE " (since Linux 2.3.20)"
Set the state of the "dumpable" attribute,
which determines whether core dumps are produced for the calling process
upon delivery of a signal whose default behavior is to produce a core dump.
-.IP
-Up to and including Linux 2.6.12,
-.I arg2
-must be either 0
+.P
+.I dumpable
+must be either
+.B 0L
.RB ( SUID_DUMP_DISABLE ,
-process is not dumpable) or 1
+process is not dumpable) or
+.B 1L
.RB ( SUID_DUMP_USER ,
process is dumpable).
-Between Linux 2.6.13 and Linux 2.6.17,
-.\" commit abf75a5033d4da7b8a7e92321d74021d1fcfb502
-the value 2 was also permitted,
-which caused any binary which normally would not be dumped
-to be dumped readable by root only;
-for security reasons, this feature has been removed.
-.\" See http://marc.theaimsgroup.com/?l=linux-kernel&m=115270289030630&w=2
-.\" Subject: Fix prctl privilege escalation (CVE-2006-2451)
-.\" From: Marcel Holtmann <marcel () holtmann ! org>
-.\" Date: 2006-07-12 11:12:00
-(See also the description of
-.I /proc/sys/fs/\:suid_dumpable
-in
-.BR proc (5).)
-.IP
+.P
Normally, the "dumpable" attribute is set to 1.
However, it is reset to the current value contained in the file
.I /proc/sys/fs/\:suid_dumpable
(which by default has the value 0),
in the following circumstances:
.\" See kernel/cred.c::commit_creds() (Linux 3.18 sources)
-.RS
.IP \[bu] 3
The process's effective user or group ID is changed.
.IP \[bu]
but only if the permitted capabilities
gained exceed those already permitted for the process.
.\" Also certain namespace operations;
-.RE
-.IP
+.P
Processes that are not dumpable can not be attached via
.BR ptrace (2)
.BR PTRACE_ATTACH ;
see
.BR ptrace (2)
for further details.
-.IP
+.P
If a process is not dumpable,
the ownership of files in the process's
.IR /proc/ pid
directory is affected as described in
-.BR proc (5).
+.BR proc_pid (5).
.SH RETURN VALUE
On success,
0 is returned.
.SH ERRORS
.TP
.B EINVAL
-.I op
-is
-.B PR_SET_DUMPABLE
-and
.I arg2
is neither
.B SUID_DUMP_DISABLE
nor
.BR SUID_DUMP_USER .
+.SH FILES
+.TP
+.I /proc/sys/fs/\:suid_dumpable
+.TP
+.IR /proc/ pid /
.SH STANDARDS
Linux.
.SH HISTORY
+Linux 2.3.20.
+.P
+Between Linux 2.6.13 and Linux 2.6.17,
+.\" commit abf75a5033d4da7b8a7e92321d74021d1fcfb502
+the value
+.B 2L
+was also permitted,
+which caused any binary which normally would not be dumped
+to be dumped readable by root only;
+for security reasons, this feature has been removed.
+.\" See http://marc.theaimsgroup.com/?l=linux-kernel&m=115270289030630&w=2
+.\" Subject: Fix prctl privilege escalation (CVE-2006-2451)
+.\" From: Marcel Holtmann <marcel () holtmann ! org>
+.\" Date: 2006-07-12 11:12:00
+(See also the description of
+.I /proc/sys/fs/\:suid_dumpable
+in
+.BR proc_sys_fs (5).)
.SH SEE ALSO
-.BR prctl (2)
+.BR prctl (2),
+.BR PR_SET_DUMPABLE (2const)