aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/futex.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2008-11-13 18:39:12 -0500
committerJames Morris <jmorris@namei.org>2008-11-13 18:39:12 -0500
commit76aac0e9a17742e60d408be1a706e9aaad370891 (patch)
treee873a000d9c96209726e0958e311f005c13b2ed5 /kernel/futex.c
parentb103c59883f1ec6e4d548b25054608cb5724453c (diff)
CRED: Wrap task credential accesses in the core kernel
Wrap access to task credentials so that they can be separated more easily from the task_struct during the introduction of COW creds. Change most current->(|e|s|fs)[ug]id to current_(|e|s|fs)[ug]id(). Change some task->e?[ug]id to task_e?[ug]id(). In some places it makes more sense to use RCU directly rather than a convenient wrapper; these will be addressed by later patches. Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: James Morris <jmorris@namei.org> Acked-by: Serge Hallyn <serue@us.ibm.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: linux-audit@redhat.com Cc: containers@lists.linux-foundation.org Cc: linux-mm@kvack.org Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'kernel/futex.c')
-rw-r--r--kernel/futex.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/futex.c b/kernel/futex.c
index 8af10027514b..e06962132aaf 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -439,10 +439,11 @@ static void free_pi_state(struct futex_pi_state *pi_state)
439static struct task_struct * futex_find_get_task(pid_t pid) 439static struct task_struct * futex_find_get_task(pid_t pid)
440{ 440{
441 struct task_struct *p; 441 struct task_struct *p;
442 uid_t euid = current_euid();
442 443
443 rcu_read_lock(); 444 rcu_read_lock();
444 p = find_task_by_vpid(pid); 445 p = find_task_by_vpid(pid);
445 if (!p || ((current->euid != p->euid) && (current->euid != p->uid))) 446 if (!p || (euid != p->euid && euid != p->uid))
446 p = ERR_PTR(-ESRCH); 447 p = ERR_PTR(-ESRCH);
447 else 448 else
448 get_task_struct(p); 449 get_task_struct(p);
@@ -1829,6 +1830,7 @@ sys_get_robust_list(int pid, struct robust_list_head __user * __user *head_ptr,
1829{ 1830{
1830 struct robust_list_head __user *head; 1831 struct robust_list_head __user *head;
1831 unsigned long ret; 1832 unsigned long ret;
1833 uid_t euid = current_euid();
1832 1834
1833 if (!futex_cmpxchg_enabled) 1835 if (!futex_cmpxchg_enabled)
1834 return -ENOSYS; 1836 return -ENOSYS;
@@ -1844,8 +1846,8 @@ sys_get_robust_list(int pid, struct robust_list_head __user * __user *head_ptr,
1844 if (!p) 1846 if (!p)
1845 goto err_unlock; 1847 goto err_unlock;
1846 ret = -EPERM; 1848 ret = -EPERM;
1847 if ((current->euid != p->euid) && (current->euid != p->uid) && 1849 if (euid != p->euid && euid != p->uid &&
1848 !capable(CAP_SYS_PTRACE)) 1850 !capable(CAP_SYS_PTRACE))
1849 goto err_unlock; 1851 goto err_unlock;
1850 head = p->robust_list; 1852 head = p->robust_list;
1851 rcu_read_unlock(); 1853 rcu_read_unlock();