CRED: Separate per-task-group keyrings from signal_struct
Separate per-task-group keyrings from signal_struct and dangle their anchor from the cred struct rather than the signal_struct. Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: James Morris <jmorris@namei.org> Signed-off-by: James Morris <jmorris@namei.org>
This commit is contained in:
committed by
James Morris
parent
275bb41e9d
commit
bb952bb98a
@@ -71,6 +71,21 @@ extern int groups_search(const struct group_info *, gid_t);
|
||||
extern int in_group_p(gid_t);
|
||||
extern int in_egroup_p(gid_t);
|
||||
|
||||
/*
|
||||
* The common credentials for a thread group
|
||||
* - shared by CLONE_THREAD
|
||||
*/
|
||||
#ifdef CONFIG_KEYS
|
||||
struct thread_group_cred {
|
||||
atomic_t usage;
|
||||
pid_t tgid; /* thread group process ID */
|
||||
spinlock_t lock;
|
||||
struct key *session_keyring; /* keyring inherited over fork */
|
||||
struct key *process_keyring; /* keyring private to this process */
|
||||
struct rcu_head rcu; /* RCU deletion hook */
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The security context of a task
|
||||
*
|
||||
@@ -114,6 +129,7 @@ struct cred {
|
||||
* keys to */
|
||||
struct key *thread_keyring; /* keyring private to this thread */
|
||||
struct key *request_key_auth; /* assumed request_key authority */
|
||||
struct thread_group_cred *tgcred; /* thread-group shared credentials */
|
||||
#endif
|
||||
#ifdef CONFIG_SECURITY
|
||||
void *security; /* subjective LSM security */
|
||||
|
||||
+2
-6
@@ -278,9 +278,7 @@ extern ctl_table key_sysctls[];
|
||||
*/
|
||||
extern void switch_uid_keyring(struct user_struct *new_user);
|
||||
extern int copy_keys(unsigned long clone_flags, struct task_struct *tsk);
|
||||
extern int copy_thread_group_keys(struct task_struct *tsk);
|
||||
extern void exit_keys(struct task_struct *tsk);
|
||||
extern void exit_thread_group_keys(struct signal_struct *tg);
|
||||
extern int suid_keys(struct task_struct *tsk);
|
||||
extern int exec_keys(struct task_struct *tsk);
|
||||
extern void key_fsuid_changed(struct task_struct *tsk);
|
||||
@@ -289,8 +287,8 @@ extern void key_init(void);
|
||||
|
||||
#define __install_session_keyring(keyring) \
|
||||
({ \
|
||||
struct key *old_session = current->signal->session_keyring; \
|
||||
current->signal->session_keyring = keyring; \
|
||||
struct key *old_session = current->cred->tgcred->session_keyring; \
|
||||
current->cred->tgcred->session_keyring = keyring; \
|
||||
old_session; \
|
||||
})
|
||||
|
||||
@@ -308,9 +306,7 @@ extern void key_init(void);
|
||||
#define switch_uid_keyring(u) do { } while(0)
|
||||
#define __install_session_keyring(k) ({ NULL; })
|
||||
#define copy_keys(f,t) 0
|
||||
#define copy_thread_group_keys(t) 0
|
||||
#define exit_keys(t) do { } while(0)
|
||||
#define exit_thread_group_keys(tg) do { } while(0)
|
||||
#define suid_keys(t) do { } while(0)
|
||||
#define exec_keys(t) do { } while(0)
|
||||
#define key_fsuid_changed(t) do { } while(0)
|
||||
|
||||
@@ -571,12 +571,6 @@ struct signal_struct {
|
||||
*/
|
||||
struct rlimit rlim[RLIM_NLIMITS];
|
||||
|
||||
/* keep the process-shared keyrings here so that they do the right
|
||||
* thing in threads created with CLONE_THREAD */
|
||||
#ifdef CONFIG_KEYS
|
||||
struct key *session_keyring; /* keyring inherited over fork */
|
||||
struct key *process_keyring; /* keyring private to this process */
|
||||
#endif
|
||||
#ifdef CONFIG_BSD_PROCESS_ACCT
|
||||
struct pacct_struct pacct; /* per-process accounting information */
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user