syzbot


KASAN: use-after-free Write in steam_input_close

Status: premoderation: reported on 2024/09/24 19:39
Reported-by: syzbot+9ead2487297bccf301c5@syzkaller.appspotmail.com
First crash: 57d, last: 57d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-10 KASAN: use-after-free Write in steam_input_close C 4 27d 43d 0/2 upstream: reported C repro on 2024/10/08 20:27
android-5-15 KASAN: use-after-free Write in steam_input_close origin:lts C error 3 73d 74d 0/2 upstream: reported C repro on 2024/09/08 05:16
linux-6.1 KASAN: use-after-free Read in steam_input_close 1 97d 97d 0/3 upstream: reported on 2024/08/15 18:33

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:102 [inline]
BUG: KASAN: use-after-free in atomic_long_try_cmpxchg_acquire include/linux/atomic/atomic-instrumented.h:1779 [inline]
BUG: KASAN: use-after-free in __mutex_trylock_fast kernel/locking/mutex.c:176 [inline]
BUG: KASAN: use-after-free in mutex_lock+0xa4/0x1e0 kernel/locking/mutex.c:295
Write of size 8 at addr ffff888149cb7c50 by task acpid/86

CPU: 1 PID: 86 Comm: acpid Not tainted 6.1.99-syzkaller-00075-g2cd8ac816de5 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
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
 kasan_check_range+0x294/0x2a0 mm/kasan/generic.c:189
 __kasan_check_write+0x14/0x20 mm/kasan/shadow.c:37
 instrument_atomic_read_write include/linux/instrumented.h:102 [inline]
 atomic_long_try_cmpxchg_acquire include/linux/atomic/atomic-instrumented.h:1779 [inline]
 __mutex_trylock_fast kernel/locking/mutex.c:176 [inline]
 mutex_lock+0xa4/0x1e0 kernel/locking/mutex.c:295
 steam_input_close+0x90/0x1e0 drivers/hid/hid-steam.c:308
 input_close_device+0x29e/0x350 drivers/input/input.c:708
 evdev_close_device drivers/input/evdev.c:414 [inline]
 evdev_release+0x7be/0x850 drivers/input/evdev.c:456
 __fput+0x1e5/0x870 fs/file_table.c:320
 ____fput+0x15/0x20 fs/file_table.c:348
 task_work_run+0x24d/0x2e0 kernel/task_work.c:179
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 exit_to_user_mode_loop+0x94/0xa0 kernel/entry/common.c:177
 exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:210
 __syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
 syscall_exit_to_user_mode+0x26/0x130 kernel/entry/common.c:303
 do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:87
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f7662a1d0a8
Code: 48 8b 05 83 9d 0d 00 64 c7 00 16 00 00 00 83 c8 ff 48 83 c4 20 5b c3 64 8b 04 25 18 00 00 00 85 c0 75 20 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 76 5b 48 8b 15 51 9d 0d 00 f7 d8 64 89 02 48 83
RSP: 002b:00007ffcc143b818 EFLAGS: 00000246 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 00007ffcc143ba88 RCX: 00007f7662a1d0a8
RDX: 0000000000000000 RSI: 000000000000001e RDI: 000000000000000a
RBP: 000000000000000a R08: 0000000000000008 R09: 00007ffcc143b988
R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffcc143b988
R13: 00000000000000a0 R14: 00007ffcc143ba88 R15: 00007ffcc143b988
 </TASK>

Allocated by task 223:
 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:957 [inline]
 __kmalloc_node_track_caller+0xb3/0x1e0 mm/slab_common.c:977
 alloc_dr drivers/base/devres.c:116 [inline]
 devm_kmalloc+0x55/0x180 drivers/base/devres.c:825
 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:427
 __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:487
 device_add+0xb60/0xf10 drivers/base/core.c:3689
 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:427
 __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:487
 device_add+0xb60/0xf10 drivers/base/core.c:3689
 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:427
 __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:487
 device_add+0xb60/0xf10 drivers/base/core.c:3689
 usb_new_device+0xf2f/0x1820 drivers/usb/core/hub.c:2645
 hub_port_connect drivers/usb/core/hub.c:5554 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5694 [inline]
 port_event drivers/usb/core/hub.c:5854 [inline]
 hub_event+0x2db1/0x4830 drivers/usb/core/hub.c:5936
 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:308

Freed by task 223:
 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:3684 [inline]
 __kmem_cache_free+0x218/0x3b0 mm/slub.c:3697
 kfree+0x7a/0xf0 mm/slab_common.c:1009
 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:529
 device_del+0x663/0xe90 drivers/base/core.c:3877
 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:529
 device_del+0x663/0xe90 drivers/base/core.c:3877
 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:5393 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5694 [inline]
 port_event drivers/usb/core/hub.c:5854 [inline]
 hub_event+0x1ed8/0x4830 drivers/usb/core/hub.c:5936
 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:308

Last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xb4/0xc0 mm/kasan/generic.c:486
 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:496
 kvfree_call_rcu+0x9f/0x800 kernel/rcu/tree.c:3444
 drop_sysctl_table+0x311/0x450 fs/proc/proc_sysctl.c:1729
 drop_sysctl_table+0x323/0x450 fs/proc/proc_sysctl.c:1732
 unregister_sysctl_table+0x76/0x120 fs/proc/proc_sysctl.c:1767
 unregister_net_sysctl_table+0x15/0x20 net/sysctl_net.c:175
 neigh_sysctl_unregister+0x78/0x90 net/core/neighbour.c:3866
 devinet_sysctl_unregister net/ipv4/devinet.c:2651 [inline]
 inetdev_destroy net/ipv4/devinet.c:327 [inline]
 inetdev_event+0x848/0x1110 net/ipv4/devinet.c:1602
 notifier_call_chain kernel/notifier.c:87 [inline]
 raw_notifier_call_chain+0x8c/0xf0 kernel/notifier.c:455
 call_netdevice_notifiers_info net/core/dev.c:1978 [inline]
 call_netdevice_notifiers_extack net/core/dev.c:2016 [inline]
 call_netdevice_notifiers net/core/dev.c:2030 [inline]
 unregister_netdevice_many+0xe2a/0x1740 net/core/dev.c:10890
 default_device_exit_batch+0x975/0xa00 net/core/dev.c:11403
 ops_exit_list net/core/net_namespace.c:177 [inline]
 cleanup_net+0x6c9/0xbf0 net/core/net_namespace.c:604
 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:308

Second to last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xb4/0xc0 mm/kasan/generic.c:486
 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:496
 __call_rcu_common kernel/rcu/tree.c:2806 [inline]
 call_rcu+0xee/0x1340 kernel/rcu/tree.c:2925
 fib6_info_release include/net/ip6_fib.h:350 [inline]
 fib6_del_route net/ipv6/ip6_fib.c:1999 [inline]
 fib6_del+0xd30/0x1060 net/ipv6/ip6_fib.c:2032
 fib6_clean_node+0x2ed/0x550 net/ipv6/ip6_fib.c:2194
 fib6_walk_continue+0x52d/0x720 net/ipv6/ip6_fib.c:2116
 fib6_walk+0x172/0x2d0 net/ipv6/ip6_fib.c:2164
 fib6_clean_tree net/ipv6/ip6_fib.c:2244 [inline]
 __fib6_clean_all net/ipv6/ip6_fib.c:2260 [inline]
 fib6_clean_all+0x202/0x2c0 net/ipv6/ip6_fib.c:2271
 rt6_sync_down_dev net/ipv6/route.c:4882 [inline]
 rt6_disable_ip+0x166/0x9e0 net/ipv6/route.c:4887
 addrconf_ifdown+0x15e/0x1ab0 net/ipv6/addrconf.c:3803
 addrconf_notify+0x32f/0xe10
 notifier_call_chain kernel/notifier.c:87 [inline]
 raw_notifier_call_chain+0x8c/0xf0 kernel/notifier.c:455
 call_netdevice_notifiers_info net/core/dev.c:1978 [inline]
 call_netdevice_notifiers_extack net/core/dev.c:2016 [inline]
 call_netdevice_notifiers net/core/dev.c:2030 [inline]
 dev_close_many+0x37c/0x530 net/core/dev.c:1578
 unregister_netdevice_many+0x4d1/0x1740 net/core/dev.c:10864
 xfrmi_exit_batch_net+0x262/0x2b0 net/xfrm/xfrm_interface_core.c:973
 ops_exit_list net/core/net_namespace.c:177 [inline]
 cleanup_net+0x6c9/0xbf0 net/core/net_namespace.c:604
 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:308

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

The buggy address belongs to the physical page:
page:ffffea0005272d00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x149cb4
head:ffffea0005272d00 order:2 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head|zone=1)
raw: 4000000000010200 ffffea0004643900 dead000000000002 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 21605, tgid 21605 (syz-executor), ts 1370075635532, free_ts 1366039329226
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x213/0x220 mm/page_alloc.c:2590
 prep_new_page+0x1b/0x110 mm/page_alloc.c:2597
 get_page_from_freelist+0x27ea/0x2870 mm/page_alloc.c:4425
 __alloc_pages+0x3a1/0x780 mm/page_alloc.c:5714
 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+0x1af/0x250 mm/slub.c:3460
 kmalloc_trace+0x2a/0xa0 mm/slab_common.c:1047
 kmalloc include/linux/slab.h:556 [inline]
 kzalloc include/linux/slab.h:692 [inline]
 ipv6_add_addr+0x41b/0xdf0 net/ipv6/addrconf.c:1117
 addrconf_add_linklocal+0x326/0x9e0 net/ipv6/addrconf.c:3263
 addrconf_addr_gen+0x57f/0xcf0 net/ipv6/addrconf.c:3394
 addrconf_init_auto_addrs+0xb96/0x1050
 addrconf_notify+0x976/0xe10 net/ipv6/addrconf.c:3690
 notifier_call_chain kernel/notifier.c:87 [inline]
 raw_notifier_call_chain+0x8c/0xf0 kernel/notifier.c:455
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:26 [inline]
 free_pages_prepare mm/page_alloc.c:1498 [inline]
 free_pcp_prepare mm/page_alloc.c:1572 [inline]
 free_unref_page_prepare+0x83d/0x850 mm/page_alloc.c:3498
 free_unref_page+0xb2/0x5c0 mm/page_alloc.c:3594
 free_the_page mm/page_alloc.c:798 [inline]
 __free_pages+0x61/0xf0 mm/page_alloc.c:5803
 __free_slab+0xce/0x1a0 mm/slub.c:2039
 free_slab mm/slub.c:2054 [inline]
 discard_slab mm/slub.c:2060 [inline]
 __unfreeze_partials+0x165/0x1a0 mm/slub.c:2609
 put_cpu_partial+0xa9/0x100 mm/slub.c:2685
 __slab_free+0x1c8/0x280 mm/slub.c:3561
 do_slab_free mm/slub.c:3638 [inline]
 ___cache_free+0xc6/0xd0 mm/slub.c:3691
 qlink_free mm/kasan/quarantine.c:168 [inline]
 qlist_free_all+0xc5/0x140 mm/kasan/quarantine.c:187
 kasan_quarantine_reduce+0x15a/0x180 mm/kasan/quarantine.c:294
 __kasan_slab_alloc+0x24/0x80 mm/kasan/common.c:310
 kasan_slab_alloc include/linux/kasan.h:202 [inline]
 slab_post_alloc_hook+0x53/0x2c0 mm/slab.h:768
 slab_alloc_node mm/slub.c:3421 [inline]
 kmem_cache_alloc_node+0x18a/0x2d0 mm/slub.c:3466
 __alloc_skb+0xcc/0x2d0 net/core/skbuff.c:505
 alloc_skb include/linux/skbuff.h:1290 [inline]
 nlmsg_new include/net/netlink.h:991 [inline]
 rtmsg_ifa+0x1e7/0x3a0 net/ipv4/devinet.c:1920
 __inet_del_ifa+0x7eb/0xdb0 net/ipv4/devinet.c:430

Memory state around the buggy address:
 ffff888149cb7b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888149cb7b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888149cb7c00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                 ^
 ffff888149cb7c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888149cb7d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
hid 0003:28DE:1102.014F: No HID_FEATURE_REPORT submitted -  nothing to read
hid 0003:28DE:1102.014F: No HID_FEATURE_REPORT submitted -  nothing to read
hid 0003:28DE:1102.014F: No HID_FEATURE_REPORT submitted -  nothing to read
hid 0003:28DE:1102.014F: No HID_FEATURE_REPORT submitted -  nothing to read
hid 0003:28DE:1102.014F: No HID_FEATURE_REPORT submitted -  nothing to read
hid 0003:28DE:1102.014F: No HID_FEATURE_REPORT submitted -  nothing to read
hid 0003:28DE:1102.014F: No HID_FEATURE_REPORT submitted -  nothing to read
hid 0003:28DE:1102.014F: No HID_FEATURE_REPORT submitted -  nothing to read
hid 0003:28DE:1102.014F: No HID_FEATURE_REPORT submitted -  nothing to read
hid 0003:28DE:1102.014F: No HID_FEATURE_REPORT submitted -  nothing to read
hid 0003:28DE:1102.014F: No HID_FEATURE_REPORT submitted -  nothing to read
hid 0003:28DE:1102.014F: No HID_FEATURE_REPORT submitted -  nothing to read
hid 0003:28DE:1102.014F: No HID_FEATURE_REPORT submitted -  nothing to read
hid 0003:28DE:1102.014F: No HID_FEATURE_REPORT submitted -  nothing to read
hid 0003:28DE:1102.014F: No HID_FEATURE_REPORT submitted -  nothing to read
hid 0003:28DE:1102.014F: No HID_FEATURE_REPORT submitted -  nothing to read
hid 0003:28DE:1102.014F: No HID_FEATURE_REPORT submitted -  nothing to read
hid 0003:28DE:1102.014F: No HID_FEATURE_REPORT submitted -  nothing to read

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/09/24 19:38 android14-6.1 2cd8ac816de5 5643e0e9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-6-1 KASAN: use-after-free Write in steam_input_close
* Struck through repros no longer work on HEAD.