Messages in this thread | | | Date | Wed, 13 Apr 2022 15:24:52 +0200 | From | Oleg Nesterov <> | Subject | Re: [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.
| |