Skip to content

Commit 3db38ed

Browse files
keesJonathan Corbet
authored andcommitted
doc: ReSTify keys-request-key.txt
Adjusts for ReST markup and moves under keys security devel index. Cc: David Howells <dhowells@redhat.com> Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
1 parent 09f5412 commit 3db38ed

File tree

7 files changed

+38
-42
lines changed

7 files changed

+38
-42
lines changed

Documentation/filesystems/nfs/idmapper.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ request-key will find the first matching line and corresponding program. In
5555
this case, /some/other/program will handle all uid lookups and
5656
/usr/sbin/nfs.idmap will handle gid, user, and group lookups.
5757

58-
See <file:Documentation/security/keys-request-key.txt> for more information
58+
See <file:Documentation/security/keys/request-key.rst> for more information
5959
about the request-key function.
6060

6161

Documentation/networking/dns_resolver.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ the key will be discarded and recreated when the data it holds has expired.
143143
dns_query() returns a copy of the value attached to the key, or an error if
144144
that is indicated instead.
145145

146-
See <file:Documentation/security/keys-request-key.txt> for further
146+
See <file:Documentation/security/keys/request-key.rst> for further
147147
information about request-key function.
148148

149149

Documentation/security/00-INDEX

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
00-INDEX
22
- this file.
3-
keys-request-key.txt
4-
- description of the kernel key request service.
53
keys-trusted-encrypted.txt
64
- info on the Trusted and Encrypted keys in the kernel key ring service.

Documentation/security/keys/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ Kernel Keys
77

88
core
99
ecryptfs
10+
request-key

Documentation/security/keys-request-key.txt renamed to Documentation/security/keys/request-key.rst

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1-
===================
2-
KEY REQUEST SERVICE
3-
===================
1+
===================
2+
Key Request Service
3+
===================
44

55
The key request service is part of the key retention service (refer to
66
Documentation/security/keys.txt). This document explains more fully how
77
the requesting algorithm works.
88

99
The process starts by either the kernel requesting a service by calling
10-
request_key*():
10+
``request_key*()``::
1111

1212
struct key *request_key(const struct key_type *type,
1313
const char *description,
1414
const char *callout_info);
1515

16-
or:
16+
or::
1717

1818
struct key *request_key_with_auxdata(const struct key_type *type,
1919
const char *description,
2020
const char *callout_info,
2121
size_t callout_len,
2222
void *aux);
2323

24-
or:
24+
or::
2525

2626
struct key *request_key_async(const struct key_type *type,
2727
const char *description,
2828
const char *callout_info,
2929
size_t callout_len);
3030

31-
or:
31+
or::
3232

3333
struct key *request_key_async_with_auxdata(const struct key_type *type,
3434
const char *description,
3535
const char *callout_info,
3636
size_t callout_len,
3737
void *aux);
3838

39-
Or by userspace invoking the request_key system call:
39+
Or by userspace invoking the request_key system call::
4040

4141
key_serial_t request_key(const char *type,
4242
const char *description,
@@ -67,38 +67,37 @@ own upcall mechanisms. If they do, then those should be substituted for the
6767
forking and execution of /sbin/request-key.
6868

6969

70-
===========
71-
THE PROCESS
70+
The Process
7271
===========
7372

7473
A request proceeds in the following manner:
7574

76-
(1) Process A calls request_key() [the userspace syscall calls the kernel
75+
1) Process A calls request_key() [the userspace syscall calls the kernel
7776
interface].
7877

79-
(2) request_key() searches the process's subscribed keyrings to see if there's
78+
2) request_key() searches the process's subscribed keyrings to see if there's
8079
a suitable key there. If there is, it returns the key. If there isn't,
8180
and callout_info is not set, an error is returned. Otherwise the process
8281
proceeds to the next step.
8382

84-
(3) request_key() sees that A doesn't have the desired key yet, so it creates
83+
3) request_key() sees that A doesn't have the desired key yet, so it creates
8584
two things:
8685

87-
(a) An uninstantiated key U of requested type and description.
86+
a) An uninstantiated key U of requested type and description.
8887

89-
(b) An authorisation key V that refers to key U and notes that process A
88+
b) An authorisation key V that refers to key U and notes that process A
9089
is the context in which key U should be instantiated and secured, and
9190
from which associated key requests may be satisfied.
9291

93-
(4) request_key() then forks and executes /sbin/request-key with a new session
92+
4) request_key() then forks and executes /sbin/request-key with a new session
9493
keyring that contains a link to auth key V.
9594

96-
(5) /sbin/request-key assumes the authority associated with key U.
95+
5) /sbin/request-key assumes the authority associated with key U.
9796

98-
(6) /sbin/request-key execs an appropriate program to perform the actual
97+
6) /sbin/request-key execs an appropriate program to perform the actual
9998
instantiation.
10099

101-
(7) The program may want to access another key from A's context (say a
100+
7) The program may want to access another key from A's context (say a
102101
Kerberos TGT key). It just requests the appropriate key, and the keyring
103102
search notes that the session keyring has auth key V in its bottom level.
104103

@@ -110,10 +109,10 @@ A request proceeds in the following manner:
110109
instantiate key U, using key W as a reference (perhaps it contacts a
111110
Kerberos server using the TGT) and then instantiates key U.
112111

113-
(9) Upon instantiating key U, auth key V is automatically revoked so that it
112+
9) Upon instantiating key U, auth key V is automatically revoked so that it
114113
may not be used again.
115114

116-
(10) The program then exits 0 and request_key() deletes key V and returns key
115+
10) The program then exits 0 and request_key() deletes key V and returns key
117116
U to the caller.
118117

119118
This also extends further. If key W (step 7 above) didn't exist, key W would
@@ -127,8 +126,7 @@ This is because process A's keyrings can't simply be attached to
127126
of them, and (b) it requires the same UID/GID/Groups all the way through.
128127

129128

130-
====================================
131-
NEGATIVE INSTANTIATION AND REJECTION
129+
Negative Instantiation And Rejection
132130
====================================
133131

134132
Rather than instantiating a key, it is possible for the possessor of an
@@ -145,23 +143,22 @@ signal, the key under construction will be automatically negatively
145143
instantiated for a short amount of time.
146144

147145

148-
====================
149-
THE SEARCH ALGORITHM
146+
The Search Algorithm
150147
====================
151148

152149
A search of any particular keyring proceeds in the following fashion:
153150

154-
(1) When the key management code searches for a key (keyring_search_aux) it
151+
1) When the key management code searches for a key (keyring_search_aux) it
155152
firstly calls key_permission(SEARCH) on the keyring it's starting with,
156153
if this denies permission, it doesn't search further.
157154

158-
(2) It considers all the non-keyring keys within that keyring and, if any key
155+
2) It considers all the non-keyring keys within that keyring and, if any key
159156
matches the criteria specified, calls key_permission(SEARCH) on it to see
160157
if the key is allowed to be found. If it is, that key is returned; if
161158
not, the search continues, and the error code is retained if of higher
162159
priority than the one currently set.
163160

164-
(3) It then considers all the keyring-type keys in the keyring it's currently
161+
3) It then considers all the keyring-type keys in the keyring it's currently
165162
searching. It calls key_permission(SEARCH) on each keyring, and if this
166163
grants permission, it recurses, executing steps (2) and (3) on that
167164
keyring.
@@ -173,28 +170,28 @@ returned.
173170
When search_process_keyrings() is invoked, it performs the following searches
174171
until one succeeds:
175172

176-
(1) If extant, the process's thread keyring is searched.
173+
1) If extant, the process's thread keyring is searched.
177174

178-
(2) If extant, the process's process keyring is searched.
175+
2) If extant, the process's process keyring is searched.
179176

180-
(3) The process's session keyring is searched.
177+
3) The process's session keyring is searched.
181178

182-
(4) If the process has assumed the authority associated with a request_key()
179+
4) If the process has assumed the authority associated with a request_key()
183180
authorisation key then:
184181

185-
(a) If extant, the calling process's thread keyring is searched.
182+
a) If extant, the calling process's thread keyring is searched.
186183

187-
(b) If extant, the calling process's process keyring is searched.
184+
b) If extant, the calling process's process keyring is searched.
188185

189-
(c) The calling process's session keyring is searched.
186+
c) The calling process's session keyring is searched.
190187

191188
The moment one succeeds, all pending errors are discarded and the found key is
192189
returned.
193190

194191
Only if all these fail does the whole thing fail with the highest priority
195192
error. Note that several errors may have come from LSM.
196193

197-
The error priority is:
194+
The error priority is::
198195

199196
EKEYREVOKED > EKEYEXPIRED > ENOKEY
200197

security/keys/request_key.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* as published by the Free Software Foundation; either version
99
* 2 of the License, or (at your option) any later version.
1010
*
11-
* See Documentation/security/keys-request-key.txt
11+
* See Documentation/security/keys/request-key.rst
1212
*/
1313

1414
#include <linux/module.h>

security/keys/request_key_auth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* as published by the Free Software Foundation; either version
99
* 2 of the License, or (at your option) any later version.
1010
*
11-
* See Documentation/security/keys-request-key.txt
11+
* See Documentation/security/keys/request-key.rst
1212
*/
1313

1414
#include <linux/module.h>

0 commit comments

Comments
 (0)