diff options
author | David Howells <dhowells@redhat.com> | 2008-11-13 18:39:16 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2008-11-13 18:39:16 -0500 |
commit | b6dff3ec5e116e3af6f537d4caedcad6b9e5082a (patch) | |
tree | 9e76f972eb7ce9b84e0146c8e4126a3f86acb428 /kernel/sched.c | |
parent | 15a2460ed0af7538ca8e6c610fe607a2cd9da142 (diff) |
CRED: Separate task security context from task_struct
Separate the task security context from task_struct. At this point, the
security data is temporarily embedded in the task_struct with two pointers
pointing to it.
Note that the Alpha arch is altered as it refers to (E)UID and (E)GID in
entry.S via asm-offsets.
With comment fixes Signed-off-by: Marc Dionne <marc.c.dionne@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: James Morris <jmorris@namei.org>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index c3b8b1fcde0d..733c59e645aa 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -345,7 +345,7 @@ static inline struct task_group *task_group(struct task_struct *p) | |||
345 | struct task_group *tg; | 345 | struct task_group *tg; |
346 | 346 | ||
347 | #ifdef CONFIG_USER_SCHED | 347 | #ifdef CONFIG_USER_SCHED |
348 | tg = p->user->tg; | 348 | tg = p->cred->user->tg; |
349 | #elif defined(CONFIG_CGROUP_SCHED) | 349 | #elif defined(CONFIG_CGROUP_SCHED) |
350 | tg = container_of(task_subsys_state(p, cpu_cgroup_subsys_id), | 350 | tg = container_of(task_subsys_state(p, cpu_cgroup_subsys_id), |
351 | struct task_group, css); | 351 | struct task_group, css); |
@@ -5182,8 +5182,8 @@ recheck: | |||
5182 | 5182 | ||
5183 | /* can't change other user's priorities */ | 5183 | /* can't change other user's priorities */ |
5184 | euid = current_euid(); | 5184 | euid = current_euid(); |
5185 | if (euid != p->euid && | 5185 | if (euid != p->cred->euid && |
5186 | euid != p->uid) | 5186 | euid != p->cred->uid) |
5187 | return -EPERM; | 5187 | return -EPERM; |
5188 | } | 5188 | } |
5189 | 5189 | ||
@@ -5417,7 +5417,9 @@ long sched_setaffinity(pid_t pid, const cpumask_t *in_mask) | |||
5417 | 5417 | ||
5418 | euid = current_euid(); | 5418 | euid = current_euid(); |
5419 | retval = -EPERM; | 5419 | retval = -EPERM; |
5420 | if (euid != p->euid && euid != p->uid && !capable(CAP_SYS_NICE)) | 5420 | if (euid != p->cred->euid && |
5421 | euid != p->cred->uid && | ||
5422 | !capable(CAP_SYS_NICE)) | ||
5421 | goto out_unlock; | 5423 | goto out_unlock; |
5422 | 5424 | ||
5423 | retval = security_task_setscheduler(p, 0, NULL); | 5425 | retval = security_task_setscheduler(p, 0, NULL); |