[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAq0SUk3c5H8YCVAfRAU=pZFNLrA90mNMq=k5BohTutM7cfcvg@mail.gmail.com>
Date: Thu, 1 Jun 2023 15:23:32 -0300
From: Wander Lairson Costa <wander@...hat.com>
To: Oleg Nesterov <oleg@...hat.com>
Cc: "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>,
Brian Cain <bcain@...cinc.com>,
Michael Ellerman <mpe@...erman.id.au>,
Stafford Horne <shorne@...il.com>,
Kefeng Wang <wangkefeng.wang@...wei.com>,
Andrew Morton <akpm@...ux-foundation.org>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
Vlastimil Babka <vbabka@...e.cz>,
"Matthew Wilcox (Oracle)" <willy@...radead.org>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Andrei Vagin <avagin@...il.com>,
Peter Zijlstra <peterz@...radead.org>,
"Paul E. McKenney" <paulmck@...nel.org>,
Daniel Bristot de Oliveira <bristot@...nel.org>,
Yu Zhao <yuzhao@...gle.com>,
Alexey Gladkov <legion@...nel.org>,
Mike Kravetz <mike.kravetz@...cle.com>,
Yang Shi <shy828301@...il.com>,
open list <linux-kernel@...r.kernel.org>,
Hu Chunyu <chuhu@...hat.com>,
Valentin Schneider <vschneid@...hat.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Steven Rostedt <rostedt@...dmis.org>,
Luis Goncalves <lgoncalv@...hat.com>
Subject: Re: [PATCH v9] kernel/fork: beware of __put_task_struct calling context
On Thu, Jun 1, 2023 at 3:14 PM Oleg Nesterov <oleg@...hat.com> wrote:
>
> On 06/01, Wander Lairson Costa wrote:
> >
> > On Mon, May 29, 2023 at 9:23 AM Oleg Nesterov <oleg@...hat.com> wrote:
> > >
> > > On 05/17, Wander Lairson Costa wrote:
> > > >
> > > > On Wed, May 17, 2023 at 12:26 PM Oleg Nesterov <oleg@...hat.com> wrote:
> > > > >
> > > > > LGTM but we still need to understand the possible problems with CONFIG_PROVE_RAW_LOCK_NESTING ...
> > > > >
> > > > > Again, I'll try to investigate when I have time although I am not sure I can really help.
> > > > >
> > > > > Perhaps you too can try to do this ? ;)
> > > > >
> > > >
> > > > FWIW, I tested this patch with CONFIG_PROVE_LOCK_NESTING in RT and
> > > > stock kernels. No splat happened.
> > >
> > > Strange... FYI, I am running the kernel with this patch
> > >
> > > diff --git a/kernel/sys.c b/kernel/sys.c
> > > index 339fee3eff6a..3169cceddf3b 100644
> > > --- a/kernel/sys.c
> > > +++ b/kernel/sys.c
> > > @@ -2412,6 +2412,17 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
> > >
> > > error = 0;
> > > switch (option) {
> > > + case 666: {
> > > + static DEFINE_SPINLOCK(l);
> > > + static DEFINE_RAW_SPINLOCK(r);
> > > +
> > > + raw_spin_lock(&r);
> > > + spin_lock(&l);
> > > + spin_unlock(&l);
> > > + raw_spin_unlock(&r);
> > > +
> > > + break;
> > > + }
> > > case PR_SET_PDEATHSIG:
> > > if (!valid_signal(arg2)) {
> > > error = -EINVAL;
> > >
> > > applied (because I am too lazy to compile a module ;) and
> > >
> >
> > FWIW, I converted it to a module [1]
>
> where is [1] ? not that I think this matters though...
>
> > > # perl -e 'syscall 157,666'
> > >
> > > triggers the lockdep bug
> > >
> > > =============================
> > > [ BUG: Invalid wait context ]
> > > 6.4.0-rc2-00018-g4d6d4c7f541d-dirty #1176 Not tainted
> > > -----------------------------
> > > perl/35 is trying to lock:
> > > ffffffff81c4cc18 (l){....}-{3:3}, at: __do_sys_prctl+0x21b/0x87b
> > > other info that might help us debug this:
> > > context-{5:5}
> > > ...
> > >
> > > as expected.
> > >
> >
> > Yeah, I tried it here and I had the same results,
>
> OK,
>
> > but only in the RT kernel
>
> this again suggests that your testing was wrong or I am totally confused (quite
> possible, I know nothing about RT). I did the testing without CONFIG_PREEMPT_RT.
>
Hrm, could you please share your .config?
> > But running the reproducer for put_task_struct(), works fine.
>
> which reproducer ?
>
Only now I noticed I didn't add the reproducer to the commit message:
while true; do
stress-ng --sched deadline --sched-period 1000000000
--sched-runtime 800000000 --sched-deadline 1000000000 --mmapfork 23 -t
20
done
Powered by blists - more mailing lists