syzbot


KASAN: slab-use-after-free Read in super_lock

Status: upstream: reported on 2025/07/14 20:50
Reported-by: syzbot+accc2a70d2f6627b2b3e@syzkaller.appspotmail.com
First crash: 47d, last: 39d

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in __lock_acquire+0xff/0x7c80 kernel/locking/lockdep.c:5005
Read of size 8 at addr ffff88805a2de0e0 by task syz.0.611/7518

CPU: 0 PID: 7518 Comm: syz.0.611 Not tainted 6.6.99-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x16c/0x230 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:364 [inline]
 print_report+0xac/0x200 mm/kasan/report.c:466
 kasan_report+0x117/0x150 mm/kasan/report.c:579
 __lock_acquire+0xff/0x7c80 kernel/locking/lockdep.c:5005
 lock_acquire+0x197/0x410 kernel/locking/lockdep.c:5754
 down_read+0x46/0x2e0 kernel/locking/rwsem.c:1520
 __super_lock fs/super.c:58 [inline]
 super_lock+0x167/0x360 fs/super.c:117
 super_lock_shared fs/super.c:146 [inline]
 super_lock_shared_active fs/super.c:1442 [inline]
 fs_bdev_sync+0xa4/0x170 fs/super.c:1477
 blkdev_flushbuf block/ioctl.c:375 [inline]
 blkdev_common_ioctl+0x880/0x23d0 block/ioctl.c:505
 blkdev_ioctl+0x4eb/0x6f0 block/ioctl.c:627
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:871 [inline]
 __se_sys_ioctl+0xfd/0x170 fs/ioctl.c:857
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f117538e9a9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f11761be038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f11755b5fa0 RCX: 00007f117538e9a9
RDX: 0000000000000000 RSI: 0000000000001261 RDI: 0000000000000004
RBP: 00007f1175410d69 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f11755b5fa0 R15: 00007fffb5b8baa8
 </TASK>

Allocated by task 7474:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4e/0x70 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0x8f/0xa0 mm/kasan/common.c:383
 kmalloc include/linux/slab.h:600 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 alloc_super+0x59/0x920 fs/super.c:326
 sget_fc+0x322/0x8d0 fs/super.c:805
 sget_dev fs/super.c:1427 [inline]
 get_tree_bdev+0x1f7/0x510 fs/super.c:1569
 vfs_get_tree+0x8c/0x280 fs/super.c:1764
 do_new_mount+0x24b/0xa40 fs/namespace.c:3366
 do_mount fs/namespace.c:3706 [inline]
 __do_sys_mount fs/namespace.c:3915 [inline]
 __se_sys_mount+0x2da/0x3c0 fs/namespace.c:3892
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Freed by task 5833:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4e/0x70 mm/kasan/common.c:52
 kasan_save_free_info+0x2e/0x50 mm/kasan/generic.c:522
 ____kasan_slab_free+0x126/0x1e0 mm/kasan/common.c:236
 kasan_slab_free include/linux/kasan.h:164 [inline]
 slab_free_hook mm/slub.c:1806 [inline]
 slab_free_freelist_hook+0x130/0x1b0 mm/slub.c:1832
 slab_free mm/slub.c:3816 [inline]
 __kmem_cache_free+0xba/0x1f0 mm/slub.c:3829
 process_one_work kernel/workqueue.c:2634 [inline]
 process_scheduled_works+0xa45/0x15b0 kernel/workqueue.c:2711
 worker_thread+0xa55/0xfc0 kernel/workqueue.c:2792
 kthread+0x2fa/0x390 kernel/kthread.c:388
 ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:152
 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:293

Last potentially related work creation:
 kasan_save_stack+0x3e/0x60 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xaf/0xc0 mm/kasan/generic.c:492
 insert_work+0x3d/0x310 kernel/workqueue.c:1651
 __queue_work+0xc39/0x1020 kernel/workqueue.c:1800
 queue_work_on+0x121/0x1e0 kernel/workqueue.c:1835
 rcu_do_batch kernel/rcu/tree.c:2194 [inline]
 rcu_core+0xcc4/0x1720 kernel/rcu/tree.c:2467
 handle_softirqs+0x280/0x820 kernel/softirq.c:578
 run_ksoftirqd+0x9c/0xf0 kernel/softirq.c:950
 smpboot_thread_fn+0x635/0xa00 kernel/smpboot.c:164
 kthread+0x2fa/0x390 kernel/kthread.c:388
 ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:152
 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:293

Second to last potentially related work creation:
 kasan_save_stack+0x3e/0x60 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xaf/0xc0 mm/kasan/generic.c:492
 __call_rcu_common kernel/rcu/tree.c:2721 [inline]
 call_rcu+0x158/0x930 kernel/rcu/tree.c:2837
 put_super fs/super.c:433 [inline]
 deactivate_locked_super+0xd3/0x100 fs/super.c:494
 cleanup_mnt+0x429/0x4c0 fs/namespace.c:1250
 task_work_run+0x1ce/0x250 kernel/task_work.c:239
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 exit_to_user_mode_loop+0xe6/0x110 kernel/entry/common.c:177
 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:210
 __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline]
 syscall_exit_to_user_mode+0x1a/0x50 kernel/entry/common.c:302
 do_syscall_64+0x61/0xb0 arch/x86/entry/common.c:87
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

The buggy address belongs to the object at ffff88805a2de000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 224 bytes inside of
 freed 4096-byte region [ffff88805a2de000, ffff88805a2df000)

The buggy address belongs to the physical page:
page:ffffea000168b600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5a2d8
head:ffffea000168b600 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000840 ffff888017842140 ffffea000169aa00 dead000000000002
raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d2820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 1144, tgid 1144 (kworker/u4:7), ts 97383384482, free_ts 92565380782
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x1cd/0x210 mm/page_alloc.c:1554
 prep_new_page mm/page_alloc.c:1561 [inline]
 get_page_from_freelist+0x195c/0x19f0 mm/page_alloc.c:3191
 __alloc_pages+0x1e3/0x460 mm/page_alloc.c:4457
 alloc_slab_page+0x5d/0x170 mm/slub.c:1876
 allocate_slab mm/slub.c:2023 [inline]
 new_slab+0x87/0x2e0 mm/slub.c:2076
 ___slab_alloc+0xc6d/0x12f0 mm/slub.c:3230
 __slab_alloc mm/slub.c:3329 [inline]
 __slab_alloc_node mm/slub.c:3382 [inline]
 slab_alloc_node mm/slub.c:3475 [inline]
 __kmem_cache_alloc_node+0x1a2/0x260 mm/slub.c:3524
 __do_kmalloc_node mm/slab_common.c:1006 [inline]
 __kmalloc_node_track_caller+0xa2/0x230 mm/slab_common.c:1027
 kmalloc_reserve+0x117/0x260 net/core/skbuff.c:581
 __alloc_skb+0x138/0x2c0 net/core/skbuff.c:650
 alloc_skb include/linux/skbuff.h:1284 [inline]
 nsim_dev_trap_skb_build drivers/net/netdevsim/dev.c:748 [inline]
 nsim_dev_trap_report drivers/net/netdevsim/dev.c:805 [inline]
 nsim_dev_trap_report_work+0x293/0xb00 drivers/net/netdevsim/dev.c:851
 process_one_work kernel/workqueue.c:2634 [inline]
 process_scheduled_works+0xa45/0x15b0 kernel/workqueue.c:2711
 worker_thread+0xa55/0xfc0 kernel/workqueue.c:2792
 kthread+0x2fa/0x390 kernel/kthread.c:388
 ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:152
 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:293
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1154 [inline]
 free_unref_page_prepare+0x7ce/0x8e0 mm/page_alloc.c:2336
 free_unref_page+0x32/0x2e0 mm/page_alloc.c:2429
 io_pages_unmap+0x1c4/0x300 io_uring/io_uring.c:2687
 io_rings_free+0xbe/0x3d0 io_uring/io_uring.c:2796
 io_ring_ctx_free+0x730/0x930 io_uring/io_uring.c:3039
 io_ring_exit_work+0x76d/0x7e0 io_uring/io_uring.c:3263
 process_one_work kernel/workqueue.c:2634 [inline]
 process_scheduled_works+0xa45/0x15b0 kernel/workqueue.c:2711
 worker_thread+0xa55/0xfc0 kernel/workqueue.c:2792
 kthread+0x2fa/0x390 kernel/kthread.c:388
 ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:152
 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:293

Memory state around the buggy address:
 ffff88805a2ddf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88805a2de000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88805a2de080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff88805a2de100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88805a2de180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/07/22 17:31 linux-6.6.y d96eb99e2f0e 8e9d1dc1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in super_lock
2025/07/18 22:48 linux-6.6.y d96eb99e2f0e 7117feec .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in super_lock
2025/07/18 22:48 linux-6.6.y d96eb99e2f0e 7117feec .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in super_lock
2025/07/14 20:49 linux-6.6.y 9247f4e6573a d8fc7335 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in super_lock
* Struck through repros no longer work on HEAD.