mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-24 07:31:41 +00:00
keys: Move the user and user-session keyrings to the user_namespace
Move the user and user-session keyrings to the user_namespace struct rather than pinning them from the user_struct struct. This prevents these keyrings from propagating across user-namespaces boundaries with regard to the KEY_SPEC_* flags, thereby making them more useful in a containerised environment. The issue is that a single user_struct may be represent UIDs in several different namespaces. The way the patch does this is by attaching a 'register keyring' in each user_namespace and then sticking the user and user-session keyrings into that. It can then be searched to retrieve them. Signed-off-by: David Howells <dhowells@redhat.com> cc: Jann Horn <jannh@google.com>
This commit is contained in:
parent
b206f281d0
commit
0f44e4d976
9 changed files with 200 additions and 133 deletions
|
@ -7,8 +7,6 @@
|
|||
#include <linux/refcount.h>
|
||||
#include <linux/ratelimit.h>
|
||||
|
||||
struct key;
|
||||
|
||||
/*
|
||||
* Some day this will be a full-fledged user tracking system..
|
||||
*/
|
||||
|
@ -30,18 +28,6 @@ struct user_struct {
|
|||
unsigned long unix_inflight; /* How many files in flight in unix sockets */
|
||||
atomic_long_t pipe_bufs; /* how many pages are allocated in pipe buffers */
|
||||
|
||||
#ifdef CONFIG_KEYS
|
||||
/*
|
||||
* These pointers can only change from NULL to a non-NULL value once.
|
||||
* Writes are protected by key_user_keyring_mutex.
|
||||
* Unlocked readers should use READ_ONCE() unless they know that
|
||||
* install_user_keyrings() has been called successfully (which sets
|
||||
* these members to non-NULL values, preventing further modifications).
|
||||
*/
|
||||
struct key *uid_keyring; /* UID specific keyring */
|
||||
struct key *session_keyring; /* UID's default session keyring */
|
||||
#endif
|
||||
|
||||
/* Hash table maintenance information */
|
||||
struct hlist_node uidhash_node;
|
||||
kuid_t uid;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue