提交 ef81ee98 编写于 作者: D David Howells 提交者: James Morris

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: NDavid Howells <dhowells@redhat.com>
Reviewed-by: NJames Morris <jmorris@namei.org>
Acked-by: NSerge Hallyn <serue@us.ibm.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: linux-ia64@vger.kernel.org
Signed-off-by: NJames Morris <jmorris@namei.org>
上级 92a77aac
...@@ -158,7 +158,7 @@ mca_handler_bh(unsigned long paddr, void *iip, unsigned long ipsr) ...@@ -158,7 +158,7 @@ mca_handler_bh(unsigned long paddr, void *iip, unsigned long ipsr)
ia64_mlogbuf_dump(); ia64_mlogbuf_dump();
printk(KERN_ERR "OS_MCA: process [cpu %d, pid: %d, uid: %d, " printk(KERN_ERR "OS_MCA: process [cpu %d, pid: %d, uid: %d, "
"iip: %p, psr: 0x%lx,paddr: 0x%lx](%s) encounters MCA.\n", "iip: %p, psr: 0x%lx,paddr: 0x%lx](%s) encounters MCA.\n",
raw_smp_processor_id(), current->pid, current->uid, raw_smp_processor_id(), current->pid, current_uid(),
iip, ipsr, paddr, current->comm); iip, ipsr, paddr, current->comm);
spin_lock(&mca_bh_lock); spin_lock(&mca_bh_lock);
......
...@@ -2220,8 +2220,8 @@ pfm_alloc_file(pfm_context_t *ctx) ...@@ -2220,8 +2220,8 @@ pfm_alloc_file(pfm_context_t *ctx)
DPRINT(("new inode ino=%ld @%p\n", inode->i_ino, inode)); DPRINT(("new inode ino=%ld @%p\n", inode->i_ino, inode));
inode->i_mode = S_IFCHR|S_IRUGO; inode->i_mode = S_IFCHR|S_IRUGO;
inode->i_uid = current->fsuid; inode->i_uid = current_fsuid();
inode->i_gid = current->fsgid; inode->i_gid = current_fsgid();
sprintf(name, "[%lu]", inode->i_ino); sprintf(name, "[%lu]", inode->i_ino);
this.name = name; this.name = name;
...@@ -2399,22 +2399,25 @@ pfm_smpl_buffer_alloc(struct task_struct *task, struct file *filp, pfm_context_t ...@@ -2399,22 +2399,25 @@ pfm_smpl_buffer_alloc(struct task_struct *task, struct file *filp, pfm_context_t
static int static int
pfm_bad_permissions(struct task_struct *task) pfm_bad_permissions(struct task_struct *task)
{ {
uid_t uid = current_uid();
gid_t gid = current_gid();
/* inspired by ptrace_attach() */ /* inspired by ptrace_attach() */
DPRINT(("cur: uid=%d gid=%d task: euid=%d suid=%d uid=%d egid=%d sgid=%d\n", DPRINT(("cur: uid=%d gid=%d task: euid=%d suid=%d uid=%d egid=%d sgid=%d\n",
current->uid, uid,
current->gid, gid,
task->euid, task->euid,
task->suid, task->suid,
task->uid, task->uid,
task->egid, task->egid,
task->sgid)); task->sgid));
return ((current->uid != task->euid) return (uid != task->euid)
|| (current->uid != task->suid) || (uid != task->suid)
|| (current->uid != task->uid) || (uid != task->uid)
|| (current->gid != task->egid) || (gid != task->egid)
|| (current->gid != task->sgid) || (gid != task->sgid)
|| (current->gid != task->gid)) && !capable(CAP_SYS_PTRACE); || (gid != task->gid)) && !capable(CAP_SYS_PTRACE);
} }
static int static int
......
...@@ -229,7 +229,7 @@ ia64_rt_sigreturn (struct sigscratch *scr) ...@@ -229,7 +229,7 @@ ia64_rt_sigreturn (struct sigscratch *scr)
si.si_errno = 0; si.si_errno = 0;
si.si_code = SI_KERNEL; si.si_code = SI_KERNEL;
si.si_pid = task_pid_vnr(current); si.si_pid = task_pid_vnr(current);
si.si_uid = current->uid; si.si_uid = current_uid();
si.si_addr = sc; si.si_addr = sc;
force_sig_info(SIGSEGV, &si, current); force_sig_info(SIGSEGV, &si, current);
return retval; return retval;
...@@ -326,7 +326,7 @@ force_sigsegv_info (int sig, void __user *addr) ...@@ -326,7 +326,7 @@ force_sigsegv_info (int sig, void __user *addr)
si.si_errno = 0; si.si_errno = 0;
si.si_code = SI_KERNEL; si.si_code = SI_KERNEL;
si.si_pid = task_pid_vnr(current); si.si_pid = task_pid_vnr(current);
si.si_uid = current->uid; si.si_uid = current_uid();
si.si_addr = addr; si.si_addr = addr;
force_sig_info(SIGSEGV, &si, current); force_sig_info(SIGSEGV, &si, current);
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册