1 .\" Copyright (C) 1994, 1995, Daniel Quinlan <quinlan@yggdrasil.com)
2 .\" Copyright (C) 2002-2008, 2017, Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" Copyright (C) 2023, Alejandro Colomar <alx@kernel.org>
5 .\" SPDX-License-Identifier: GPL-3.0-or-later
7 .TH proc_pid_attr 5 (date) "Linux man-pages (unreleased)"
9 /proc/pid/attr/ \- security-related attributes
13 .\" https://lwn.net/Articles/28222/
14 .\" From: Stephen Smalley <sds@epoch.ncsc.mil>
15 .\" To: LKML and others
16 .\" Subject: [RFC][PATCH] Process Attribute API for Security Modules
17 .\" Date: 08 Apr 2003 16:17:52 -0400
19 .\" http://www.nsa.gov/research/_files/selinux/papers/module/x362.shtml
21 The files in this directory provide an API for security modules.
22 The contents of this directory are files that can be read and written
23 in order to set security-related attributes.
24 This directory was added to support SELinux,
25 but the intention was that the API be general enough to support
26 other security modules.
27 For the purpose of explanation,
28 examples of how SELinux uses these files are provided below.
30 This directory is present only if the kernel was configured with
33 .IR /proc/ pid /attr/current " (since Linux 2.6.0)"
34 The contents of this file represent the current
35 security attributes of the process.
37 In SELinux, this file is used to get the security context of a process.
38 Prior to Linux 2.6.11, this file could not be used to set the security
39 context (a write was always denied), since SELinux limited process security
42 (see the description of
43 .IR /proc/ pid /attr/exec ,
45 Since Linux 2.6.11, SELinux lifted this restriction and began supporting
46 "set" operations via writes to this node if authorized by policy,
47 although use of this operation is only suitable for applications that are
48 trusted to maintain any desired separation between the old and new security
51 Prior to Linux 2.6.28, SELinux did not allow threads within a
52 multithreaded process to set their security context via this node
53 as it would yield an inconsistency among the security contexts of the
54 threads sharing the same memory space.
55 Since Linux 2.6.28, SELinux lifted
56 this restriction and began supporting "set" operations for threads within
57 a multithreaded process if the new security context is bounded by the old
58 security context, where the bounded relation is defined in policy and
59 guarantees that the new security context has a subset of the permissions
60 of the old security context.
62 Other security modules may choose to support "set" operations via
65 .IR /proc/ pid /attr/exec " (since Linux 2.6.0)"
66 This file represents the attributes to assign to the
67 process upon a subsequent
71 this is needed to support role/domain transitions, and
73 is the preferred point to make such transitions because it offers better
74 control over the initialization of the process in the new security label
75 and the inheritance of state.
76 In SELinux, this attribute is reset on
78 so that the new program reverts to the default behavior for any
80 calls that it may make.
81 In SELinux, a process can set
83 .IR /proc/ pid /attr/exec
86 .IR /proc/ pid /attr/fscreate " (since Linux 2.6.0)"
87 This file represents the attributes to assign to files
88 created by subsequent calls to
95 SELinux employs this file to support creation of a file
96 (using the aforementioned system calls)
98 so that there is no risk of inappropriate access being obtained
99 between the time of creation and the time that attributes are set.
100 In SELinux, this attribute is reset on
102 so that the new program reverts to the default behavior for
103 any file creation calls it may make, but the attribute will persist
104 across multiple file creation calls within a program unless it is
106 In SELinux, a process can set only its own
107 .IR /proc/ pid /attr/fscreate
110 .IR /proc/ pid /attr/keycreate " (since Linux 2.6.18)"
111 .\" commit 4eb582cf1fbd7b9e5f466e3718a59c957e75254e
112 If a process writes a security context into this file,
113 all subsequently created keys
115 will be labeled with this context.
116 For further information, see the kernel source file
117 .I Documentation/security/keys/core.rst
119 .\" commit b68101a1e8f0263dbc7b8375d2a7c57c6216fb76
120 .I Documentation/security/keys.txt
121 between Linux 3.0 and Linux 4.13, or
122 .\" commit d410fa4ef99112386de5f218dd7df7b4fca910b4
123 .I Documentation/keys.txt
126 .IR /proc/ pid /attr/prev " (since Linux 2.6.0)"
127 This file contains the security context of the process before the last
129 that is, the previous value of
130 .IR /proc/ pid /attr/current .
132 .IR /proc/ pid /attr/socketcreate " (since Linux 2.6.18)"
133 .\" commit 42c3e03ef6b298813557cdb997bd6db619cd65a2
134 If a process writes a security context into this file,
135 all subsequently created sockets will be labeled with this context.