syzbot


KASAN: slab-use-after-free Read in remove_wait_queue

Status: auto-obsoleted due to no activity on 2023/10/01 17:55
Subsystems: usb input
[Documentation on labels]
Reported-by: syzbot+e0b9084463edf54b83c4@syzkaller.appspotmail.com
First crash: 348d, last: 341d
Discussions (2)
Title Replies (including bot) Last reply
[syzbot] Monthly input report (Jul 2023) 0 (1) 2023/07/07 08:54
[syzbot] [input?] [usb?] KASAN: slab-use-after-free Read in remove_wait_queue 0 (1) 2023/06/22 06:12
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 BUG: corrupted list in remove_wait_queue C 31139 449d 1876d 0/1 upstream: reported C repro on 2019/04/10 16:06
upstream KASAN: use-after-free Read in remove_wait_queue (3) kernfs C inconclusive 123 500d 925d 22/26 fixed on 2023/02/24 13:50
linux-4.14 KASAN: use-after-free Read in remove_wait_queue (2) C error 7 818d 1514d 0/1 upstream: reported C repro on 2020/04/07 06:03

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in __lock_acquire+0x41b9/0x5f30 kernel/locking/lockdep.c:4956
Read of size 8 at addr ffff88814b7e8728 by task syz-executor.4/26353

CPU: 0 PID: 26353 Comm: syz-executor.4 Not tainted 6.4.0-rc7-syzkaller-00194-g8a28a0b6f1a1 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106
 print_address_description.constprop.0+0x2c/0x3c0 mm/kasan/report.c:351
 print_report mm/kasan/report.c:462 [inline]
 kasan_report+0x11c/0x130 mm/kasan/report.c:572
 __lock_acquire+0x41b9/0x5f30 kernel/locking/lockdep.c:4956
 lock_acquire kernel/locking/lockdep.c:5705 [inline]
 lock_acquire+0x1b1/0x520 kernel/locking/lockdep.c:5670
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
 _raw_spin_lock_irqsave+0x3d/0x60 kernel/locking/spinlock.c:162
 remove_wait_queue+0x21/0x180 kernel/sched/wait.c:54
 hidraw_read+0x5e8/0xa80 drivers/hid/hidraw.c:74
 vfs_read+0x1e1/0x8a0 fs/read_write.c:468
 ksys_read+0x12b/0x250 fs/read_write.c:613
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fbecda8c389
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fbece8b2168 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00007fbecdbabf80 RCX: 00007fbecda8c389
RDX: 0000000000000010 RSI: 0000000020000000 RDI: 0000000000000004
RBP: 00007fbecdad7493 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fbecdccfb1f R14: 00007fbece8b2300 R15: 0000000000022000
 </TASK>

Allocated by task 18052:
 kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 ____kasan_kmalloc mm/kasan/common.c:333 [inline]
 __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383
 kmalloc include/linux/slab.h:559 [inline]
 kzalloc include/linux/slab.h:680 [inline]
 hidraw_connect+0x4f/0x450 drivers/hid/hidraw.c:545
 hid_connect+0x10b8/0x18c0 drivers/hid/hid-core.c:2195
 hid_hw_start drivers/hid/hid-core.c:2302 [inline]
 hid_hw_start+0xa6/0x130 drivers/hid/hid-core.c:2293
 wacom_parse_and_register+0x2f4d/0x5b40 drivers/hid/wacom_sys.c:2397
 wacom_probe+0x9e8/0xdd0 drivers/hid/wacom_sys.c:2797
 hid_device_probe+0x2aa/0x3d0 drivers/hid/hid-core.c:2633
 call_driver_probe drivers/base/dd.c:579 [inline]
 really_probe+0x240/0xca0 drivers/base/dd.c:658
 __driver_probe_device+0x1df/0x4b0 drivers/base/dd.c:800
 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:830
 __device_attach_driver+0x1d4/0x2e0 drivers/base/dd.c:958
 bus_for_each_drv+0x149/0x1d0 drivers/base/bus.c:457
 __device_attach+0x1e4/0x4b0 drivers/base/dd.c:1030
 bus_probe_device+0x17c/0x1c0 drivers/base/bus.c:532
 device_add+0x112d/0x1a40 drivers/base/core.c:3625
 hid_add_device+0x377/0xa60 drivers/hid/hid-core.c:2785
 usbhid_probe+0xc49/0x1100 drivers/hid/usbhid/hid-core.c:1429
 usb_probe_interface+0x30f/0x960 drivers/usb/core/driver.c:396
 call_driver_probe drivers/base/dd.c:579 [inline]
 really_probe+0x240/0xca0 drivers/base/dd.c:658
 __driver_probe_device+0x1df/0x4b0 drivers/base/dd.c:800
 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:830
 __device_attach_driver+0x1d4/0x2e0 drivers/base/dd.c:958
 bus_for_each_drv+0x149/0x1d0 drivers/base/bus.c:457
 __device_attach+0x1e4/0x4b0 drivers/base/dd.c:1030
 bus_probe_device+0x17c/0x1c0 drivers/base/bus.c:532
 device_add+0x112d/0x1a40 drivers/base/core.c:3625
 usb_set_configuration+0x1196/0x1bc0 drivers/usb/core/message.c:2211
 usb_generic_driver_probe+0xcf/0x130 drivers/usb/core/generic.c:238
 usb_probe_device+0xd8/0x2c0 drivers/usb/core/driver.c:293
 call_driver_probe drivers/base/dd.c:579 [inline]
 really_probe+0x240/0xca0 drivers/base/dd.c:658
 __driver_probe_device+0x1df/0x4b0 drivers/base/dd.c:800
 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:830
 __device_attach_driver+0x1d4/0x2e0 drivers/base/dd.c:958
 bus_for_each_drv+0x149/0x1d0 drivers/base/bus.c:457
 __device_attach+0x1e4/0x4b0 drivers/base/dd.c:1030
 bus_probe_device+0x17c/0x1c0 drivers/base/bus.c:532
 device_add+0x112d/0x1a40 drivers/base/core.c:3625
 usb_new_device+0xcb2/0x19d0 drivers/usb/core/hub.c:2575
 hub_port_connect drivers/usb/core/hub.c:5407 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5551 [inline]
 port_event drivers/usb/core/hub.c:5711 [inline]
 hub_event+0x2d9e/0x4e40 drivers/usb/core/hub.c:5793
 process_one_work+0x99a/0x15e0 kernel/workqueue.c:2405
 worker_thread+0x67d/0x10c0 kernel/workqueue.c:2552
 kthread+0x344/0x440 kernel/kthread.c:379
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308

Freed by task 22:
 kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 kasan_save_free_info+0x2e/0x40 mm/kasan/generic.c:521
 ____kasan_slab_free mm/kasan/common.c:236 [inline]
 ____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200
 kasan_slab_free include/linux/kasan.h:162 [inline]
 slab_free_hook mm/slub.c:1781 [inline]
 slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1807
 slab_free mm/slub.c:3786 [inline]
 __kmem_cache_free+0xaf/0x2d0 mm/slub.c:3799
 drop_ref+0x28f/0x390 drivers/hid/hidraw.c:335
 hidraw_disconnect+0x4c/0x70 drivers/hid/hidraw.c:601
 hid_disconnect+0x134/0x1b0 drivers/hid/hid-core.c:2277
 hid_hw_stop+0x16/0x70 drivers/hid/hid-core.c:2322
 wacom_remove+0x8c/0x3b0 drivers/hid/wacom_sys.c:2822
 hid_device_remove+0xce/0x210 drivers/hid/hid-core.c:2662
 device_remove+0xc8/0x170 drivers/base/dd.c:567
 __device_release_driver drivers/base/dd.c:1272 [inline]
 device_release_driver_internal+0x443/0x610 drivers/base/dd.c:1295
 bus_remove_device+0x22c/0x420 drivers/base/bus.c:574
 device_del+0x399/0xa30 drivers/base/core.c:3814
 hid_remove_device drivers/hid/hid-core.c:2835 [inline]
 hid_destroy_device+0xe5/0x150 drivers/hid/hid-core.c:2855
 usbhid_disconnect+0xa3/0xe0 drivers/hid/usbhid/hid-core.c:1456
 usb_unbind_interface+0x1dc/0x8e0 drivers/usb/core/driver.c:458
 device_remove drivers/base/dd.c:569 [inline]
 device_remove+0x11f/0x170 drivers/base/dd.c:561
 __device_release_driver drivers/base/dd.c:1272 [inline]
 device_release_driver_internal+0x443/0x610 drivers/base/dd.c:1295
 bus_remove_device+0x22c/0x420 drivers/base/bus.c:574
 device_del+0x399/0xa30 drivers/base/core.c:3814
 usb_disable_device+0x360/0x7b0 drivers/usb/core/message.c:1420
 usb_disconnect+0x2db/0x8a0 drivers/usb/core/hub.c:2238
 hub_port_connect drivers/usb/core/hub.c:5246 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5551 [inline]
 port_event drivers/usb/core/hub.c:5711 [inline]
 hub_event+0x1fbf/0x4e40 drivers/usb/core/hub.c:5793
 process_one_work+0x99a/0x15e0 kernel/workqueue.c:2405
 worker_thread+0x67d/0x10c0 kernel/workqueue.c:2552
 kthread+0x344/0x440 kernel/kthread.c:379
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308

Last potentially related work creation:
 kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:491
 insert_work+0x48/0x360 kernel/workqueue.c:1365
 __queue_work+0x625/0x1120 kernel/workqueue.c:1526
 queue_work_on+0xf2/0x110 kernel/workqueue.c:1554
 queue_work include/linux/workqueue.h:505 [inline]
 netdevice_queue_work drivers/infiniband/core/roce_gid_mgmt.c:659 [inline]
 netdevice_event+0x5e9/0x8f0 drivers/infiniband/core/roce_gid_mgmt.c:802
 notifier_call_chain+0xb6/0x3c0 kernel/notifier.c:93
 call_netdevice_notifiers_info+0xb9/0x130 net/core/dev.c:1935
 call_netdevice_notifiers_extack net/core/dev.c:1973 [inline]
 call_netdevice_notifiers+0x7d/0xb0 net/core/dev.c:1987
 vlan_dev_inherit_address net/8021q/vlan_dev.c:255 [inline]
 vlan_dev_inherit_address net/8021q/vlan_dev.c:248 [inline]
 vlan_dev_open+0x78b/0x970 net/8021q/vlan_dev.c:270
 __dev_open+0x297/0x4d0 net/core/dev.c:1415
 __dev_change_flags+0x587/0x750 net/core/dev.c:8568
 dev_change_flags+0x97/0x170 net/core/dev.c:8640
 vlan_device_event+0xa1c/0x1fe0 net/8021q/vlan.c:468
 notifier_call_chain+0xb6/0x3c0 kernel/notifier.c:93
 call_netdevice_notifiers_info+0xb9/0x130 net/core/dev.c:1935
 call_netdevice_notifiers_extack net/core/dev.c:1973 [inline]
 call_netdevice_notifiers net/core/dev.c:1987 [inline]
 __dev_notify_flags+0x120/0x2d0 net/core/dev.c:8607
 dev_change_flags+0x11b/0x170 net/core/dev.c:8645
 do_setlink+0x9ef/0x3b70 net/core/rtnetlink.c:2867
 __rtnl_newlink+0xd69/0x1840 net/core/rtnetlink.c:3648
 rtnl_newlink+0x68/0xa0 net/core/rtnetlink.c:3695
 rtnetlink_rcv_msg+0x43d/0xd50 net/core/rtnetlink.c:6417
 netlink_rcv_skb+0x165/0x440 net/netlink/af_netlink.c:2546
 netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline]
 netlink_unicast+0x547/0x7f0 net/netlink/af_netlink.c:1365
 netlink_sendmsg+0x925/0xe30 net/netlink/af_netlink.c:1913
 sock_sendmsg_nosec net/socket.c:724 [inline]
 sock_sendmsg+0xde/0x190 net/socket.c:747
 __sys_sendto+0x23a/0x340 net/socket.c:2144
 __do_sys_sendto net/socket.c:2156 [inline]
 __se_sys_sendto net/socket.c:2152 [inline]
 __x64_sys_sendto+0xe1/0x1b0 net/socket.c:2152
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Second to last potentially related work creation:
 kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:491
 insert_work+0x48/0x360 kernel/workqueue.c:1365
 __queue_work+0x625/0x1120 kernel/workqueue.c:1526
 queue_work_on+0xf2/0x110 kernel/workqueue.c:1554
 queue_work include/linux/workqueue.h:505 [inline]
 call_usermodehelper_exec+0x1d2/0x4c0 kernel/umh.c:434
 kobject_uevent_env+0xefc/0x16c0 lib/kobject_uevent.c:618
 kernel_add_sysfs_param kernel/params.c:817 [inline]
 param_sysfs_builtin kernel/params.c:852 [inline]
 param_sysfs_builtin_init+0x21d/0x460 kernel/params.c:986
 do_one_initcall+0x102/0x540 init/main.c:1246
 do_initcall_level init/main.c:1319 [inline]
 do_initcalls init/main.c:1335 [inline]
 do_basic_setup init/main.c:1354 [inline]
 kernel_init_freeable+0x64e/0xba0 init/main.c:1571
 kernel_init+0x1e/0x2c0 init/main.c:1462
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308

The buggy address belongs to the object at ffff88814b7e8700
 which belongs to the cache kmalloc-192 of size 192
The buggy address is located 40 bytes inside of
 freed 192-byte region [ffff88814b7e8700, ffff88814b7e87c0)

The buggy address belongs to the physical page:
page:ffffea00052dfa00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x14b7e8
anon flags: 0x57ff00000000200(slab|node=1|zone=2|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 057ff00000000200 ffff888012441a00 0000000000000000 dead000000000001
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 1, tgid 1 (swapper/0), ts 24371340961, free_ts 0
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x2db/0x350 mm/page_alloc.c:1731
 prep_new_page mm/page_alloc.c:1738 [inline]
 get_page_from_freelist+0xf41/0x2c00 mm/page_alloc.c:3502
 __alloc_pages+0x1cb/0x4a0 mm/page_alloc.c:4768
 alloc_page_interleave+0x1e/0x200 mm/mempolicy.c:2112
 alloc_pages+0x233/0x270 mm/mempolicy.c:2274
 alloc_slab_page mm/slub.c:1851 [inline]
 allocate_slab+0x25f/0x390 mm/slub.c:1998
 new_slab mm/slub.c:2051 [inline]
 ___slab_alloc+0xa91/0x1400 mm/slub.c:3192
 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3291
 __slab_alloc_node mm/slub.c:3344 [inline]
 slab_alloc_node mm/slub.c:3441 [inline]
 __kmem_cache_alloc_node+0x136/0x320 mm/slub.c:3490
 kmalloc_trace+0x26/0xe0 mm/slab_common.c:1057
 kmalloc include/linux/slab.h:559 [inline]
 kzalloc include/linux/slab.h:680 [inline]
 call_usermodehelper_setup+0x9c/0x340 kernel/umh.c:363
 kobject_uevent_env+0xedd/0x16c0 lib/kobject_uevent.c:614
 kernel_add_sysfs_param kernel/params.c:817 [inline]
 param_sysfs_builtin kernel/params.c:852 [inline]
 param_sysfs_builtin_init+0x21d/0x460 kernel/params.c:986
 do_one_initcall+0x102/0x540 init/main.c:1246
 do_initcall_level init/main.c:1319 [inline]
 do_initcalls init/main.c:1335 [inline]
 do_basic_setup init/main.c:1354 [inline]
 kernel_init_freeable+0x64e/0xba0 init/main.c:1571
 kernel_init+0x1e/0x2c0 init/main.c:1462
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88814b7e8600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88814b7e8680: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff88814b7e8700: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                  ^
 ffff88814b7e8780: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff88814b7e8800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/06/23 17:55 upstream 8a28a0b6f1a1 09ffe269 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce KASAN: slab-use-after-free Read in remove_wait_queue
2023/06/21 05:35 upstream 99ec1ed7c2ed 09ffe269 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce KASAN: slab-use-after-free Read in remove_wait_queue
2023/06/16 23:37 upstream 40f71e7cd3c6 f3921d4d .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce KASAN: slab-use-after-free Read in remove_wait_queue
* Struck through repros no longer work on HEAD.