From: Oleg Nesterov <oleg@redhat.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Alexander Fyodorov <halcy@yandex.ru>,
Juri Lelli <jlelli@redhat.com>,
"Luis Claudio R. Goncalves" <lgoncalv@redhat.com>,
Steven Rostedt <rostedt@goodmis.org>,
linux-rt-users@vger.kernel.org
Subject: Re: [PATCH] ptrace: fix ptrace_unfreeze_traced() race with rt-lock
Date: Mon, 2 Nov 2020 18:01:33 +0100 [thread overview]
Message-ID: <20201102170132.GA32111@redhat.com> (raw)
In-Reply-To: <20201102163411.izhdlegaifq544l2@linutronix.de>
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.
next prev parent reply other threads:[~2020-11-02 17:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-02 15:50 [PATCH] ptrace: fix ptrace_unfreeze_traced() race with rt-lock Oleg Nesterov
2020-11-02 16:25 ` Oleg Nesterov
2020-11-02 16:34 ` Sebastian Andrzej Siewior
2020-11-02 17:01 ` Oleg Nesterov [this message]
2020-11-02 17:30 ` Sebastian Andrzej Siewior
2020-11-02 17:41 ` Oleg Nesterov
2020-11-02 18:04 ` Sebastian Andrzej Siewior
2020-11-02 17:42 ` Sebastian Andrzej Siewior
2020-11-03 11:37 ` Oleg Nesterov
2020-11-03 16:45 ` Sebastian Andrzej Siewior
2020-11-03 11:39 ` [PATCH v2] " Oleg Nesterov
2020-11-03 17:01 ` Sebastian Andrzej Siewior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201102170132.GA32111@redhat.com \
--to=oleg@redhat.com \
--cc=bigeasy@linutronix.de \
--cc=halcy@yandex.ru \
--cc=jlelli@redhat.com \
--cc=lgoncalv@redhat.com \
--cc=linux-rt-users@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.