summaryrefslogtreecommitdiffstats
path: root/arch/ia64/kernel/perfmon.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2008-11-14 10:38:37 +1100
committerJames Morris <jmorris@namei.org>2008-11-14 10:38:37 +1100
commitef81ee9855d6c605ed6090a8018c78572cc68b5c (patch)
treec1fe4990fbff200448ba02eb8d6fd896f0357967 /arch/ia64/kernel/perfmon.c
parent92a77aac9812d5397abbe6f1920e085e50838635 (diff)
downloadop-kernel-dev-ef81ee9855d6c605ed6090a8018c78572cc68b5c.zip
op-kernel-dev-ef81ee9855d6c605ed6090a8018c78572cc68b5c.tar.gz
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>
Diffstat (limited to 'arch/ia64/kernel/perfmon.c')
-rw-r--r--arch/ia64/kernel/perfmon.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 6543a55..dd38db4 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -2220,8 +2220,8 @@ pfm_alloc_file(pfm_context_t *ctx)
DPRINT(("new inode ino=%ld @%p\n", inode->i_ino, inode));
inode->i_mode = S_IFCHR|S_IRUGO;
- inode->i_uid = current->fsuid;
- inode->i_gid = current->fsgid;
+ inode->i_uid = current_fsuid();
+ inode->i_gid = current_fsgid();
sprintf(name, "[%lu]", inode->i_ino);
this.name = name;
@@ -2399,22 +2399,25 @@ error_kmem:
static int
pfm_bad_permissions(struct task_struct *task)
{
+ uid_t uid = current_uid();
+ gid_t gid = current_gid();
+
/* inspired by ptrace_attach() */
DPRINT(("cur: uid=%d gid=%d task: euid=%d suid=%d uid=%d egid=%d sgid=%d\n",
- current->uid,
- current->gid,
+ uid,
+ gid,
task->euid,
task->suid,
task->uid,
task->egid,
task->sgid));
- return ((current->uid != task->euid)
- || (current->uid != task->suid)
- || (current->uid != task->uid)
- || (current->gid != task->egid)
- || (current->gid != task->sgid)
- || (current->gid != task->gid)) && !capable(CAP_SYS_PTRACE);
+ return (uid != task->euid)
+ || (uid != task->suid)
+ || (uid != task->uid)
+ || (gid != task->egid)
+ || (gid != task->sgid)
+ || (gid != task->gid)) && !capable(CAP_SYS_PTRACE);
}
static int
OpenPOWER on IntegriCloud