Re: [syzbot] [kernel?] inconsistent lock state in ptrace_attach

From: Oleg Nesterov
Date: Fri Nov 17 2023 - 04:39:48 EST


On 11/17, Peter Zijlstra wrote:
>
> On Fri, Nov 17, 2023 at 12:49:04AM -0800, syzbot wrote:
> > syzbot has bisected this issue to:
> >
> > commit 2d25a889601d2fbc87ec79b30ea315820f874b78
> > Author: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> > Date: Sun Sep 17 11:24:21 2023 +0000
> >
> > ptrace: Convert ptrace_attach() to use lock guards
> >
> > bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=132b7d84e80000
> > start commit: f31817cbcf48 Add linux-next specific files for 20231116
> > git tree: linux-next
> > final oops: https://syzkaller.appspot.com/x/report.txt?x=10ab7d84e80000
> > console output: https://syzkaller.appspot.com/x/log.txt?x=172b7d84e80000
> > kernel config: https://syzkaller.appspot.com/x/.config?x=f59345f1d0a928c
> > dashboard link: https://syzkaller.appspot.com/bug?extid=cbb25bb9b4d29a773985
> > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1014d797680000
> > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11b1ec67680000
> >
> > Reported-by: syzbot+cbb25bb9b4d29a773985@xxxxxxxxxxxxxxxxxxxxxxxxx
> > Fixes: 2d25a889601d ("ptrace: Convert ptrace_attach() to use lock guards")
>
> Hurmph, let me pull that patch from tip and go have a look. Thanks!

I guess

scoped_guard (write_lock, &tasklist_lock)

is not right... this needs write_lock_irq().

I didn't notice this when I reviewed this patch.

Oleg.