* Re: [syzbot] [mm?] KASAN: slab-use-after-free Read in __mmap_region
@ 2024-12-24 12:13 Kun Hu
2024-12-24 16:35 ` Liam R. Howlett
0 siblings, 1 reply; 7+ messages in thread
From: Kun Hu @ 2024-12-24 12:13 UTC (permalink / raw)
To: akpm, Liam.Howlett, lorenzo.stoakes, vbabka, jannh
Cc: linux-mm, linux-kernel, jjtan24
Hello,
When using fuzzer tool to fuzz the latest Linux kernel, the following crash
was triggered.
HEAD commit: 78d4f34e2115b517bcbfe7ec0d018bbbb6f9b0b8
git tree: upstream
Console output: https://drive.google.com/file/d/1_GxT_B3JkCE8Q6r6PGgG27uNn5cgzZm3/view?usp=sharing
Kernel config: https://drive.google.com/file/d/1RhT5dFTs6Vx1U71PbpenN7TPtnPoa3NI/view?usp=sharing
C reproducer: https://drive.google.com/file/d/1zyZSM-hp1UInnE-AA9J3NXmMCV7DCqgf/view?usp=sharing
Syzlang reproducer: https://drive.google.com/file/d/1W0yvbKYi6GaAaG0YNeDVacN3eEa8rxot/view?usp=sharing
We are triggering the same issue and I hope this information is useful to you. If you fix this issue, please let me know.
==================================================================
BUG: KASAN: slab-use-after-free in __mmap_complete mm/vma.c:2408 [inline]
BUG: KASAN: slab-use-after-free in __mmap_region+0x22d6/0x2700 mm/vma.c:2469
Read of size 8 at addr ff110000085279c0 by task syz-executor339/448
CPU: 2 UID: 0 PID: 448 Comm: syz-executor339 Not tainted 6.13.0-rc3 #8
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x116/0x1b0 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:378 [inline]
print_report+0xcf/0x5f0 mm/kasan/report.c:489
kasan_report+0x93/0xc0 mm/kasan/report.c:602
__mmap_complete mm/vma.c:2408 [inline]
__mmap_region+0x22d6/0x2700 mm/vma.c:2469
mmap_region+0x265/0x300 mm/mmap.c:1348
do_mmap+0xc3f/0x1000 mm/mmap.c:496
vm_mmap_pgoff+0x1b3/0x380 mm/util.c:580
ksys_mmap_pgoff+0x477/0x600 mm/mmap.c:542
__do_sys_mmap arch/x86/kernel/sys_x86_64.c:89 [inline]
__se_sys_mmap arch/x86/kernel/sys_x86_64.c:82 [inline]
__x64_sys_mmap+0x127/0x190 arch/x86/kernel/sys_x86_64.c:82
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xc3/0x1d0 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f53b07cbb1d
Code: c3 e8 37 2a 00 00 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe3353bbe8 EFLAGS: 00000246 ORIG_RAX: 0000000000000009
RAX: ffffffffffffffda RBX: 00000000000172cc RCX: 00007f53b07cbb1d
RDX: 0000000000000008 RSI: 0000000000001000 RDI: 0000000020ffe000
RBP: 0000000000000000 R08: 0000000000000004 R09: 0000000000000000
R10: 0000000000000011 R11: 0000000000000246 R12: 00007ffe3353bc04
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
</TASK>
Allocated by task 448:
kasan_save_stack+0x24/0x50 mm/kasan/common.c:47
kasan_save_track+0x14/0x30 mm/kasan/common.c:68
unpoison_slab_object mm/kasan/common.c:319 [inline]
__kasan_slab_alloc+0x87/0x90 mm/kasan/common.c:345
kasan_slab_alloc include/linux/kasan.h:250 [inline]
slab_post_alloc_hook mm/slub.c:4119 [inline]
slab_alloc_node mm/slub.c:4168 [inline]
kmem_cache_alloc_noprof+0x154/0x420 mm/slub.c:4175
vm_area_alloc+0x20/0x200 kernel/fork.c:472
__mmap_new_vma mm/vma.c:2340 [inline]
__mmap_region+0x1219/0x2700 mm/vma.c:2456
mmap_region+0x265/0x300 mm/mmap.c:1348
do_mmap+0xc3f/0x1000 mm/mmap.c:496
vm_mmap_pgoff+0x1b3/0x380 mm/util.c:580
ksys_mmap_pgoff+0x477/0x600 mm/mmap.c:542
__do_sys_mmap arch/x86/kernel/sys_x86_64.c:89 [inline]
__se_sys_mmap arch/x86/kernel/sys_x86_64.c:82 [inline]
__x64_sys_mmap+0x127/0x190 arch/x86/kernel/sys_x86_64.c:82
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xc3/0x1d0 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Freed by task 425:
kasan_save_stack+0x24/0x50 mm/kasan/common.c:47
kasan_save_track+0x14/0x30 mm/kasan/common.c:68
kasan_save_free_info+0x3a/0x60 mm/kasan/generic.c:582
poison_slab_object mm/kasan/common.c:247 [inline]
__kasan_slab_free+0x54/0x70 mm/kasan/common.c:264
kasan_slab_free include/linux/kasan.h:233 [inline]
slab_free_hook mm/slub.c:2353 [inline]
slab_free mm/slub.c:4613 [inline]
kmem_cache_free+0x126/0x4d0 mm/slub.c:4715
rcu_do_batch kernel/rcu/tree.c:2567 [inline]
rcu_core+0x7cb/0x16c0 kernel/rcu/tree.c:2823
handle_softirqs+0x1ad/0x870 kernel/softirq.c:561
__do_softirq kernel/softirq.c:595 [inline]
invoke_softirq kernel/softirq.c:435 [inline]
__irq_exit_rcu kernel/softirq.c:662 [inline]
irq_exit_rcu+0xee/0x140 kernel/softirq.c:678
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1049 [inline]
sysvec_apic_timer_interrupt+0x94/0xb0 arch/x86/kernel/apic/apic.c:1049
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702
Last potentially related work creation:
kasan_save_stack+0x24/0x50 mm/kasan/common.c:47
__kasan_record_aux_stack+0xa6/0xc0 mm/kasan/generic.c:544
__call_rcu_common.constprop.0+0x99/0x790 kernel/rcu/tree.c:3086
vma_complete+0x671/0xb70 mm/vma.c:310
commit_merge+0x7b3/0xec0 mm/vma.c:674
vma_merge_existing_range+0xd7a/0x1f10 mm/vma.c:897
__mmap_region+0x11e4/0x2700 mm/vma.c:2466
mmap_region+0x265/0x300 mm/mmap.c:1348
do_mmap+0xc3f/0x1000 mm/mmap.c:496
vm_mmap_pgoff+0x1b3/0x380 mm/util.c:580
ksys_mmap_pgoff+0x477/0x600 mm/mmap.c:542
__do_sys_mmap arch/x86/kernel/sys_x86_64.c:89 [inline]
__se_sys_mmap arch/x86/kernel/sys_x86_64.c:82 [inline]
__x64_sys_mmap+0x127/0x190 arch/x86/kernel/sys_x86_64.c:82
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xc3/0x1d0 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
The buggy address belongs to the object at ff110000085279a0
which belongs to the cache vm_area_struct of size 160
The buggy address is located 32 bytes inside of
freed 160-byte region [ff110000085279a0, ff11000008527a40)
The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x8527
anon flags: 0x100000000000000(node=0|zone=1)
page_type: f5(slab)
raw: 0100000000000000 ff110000014cb680 ffd400000019bf40 dead00000000000d
raw: 0000000000000000 0000000000120012 00000001f5000000 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ff11000008527880: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
ff11000008527900: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
>ff11000008527980: fc fc fc fc fa fb fb fb fb fb fb fb fb fb fb fb
^
ff11000008527a00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ff11000008527a80: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
---------------
thanks,
Kun Hu
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [syzbot] [mm?] KASAN: slab-use-after-free Read in __mmap_region
2024-12-24 12:13 [syzbot] [mm?] KASAN: slab-use-after-free Read in __mmap_region Kun Hu
@ 2024-12-24 16:35 ` Liam R. Howlett
2025-01-16 19:28 ` Liam R. Howlett
0 siblings, 1 reply; 7+ messages in thread
From: Liam R. Howlett @ 2024-12-24 16:35 UTC (permalink / raw)
To: Kun Hu
Cc: akpm, lorenzo.stoakes, vbabka, jannh, linux-mm, linux-kernel, jjtan24
* Kun Hu <huk23@m.fudan.edu.cn> [241224 07:13]:
> Hello,
>
> When using fuzzer tool to fuzz the latest Linux kernel, the following crash
> was triggered.
>
> HEAD commit: 78d4f34e2115b517bcbfe7ec0d018bbbb6f9b0b8
> git tree: upstream
> Console output: https://drive.google.com/file/d/1_GxT_B3JkCE8Q6r6PGgG27uNn5cgzZm3/view?usp=sharing
> Kernel config: https://drive.google.com/file/d/1RhT5dFTs6Vx1U71PbpenN7TPtnPoa3NI/view?usp=sharing
> C reproducer: https://drive.google.com/file/d/1zyZSM-hp1UInnE-AA9J3NXmMCV7DCqgf/view?usp=sharing
> Syzlang reproducer: https://drive.google.com/file/d/1W0yvbKYi6GaAaG0YNeDVacN3eEa8rxot/view?usp=sharing
>
> We are triggering the same issue and I hope this information is useful to you. If you fix this issue, please let me know.
The fix is on its way upstream. [1]
It is on the dashboard page of the syzbot report you are responding
to...
It specifies the closes and reported-by in the commit.
Are you saying it happens with this fix or did you not test the fix?
Thanks,
Liam
[1] https://lore.kernel.org/all/20241206215229.244413-1-lorenzo.stoakes@oracle.com/T/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [syzbot] [mm?] KASAN: slab-use-after-free Read in __mmap_region
2024-12-24 16:35 ` Liam R. Howlett
@ 2025-01-16 19:28 ` Liam R. Howlett
2025-01-17 2:13 ` Fudam
0 siblings, 1 reply; 7+ messages in thread
From: Liam R. Howlett @ 2025-01-16 19:28 UTC (permalink / raw)
To: Kun Hu, akpm, lorenzo.stoakes, vbabka, jannh, linux-mm,
linux-kernel, jjtan24
* Liam R. Howlett <Liam.Howlett@oracle.com> [241224 11:35]:
> * Kun Hu <huk23@m.fudan.edu.cn> [241224 07:13]:
> > Hello,
> >
> > When using fuzzer tool to fuzz the latest Linux kernel, the following crash
> > was triggered.
> >
> > HEAD commit: 78d4f34e2115b517bcbfe7ec0d018bbbb6f9b0b8
> > git tree: upstream
> > Console output: https://drive.google.com/file/d/1_GxT_B3JkCE8Q6r6PGgG27uNn5cgzZm3/view?usp=sharing
> > Kernel config: https://drive.google.com/file/d/1RhT5dFTs6Vx1U71PbpenN7TPtnPoa3NI/view?usp=sharing
> > C reproducer: https://drive.google.com/file/d/1zyZSM-hp1UInnE-AA9J3NXmMCV7DCqgf/view?usp=sharing
> > Syzlang reproducer: https://drive.google.com/file/d/1W0yvbKYi6GaAaG0YNeDVacN3eEa8rxot/view?usp=sharing
> >
> > We are triggering the same issue and I hope this information is useful to you. If you fix this issue, please let me know.
>
> The fix is on its way upstream. [1]
>
> It is on the dashboard page of the syzbot report you are responding
> to...
>
> It specifies the closes and reported-by in the commit.
>
> Are you saying it happens with this fix or did you not test the fix?
Anything?
>
> Thanks,
> Liam
>
> [1] https://lore.kernel.org/all/20241206215229.244413-1-lorenzo.stoakes@oracle.com/T/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [syzbot] [mm?] KASAN: slab-use-after-free Read in __mmap_region
2025-01-16 19:28 ` Liam R. Howlett
@ 2025-01-17 2:13 ` Fudam
0 siblings, 0 replies; 7+ messages in thread
From: Fudam @ 2025-01-17 2:13 UTC (permalink / raw)
To: Liam R. Howlett
Cc: akpm, lorenzo.stoakes, vbabka, jannh, linux-mm, linux-kernel, jjtan24
> 在 2025年1月17日,03:29,Liam R. Howlett <Liam.Howlett@oracle.com> 写道:
>
> * Liam R. Howlett <Liam.Howlett@oracle.com> [241224 11:35]:
>> * Kun Hu <huk23@m.fudan.edu.cn> [241224 07:13]:
>>> Hello,
>>>
>>> When using fuzzer tool to fuzz the latest Linux kernel, the following crash
>>> was triggered.
>>>
>>> HEAD commit: 78d4f34e2115b517bcbfe7ec0d018bbbb6f9b0b8
>>> git tree: upstream
>>> Console output: https://drive.google.com/file/d/1_GxT_B3JkCE8Q6r6PGgG27uNn5cgzZm3/view?usp=sharing
>>> Kernel config: https://drive.google.com/file/d/1RhT5dFTs6Vx1U71PbpenN7TPtnPoa3NI/view?usp=sharing
>>> C reproducer: https://drive.google.com/file/d/1zyZSM-hp1UInnE-AA9J3NXmMCV7DCqgf/view?usp=sharing
>>> Syzlang reproducer: https://drive.google.com/file/d/1W0yvbKYi6GaAaG0YNeDVacN3eEa8rxot/view?usp=sharing
>>>
>>> We are triggering the same issue and I hope this information is useful to you. If you fix this issue, please let me know.
>>
>> The fix is on its way upstream. [1]
>>
>> It is on the dashboard page of the syzbot report you are responding
>> to...
>>
>> It specifies the closes and reported-by in the commit.
>>
>> Are you saying it happens with this fix or did you not test the fix?
>
> Anything?
Sorry for late, we’ve tested this issue for multiple rounds on v6.13-rc7 and failed to reproduce the crash we reported.
————
Thanks,
Kun
>
>>
>> Thanks,
>> Liam
>>
>> [1] https://lore.kernel.org/all/20241206215229.244413-1-lorenzo.stoakes@oracle.com/T/
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [syzbot] [mm?] KASAN: slab-use-after-free Read in __mmap_region
2024-12-06 21:29 ` Jann Horn
@ 2024-12-06 21:36 ` Lorenzo Stoakes
0 siblings, 0 replies; 7+ messages in thread
From: Lorenzo Stoakes @ 2024-12-06 21:36 UTC (permalink / raw)
To: Jann Horn
Cc: syzbot, Liam.Howlett, akpm, linux-kernel, linux-mm,
syzkaller-bugs, vbabka
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@syzkaller.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@syzkaller.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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [syzbot] [mm?] KASAN: slab-use-after-free Read in __mmap_region
2024-12-06 21:18 syzbot
@ 2024-12-06 21:29 ` Jann Horn
2024-12-06 21:36 ` Lorenzo Stoakes
0 siblings, 1 reply; 7+ messages in thread
From: Jann Horn @ 2024-12-06 21:29 UTC (permalink / raw)
To: syzbot
Cc: Liam.Howlett, akpm, linux-kernel, linux-mm, lorenzo.stoakes,
syzkaller-bugs, vbabka
On Fri, Dec 6, 2024 at 10:18 PM syzbot
<syzbot+91cf8da9401355f946c3@syzkaller.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@syzkaller.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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [syzbot] [mm?] KASAN: slab-use-after-free Read in __mmap_region
@ 2024-12-06 21:18 syzbot
2024-12-06 21:29 ` Jann Horn
0 siblings, 1 reply; 7+ messages in thread
From: syzbot @ 2024-12-06 21:18 UTC (permalink / raw)
To: Liam.Howlett, akpm, jannh, linux-kernel, linux-mm,
lorenzo.stoakes, syzkaller-bugs, vbabka
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@syzkaller.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
CPU: 0 UID: 0 PID: 5461 Comm: syz-executor239 Not tainted 6.13.0-rc1-syzkaller-00001-ge70140ba0d2b #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:378 [inline]
print_report+0x169/0x550 mm/kasan/report.c:489
kasan_report+0x143/0x180 mm/kasan/report.c:602
__mmap_complete mm/vma.c:2408 [inline]
__mmap_region+0x1802/0x2cd0 mm/vma.c:2469
mmap_region+0x226/0x2c0 mm/mmap.c:1347
do_mmap+0x8f0/0x1000 mm/mmap.c:496
vm_mmap_pgoff+0x1dd/0x3d0 mm/util.c:580
ksys_mmap_pgoff+0x4eb/0x720 mm/mmap.c:542
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f8522e6cb29
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 c1 17 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc930f7e48 EFLAGS: 00000246 ORIG_RAX: 0000000000000009
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f8522e6cb29
RDX: 0000000000000000 RSI: 0000000000001008 RDI: 0000000020ffc000
RBP: 00000000000f4240 R08: 0000000000000003 R09: 0000000000000000
R10: 0000000000000013 R11: 0000000000000246 R12: 000000000001294d
R13: 00007ffc930f7e6c R14: 00007ffc930f7e80 R15: 00007ffc930f7e70
</TASK>
Allocated by task 5461:
kasan_save_stack mm/kasan/common.c:47 [inline]
kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
unpoison_slab_object mm/kasan/common.c:319 [inline]
__kasan_slab_alloc+0x66/0x80 mm/kasan/common.c:345
kasan_slab_alloc include/linux/kasan.h:250 [inline]
slab_post_alloc_hook mm/slub.c:4104 [inline]
slab_alloc_node mm/slub.c:4153 [inline]
kmem_cache_alloc_noprof+0x1d9/0x380 mm/slub.c:4160
vm_area_alloc+0x24/0x1d0 kernel/fork.c:472
__mmap_new_vma mm/vma.c:2340 [inline]
__mmap_region+0x196e/0x2cd0 mm/vma.c:2456
mmap_region+0x226/0x2c0 mm/mmap.c:1347
do_mmap+0x8f0/0x1000 mm/mmap.c:496
vm_mmap_pgoff+0x1dd/0x3d0 mm/util.c:580
ksys_mmap_pgoff+0x4eb/0x720 mm/mmap.c:542
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Freed by task 5295:
kasan_save_stack mm/kasan/common.c:47 [inline]
kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:582
poison_slab_object mm/kasan/common.c:247 [inline]
__kasan_slab_free+0x59/0x70 mm/kasan/common.c:264
kasan_slab_free include/linux/kasan.h:233 [inline]
slab_free_hook mm/slub.c:2338 [inline]
slab_free mm/slub.c:4598 [inline]
kmem_cache_free+0x195/0x410 mm/slub.c:4700
rcu_do_batch kernel/rcu/tree.c:2567 [inline]
rcu_core+0xaaa/0x17a0 kernel/rcu/tree.c:2823
handle_softirqs+0x2d4/0x9b0 kernel/softirq.c:554
do_softirq+0x11b/0x1e0 kernel/softirq.c:455
__local_bh_enable_ip+0x1bb/0x200 kernel/softirq.c:382
lock_sock include/net/sock.h:1617 [inline]
tcp_sendmsg+0x22/0x50 net/ipv4/tcp.c:1357
sock_sendmsg_nosec net/socket.c:711 [inline]
__sock_sendmsg+0x1a6/0x270 net/socket.c:726
sock_write_iter+0x2d7/0x3f0 net/socket.c:1147
new_sync_write fs/read_write.c:586 [inline]
vfs_write+0xaeb/0xd30 fs/read_write.c:679
ksys_write+0x18f/0x2b0 fs/read_write.c:731
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Last potentially related work creation:
kasan_save_stack+0x3f/0x60 mm/kasan/common.c:47
__kasan_record_aux_stack+0xac/0xc0 mm/kasan/generic.c:544
__call_rcu_common kernel/rcu/tree.c:3086 [inline]
call_rcu+0x167/0xa70 kernel/rcu/tree.c:3190
vma_complete+0x97f/0xb50 mm/vma.c:310
commit_merge+0x6f6/0x760 mm/vma.c:674
vma_merge_existing_range+0x13b8/0x16f0 mm/vma.c:897
__mmap_region+0x175b/0x2cd0 mm/vma.c:2466
mmap_region+0x226/0x2c0 mm/mmap.c:1347
do_mmap+0x8f0/0x1000 mm/mmap.c:496
vm_mmap_pgoff+0x1dd/0x3d0 mm/util.c:580
ksys_mmap_pgoff+0x4eb/0x720 mm/mmap.c:542
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
The buggy address belongs to the object at ffff8880403a60f8
which belongs to the cache vm_area_struct of size 184
The buggy address is located 32 bytes inside of
freed 184-byte region [ffff8880403a60f8, ffff8880403a61b0)
The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x403a6
flags: 0x4fff00000000000(node=1|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 04fff00000000000 ffff88801be90b40 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000100010 00000001f5000000 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x52cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 5461, tgid 5461 (syz-executor239), ts 76280088571, free_ts 76278589874
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1556
prep_new_page mm/page_alloc.c:1564 [inline]
get_page_from_freelist+0x365c/0x37a0 mm/page_alloc.c:3474
__alloc_pages_noprof+0x292/0x710 mm/page_alloc.c:4751
alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2265
alloc_slab_page+0x6a/0x140 mm/slub.c:2408
allocate_slab+0x5a/0x2f0 mm/slub.c:2574
new_slab mm/slub.c:2627 [inline]
___slab_alloc+0xcd1/0x14b0 mm/slub.c:3815
__slab_alloc+0x58/0xa0 mm/slub.c:3905
__slab_alloc_node mm/slub.c:3980 [inline]
slab_alloc_node mm/slub.c:4141 [inline]
kmem_cache_alloc_noprof+0x268/0x380 mm/slub.c:4160
vm_area_dup+0x27/0x290 kernel/fork.c:487
__split_vma+0x1cb/0xc50 mm/vma.c:434
vms_gather_munmap_vmas+0x4c1/0x1600 mm/vma.c:1288
__mmap_prepare mm/vma.c:2241 [inline]
__mmap_region+0x7de/0x2cd0 mm/vma.c:2443
mmap_region+0x226/0x2c0 mm/mmap.c:1347
do_mmap+0x8f0/0x1000 mm/mmap.c:496
vm_mmap_pgoff+0x1dd/0x3d0 mm/util.c:580
page last free pid 5457 tgid 5457 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1127 [inline]
free_unref_folios+0xf62/0x1a90 mm/page_alloc.c:2704
folios_put_refs+0x76c/0x860 mm/swap.c:962
free_pages_and_swap_cache+0x5c8/0x690 mm/swap_state.c:335
__tlb_batch_free_encoded_pages mm/mmu_gather.c:136 [inline]
tlb_batch_pages_flush mm/mmu_gather.c:149 [inline]
tlb_flush_mmu_free mm/mmu_gather.c:366 [inline]
tlb_flush_mmu+0x3a3/0x680 mm/mmu_gather.c:373
tlb_finish_mmu+0xd4/0x200 mm/mmu_gather.c:465
exit_mmap+0x496/0xc20 mm/mmap.c:1680
__mmput+0x115/0x3c0 kernel/fork.c:1353
exit_mm+0x220/0x310 kernel/exit.c:570
do_exit+0x9b2/0x28e0 kernel/exit.c:925
do_group_exit+0x207/0x2c0 kernel/exit.c:1087
__do_sys_exit_group kernel/exit.c:1098 [inline]
__se_sys_exit_group kernel/exit.c:1096 [inline]
__x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1096
x64_sys_call+0x26a8/0x26b0 arch/x86/include/generated/asm/syscalls_64.h:232
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Memory state around the buggy address:
ffff8880403a6000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8880403a6080: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fa
>ffff8880403a6100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880403a6180: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fa fb
ffff8880403a6200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.
If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)
If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report
If you want to undo deduplication, reply with:
#syz undup
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-01-17 2:13 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-24 12:13 [syzbot] [mm?] KASAN: slab-use-after-free Read in __mmap_region Kun Hu
2024-12-24 16:35 ` Liam R. Howlett
2025-01-16 19:28 ` Liam R. Howlett
2025-01-17 2:13 ` Fudam
-- strict thread matches above, loose matches on Subject: below --
2024-12-06 21:18 syzbot
2024-12-06 21:29 ` Jann Horn
2024-12-06 21:36 ` Lorenzo Stoakes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox