aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2008-11-13 18:38:37 -0500
committerJames Morris <jmorris@namei.org>2008-11-13 18:38:37 -0500
commitef81ee9855d6c605ed6090a8018c78572cc68b5c (patch)
treec1fe4990fbff200448ba02eb8d6fd896f0357967
parent92a77aac9812d5397abbe6f1920e085e50838635 (diff)
CRED: Wrap task credential accesses in the IA64 arch
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: Tony Luck <tony.luck@intel.com> Cc: linux-ia64@vger.kernel.org Signed-off-by: James Morris <jmorris@namei.org>
-rw-r--r--arch/ia64/kernel/mca_drv.c2
-rw-r--r--arch/ia64/kernel/perfmon.c23
-rw-r--r--arch/ia64/kernel/signal.c4
3 files changed, 16 insertions, 13 deletions
diff --git a/arch/ia64/kernel/mca_drv.c b/arch/ia64/kernel/mca_drv.c
index fab1d21a4f2c..f94aaa86933f 100644
--- a/arch/ia64/kernel/mca_drv.c
+++ b/arch/ia64/kernel/mca_drv.c
@@ -158,7 +158,7 @@ mca_handler_bh(unsigned long paddr, void *iip, unsigned long ipsr)
158 ia64_mlogbuf_dump(); 158 ia64_mlogbuf_dump();
159 printk(KERN_ERR "OS_MCA: process [cpu %d, pid: %d, uid: %d, " 159 printk(KERN_ERR "OS_MCA: process [cpu %d, pid: %d, uid: %d, "
160 "iip: %p, psr: 0x%lx,paddr: 0x%lx](%s) encounters MCA.\n", 160 "iip: %p, psr: 0x%lx,paddr: 0x%lx](%s) encounters MCA.\n",
161 raw_smp_processor_id(), current->pid, current->uid, 161 raw_smp_processor_id(), current->pid, current_uid(),
162 iip, ipsr, paddr, current->comm); 162 iip, ipsr, paddr, current->comm);
163 163
164 spin_lock(&mca_bh_lock); 164 spin_lock(&mca_bh_lock);
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 6543a5547c84..dd38db46a77a 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -2220,8 +2220,8 @@ pfm_alloc_file(pfm_context_t *ctx)
2220 DPRINT(("new inode ino=%ld @%p\n", inode->i_ino, inode)); 2220 DPRINT(("new inode ino=%ld @%p\n", inode->i_ino, inode));
2221 2221
2222 inode->i_mode = S_IFCHR|S_IRUGO; 2222 inode->i_mode = S_IFCHR|S_IRUGO;
2223 inode->i_uid = current->fsuid; 2223 inode->i_uid = current_fsuid();
2224 inode->i_gid = current->fsgid; 2224 inode->i_gid = current_fsgid();
2225 2225
2226 sprintf(name, "[%lu]", inode->i_ino); 2226 sprintf(name, "[%lu]", inode->i_ino);
2227 this.name = name; 2227 this.name = name;
@@ -2399,22 +2399,25 @@ error_kmem:
2399static int 2399static int
2400pfm_bad_permissions(struct task_struct *task) 2400pfm_bad_permissions(struct task_struct *task)
2401{ 2401{
2402 uid_t uid = current_uid();
2403 gid_t gid = current_gid();
2404
2402 /* inspired by ptrace_attach() */ 2405 /* inspired by ptrace_attach() */
2403 DPRINT(("cur: uid=%d gid=%d task: euid=%d suid=%d uid=%d egid=%d sgid=%d\n", 2406 DPRINT(("cur: uid=%d gid=%d task: euid=%d suid=%d uid=%d egid=%d sgid=%d\n",
2404 current->uid, 2407 uid,
2405 current->gid, 2408 gid,
2406 task->euid, 2409 task->euid,
2407 task->suid, 2410 task->suid,
2408 task->uid, 2411 task->uid,
2409 task->egid, 2412 task->egid,
2410 task->sgid)); 2413 task->sgid));
2411 2414
2412 return ((current->uid != task->euid) 2415 return (uid != task->euid)
2413 || (current->uid != task->suid) 2416 || (uid != task->suid)
2414 || (current->uid != task->uid) 2417 || (uid != task->uid)
2415 || (current->gid != task->egid) 2418 || (gid != task->egid)
2416 || (current->gid != task->sgid) 2419 || (gid != task->sgid)
2417 || (current->gid != task->gid)) && !capable(CAP_SYS_PTRACE); 2420 || (gid != task->gid)) && !capable(CAP_SYS_PTRACE);
2418} 2421}
2419 2422
2420static int 2423static int
diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c
index e12500a9c443..e1821ca4c7df 100644
--- a/arch/ia64/kernel/signal.c
+++ b/arch/ia64/kernel/signal.c
@@ -229,7 +229,7 @@ ia64_rt_sigreturn (struct sigscratch *scr)
229 si.si_errno = 0; 229 si.si_errno = 0;
230 si.si_code = SI_KERNEL; 230 si.si_code = SI_KERNEL;
231 si.si_pid = task_pid_vnr(current); 231 si.si_pid = task_pid_vnr(current);
232 si.si_uid = current->uid; 232 si.si_uid = current_uid();
233 si.si_addr = sc; 233 si.si_addr = sc;
234 force_sig_info(SIGSEGV, &si, current); 234 force_sig_info(SIGSEGV, &si, current);
235 return retval; 235 return retval;
@@ -326,7 +326,7 @@ force_sigsegv_info (int sig, void __user *addr)
326 si.si_errno = 0; 326 si.si_errno = 0;
327 si.si_code = SI_KERNEL; 327 si.si_code = SI_KERNEL;
328 si.si_pid = task_pid_vnr(current); 328 si.si_pid = task_pid_vnr(current);
329 si.si_uid = current->uid; 329 si.si_uid = current_uid();
330 si.si_addr = addr; 330 si.si_addr = addr;
331 force_sig_info(SIGSEGV, &si, current); 331 force_sig_info(SIGSEGV, &si, current);
332 return 0; 332 return 0;