syzbot


KASAN: use-after-free Read in input_dev_uevent

Status: premoderation: reported on 2025/03/10 06:53
Reported-by: syzbot+5b648ede6aab14e8d8fa@syzkaller.appspotmail.com
First crash: 30d, last: 30d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-use-after-free Read in input_dev_uevent input C done 7 586d 597d 23/28 fixed on 2023/10/12 12:48

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in string_nocheck lib/vsprintf.c:643 [inline]
BUG: KASAN: use-after-free in string+0x218/0x2a0 lib/vsprintf.c:725
Read of size 1 at addr ffff8881183edcc9 by task udevd/102

CPU: 1 PID: 102 Comm: udevd Not tainted 6.1.128-syzkaller-00002-g44db4837f75e #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:316 [inline]
 print_report+0x158/0x4e0 mm/kasan/report.c:427
 kasan_report+0x13c/0x170 mm/kasan/report.c:531
 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report_generic.c:348
 string_nocheck lib/vsprintf.c:643 [inline]
 string+0x218/0x2a0 lib/vsprintf.c:725
 vsnprintf+0x11a4/0x1c70 lib/vsprintf.c:2805
 add_uevent_var+0x1c0/0x440 lib/kobject_uevent.c:680
 input_dev_uevent+0x1f0/0x740 drivers/input/input.c:1765
 dev_uevent+0x560/0x6f0 drivers/base/core.c:2622
 uevent_show+0x1a9/0x330 drivers/base/core.c:2671
 dev_attr_show+0x56/0xd0 drivers/base/core.c:2372
 sysfs_kf_seq_show+0x27c/0x3a0 fs/sysfs/file.c:59
 kernfs_seq_show+0x119/0x160 fs/kernfs/file.c:205
 seq_read_iter+0x430/0xd00 fs/seq_file.c:230
 kernfs_fop_read_iter+0x145/0x470 fs/kernfs/file.c:279
 call_read_iter include/linux/fs.h:2268 [inline]
 new_sync_read fs/read_write.c:389 [inline]
 vfs_read+0x801/0xae0 fs/read_write.c:470
 ksys_read+0x199/0x2c0 fs/read_write.c:613
 __do_sys_read fs/read_write.c:623 [inline]
 __se_sys_read fs/read_write.c:621 [inline]
 __x64_sys_read+0x7b/0x90 fs/read_write.c:621
 x64_sys_call+0x28/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:1
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f405c716b6a
Code: 00 3d 00 00 41 00 75 0d 50 48 8d 3d 2d 08 0a 00 e8 ea 7d 01 00 31 c0 e9 07 ff ff ff 64 8b 04 25 18 00 00 00 85 c0 75 1b 0f 05 <48> 3d 00 f0 ff ff 76 6c 48 8b 15 8f a2 0d 00 f7 d8 64 89 02 48 83
RSP: 002b:00007ffd7c171cb8 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00005644d0e98ce0 RCX: 00007f405c716b6a
RDX: 0000000000001000 RSI: 00005644d0eb0f10 RDI: 000000000000000c
RBP: 00005644d0e98ce0 R08: 000000000000000c R09: 0000000000080000
R10: 000000000000010f R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000003fff R14: 00007ffd7c172198 R15: 000000000000000a
 </TASK>

Allocated by task 810:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 kasan_save_alloc_info+0x1f/0x30 mm/kasan/generic.c:505
 ____kasan_kmalloc mm/kasan/common.c:379 [inline]
 __kasan_kmalloc+0x9c/0xb0 mm/kasan/common.c:388
 kasan_kmalloc include/linux/kasan.h:212 [inline]
 __do_kmalloc_node mm/slab_common.c:938 [inline]
 __kmalloc_node_track_caller+0xb3/0x1e0 mm/slab_common.c:958
 alloc_dr drivers/base/devres.c:116 [inline]
 devm_kmalloc+0x55/0x180 drivers/base/devres.c:826
 devm_kzalloc include/linux/device.h:211 [inline]
 steam_probe+0x12e/0xbe0 drivers/hid/hid-steam.c:741
 hid_device_probe+0x292/0x3a0 drivers/hid/hid-core.c:2624
 really_probe+0x2b8/0x920 drivers/base/dd.c:639
 __driver_probe_device+0x1a0/0x310 drivers/base/dd.c:808
 driver_probe_device+0x54/0x3d0 drivers/base/dd.c:838
 __device_attach_driver+0x2e3/0x490 drivers/base/dd.c:966
 bus_for_each_drv+0x183/0x200 drivers/base/bus.c:429
 __device_attach+0x312/0x510 drivers/base/dd.c:1038
 device_initial_probe+0x1a/0x20 drivers/base/dd.c:1087
 bus_probe_device+0xbe/0x1e0 drivers/base/bus.c:489
 device_add+0xb60/0xf10 drivers/base/core.c:3697
 hid_add_device+0x3ad/0x510 drivers/hid/hid-core.c:2776
 usbhid_probe+0xc1f/0xff0 drivers/hid/usbhid/hid-core.c:1424
 usb_probe_interface+0x5b6/0xa90 drivers/usb/core/driver.c:397
 really_probe+0x2b8/0x920 drivers/base/dd.c:639
 __driver_probe_device+0x1a0/0x310 drivers/base/dd.c:808
 driver_probe_device+0x54/0x3d0 drivers/base/dd.c:838
 __device_attach_driver+0x2e3/0x490 drivers/base/dd.c:966
 bus_for_each_drv+0x183/0x200 drivers/base/bus.c:429
 __device_attach+0x312/0x510 drivers/base/dd.c:1038
 device_initial_probe+0x1a/0x20 drivers/base/dd.c:1087
 bus_probe_device+0xbe/0x1e0 drivers/base/bus.c:489
 device_add+0xb60/0xf10 drivers/base/core.c:3697
 usb_set_configuration+0x190f/0x1e80 drivers/usb/core/message.c:2165
 usb_generic_driver_probe+0x8b/0x150 drivers/usb/core/generic.c:238
 usb_probe_device+0x144/0x260 drivers/usb/core/driver.c:294
 really_probe+0x2b8/0x920 drivers/base/dd.c:639
 __driver_probe_device+0x1a0/0x310 drivers/base/dd.c:808
 driver_probe_device+0x54/0x3d0 drivers/base/dd.c:838
 __device_attach_driver+0x2e3/0x490 drivers/base/dd.c:966
 bus_for_each_drv+0x183/0x200 drivers/base/bus.c:429
 __device_attach+0x312/0x510 drivers/base/dd.c:1038
 device_initial_probe+0x1a/0x20 drivers/base/dd.c:1087
 bus_probe_device+0xbe/0x1e0 drivers/base/bus.c:489
 device_add+0xb60/0xf10 drivers/base/core.c:3697
 usb_new_device+0xf2f/0x1820 drivers/usb/core/hub.c:2645
 hub_port_connect drivers/usb/core/hub.c:5556 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5696 [inline]
 port_event drivers/usb/core/hub.c:5856 [inline]
 hub_event+0x2db1/0x4830 drivers/usb/core/hub.c:5938
 process_one_work+0x73d/0xcb0 kernel/workqueue.c:2299
 worker_thread+0xa60/0x1260 kernel/workqueue.c:2446
 kthread+0x26d/0x300 kernel/kthread.c:386
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Freed by task 810:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:516
 ____kasan_slab_free+0x131/0x180 mm/kasan/common.c:241
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:249
 kasan_slab_free include/linux/kasan.h:178 [inline]
 slab_free_hook mm/slub.c:1745 [inline]
 slab_free_freelist_hook mm/slub.c:1771 [inline]
 slab_free mm/slub.c:3686 [inline]
 __kmem_cache_free+0x21d/0x410 mm/slub.c:3702
 kfree+0x7a/0xf0 mm/slab_common.c:990
 release_nodes+0xf1/0x230 drivers/base/devres.c:503
 devres_release_all+0x148/0x1a0 drivers/base/devres.c:532
 device_unbind_cleanup drivers/base/dd.c:530 [inline]
 __device_release_driver drivers/base/dd.c:1288 [inline]
 device_release_driver_internal+0x5bb/0x870 drivers/base/dd.c:1309
 device_release_driver+0x19/0x20 drivers/base/dd.c:1332
 bus_remove_device+0x2fa/0x360 drivers/base/bus.c:531
 device_del+0x663/0xe90 drivers/base/core.c:3885
 hid_remove_device drivers/hid/hid-core.c:2824 [inline]
 hid_destroy_device+0x68/0x110 drivers/hid/hid-core.c:2843
 usbhid_disconnect+0x9e/0xc0 drivers/hid/usbhid/hid-core.c:1451
 usb_unbind_interface+0x1fa/0x8c0 drivers/usb/core/driver.c:459
 device_remove drivers/base/dd.c:550 [inline]
 __device_release_driver drivers/base/dd.c:1283 [inline]
 device_release_driver_internal+0x53e/0x870 drivers/base/dd.c:1309
 device_release_driver+0x19/0x20 drivers/base/dd.c:1332
 bus_remove_device+0x2fa/0x360 drivers/base/bus.c:531
 device_del+0x663/0xe90 drivers/base/core.c:3885
 usb_disable_device+0x380/0x720 drivers/usb/core/message.c:1414
 usb_disconnect+0x32a/0x890 drivers/usb/core/hub.c:2300
 hub_port_connect drivers/usb/core/hub.c:5395 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5696 [inline]
 port_event drivers/usb/core/hub.c:5856 [inline]
 hub_event+0x1ed8/0x4830 drivers/usb/core/hub.c:5938
 process_one_work+0x73d/0xcb0 kernel/workqueue.c:2299
 process_scheduled_works kernel/workqueue.c:2362 [inline]
 worker_thread+0xd71/0x1260 kernel/workqueue.c:2448
 kthread+0x26d/0x300 kernel/kthread.c:386
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

The buggy address belongs to the object at ffff8881183edc00
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 201 bytes inside of
 512-byte region [ffff8881183edc00, ffff8881183ede00)

The buggy address belongs to the physical page:
page:ffffea000460fb00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1183ec
head:ffffea000460fb00 order:2 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head|zone=1)
raw: 4000000000010200 0000000000000000 dead000000000122 ffff888100042f00
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0x1d2a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 12669, tgid 12669 (syz-executor), ts 1133675358524, free_ts 1115026063598
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x213/0x220 mm/page_alloc.c:2637
 prep_new_page+0x1b/0x110 mm/page_alloc.c:2644
 get_page_from_freelist+0x3a98/0x3b10 mm/page_alloc.c:4539
 __alloc_pages+0x234/0x610 mm/page_alloc.c:5837
 alloc_slab_page+0x6c/0xf0
 allocate_slab mm/slub.c:1962 [inline]
 new_slab+0x90/0x3e0 mm/slub.c:2015
 ___slab_alloc+0x6f9/0xb80 mm/slub.c:3203
 __slab_alloc+0x5d/0xa0 mm/slub.c:3302
 slab_alloc_node mm/slub.c:3387 [inline]
 __kmem_cache_alloc_node+0x207/0x2a0 mm/slub.c:3462
 __do_kmalloc_node mm/slab_common.c:937 [inline]
 __kmalloc_node_track_caller+0xa2/0x1e0 mm/slab_common.c:958
 kmalloc_reserve net/core/skbuff.c:446 [inline]
 __alloc_skb+0x125/0x2d0 net/core/skbuff.c:515
 alloc_skb include/linux/skbuff.h:1290 [inline]
 nlmsg_new include/net/netlink.h:991 [inline]
 inet6_ifa_notify net/ipv6/addrconf.c:5568 [inline]
 __ipv6_ifa_notify+0x2e1/0x11a0 net/ipv6/addrconf.c:6213
 ipv6_ifa_notify net/ipv6/addrconf.c:6265 [inline]
 add_addr+0x2ca/0x480 net/ipv6/addrconf.c:3176
 add_v4_addrs+0x7cd/0xfc0 net/ipv6/addrconf.c:3235
 addrconf_sit_config net/ipv6/addrconf.c:3486 [inline]
 addrconf_init_auto_addrs+0x74e/0x1050 net/ipv6/addrconf.c:3523
 addrconf_notify+0x976/0xe10 net/ipv6/addrconf.c:3710
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:26 [inline]
 free_pages_prepare mm/page_alloc.c:1545 [inline]
 free_pcp_prepare mm/page_alloc.c:1619 [inline]
 free_unref_page_prepare+0x9f1/0xa00 mm/page_alloc.c:3581
 free_unref_page+0xb2/0x5c0 mm/page_alloc.c:3677
 free_the_page mm/page_alloc.c:830 [inline]
 __free_pages+0x61/0xf0 mm/page_alloc.c:5926
 free_large_kmalloc+0xa9/0xe0 mm/slab_common.c:915
 kfree+0x93/0xf0 mm/slab_common.c:984
 kvfree+0x35/0x40 mm/util.c:639
 bpf_check+0x118a6/0x17ed0 kernel/bpf/verifier.c:15689
 bpf_prog_load+0x1304/0x1bf0 kernel/bpf/syscall.c:2626
 __sys_bpf+0x52c/0x7f0 kernel/bpf/syscall.c:5007
 __do_sys_bpf kernel/bpf/syscall.c:5111 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:5109 [inline]
 __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5109
 x64_sys_call+0x87f/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:322
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Memory state around the buggy address:
 ffff8881183edb80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8881183edc00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8881183edc80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                              ^
 ffff8881183edd00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881183edd80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/03/10 06:52 android14-6.1 44db4837f75e 163f510d .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-6-1 KASAN: use-after-free Read in input_dev_uevent
* Struck through repros no longer work on HEAD.