syzbot


KASAN: use-after-free Read in device_shutdown (4)

Status: upstream: reported on 2025/12/18 09:02
Reported-by: syzbot+6dd34c5dc2feaf2b7927@syzkaller.appspotmail.com
First crash: 186d, last: 33d
Similar bugs (3)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: use-after-free Read in device_shutdown 19 3 642d 648d 0/3 auto-obsoleted due to no activity on 2024/12/26 22:56
linux-5.15 KASAN: use-after-free Read in device_shutdown (2) 19 2 522d 523d 0/3 auto-obsoleted due to no activity on 2025/04/25 22:07
linux-5.15 KASAN: use-after-free Read in device_shutdown (3) 19 2 392d 405d 0/3 auto-obsoleted due to no activity on 2025/09/03 15:39

Sample crash report:
kvm: exiting hardware virtualization
==================================================================
BUG: KASAN: use-after-free in __mutex_waiter_is_first kernel/locking/mutex.c:191 [inline]
BUG: KASAN: use-after-free in __mutex_lock_common+0xd0f/0x2400 kernel/locking/mutex.c:671
Read of size 8 at addr ffff8880918a4160 by task init/7432

CPU: 0 PID: 7432 Comm: init Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/18/2026
Call Trace:
 <TASK>
 dump_stack_lvl+0x188/0x250 lib/dump_stack.c:106
 print_address_description+0x60/0x2d0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0xdf/0x130 mm/kasan/report.c:451
 __mutex_waiter_is_first kernel/locking/mutex.c:191 [inline]
 __mutex_lock_common+0xd0f/0x2400 kernel/locking/mutex.c:671
 __mutex_lock kernel/locking/mutex.c:729 [inline]
 mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
 device_lock include/linux/device.h:764 [inline]
 device_shutdown+0x1fc/0x5e0 drivers/base/core.c:4549
 kernel_shutdown_prepare kernel/reboot.c:266 [inline]
 kernel_power_off+0x4f/0xb0 kernel/reboot.c:291
 __do_sys_reboot kernel/reboot.c:366 [inline]
 __se_sys_reboot+0x40d/0x430 kernel/reboot.c:312
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7fba626818d3
Code: ff 45 31 c9 6a 13 45 31 c0 31 c9 e8 67 8b f8 ff 48 83 c4 18 c3 66 90 89 fa be 69 19 12 28 bf ad de e1 fe b8 a9 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 05 c3 0f 1f 40 00 48 8b 15 f1 24 0d 00 f7 d8
RSP: 002b:00007ffeb8577228 EFLAGS: 00000246 ORIG_RAX: 00000000000000a9
RAX: ffffffffffffffda RBX: 000000000000000c RCX: 00007fba626818d3
RDX: 000000004321fedc RSI: 0000000028121969 RDI: 00000000fee1dead
RBP: 000000004321fedc R08: 0000000000000000 R09: 0000000000000000
R10: 00007ffeb8577200 R11: 0000000000000246 R12: 00007fba62824490
R13: 00007ffeb857727c R14: 00007fba6285c000 R15: 000055b88670fd98
 </TASK>

Allocated by task 6821:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 ____kasan_kmalloc mm/kasan/common.c:513 [inline]
 __kasan_kmalloc+0xb5/0xf0 mm/kasan/common.c:522
 kmalloc include/linux/slab.h:607 [inline]
 kzalloc include/linux/slab.h:738 [inline]
 nsim_bus_dev_new drivers/net/netdevsim/bus.c:408 [inline]
 new_device_store+0x1a4/0x760 drivers/net/netdevsim/bus.c:302
 kernfs_fop_write_iter+0x379/0x4c0 fs/kernfs/file.c:296
 call_write_iter include/linux/fs.h:2173 [inline]
 new_sync_write fs/read_write.c:507 [inline]
 vfs_write+0x745/0xd60 fs/read_write.c:594
 ksys_write+0x152/0x260 fs/read_write.c:647
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Freed by task 7303:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
 ____kasan_slab_free+0xd5/0x110 mm/kasan/common.c:366
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1710 [inline]
 slab_free_freelist_hook+0xea/0x170 mm/slub.c:1736
 slab_free mm/slub.c:3504 [inline]
 kfree+0xef/0x2a0 mm/slub.c:4564
 nsim_bus_dev_del drivers/net/netdevsim/bus.c:457 [inline]
 del_device_store+0x2e9/0x3a0 drivers/net/netdevsim/bus.c:354
 kernfs_fop_write_iter+0x379/0x4c0 fs/kernfs/file.c:296
 call_write_iter include/linux/fs.h:2173 [inline]
 new_sync_write fs/read_write.c:507 [inline]
 vfs_write+0x745/0xd60 fs/read_write.c:594
 ksys_write+0x152/0x260 fs/read_write.c:647
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

The buggy address belongs to the object at ffff8880918a4000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 352 bytes inside of
 2048-byte region [ffff8880918a4000, ffff8880918a4800)
The buggy address belongs to the page:
page:ffffea0002462800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x918a0
head:ffffea0002462800 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888016c42000
raw: 0000000000000000 0000000000080008 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 6784, ts 252703539990, free_ts 0
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x1bbd/0x1ca0 mm/page_alloc.c:4192
 __alloc_pages+0x1ee/0x480 mm/page_alloc.c:5501
 alloc_slab_page mm/slub.c:1780 [inline]
 allocate_slab mm/slub.c:1917 [inline]
 new_slab+0xc0/0x4b0 mm/slub.c:1980
 ___slab_alloc+0x80a/0xdd0 mm/slub.c:3013
 __slab_alloc mm/slub.c:3100 [inline]
 slab_alloc_node mm/slub.c:3191 [inline]
 slab_alloc mm/slub.c:3233 [inline]
 __kmalloc_track_caller+0x1cb/0x330 mm/slub.c:4930
 kmemdup+0x22/0x50 mm/util.c:128
 bpf_prog_store_orig_filter net/core/filter.c:1154 [inline]
 bpf_prog_create_from_user+0x286/0x420 net/core/filter.c:1439
 seccomp_prepare_filter kernel/seccomp.c:669 [inline]
 seccomp_prepare_user_filter kernel/seccomp.c:706 [inline]
 seccomp_set_mode_filter kernel/seccomp.c:1834 [inline]
 do_seccomp+0x814/0x16c0 kernel/seccomp.c:1954
 __do_sys_prctl kernel/sys.c:2380 [inline]
 __se_sys_prctl+0x76d/0x1050 kernel/sys.c:2298
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
page_owner free stack trace missing

Memory state around the buggy address:
 ffff8880918a4000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880918a4080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880918a4100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff8880918a4180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880918a4200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (10):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/05/20 17:01 linux-5.15.y 93741761e5e3 62fb93a2 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-perf KASAN: use-after-free Read in device_shutdown
2026/04/08 02:32 linux-5.15.y 91d48252ad4b 2c961e87 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-perf KASAN: use-after-free Read in device_shutdown
2026/04/07 00:01 linux-5.15.y 91d48252ad4b 4440e7c2 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-perf KASAN: use-after-free Read in device_shutdown
2026/04/04 08:08 linux-5.15.y 91d48252ad4b 4440e7c2 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-perf KASAN: use-after-free Read in device_shutdown
2026/04/01 19:02 linux-5.15.y 91d48252ad4b 9a1f7828 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-perf KASAN: use-after-free Read in device_shutdown
2026/03/30 08:07 linux-5.15.y 91d48252ad4b b5ceaad2 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-perf KASAN: use-after-free Read in device_shutdown
2026/03/29 01:08 linux-5.15.y 91d48252ad4b b5ceaad2 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-perf KASAN: use-after-free Read in device_shutdown
2026/01/14 02:01 linux-5.15.y 68efe5a6c16a d6526ea3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-perf KASAN: use-after-free Read in device_shutdown
2026/01/10 05:00 linux-5.15.y 68efe5a6c16a d6526ea3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-perf KASAN: use-after-free Read in device_shutdown
2025/12/18 09:02 linux-5.15.y 68efe5a6c16a d6526ea3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-perf KASAN: use-after-free Read in device_shutdown
* Struck through repros no longer work on HEAD.