syzbot


KASAN: use-after-free Write in steam_input_open

Status: upstream: reported C repro on 2024/09/03 09:12
Reported-by: syzbot+d6a6ba46361f19622c24@syzkaller.appspotmail.com
First crash: 158d, last: 16d
Fix bisection: the issue occurs on the latest tested release (bisect log)
  
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-15 KASAN: use-after-free Write in steam_input_open origin:lts C 23 10d 153d 0/2 upstream: reported C repro on 2024/09/08 02:35
android-6-1 KASAN: use-after-free Write in steam_input_open origin:lts C 10 10d 136d 0/2 upstream: reported C repro on 2024/09/25 04:26
Last patch testing requests (3)
Created Duration User Patch Repo Result
2025/01/23 01:32 15m retest repro android13-5.10-lts report log
2025/01/03 21:58 8m retest repro android13-5.10-lts report log
2024/10/09 22:55 15m retest repro android13-5.10-lts report log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
BUG: KASAN: use-after-free in atomic64_try_cmpxchg_acquire include/asm-generic/atomic-instrumented.h:1515 [inline]
BUG: KASAN: use-after-free in atomic_long_try_cmpxchg_acquire include/asm-generic/atomic-long.h:443 [inline]
BUG: KASAN: use-after-free in __mutex_trylock_fast kernel/locking/mutex.c:173 [inline]
BUG: KASAN: use-after-free in mutex_lock+0x98/0x110 kernel/locking/mutex.c:298
Write of size 8 at addr ffff88810479b040 by task udevd/300

CPU: 0 PID: 300 Comm: udevd Not tainted 5.10.232-syzkaller-00746-g49e8ba0a684f #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118
 print_address_description+0x81/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:435 [inline]
 kasan_report+0x179/0x1c0 mm/kasan/report.c:452
 kasan_check_range+0x293/0x2a0 mm/kasan/generic.c:189
 __kasan_check_write+0x14/0x20 mm/kasan/shadow.c:37
 instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
 atomic64_try_cmpxchg_acquire include/asm-generic/atomic-instrumented.h:1515 [inline]
 atomic_long_try_cmpxchg_acquire include/asm-generic/atomic-long.h:443 [inline]
 __mutex_trylock_fast kernel/locking/mutex.c:173 [inline]
 mutex_lock+0x98/0x110 kernel/locking/mutex.c:298
 steam_input_open+0x91/0x1a0 drivers/hid/hid-steam.c:297
 input_open_device+0x151/0x2a0 drivers/input/input.c:635
 evdev_open_device drivers/input/evdev.c:400 [inline]
 evdev_open+0x3a5/0x5c0 drivers/input/evdev.c:487
 chrdev_open+0x4f7/0x620 fs/char_dev.c:414
 do_dentry_open+0x7c1/0x10d0 fs/open.c:819
 vfs_open+0x73/0x80 fs/open.c:942
 do_open fs/namei.c:3391 [inline]
 path_openat+0x2660/0x3000 fs/namei.c:3509
 do_filp_open+0x21c/0x460 fs/namei.c:3536
 do_sys_openat2+0x13f/0x710 fs/open.c:1217
 do_sys_open fs/open.c:1233 [inline]
 __do_sys_openat fs/open.c:1249 [inline]
 __se_sys_openat fs/open.c:1244 [inline]
 __x64_sys_openat+0x243/0x290 fs/open.c:1244
 do_syscall_64+0x34/0x70
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f20153279a4
Code: 24 20 48 8d 44 24 30 48 89 44 24 28 64 8b 04 25 18 00 00 00 85 c0 75 2c 44 89 e2 48 89 ee bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 76 60 48 8b 15 55 a4 0d 00 f7 d8 64 89 02 48 83
RSP: 002b:00007fff4d92bd20 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f20153279a4
RDX: 0000000000080000 RSI: 000055d5264f74a0 RDI: 00000000ffffff9c
RBP: 000055d5264f74a0 R08: 000055d5265224e8 R09: 00007f2015402b10
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000080000
R13: 00007fff4d92bee8 R14: 0000000000000000 R15: 000055d4edbb8ed5

Allocated by task 0:
(stack is not available)

Freed by task 54:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:45
 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
 ____kasan_slab_free+0x121/0x160 mm/kasan/common.c:362
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:370
 kasan_slab_free include/linux/kasan.h:220 [inline]
 slab_free_hook mm/slub.c:1595 [inline]
 slab_free_freelist_hook+0xc0/0x190 mm/slub.c:1621
 slab_free mm/slub.c:3203 [inline]
 kfree+0xc3/0x270 mm/slub.c:4191
 release_nodes+0x873/0x8f0 drivers/base/devres.c:524
 devres_release_all+0x7b/0xa0 drivers/base/devres.c:545
 __device_release_driver drivers/base/dd.c:1190 [inline]
 device_release_driver_internal+0x515/0x7c0 drivers/base/dd.c:1221
 device_release_driver+0x19/0x20 drivers/base/dd.c:1244
 bus_remove_device+0x2f8/0x360 drivers/base/bus.c:535
 device_del+0x68b/0xf00 drivers/base/core.c:3452
 hid_remove_device drivers/hid/hid-core.c:2501 [inline]
 hid_destroy_device+0x68/0x110 drivers/hid/hid-core.c:2520
 usbhid_disconnect+0x9e/0xc0 drivers/hid/usbhid/hid-core.c:1445
 usb_unbind_interface+0x1fa/0x8c0 drivers/usb/core/driver.c:459
 device_release_driver_internal+0x506/0x7c0 drivers/base/dd.c:1221
 device_release_driver+0x19/0x20 drivers/base/dd.c:1244
 bus_remove_device+0x2f8/0x360 drivers/base/bus.c:535
 device_del+0x68b/0xf00 drivers/base/core.c:3452
 usb_disable_device+0x380/0x720 drivers/usb/core/message.c:1411
 usb_disconnect+0x32a/0x890 drivers/usb/core/hub.c:2271
 hub_port_connect drivers/usb/core/hub.c:5296 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5597 [inline]
 port_event drivers/usb/core/hub.c:5747 [inline]
 hub_event+0x1e73/0x47c0 drivers/usb/core/hub.c:5829
 process_one_work+0x6dc/0xbd0 kernel/workqueue.c:2301
 process_scheduled_works kernel/workqueue.c:2363 [inline]
 worker_thread+0xe18/0x1510 kernel/workqueue.c:2449
 kthread+0x34b/0x3d0 kernel/kthread.c:313
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

The buggy address belongs to the object at ffff88810479b000
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 64 bytes inside of
 512-byte region [ffff88810479b000, ffff88810479b200)
The buggy address belongs to the page:
page:ffffea000411e600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x104798
head:ffffea000411e600 order:2 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head)
raw: 4000000000010200 dead000000000100 dead000000000122 ffff888100043080
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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, ts 1586339164, free_ts 1575638422
 set_page_owner include/linux/page_owner.h:35 [inline]
 post_alloc_hook mm/page_alloc.c:2456 [inline]
 prep_new_page+0x166/0x180 mm/page_alloc.c:2462
 get_page_from_freelist+0x2d8c/0x2f30 mm/page_alloc.c:4254
 __alloc_pages_nodemask+0x435/0xaf0 mm/page_alloc.c:5348
 allocate_slab mm/slub.c:1808 [inline]
 new_slab+0x80/0x400 mm/slub.c:1869
 new_slab_objects mm/slub.c:2627 [inline]
 ___slab_alloc+0x302/0x4b0 mm/slub.c:2791
 __slab_alloc+0x63/0xa0 mm/slub.c:2831
 slab_alloc_node mm/slub.c:2913 [inline]
 slab_alloc mm/slub.c:2955 [inline]
 __kmalloc_track_caller+0x1f8/0x320 mm/slub.c:4536
 __kmalloc_reserve net/core/skbuff.c:144 [inline]
 __alloc_skb+0xbc/0x510 net/core/skbuff.c:212
 alloc_skb include/linux/skbuff.h:1126 [inline]
 nlmsg_new include/net/netlink.h:953 [inline]
 inet_netconf_notify_devconf+0x173/0x220 net/ipv4/devinet.c:2120
 __devinet_sysctl_register+0x232/0x2a0 net/ipv4/devinet.c:2604
 devinet_init_net+0x359/0x5d0 net/ipv4/devinet.c:2725
 ops_init+0x1cd/0x4a0 net/core/net_namespace.c:144
 __register_pernet_operations net/core/net_namespace.c:1164 [inline]
 register_pernet_operations+0x2d0/0x9f0 net/core/net_namespace.c:1245
 register_pernet_subsys+0x28/0x40 net/core/net_namespace.c:1286
 devinet_init+0x28/0xf4 net/ipv4/devinet.c:2794
 ip_rt_init+0x290/0x373 net/ipv4/route.c:3638
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:28 [inline]
 free_pages_prepare mm/page_alloc.c:1349 [inline]
 __free_pages_ok+0x82c/0x850 mm/page_alloc.c:1629
 free_the_page+0x76/0x370 mm/page_alloc.c:5409
 __free_pages+0x67/0xc0 mm/page_alloc.c:5418
 free_pages+0x7c/0x90 mm/page_alloc.c:5429
 __stack_depot_save+0x47b/0x4d0 lib/stackdepot.c:359
 kasan_save_stack mm/kasan/common.c:39 [inline]
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:430 [inline]
 ____kasan_kmalloc+0xed/0x110 mm/kasan/common.c:509
 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:518
 kasan_kmalloc include/linux/kasan.h:254 [inline]
 kmem_cache_alloc_trace+0x18a/0x2e0 mm/slub.c:2974
 kmalloc include/linux/slab.h:552 [inline]
 kzalloc include/linux/slab.h:664 [inline]
 __class_register+0x59/0x430 drivers/base/class.c:160
 register_sysfs_loader+0x1c/0x20 drivers/base/firmware_loader/fallback.c:202
 firmware_class_init+0x5a/0x61 drivers/base/firmware_loader/main.c:1604
 do_one_initcall+0x189/0x620 init/main.c:1197
 do_initcall_level+0x186/0x304 init/main.c:1270
 do_initcalls+0x4e/0x8e init/main.c:1286
 do_basic_setup+0x88/0x91 init/main.c:1306
 kernel_init_freeable+0x2be/0x3f5 init/main.c:1510

Memory state around the buggy address:
 ffff88810479af00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88810479af80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88810479b000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                           ^
 ffff88810479b080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88810479b100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
hid 0003:28DE:1102.000B: No HID_FEATURE_REPORT submitted -  nothing to read
hid 0003:28DE:1102.000B: No HID_FEATURE_REPORT submitted -  nothing to read
hid 0003:28DE:1102.000B: No HID_FEATURE_REPORT submitted -  nothing to read
hid 0003:28DE:1102.000B: No HID_FEATURE_REPORT submitted -  nothing to read
hid 0003:28DE:1102.000B: No HID_FEATURE_REPORT submitted -  nothing to read
hid 0003:28DE:1102.001F: No HID_FEATURE_REPORT submitted -  nothing to read
hid 0003:28DE:1102.001F: No HID_FEATURE_REPORT submitted -  nothing to read
hid 0003:28DE:1102.001F: No HID_FEATURE_REPORT submitted -  nothing to read
hid 0003:28DE:1102.001F: No HID_FEATURE_REPORT submitted -  nothing to read
hid 0003:28DE:1102.001F: No HID_FEATURE_REPORT submitted -  nothing to read

Crashes (7):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/01/08 19:00 android13-5.10-lts 49e8ba0a684f f3558dbf .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Write in steam_input_open
2024/09/03 09:05 android13-5.10-lts 1c5354a314ea 8045124c .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Write in steam_input_open
2024/09/23 21:32 android13-5.10-lts 8d23314f588a 89298aad .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Write in steam_input_open
2024/09/17 12:08 android13-5.10-lts 8d23314f588a c673ca06 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Write in steam_input_open
2024/09/07 18:39 android13-5.10-lts 1c5354a314ea 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Write in steam_input_open
2024/09/07 18:30 android13-5.10-lts 1c5354a314ea 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Write in steam_input_open
2024/09/03 01:34 android13-5.10-lts 1c5354a314ea 8045124c .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Write in steam_input_open
* Struck through repros no longer work on HEAD.