[moderation] [fs?] KASAN: slab-use-after-free Read in __fput (2)

0 views
Skip to first unread message

syzbot

unread,
Apr 11, 2024, 1:46:19 PMApr 11
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 480e035fc4c7 Merge tag 'drm-next-2024-03-13' of https://gi..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1605c5a1180000
kernel config: https://syzkaller.appspot.com/x/.config?x=1e5b814e91787669
dashboard link: https://syzkaller.appspot.com/bug?extid=4abdef8adca382244f5d
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
CC: [gre...@linuxfoundation.org linux-...@vger.kernel.org linux-...@vger.kernel.org raf...@kernel.org]

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/5f73b6ef963d/disk-480e035f.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/46c949396aad/vmlinux-480e035f.xz
kernel image: https://storage.googleapis.com/syzbot-assets/e3b4d0f5a5f8/bzImage-480e035f.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+4abdef...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: slab-use-after-free in d_inode include/linux/dcache.h:520 [inline]
BUG: KASAN: slab-use-after-free in fsnotify_parent include/linux/fsnotify.h:66 [inline]
BUG: KASAN: slab-use-after-free in fsnotify_file include/linux/fsnotify.h:106 [inline]
BUG: KASAN: slab-use-after-free in fsnotify_close include/linux/fsnotify.h:387 [inline]
BUG: KASAN: slab-use-after-free in __fput+0x1b8/0x8a0 fs/file_table.c:408
Read of size 8 at addr ffff88807ab3bad8 by task syz-executor.0/10980

CPU: 0 PID: 10980 Comm: syz-executor.0 Not tainted 6.8.0-syzkaller-08073-g480e035fc4c7 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114
print_address_description mm/kasan/report.c:377 [inline]
print_report+0x169/0x550 mm/kasan/report.c:488
kasan_report+0x143/0x180 mm/kasan/report.c:601
d_inode include/linux/dcache.h:520 [inline]
fsnotify_parent include/linux/fsnotify.h:66 [inline]
fsnotify_file include/linux/fsnotify.h:106 [inline]
fsnotify_close include/linux/fsnotify.h:387 [inline]
__fput+0x1b8/0x8a0 fs/file_table.c:408
task_work_run+0x24f/0x310 kernel/task_work.c:180
get_signal+0x1673/0x1850 kernel/signal.c:2683
arch_do_signal_or_restart+0x96/0x860 arch/x86/kernel/signal.c:310
exit_to_user_mode_loop kernel/entry/common.c:105 [inline]
exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
__syscall_exit_to_user_mode_work kernel/entry/common.c:201 [inline]
syscall_exit_to_user_mode+0xc9/0x360 kernel/entry/common.c:212
do_syscall_64+0x10a/0x240 arch/x86/entry/common.c:89
entry_SYSCALL_64_after_hwframe+0x6d/0x75
RIP: 0033:0x7f4420e7de69
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f4421ba9178 EFLAGS: 00000246
ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 00007f4420fac058 RCX: 00007f4420e7de69
RDX: 0000000000000000 RSI: 0000000000000080 RDI: 00007f4420fac058
RBP: 00007f4420fac050 R08: 00007f4421ba96c0 R09: 00007f4421ba96c0
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f4420fac05c
R13: 000000000000000b R14: 00007f44210cf960 R15: 00007f44210cfa48
</TASK>

Allocated by task 10982:
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:312 [inline]
__kasan_slab_alloc+0x66/0x80 mm/kasan/common.c:338
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook mm/slub.c:3798 [inline]
slab_alloc_node mm/slub.c:3845 [inline]
kmem_cache_alloc_lru+0x178/0x350 mm/slub.c:3864
__d_alloc+0x31/0x700 fs/dcache.c:1624
d_alloc_pseudo+0x1f/0xb0 fs/dcache.c:1756
alloc_path_pseudo fs/file_table.c:330 [inline]
alloc_file_pseudo+0x123/0x290 fs/file_table.c:346
dma_buf_getfile drivers/dma-buf/dma-buf.c:547 [inline]
dma_buf_export+0x3dd/0x990 drivers/dma-buf/dma-buf.c:632
udmabuf_create+0x78e/0xa10 drivers/dma-buf/udmabuf.c:272
udmabuf_ioctl_create drivers/dma-buf/udmabuf.c:309 [inline]
udmabuf_ioctl+0x304/0x4f0 drivers/dma-buf/udmabuf.c:340
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:904 [inline]
__se_sys_ioctl+0xfc/0x170 fs/ioctl.c:890
do_syscall_64+0xfb/0x240
entry_SYSCALL_64_after_hwframe+0x6d/0x75

Freed by task 10980:
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:579
poison_slab_object+0xa6/0xe0 mm/kasan/common.c:240
__kasan_slab_free+0x37/0x60 mm/kasan/common.c:256
kasan_slab_free include/linux/kasan.h:184 [inline]
slab_free_hook mm/slub.c:2106 [inline]
slab_free mm/slub.c:4280 [inline]
kmem_cache_free+0x102/0x2b0 mm/slub.c:4344
__dentry_kill+0x497/0x630 fs/dcache.c:622
dput+0x19f/0x2b0 fs/dcache.c:845
__fput+0x678/0x8a0 fs/file_table.c:430
task_work_run+0x24f/0x310 kernel/task_work.c:180
get_signal+0x1673/0x1850 kernel/signal.c:2683
arch_do_signal_or_restart+0x96/0x860 arch/x86/kernel/signal.c:310
exit_to_user_mode_loop kernel/entry/common.c:105 [inline]
exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
__syscall_exit_to_user_mode_work kernel/entry/common.c:201 [inline]
syscall_exit_to_user_mode+0xc9/0x360 kernel/entry/common.c:212
do_syscall_64+0x10a/0x240 arch/x86/entry/common.c:89
entry_SYSCALL_64_after_hwframe+0x6d/0x75

The buggy address belongs to the object at ffff88807ab3ba70
which belongs to the cache dentry of size 312
The buggy address is located 104 bytes inside of
freed 312-byte region [ffff88807ab3ba70, ffff88807ab3bba8)

The buggy address belongs to the physical page:
page:ffffea0001eace80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7ab3a
head:ffffea0001eace80 order:1 entire_mapcount:0 nr_pages_mapped:0 pincount:0
memcg:ffff8880231f6e01
flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000840 ffff888015aed8c0 ffffea0001872b00 dead000000000002
raw: 0000000000000000 0000000080150015 00000001ffffffff ffff8880231f6e01
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 1, migratetype Reclaimable, gfp_mask 0x1d20d0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 6613, tgid 6609 (syz-executor.3), ts 135019844832, free_ts 134716887807
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x1ea/0x210 mm/page_alloc.c:1533
prep_new_page mm/page_alloc.c:1540 [inline]
get_page_from_freelist+0x33ea/0x3580 mm/page_alloc.c:3311
__alloc_pages+0x256/0x680 mm/page_alloc.c:4569
__alloc_pages_node include/linux/gfp.h:238 [inline]
alloc_pages_node include/linux/gfp.h:261 [inline]
alloc_slab_page+0x5f/0x160 mm/slub.c:2175
allocate_slab mm/slub.c:2338 [inline]
new_slab+0x84/0x2f0 mm/slub.c:2391
___slab_alloc+0xc73/0x1260 mm/slub.c:3525
__slab_alloc mm/slub.c:3610 [inline]
__slab_alloc_node mm/slub.c:3663 [inline]
slab_alloc_node mm/slub.c:3835 [inline]
kmem_cache_alloc_lru+0x253/0x350 mm/slub.c:3864
__d_alloc+0x31/0x700 fs/dcache.c:1624
d_alloc fs/dcache.c:1704 [inline]
d_alloc_parallel+0xdf/0x1600 fs/dcache.c:2462
__lookup_slow+0x117/0x3f0 fs/namei.c:1677
lookup_one_len+0x18b/0x2d0 fs/namei.c:2756
start_creating+0x187/0x310 fs/debugfs/inode.c:382
__debugfs_create_file+0x72/0x490 fs/debugfs/inode.c:427
kvm_create_vm_debugfs arch/x86/kvm/../../../virt/kvm/kvm_main.c:1133 [inline]
kvm_create_vm arch/x86/kvm/../../../virt/kvm/kvm_main.c:1283 [inline]
kvm_dev_ioctl_create_vm arch/x86/kvm/../../../virt/kvm/kvm_main.c:5443 [inline]
kvm_dev_ioctl+0x1b55/0x2390 arch/x86/kvm/../../../virt/kvm/kvm_main.c:5485
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:904 [inline]
__se_sys_ioctl+0xfc/0x170 fs/ioctl.c:890
do_syscall_64+0xfb/0x240
page last free pid 4883 tgid 4883 stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1140 [inline]
free_unref_page_prepare+0x968/0xa90 mm/page_alloc.c:2346
free_unref_page+0x37/0x3f0 mm/page_alloc.c:2486
discard_slab mm/slub.c:2437 [inline]
__put_partials+0xeb/0x130 mm/slub.c:2906
put_cpu_partial+0x17c/0x250 mm/slub.c:2981
__slab_free+0x2ea/0x3d0 mm/slub.c:4151
qlink_free mm/kasan/quarantine.c:163 [inline]
qlist_free_all+0x5e/0xc0 mm/kasan/quarantine.c:179
kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:286
__kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:322
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook mm/slub.c:3798 [inline]
slab_alloc_node mm/slub.c:3845 [inline]
kmalloc_trace+0x16f/0x360 mm/slub.c:3992
kmalloc include/linux/slab.h:628 [inline]
kzalloc include/linux/slab.h:749 [inline]
kobject_uevent_env+0x28b/0x8f0 lib/kobject_uevent.c:524
really_probe+0x80a/0xc50 drivers/base/dd.c:708
__driver_probe_device+0x1a2/0x3e0 drivers/base/dd.c:800
driver_probe_device+0x50/0x430 drivers/base/dd.c:830
__device_attach_driver+0x2d6/0x530 drivers/base/dd.c:958
bus_for_each_drv+0x24e/0x2e0 drivers/base/bus.c:457
__device_attach+0x333/0x520 drivers/base/dd.c:1030

Memory state around the buggy address:
ffff88807ab3b980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88807ab3ba00: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fa fb
>ffff88807ab3ba80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88807ab3bb00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88807ab3bb80: fb fb fb fb fb fc fc fc fc fc fc fc fc fa 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 syzk...@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 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

syzbot

unread,
Apr 23, 2024, 7:38:12 AM (7 days ago) Apr 23
to syzkaller-upst...@googlegroups.com
Sending this report to the next reporting stage.
Reply all
Reply to author
Forward
0 new messages