[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aa37bada-558c-41cb-963d-d3106036eaa2@lucifer.local>
Date: Fri, 6 Dec 2024 21:36:20 +0000
From: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
To: Jann Horn <jannh@...gle.com>
Cc: syzbot <syzbot+91cf8da9401355f946c3@...kaller.appspotmail.com>,
Liam.Howlett@...cle.com, akpm@...ux-foundation.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
syzkaller-bugs@...glegroups.com, vbabka@...e.cz
Subject: Re: [syzbot] [mm?] KASAN: slab-use-after-free Read in __mmap_region
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@...kaller.appspotmail.com> 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@...kaller.appspotmail.com
> >
> > ==================================================================
> > 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.
Powered by blists - more mailing lists