Re: [syzbot] WARNING in vma_merge

From: Liam Howlett
Date: Wed Apr 27 2022 - 15:12:29 EST


* Liam R. Howlett <Liam.Howlett@xxxxxxxxxx> [220427 13:52]:
> * Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> [220427 13:20]:
> > On Wed, 27 Apr 2022 06:15:20 -0700 syzbot <syzbot+7728e4ab5371cebc9c00@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > > syzbot has found a reproducer for the following issue on:
> >
> > Thanks.
> >
> > userfaultfd_release() appears to have offended vma_merge().
>
> Potentially apply_mlockall_flags() and not userfaultfd_release(). There
> is a potential that the vma iterator is stale if a split/merge succeeds,
> although KASAN should pick this up and KASAN is active according to the
> config below. I've sent a patch for the mlockall issue after Qian Cai's
> reported it to linux-mm.
>
> >
> > I'm not seeing any changes in that area from Peter, but Liam's
> > mapletree work changed things around a bit. Gents, could you please
> > take a look?
> >
> >
> > > HEAD commit: f02ac5c95dfd Add linux-next specific files for 20220427
> > > git tree: linux-next
> > > console output: https://syzkaller.appspot.com/x/log.txt?x=105a33a2f00000
> > > kernel config: https://syzkaller.appspot.com/x/.config?x=e9256c70f586da8a
> > > dashboard link: https://syzkaller.appspot.com/bug?extid=7728e4ab5371cebc9c00
> > > compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> > > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15f76f82f00000
> > > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12b42c3cf00000
> > >
> > > IMPORTANT: if you fix the issue, please add the following tag to the commit:
> > > Reported-by: syzbot+7728e4ab5371cebc9c00@xxxxxxxxxxxxxxxxxxxxxxxxx
> > >

...

>
> I cannot get this issue to trigger with the given tree and git repo with
> my config. I will try again with the kernel config above.


I was able to reproduce the issue using the config from syzkaller in my
VM and can confirm it was the apply_mlockall_flags() bug also reported
by Qian Cai [1]. The patch I sent earlier [2] fixes this issue as well.


1. https://lore.kernel.org/linux-mm/20220427161033.GA1935@qian/
2. https://lore.kernel.org/linux-mm/20220427165139.5s3qcj2u5vqrvwlc@revolver/

Thanks,
Liam