Re: [syzbot] [mm?] KASAN: slab-use-after-free Read in mas_next_slot (2)
From: Hillf Danton
Date: Wed Jul 16 2025 - 21:46:59 EST
> Date: Wed, 16 Jul 2025 10:55:35 -0700
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 0be23810e32e Add linux-next specific files for 20250714
> git tree: linux-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=11a9a7d4580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=adc3ea2bfe31343b
> dashboard link: https://syzkaller.appspot.com/bug?extid=ebfd0e44b5c11034e1eb
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11d0658c580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15dd858c580000
Test Lorenzo's patch
#syz test
--- x/mm/mremap.c
+++ y/mm/mremap.c
@@ -1112,6 +1112,7 @@ static void unmap_source_vma(struct vma_
err = do_vmi_munmap(&vmi, mm, addr, len, vrm->uf_unmap, /* unlock= */false);
vrm->vma = NULL; /* Invalidated. */
+ vrm->vmi_needs_reset = true;
if (err) {
/* OOM: unable to split vma, just get accounts right */
vm_acct_memory(len >> PAGE_SHIFT);
@@ -1367,6 +1368,7 @@ static unsigned long mremap_to(struct vm
err = do_munmap(mm, vrm->new_addr, vrm->new_len,
vrm->uf_unmap_early);
vrm->vma = NULL; /* Invalidated. */
+ vrm->vmi_needs_reset = true;
if (err)
return err;
--