[PATCH 2/2] make cap_ptrace enforce PTRACE_TRACME checks

From: Chris Wright
Date: Thu Mar 09 2006 - 06:18:23 EST


PTRACE_TRACEME doesn't have proper capabilities validation when
parent is less privileged than child. Issue pointed out by
Ram Gupta <ram.gupta5@xxxxxxxxx>.

Signed-off-by: Chris Wright <chrisw@xxxxxxxxxxxx>
Cc: Ram Gupta <ram.gupta5@xxxxxxxxx>
---
Note: I haven't identified a strong security issue, and it's a small
ABI change that could break apps that rely on existing behaviour (which
allows parent that is less privileged than child to ptrace when child
does PTRACE_TRACEME).

security/commoncap.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

--- linus-2.6.orig/security/commoncap.c
+++ linus-2.6/security/commoncap.c
@@ -60,8 +60,8 @@ int cap_settime(struct timespec *ts, str
int cap_ptrace (struct task_struct *parent, struct task_struct *child)
{
/* Derived from arch/i386/kernel/ptrace.c:sys_ptrace. */
- if (!cap_issubset (child->cap_permitted, current->cap_permitted) &&
- !capable(CAP_SYS_PTRACE))
+ if (!cap_issubset(child->cap_permitted, parent->cap_permitted) &&
+ !__capable(parent, CAP_SYS_PTRACE))
return -EPERM;
return 0;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/