lkml.org 
[lkml]   [2022]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/5] sched,ptrace: Fix ptrace_check_attach() vs PREEMPT_RT
Hi Peter,

I like 1-2 but I need to read them (and other patches) again, a
couple of nits right now.

On 04/12, Peter Zijlstra wrote:
>
> +static int __ptrace_freeze_cond(struct task_struct *p)
> +{
> + if (!task_is_traced(p))
> + return -ESRCH;

if (!task_is_traced(p) || p->parent != current)
return -ESRCH;

we should not spin/sleep if it is traced by another task

> +static int __ptrace_freeze(struct task_struct *p, void *arg)
> +{
> + int ret;
> +
> + ret = __ptrace_freeze_cond(p);
> + if (ret)
> + return ret;
> +
> + /*
> + * Task scheduled between __ptrace_pre_freeze() and here, not our task
> + * anymore.
> + */
> + if (*(unsigned long *)arg != p->nvcsw)
> + return -ESRCH;
> +
> + if (looks_like_a_spurious_pid(p))
> + return -ESRCH;

Oh, I do not think __ptrace_freeze() should check for spurious pid...
looks_like_a_spurious_pid() should be called once in ptrace_check_attach()
before task_call_func(__ptrace_freeze).

Oleg.

\
 
 \ /
  Last update: 2022-04-13 15:25    [W:0.144 / U:0.272 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site