[v5.15] KASAN: use-after-free Read in device_shutdown (4)

3 views
Skip to first unread message

syzbot

unread,
4:02 AM (13 hours ago) 4:02 AM
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 68efe5a6c16a Linux 5.15.197
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=14023a2a580000
kernel config: https://syzkaller.appspot.com/x/.config?x=7e6ed99963d6ee1d
dashboard link: https://syzkaller.appspot.com/bug?extid=6dd34c5dc2feaf2b7927
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/998e4247f9d0/disk-68efe5a6.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/4ef4066c91ec/vmlinux-68efe5a6.xz
kernel image: https://storage.googleapis.com/syzbot-assets/922e7b640c48/bzImage-68efe5a6.xz

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

==================================================================
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+0xc85/0x2390 kernel/locking/mutex.c:671
Read of size 8 at addr ffff88802aae9160 by task init/10919

CPU: 0 PID: 10919 Comm: init Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/2025
Call Trace:
<TASK>
dump_stack_lvl+0x168/0x230 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+0xc85/0x2390 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+0x1e2/0x5e0 drivers/base/core.c:4548
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+0x391/0x3b0 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:0x7fd3b3c2d8d3
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:00007ffdfcdf23e8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a9
RAX: ffffffffffffffda RBX: 000000000000000c RCX: 00007fd3b3c2d8d3
RDX: 000000004321fedc RSI: 0000000028121969 RDI: 00000000fee1dead
RBP: 000000004321fedc R08: 0000000000000000 R09: 0000000000000000
R10: 00007ffdfcdf23c0 R11: 0000000000000246 R12: 00007fd3b3dd0490
R13: 00007ffdfcdf243c R14: 00007fd3b3e08000 R15: 0000555660267d98
</TASK>

Allocated by task 5804:
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+0x194/0x740 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+0x712/0xd00 fs/read_write.c:594
ksys_write+0x14d/0x250 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 10604:
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+0x2d0/0x380 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+0x712/0xd00 fs/read_write.c:594
ksys_write+0x14d/0x250 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

Last potentially related work creation:
kasan_save_stack+0x35/0x60 mm/kasan/common.c:38
kasan_record_aux_stack+0xb8/0x100 mm/kasan/generic.c:348
__call_rcu kernel/rcu/tree.c:3011 [inline]
call_rcu+0x182/0x930 kernel/rcu/tree.c:3091
qdisc_put net/sched/sch_generic.c:1047 [inline]
shutdown_scheduler_queue net/sched/sch_generic.c:1100 [inline]
netdev_for_each_tx_queue include/linux/netdevice.h:2388 [inline]
dev_shutdown+0x19f/0x710 net/sched/sch_generic.c:1408
unregister_netdevice_many+0xa0c/0x18f0 net/core/dev.c:11127
unregister_netdevice_queue+0x31c/0x360 net/core/dev.c:11067
unregister_netdevice include/linux/netdevice.h:3029 [inline]
__tun_detach+0xd4a/0x1500 drivers/net/tun.c:686
tun_detach drivers/net/tun.c:702 [inline]
tun_chr_close+0x109/0x1b0 drivers/net/tun.c:3440
__fput+0x234/0x930 fs/file_table.c:311
task_work_run+0x125/0x1a0 kernel/task_work.c:188
tracehook_notify_resume include/linux/tracehook.h:189 [inline]
exit_to_user_mode_loop+0x10f/0x130 kernel/entry/common.c:181
exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:214
__syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:307
do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x66/0xd0

The buggy address belongs to the object at ffff88802aae9000
which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 352 bytes inside of
2048-byte region [ffff88802aae9000, ffff88802aae9800)
The buggy address belongs to the page:
page:ffffea0000aaba00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88802aae8000 pfn:0x2aae8
head:ffffea0000aaba00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea00019b0608 ffffea0001ca5a08 ffff888016842000
raw: ffff88802aae8000 0000000000080006 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 4262, ts 77284536543, free_ts 76588622273
prep_new_page mm/page_alloc.c:2426 [inline]
get_page_from_freelist+0x1b77/0x1c60 mm/page_alloc.c:4192
__alloc_pages+0x1e1/0x470 mm/page_alloc.c:5487
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+0x81e/0xdf0 mm/slub.c:3013
__slab_alloc mm/slub.c:3100 [inline]
slab_alloc_node mm/slub.c:3191 [inline]
__kmalloc_node_track_caller+0x1fc/0x3a0 mm/slub.c:4963
kmalloc_reserve net/core/skbuff.c:356 [inline]
__alloc_skb+0x22c/0x750 net/core/skbuff.c:427
alloc_skb include/linux/skbuff.h:1162 [inline]
mld_newpack+0x12a/0xb90 net/ipv6/mcast.c:1745
add_grhead+0x5a/0x240 net/ipv6/mcast.c:1856
add_grec+0x1341/0x15d0 net/ipv6/mcast.c:1994
mld_send_initial_cr+0xed/0x240 net/ipv6/mcast.c:2241
ipv6_mc_dad_complete+0x84/0x210 net/ipv6/mcast.c:2252
addrconf_dad_completed+0x6c7/0xca0 net/ipv6/addrconf.c:4255
addrconf_dad_work+0xc70/0x1520 net/ipv6/addrconf.c:-1
process_one_work+0x863/0x1000 kernel/workqueue.c:2310
worker_thread+0xaa8/0x12a0 kernel/workqueue.c:2457
kthread+0x436/0x520 kernel/kthread.c:334
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1340 [inline]
free_pcp_prepare mm/page_alloc.c:1391 [inline]
free_unref_page_prepare+0x637/0x6c0 mm/page_alloc.c:3317
free_unref_page+0x94/0x280 mm/page_alloc.c:3396
qlist_free_all+0x35/0x90 mm/kasan/quarantine.c:176
kasan_quarantine_reduce+0x150/0x160 mm/kasan/quarantine.c:283
__kasan_slab_alloc+0x2f/0xd0 mm/kasan/common.c:444
kasan_slab_alloc include/linux/kasan.h:254 [inline]
slab_post_alloc_hook+0x4c/0x380 mm/slab.h:519
slab_alloc_node mm/slub.c:3225 [inline]
slab_alloc mm/slub.c:3233 [inline]
kmem_cache_alloc_trace+0x103/0x2a0 mm/slub.c:3250
kmalloc include/linux/slab.h:607 [inline]
netdevice_queue_work drivers/infiniband/core/roce_gid_mgmt.c:643 [inline]
netdevice_event+0x324/0x900 drivers/infiniband/core/roce_gid_mgmt.c:802
notifier_call_chain kernel/notifier.c:83 [inline]
raw_notifier_call_chain+0xcb/0x160 kernel/notifier.c:391
call_netdevice_notifiers_extack net/core/dev.c:2061 [inline]
call_netdevice_notifiers net/core/dev.c:2075 [inline]
__dev_notify_flags+0x178/0x2d0 net/core/dev.c:-1
dev_change_flags+0xe3/0x1a0 net/core/dev.c:8929
do_setlink+0xc01/0x3980 net/core/rtnetlink.c:2781
__rtnl_newlink net/core/rtnetlink.c:3452 [inline]
rtnl_newlink+0x1419/0x17d0 net/core/rtnetlink.c:3574
rtnetlink_rcv_msg+0x7ff/0xe90 net/core/rtnetlink.c:5684
netlink_rcv_skb+0x1e0/0x430 net/netlink/af_netlink.c:2507
netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
netlink_unicast+0x774/0x920 net/netlink/af_netlink.c:1344

Memory state around the buggy address:
ffff88802aae9000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88802aae9080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88802aae9100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88802aae9180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88802aae9200: 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 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
Reply all
Reply to author
Forward
0 new messages