wait.2: Add ESRCH for when pid == INT_MIN
[man-pages.git] / man7 / user-session-keyring.7
blob22560bd19c5c8fedf153ad9346ebc5c8f77e32b9
1 .\" Copyright (C) 2014 Red Hat, Inc. All Rights Reserved.
2 .\" Written by David Howells (dhowells@redhat.com)
3 .\"
4 .\" %%%LICENSE_START(GPLv2+_SW_ONEPARA)
5 .\" This program is free software; you can redistribute it and/or
6 .\" modify it under the terms of the GNU General Public License
7 .\" as published by the Free Software Foundation; either version
8 .\" 2 of the License, or (at your option) any later version.
9 .\" %%%LICENSE_END
10 .\"
11 .TH USER-SESSION-KEYRING 7 2020-08-13 Linux "Linux Programmer's Manual"
12 .SH NAME
13 user-session-keyring \- per-user default session keyring
14 .SH DESCRIPTION
15 The user session keyring is a keyring used to anchor keys on behalf of a user.
16 Each UID the kernel deals with has its own user session keyring that
17 is shared by all processes with that UID.
18 The user session keyring has a name (description) of the form
19 .I _uid_ses.<UID>
20 where
21 .I <UID>
22 is the user ID of the corresponding user.
23 .PP
24 The user session keyring is associated with the record that
25 the kernel maintains for the UID.
26 It comes into existence upon the first attempt to access either the
27 user session keyring, the
28 .BR user\-keyring (7),
29 or the
30 .BR session\-keyring (7).
31 .\" Davis Howells: the user and user-session keyrings are managed as a pair.
32 The keyring remains pinned in existence so long as there are processes
33 running with that real UID or files opened by those processes remain open.
34 (The keyring can also be pinned indefinitely by linking it
35 into another keyring.)
36 .PP
37 The user session keyring is created on demand when a thread requests it
38 or when a thread asks for its
39 .BR session\-keyring (7)
40 and that keyring doesn't exist.
41 In the latter case, a user session keyring will be created and,
42 if the session keyring wasn't to be created,
43 the user session keyring will be set as the process's actual session keyring.
44 .PP
45 The user session keyring is searched by
46 .BR request_key (2)
47 if the actual session keyring does not exist and is ignored otherwise.
48 .PP
49 A special serial number value,
50 .BR KEY_SPEC_USER_SESSION_KEYRING ,
51 is defined
52 that can be used in lieu of the actual serial number of
53 the calling process's user session keyring.
54 .PP
55 From the
56 .BR keyctl (1)
57 utility, '\fB@us\fP' can be used instead of a numeric key ID in
58 much the same way.
59 .PP
60 User session keyrings are independent of
61 .BR clone (2),
62 .BR fork (2),
63 .BR vfork (2),
64 .BR execve (2),
65 and
66 .BR _exit (2)
67 excepting that the keyring is destroyed when the UID record is destroyed
68 when the last process pinning it exits.
69 .PP
70 If a user session keyring does not exist when it is accessed,
71 it will be created.
72 .PP
73 Rather than relying on the user session keyring,
74 it is strongly recommended\(emespecially if the process
75 is running as root\(emthat a
76 .BR session\-keyring (7)
77 be set explicitly, for example by
78 .BR pam_keyinit (8).
79 .SH NOTES
80 The user session keyring was added to support situations where
81 a process doesn't have a session keyring,
82 perhaps because it was created via a pathway that didn't involve PAM
83 (e.g., perhaps it was a daemon started by
84 .BR inetd (8)).
85 In such a scenario, the user session keyring acts as a substitute for the
86 .BR session\-keyring (7).
87 .SH SEE ALSO
88 .ad l
89 .nh
90 .BR keyctl (1),
91 .BR keyctl (3),
92 .BR keyrings (7),
93 .BR persistent\-keyring (7),
94 .BR process\-keyring (7),
95 .BR session\-keyring (7),
96 .BR thread\-keyring (7),
97 .BR user\-keyring (7)