[v6.1] KASAN: use-after-free Read in bus_remove_driver

2 views
Skip to first unread message

syzbot

unread,
Jul 18, 2025, 10:32:39 AM7/18/25
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 3369c6df2fae Linux 6.1.146
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=13755d8c580000
kernel config: https://syzkaller.appspot.com/x/.config?x=23408fa0371522c8
dashboard link: https://syzkaller.appspot.com/bug?extid=0f925d3e49a1341907ee
compiler: Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/ffd1a897d15e/disk-3369c6df.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/3901d2261137/vmlinux-3369c6df.xz
kernel image: https://storage.googleapis.com/syzbot-assets/dc1910a86639/bzImage-3369c6df.xz

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

==================================================================
BUG: KASAN: use-after-free in sysfs_remove_file_ns+0x39/0x70 fs/sysfs/file.c:491
Read of size 8 at addr ffff88807d2cca30 by task syz.1.959/8044

CPU: 0 PID: 8044 Comm: syz.1.959 Not tainted 6.1.146-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
<TASK>
dump_stack_lvl+0x168/0x22e lib/dump_stack.c:106
print_address_description mm/kasan/report.c:316 [inline]
print_report+0xa8/0x200 mm/kasan/report.c:418
kasan_report+0x10b/0x140 mm/kasan/report.c:522
sysfs_remove_file_ns+0x39/0x70 fs/sysfs/file.c:491
remove_bind_files drivers/base/bus.c:550 [inline]
bus_remove_driver+0x89/0x230 drivers/base/bus.c:674
comedi_device_detach+0x12d/0x6e0 drivers/comedi/drivers.c:206
do_devconfig_ioctl drivers/comedi/comedi_fops.c:829 [inline]
comedi_unlocked_ioctl+0xbd0/0xe90 drivers/comedi/comedi_fops.c:2131
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl+0xfa/0x170 fs/ioctl.c:856
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f27ab58e9a9
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:00007f27ac35f038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f27ab7b5fa0 RCX: 00007f27ab58e9a9
RDX: 0000000000000000 RSI: 0000000040946400 RDI: 0000000000000007
RBP: 00007f27ab610ca1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f27ab7b5fa0 R15: 00007fffab62aaa8
</TASK>

Allocated by task 8010:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
____kasan_kmalloc mm/kasan/common.c:374 [inline]
__kasan_kmalloc+0x8e/0xa0 mm/kasan/common.c:383
kasan_kmalloc include/linux/kasan.h:211 [inline]
__do_kmalloc_node mm/slab_common.c:936 [inline]
__kmalloc+0xb0/0x240 mm/slab_common.c:949
kmalloc_array include/linux/slab.h:615 [inline]
kcalloc include/linux/slab.h:646 [inline]
iter_file_splice_write+0x185/0xc50 fs/splice.c:624
do_splice_from fs/splice.c:763 [inline]
direct_splice_actor+0xe1/0x130 fs/splice.c:950
splice_direct_to_actor+0x480/0xb60 fs/splice.c:896
do_splice_direct+0x1b0/0x2b0 fs/splice.c:1002
do_sendfile+0x5cc/0xeb0 fs/read_write.c:1255
__do_sys_sendfile64 fs/read_write.c:1317 [inline]
__se_sys_sendfile64+0xd6/0x190 fs/read_write.c:1309
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2

Freed by task 8010:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
kasan_save_free_info+0x2d/0x50 mm/kasan/generic.c:516
____kasan_slab_free+0x126/0x1e0 mm/kasan/common.c:236
kasan_slab_free include/linux/kasan.h:177 [inline]
slab_free_hook mm/slub.c:1724 [inline]
slab_free_freelist_hook+0x131/0x1a0 mm/slub.c:1750
slab_free mm/slub.c:3661 [inline]
__kmem_cache_free+0xb6/0x1f0 mm/slub.c:3674
iter_file_splice_write+0xaa6/0xc50 fs/splice.c:713
do_splice_from fs/splice.c:763 [inline]
direct_splice_actor+0xe1/0x130 fs/splice.c:950
splice_direct_to_actor+0x480/0xb60 fs/splice.c:896
do_splice_direct+0x1b0/0x2b0 fs/splice.c:1002
do_sendfile+0x5cc/0xeb0 fs/read_write.c:1255
__do_sys_sendfile64 fs/read_write.c:1317 [inline]
__se_sys_sendfile64+0xd6/0x190 fs/read_write.c:1309
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2

Last potentially related work creation:
kasan_save_stack+0x3a/0x60 mm/kasan/common.c:45
__kasan_record_aux_stack+0xb2/0xc0 mm/kasan/generic.c:486
kvfree_call_rcu+0x108/0x870 kernel/rcu/tree.c:3405
drop_sysctl_table+0x2fa/0x430 fs/proc/proc_sysctl.c:1731
drop_sysctl_table+0x2e9/0x430 fs/proc/proc_sysctl.c:1734
unregister_sysctl_table+0x85/0x130 fs/proc/proc_sysctl.c:1769
retire_mq_sysctls+0x5a/0x80 ipc/mq_sysctl.c:163
free_ipc_ns ipc/namespace.c:143 [inline]
free_ipc+0x89/0x1d0 ipc/namespace.c:159
process_one_work+0x898/0x1160 kernel/workqueue.c:2292
worker_thread+0xaa2/0x1250 kernel/workqueue.c:2439
kthread+0x29d/0x330 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Second to last potentially related work creation:
kasan_save_stack+0x3a/0x60 mm/kasan/common.c:45
__kasan_record_aux_stack+0xb2/0xc0 mm/kasan/generic.c:486
call_rcu+0x154/0x980 kernel/rcu/tree.c:2849
fib_create_info+0x1871/0x2490 net/ipv4/fib_semantics.c:1591
fib_table_insert+0xc3/0x1b50 net/ipv4/fib_trie.c:1217
fib_magic+0x2c1/0x390 net/ipv4/fib_frontend.c:1118
fib_add_ifaddr+0x140/0x5e0 net/ipv4/fib_frontend.c:1140
fib_netdev_event+0x361/0x470 net/ipv4/fib_frontend.c:1500
notifier_call_chain kernel/notifier.c:87 [inline]
raw_notifier_call_chain+0xcb/0x160 kernel/notifier.c:455
call_netdevice_notifiers_extack net/core/dev.c:2039 [inline]
call_netdevice_notifiers net/core/dev.c:2053 [inline]
__dev_notify_flags+0x178/0x2d0 net/core/dev.c:-1
dev_change_flags+0xe3/0x1a0 net/core/dev.c:8702
do_setlink+0xc31/0x3c40 net/core/rtnetlink.c:2833
__rtnl_newlink net/core/rtnetlink.c:3608 [inline]
rtnl_newlink+0x17d6/0x1ff0 net/core/rtnetlink.c:3655
rtnetlink_rcv_msg+0x79b/0xed0 net/core/rtnetlink.c:6153
netlink_rcv_skb+0x1de/0x420 net/netlink/af_netlink.c:2511
netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
netlink_unicast+0x74d/0x8d0 net/netlink/af_netlink.c:1344
netlink_sendmsg+0x89e/0xbc0 net/netlink/af_netlink.c:1872
sock_sendmsg_nosec net/socket.c:718 [inline]
__sock_sendmsg net/socket.c:730 [inline]
__sys_sendto+0x44f/0x5c0 net/socket.c:2153
__do_sys_sendto net/socket.c:2165 [inline]
__se_sys_sendto net/socket.c:2161 [inline]
__x64_sys_sendto+0xda/0xf0 net/socket.c:2161
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2

The buggy address belongs to the object at ffff88807d2cca00
which belongs to the cache kmalloc-256 of size 256
The buggy address is located 48 bytes inside of
256-byte region [ffff88807d2cca00, ffff88807d2ccb00)

The buggy address belongs to the physical page:
page:ffffea0001f4b300 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7d2cc
head:ffffea0001f4b300 order:1 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea0000c19200 dead000000000003 ffff888017441b40
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 1, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 4266, tgid 4266 (syz-executor), ts 72539848232, free_ts 72492273459
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x173/0x1a0 mm/page_alloc.c:2532
prep_new_page mm/page_alloc.c:2539 [inline]
get_page_from_freelist+0x1a26/0x1ac0 mm/page_alloc.c:4328
__alloc_pages+0x1df/0x4e0 mm/page_alloc.c:5614
alloc_slab_page+0x5d/0x160 mm/slub.c:1794
allocate_slab mm/slub.c:1939 [inline]
new_slab+0x87/0x2c0 mm/slub.c:1992
___slab_alloc+0xbc6/0x1220 mm/slub.c:3180
__slab_alloc mm/slub.c:3279 [inline]
slab_alloc_node mm/slub.c:3364 [inline]
__kmem_cache_alloc_node+0x1a0/0x260 mm/slub.c:3437
__do_kmalloc_node mm/slab_common.c:935 [inline]
__kmalloc+0xa0/0x240 mm/slab_common.c:949
kmalloc include/linux/slab.h:568 [inline]
kzalloc include/linux/slab.h:699 [inline]
fib_create_info+0xa53/0x2490 net/ipv4/fib_semantics.c:1459
fib_table_insert+0xc3/0x1b50 net/ipv4/fib_trie.c:1217
fib_magic+0x2c1/0x390 net/ipv4/fib_frontend.c:1118
fib_add_ifaddr+0x140/0x5e0 net/ipv4/fib_frontend.c:1140
fib_inetaddr_event+0x13c/0x1c0 net/ipv4/fib_frontend.c:1454
notifier_call_chain kernel/notifier.c:87 [inline]
blocking_notifier_call_chain+0x103/0x1b0 kernel/notifier.c:382
__inet_insert_ifa+0x9aa/0xb60 net/ipv4/devinet.c:569
inet_rtm_newaddr+0x930/0x1890 net/ipv4/devinet.c:971
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1459 [inline]
free_pcp_prepare mm/page_alloc.c:1509 [inline]
free_unref_page_prepare+0x8b4/0x9a0 mm/page_alloc.c:3384
free_unref_page+0x2e/0x3f0 mm/page_alloc.c:3479
free_slab mm/slub.c:2031 [inline]
discard_slab mm/slub.c:2037 [inline]
__unfreeze_partials+0x1a5/0x200 mm/slub.c:2586
put_cpu_partial+0x17c/0x250 mm/slub.c:2662
qlink_free mm/kasan/quarantine.c:168 [inline]
qlist_free_all+0x76/0xe0 mm/kasan/quarantine.c:187
kasan_quarantine_reduce+0x144/0x160 mm/kasan/quarantine.c:294
__kasan_slab_alloc+0x1e/0x80 mm/kasan/common.c:305
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook+0x4b/0x480 mm/slab.h:737
slab_alloc_node mm/slub.c:3398 [inline]
kmem_cache_alloc_node+0x14d/0x320 mm/slub.c:3443
__alloc_skb+0xfc/0x7e0 net/core/skbuff.c:505
alloc_skb include/linux/skbuff.h:1271 [inline]
alloc_skb_with_frags+0xa7/0x710 net/core/skbuff.c:6162
sock_alloc_send_pskb+0x853/0x980 net/core/sock.c:2750
unix_dgram_sendmsg+0x592/0x16c0 net/unix/af_unix.c:1945
sock_sendmsg_nosec net/socket.c:718 [inline]
__sock_sendmsg net/socket.c:730 [inline]
__sys_sendto+0x44f/0x5c0 net/socket.c:2153
__do_sys_sendto net/socket.c:2165 [inline]
__se_sys_sendto net/socket.c:2161 [inline]
__x64_sys_sendto+0xda/0xf0 net/socket.c:2161
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81

Memory state around the buggy address:
ffff88807d2cc900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88807d2cc980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88807d2cca00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88807d2cca80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88807d2ccb00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


---
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,
Feb 13, 2026, 7:52:17 AM (5 days ago) Feb 13
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages