lkml.org 
[lkml]   [2022]   [Apr]   [20]   [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
On Fri, Apr 15, 2022 at 12:57:56PM +0200, Oleg Nesterov wrote:
> On 04/15, Oleg Nesterov wrote:
> >
> > OK, so far it seems that this patch needs a couple of simple fixes you
> > pointed out, but before I send V2:
> >
> > - do you agree we can avoid JOBCTL_TRACED_FROZEN in 1-2 ?
> >
> > - will you agree if I change ptrace_freeze_traced() to rely
> > on __state == TASK_TRACED rather than task_is_traced() ?
> >
>
> Forgot to say, I think 1/5 needs some changes in any case...
>
> ptrace_resume() does wake_up_state(child, __TASK_TRACED) but doesn't
> clear JOBCTL_TRACED. The "else" branch in ptrace_stop() leaks this flag
> too. Perhaps I missed something, I'll reread 1/5 again, but the main
> question to me is whether 1-2 actually need the JOBCTL_TRACED_FROZEN flag.

Ok, getting back to this. So I did the change to ptrace_resume(), but
I'm not entirely sure I understand the issue with the else branch of
ptrace_stop().

My understanding is that if we hit that else branch, we've raced wth
__ptrace_unlink(), and that will have done:

if (... || task_is_traced(child))
ptrace_signal_wake_up(child, true);

Which will have done that wakeup and cleared both __state and jobctl.

\
 
 \ /
  Last update: 2022-04-20 12:23    [W:0.198 / U:1.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site