Re: [syzbot] [mm?] KASAN: slab-use-after-free Read in __mmap_region

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 06, 2024 at 10:29:39PM +0100, Jann Horn wrote:
> On Fri, Dec 6, 2024 at 10:18 PM syzbot
> <syzbot+91cf8da9401355f946c3@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > Hello,
> >
> > syzbot found the following issue on:
> >
> > HEAD commit:    e70140ba0d2b Get rid of 'remove_new' relic from platform d..
> > git tree:       upstream
> > console output: https://syzkaller.appspot.com/x/log.txt?x=13300330580000
> > kernel config:  https://syzkaller.appspot.com/x/.config?x=50c7a61469ce77e7
> > dashboard link: https://syzkaller.appspot.com/bug?extid=91cf8da9401355f946c3
> > compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
> > syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=124130df980000
> > C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=10a280f8580000
> >
> > Downloadable assets:
> > disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/7feb34a89c2a/non_bootable_disk-e70140ba.raw.xz
> > vmlinux: https://storage.googleapis.com/syzbot-assets/91f313d8125b/vmlinux-e70140ba.xz
> > kernel image: https://storage.googleapis.com/syzbot-assets/a9bdf286943a/bzImage-e70140ba.xz
> >
> > IMPORTANT: if you fix the issue, please add the following tag to the commit:
> > Reported-by: syzbot+91cf8da9401355f946c3@xxxxxxxxxxxxxxxxxxxxxxxxx
> >
> > ==================================================================
> > BUG: KASAN: slab-use-after-free in __mmap_complete mm/vma.c:2408 [inline]
> > BUG: KASAN: slab-use-after-free in __mmap_region+0x1802/0x2cd0 mm/vma.c:2469
> > Read of size 8 at addr ffff8880403a6118 by task syz-executor239/5461
>
> This looks like it was introduced by commit 5ac87a885aec ("mm: defer
> second attempt at merge on mmap()"), which went into 6.13-rc1? From a
> glance it seems like the "vma_merge_existing_range(&vmg)" in
> __mmap_region() needs a "vma = " at the start of the line.

Thanks so much for so quickly noticing this...!!

Ugh you're right, what a mistake. This would fit the report completely too,
as the existing VMA would be freed etc. etc.

I'll write a test to trigger this path soon, writing mmap_region() unit
tests is on my TODO list now they're in vma.c

The line referenced seems to be to vm_stat_account(), which references
vma->vm_flags which is in other words the first time we try to access the
vma pointer, UAF...

Patch incoming in one second.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux