aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/kernel/perfmon.c
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 /arch/ia64/kernel/perfmon.c
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>
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 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