lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAq0SUkjFiN3Xap-S2awymDqDWZceCnAWBQnESVMVya7RpFFUw@mail.gmail.com>
Date:   Thu, 1 Jun 2023 14:45:53 -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 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]

>         # 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, but only in the RT
kernel. But running the reproducer for put_task_struct(), works fine.

> Looks like your testing was wrong... Or maybe you missed another lockdep problem ?
> Did you check dmesg? Perhaps lockdep detected another bug,say, even at boot time ?
> In this case debug_locks_off() sets debug_locks = 0 and this disables lockdep.
>
> Oleg.
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ