Re: [PATCH] ptrace: fix ptrace_unfreeze_traced() race with rt-lock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/02, Sebastian Andrzej Siewior wrote:
>
> On 2020-11-02 17:25:14 [+0100], Oleg Nesterov wrote:
> > On 11/02, Oleg Nesterov wrote:
> > >
> > >  	spin_lock_irq(&task->sighand->siglock);
> > > -	if (task->state == __TASK_TRACED) {
> > > -		if (__fatal_signal_pending(task))
> > > -			wake_up_state(task, __TASK_TRACED);
> > > -		else
> > > -			task->state = TASK_TRACED;
> > > -	}
> > > +
> > > +	raw_spin_lock(&task->pi_lock);
> >
> > but perhaps it should be raw_spin_lock_irq() ?
> >
> > I know nothing about kernel-rt, however it seems that spin_lock_irq()
> > from include/linux/spinlock_rt.h doesn't disable irqs?
>
> I don't exactly how much breaks when we turn siglock into a
> raw_spinlock_t but there is a memory allocation in __send_signal() which
> is a no no.
>
> There is task_is_traced() which looks under the PI lock for the task
> state to be sure (we a few of those). I haven't looked at the patch yet…

So it seems I should send V2 which uses raw_spin_(un)lock_irq().

Or even _irqsave() like ptrace_freeze_traced() does? Although this looks
confusing, exactly because ptrace_freeze_traced() calls task_is_traced()
which does raw_spin_lock_irq().

Oleg.




[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux