diff options
author | David Howells <dhowells@redhat.com> | 2019-06-26 16:02:33 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2019-06-27 18:02:12 -0400 |
commit | a58946c158a040068e7c94dc1d58bbd273258068 (patch) | |
tree | e655258b700359cdfd9f762c099b7587dc0eed9b /Documentation/security | |
parent | 9b242610514fe387ef957bce05e1fdd3efd60359 (diff) |
keys: Pass the network namespace into request_key mechanism
Create a request_key_net() function and use it to pass the network
namespace domain tag into DNS revolver keys and rxrpc/AFS keys so that keys
for different domains can coexist in the same keyring.
Signed-off-by: David Howells <dhowells@redhat.com>
cc: netdev@vger.kernel.org
cc: linux-nfs@vger.kernel.org
cc: linux-cifs@vger.kernel.org
cc: linux-afs@lists.infradead.org
Diffstat (limited to 'Documentation/security')
-rw-r--r-- | Documentation/security/keys/core.rst | 28 | ||||
-rw-r--r-- | Documentation/security/keys/request-key.rst | 29 |
2 files changed, 43 insertions, 14 deletions
diff --git a/Documentation/security/keys/core.rst b/Documentation/security/keys/core.rst index ae930ae9d590..0e74f372e58c 100644 --- a/Documentation/security/keys/core.rst +++ b/Documentation/security/keys/core.rst | |||
@@ -1102,26 +1102,42 @@ payload contents" for more information. | |||
1102 | See also Documentation/security/keys/request-key.rst. | 1102 | See also Documentation/security/keys/request-key.rst. |
1103 | 1103 | ||
1104 | 1104 | ||
1105 | * To search for a key in a specific domain, call: | ||
1106 | |||
1107 | struct key *request_key_tag(const struct key_type *type, | ||
1108 | const char *description, | ||
1109 | struct key_tag *domain_tag, | ||
1110 | const char *callout_info); | ||
1111 | |||
1112 | This is identical to request_key(), except that a domain tag may be | ||
1113 | specifies that causes search algorithm to only match keys matching that | ||
1114 | tag. The domain_tag may be NULL, specifying a global domain that is | ||
1115 | separate from any nominated domain. | ||
1116 | |||
1117 | |||
1105 | * To search for a key, passing auxiliary data to the upcaller, call:: | 1118 | * To search for a key, passing auxiliary data to the upcaller, call:: |
1106 | 1119 | ||
1107 | struct key *request_key_with_auxdata(const struct key_type *type, | 1120 | struct key *request_key_with_auxdata(const struct key_type *type, |
1108 | const char *description, | 1121 | const char *description, |
1122 | struct key_tag *domain_tag, | ||
1109 | const void *callout_info, | 1123 | const void *callout_info, |
1110 | size_t callout_len, | 1124 | size_t callout_len, |
1111 | void *aux); | 1125 | void *aux); |
1112 | 1126 | ||
1113 | This is identical to request_key(), except that the auxiliary data is | 1127 | This is identical to request_key_tag(), except that the auxiliary data is |
1114 | passed to the key_type->request_key() op if it exists, and the callout_info | 1128 | passed to the key_type->request_key() op if it exists, and the |
1115 | is a blob of length callout_len, if given (the length may be 0). | 1129 | callout_info is a blob of length callout_len, if given (the length may be |
1130 | 0). | ||
1116 | 1131 | ||
1117 | 1132 | ||
1118 | * To search for a key under RCU conditions, call:: | 1133 | * To search for a key under RCU conditions, call:: |
1119 | 1134 | ||
1120 | struct key *request_key_rcu(const struct key_type *type, | 1135 | struct key *request_key_rcu(const struct key_type *type, |
1121 | const char *description); | 1136 | const char *description, |
1137 | struct key_tag *domain_tag); | ||
1122 | 1138 | ||
1123 | which is similar to request_key() except that it does not check for keys | 1139 | which is similar to request_key_tag() except that it does not check for |
1124 | that are under construction and it will not call out to userspace to | 1140 | keys that are under construction and it will not call out to userspace to |
1125 | construct a key if it can't find a match. | 1141 | construct a key if it can't find a match. |
1126 | 1142 | ||
1127 | 1143 | ||
diff --git a/Documentation/security/keys/request-key.rst b/Documentation/security/keys/request-key.rst index 5a210baa583a..35f2296b704a 100644 --- a/Documentation/security/keys/request-key.rst +++ b/Documentation/security/keys/request-key.rst | |||
@@ -15,8 +15,16 @@ The process starts by either the kernel requesting a service by calling | |||
15 | 15 | ||
16 | or:: | 16 | or:: |
17 | 17 | ||
18 | struct key *request_key_tag(const struct key_type *type, | ||
19 | const char *description, | ||
20 | const struct key_tag *domain_tag, | ||
21 | const char *callout_info); | ||
22 | |||
23 | or:: | ||
24 | |||
18 | struct key *request_key_with_auxdata(const struct key_type *type, | 25 | struct key *request_key_with_auxdata(const struct key_type *type, |
19 | const char *description, | 26 | const char *description, |
27 | const struct key_tag *domain_tag, | ||
20 | const char *callout_info, | 28 | const char *callout_info, |
21 | size_t callout_len, | 29 | size_t callout_len, |
22 | void *aux); | 30 | void *aux); |
@@ -24,7 +32,8 @@ or:: | |||
24 | or:: | 32 | or:: |
25 | 33 | ||
26 | struct key *request_key_rcu(const struct key_type *type, | 34 | struct key *request_key_rcu(const struct key_type *type, |
27 | const char *description); | 35 | const char *description, |
36 | const struct key_tag *domain_tag); | ||
28 | 37 | ||
29 | Or by userspace invoking the request_key system call:: | 38 | Or by userspace invoking the request_key system call:: |
30 | 39 | ||
@@ -38,14 +47,18 @@ does not need to link the key to a keyring to prevent it from being immediately | |||
38 | destroyed. The kernel interface returns a pointer directly to the key, and | 47 | destroyed. The kernel interface returns a pointer directly to the key, and |
39 | it's up to the caller to destroy the key. | 48 | it's up to the caller to destroy the key. |
40 | 49 | ||
41 | The request_key_with_auxdata() calls is like the in-kernel request_key() call, | 50 | The request_key_tag() call is like the in-kernel request_key(), except that it |
42 | except that they permit auxiliary data to be passed to the upcaller (the | 51 | also takes a domain tag that allows keys to be separated by namespace and |
43 | default is NULL). This is only useful for those key types that define their | 52 | killed off as a group. |
44 | own upcall mechanism rather than using /sbin/request-key. | 53 | |
54 | The request_key_with_auxdata() calls is like the request_key_tag() call, except | ||
55 | that they permit auxiliary data to be passed to the upcaller (the default is | ||
56 | NULL). This is only useful for those key types that define their own upcall | ||
57 | mechanism rather than using /sbin/request-key. | ||
45 | 58 | ||
46 | The request_key_rcu() call is like the in-kernel request_key() call, except | 59 | The request_key_rcu() call is like the request_key_tag() call, except that it |
47 | that it doesn't check for keys that are under construction and doesn't attempt | 60 | doesn't check for keys that are under construction and doesn't attempt to |
48 | to construct missing keys. | 61 | construct missing keys. |
49 | 62 | ||
50 | The userspace interface links the key to a keyring associated with the process | 63 | The userspace interface links the key to a keyring associated with the process |
51 | to prevent the key from going away, and returns the serial number of the key to | 64 | to prevent the key from going away, and returns the serial number of the key to |