Re: [PATCH RFC] Allow introspection to already attached ptracer in __ptrace_may_access

From: Oleg Nesterov
Date: Wed Dec 24 2014 - 13:08:40 EST


On 12/24, Stijn Volckaert wrote:
>
> The question now is whether or not it's the security module's
> responsibility to check whether a tracee relationship is already in
> place or if ptrace itself should do it.

Honestly, I have no idea

> --- a/kernel/ptrace.c 2014-12-24 13:53:23.055346526 +0100
> +++ b/kernel/ptrace.c 2014-12-24 14:17:20.617824840 +0100
> @@ -232,6 +232,9 @@ static int __ptrace_may_access(struct ta
> /* Don't let security modules deny introspection */
> if (same_thread_group(task, current))
> return 0;
> + /* Don't deny introspection to already attached ptracer */
> + if (!ptrace_check_attach(task, true))
> + return 0;

Perhaps this makes sense, probably security checks do not make sense
if the target is traced.

But in this case I'd suggest to simply

if (ptrace_parent(task) == current)
return 0;


Oleg.

--
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/