Re: [PATCH v4 10/12] ptrace: Don't change __state

2022-05-10 Thread Oleg Nesterov
On 05/10, Eric W. Biederman wrote: > > > But I still think that a lockless > > > > if (!(task->jobctl & JOBCTL_PTRACE_FROZEN)) > > return; > > > > check at the start of ptrace_unfreeze_traced() makes sense to avoid > > lock_task_sighand() if possible. > > > > And ptrace_resume() can

Re: [PATCH v4 10/12] ptrace: Don't change __state

2022-05-10 Thread Eric W. Biederman
Oleg Nesterov writes: > On 05/05, Eric W. Biederman wrote: >> >> static void ptrace_unfreeze_traced(struct task_struct *task) >> { >> -if (READ_ONCE(task->__state) != __TASK_TRACED) >> -return; >> - >> -WARN_ON(!task->ptrace || task->parent != current); >> +unsigned long

Re: [PATCH v4 10/12] ptrace: Don't change __state

2022-05-10 Thread Oleg Nesterov
On 05/05, Eric W. Biederman wrote: > > static void ptrace_unfreeze_traced(struct task_struct *task) > { > - if (READ_ONCE(task->__state) != __TASK_TRACED) > - return; > - > - WARN_ON(!task->ptrace || task->parent != current); > + unsigned long flags; > > /* > -

Re: [PATCH v4 10/12] ptrace: Don't change __state

2022-05-06 Thread Eric W. Biederman
Oleg Nesterov writes: > On 05/05, Eric W. Biederman wrote: >> >> --- a/include/linux/sched.h >> +++ b/include/linux/sched.h >> @@ -103,7 +103,7 @@ struct task_group; >> /* Convenience macros for the sake of set_current_state: */ >> #define TASK_KILLABLE (TASK_WAKEKILL | >

Re: [PATCH v4 10/12] ptrace: Don't change __state

2022-05-06 Thread Oleg Nesterov
On 05/05, Eric W. Biederman wrote: > > --- a/include/linux/sched.h > +++ b/include/linux/sched.h > @@ -103,7 +103,7 @@ struct task_group; > /* Convenience macros for the sake of set_current_state: */ > #define TASK_KILLABLE(TASK_WAKEKILL | > TASK_UNINTERRUPTIBLE) > #defi

[PATCH v4 10/12] ptrace: Don't change __state

2022-05-05 Thread Eric W. Biederman
Stop playing with tsk->__state to remove TASK_WAKEKILL while a ptrace command is executing. Instead remove TASK_WAKEKILL from the definition of TASK_TRACED, and implement a new jobctl flag TASK_PTRACE_FROZEN. This new flag is set in jobctl_freeze_task and cleared when ptrace_stop is awoken or in