aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/kernel/perfmon.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ia64/kernel/perfmon.c')
-rw-r--r--arch/ia64/kernel/perfmon.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index dd38db46a77a..0e499757309b 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -2399,25 +2399,33 @@ error_kmem:
2399static int 2399static int
2400pfm_bad_permissions(struct task_struct *task) 2400pfm_bad_permissions(struct task_struct *task)
2401{ 2401{
2402 const struct cred *tcred;
2402 uid_t uid = current_uid(); 2403 uid_t uid = current_uid();
2403 gid_t gid = current_gid(); 2404 gid_t gid = current_gid();
2405 int ret;
2406
2407 rcu_read_lock();
2408 tcred = __task_cred(task);
2404 2409
2405 /* inspired by ptrace_attach() */ 2410 /* inspired by ptrace_attach() */
2406 DPRINT(("cur: uid=%d gid=%d task: euid=%d suid=%d uid=%d egid=%d sgid=%d\n", 2411 DPRINT(("cur: uid=%d gid=%d task: euid=%d suid=%d uid=%d egid=%d sgid=%d\n",
2407 uid, 2412 uid,
2408 gid, 2413 gid,
2409 task->euid, 2414 tcred->euid,
2410 task->suid, 2415 tcred->suid,
2411 task->uid, 2416 tcred->uid,
2412 task->egid, 2417 tcred->egid,
2413 task->sgid)); 2418 tcred->sgid));
2414 2419
2415 return (uid != task->euid) 2420 ret = ((uid != tcred->euid)
2416 || (uid != task->suid) 2421 || (uid != tcred->suid)
2417 || (uid != task->uid) 2422 || (uid != tcred->uid)
2418 || (gid != task->egid) 2423 || (gid != tcred->egid)
2419 || (gid != task->sgid) 2424 || (gid != tcred->sgid)
2420 || (gid != task->gid)) && !capable(CAP_SYS_PTRACE); 2425 || (gid != tcred->gid)) && !capable(CAP_SYS_PTRACE);
2426
2427 rcu_read_unlock();
2428 return ret;
2421} 2429}
2422 2430
2423static int 2431static int