syzbot


KASAN: use-after-free Read in move_linked_works

Status: auto-obsoleted due to no activity on 2023/05/21 05:23
Reported-by: syzbot+92accb27e73a6ad5ceb4@syzkaller.appspotmail.com
First crash: 375d, last: 375d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-15 KASAN: use-after-free Read in move_linked_works (2) origin:downstream C 1 10d 48d 0/2 upstream: reported C repro on 2024/01/13 21:09

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __list_del_entry_valid+0xa6/0x120 lib/list_debug.c:62
Read of size 8 at addr ffff888162836c70 by task kworker/1:0/19580

CPU: 1 PID: 19580 Comm: kworker/1:0 Not tainted 5.15.94-syzkaller-03204-g5448b2fda85f #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/21/2023
Workqueue:  0x0 (wg-crypt-wg0)
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
 print_address_description+0x87/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:427 [inline]
 kasan_report+0x179/0x1c0 mm/kasan/report.c:444
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309
 __list_del_entry_valid+0xa6/0x120 lib/list_debug.c:62
 __list_del_entry include/linux/list.h:132 [inline]
 list_move_tail include/linux/list.h:227 [inline]
 move_linked_works+0x7c/0x260 kernel/workqueue.c:1100
 process_one_work+0x2eb/0xc10 kernel/workqueue.c:2238
 worker_thread+0xad5/0x12a0 kernel/workqueue.c:2460
 kthread+0x421/0x510 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 <unknown>:298
 </TASK>

Allocated by task 496:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:433 [inline]
 ____kasan_kmalloc+0xdb/0x110 mm/kasan/common.c:512
 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:521
 kasan_kmalloc include/linux/kasan.h:227 [inline]
 __kmalloc+0x13a/0x270 mm/slub.c:4425
 __kmalloc_node include/linux/slab.h:474 [inline]
 kmalloc_node include/linux/slab.h:631 [inline]
 kvmalloc_node+0x82/0x130 mm/util.c:623
 kvmalloc include/linux/mm.h:851 [inline]
 kvzalloc include/linux/mm.h:859 [inline]
 alloc_netdev_mqs+0x8c/0xc90 net/core/dev.c:10828
 alloc_etherdev_mqs+0x33/0x40 net/ethernet/eth.c:393
 usbnet_probe+0x19e/0x2670 drivers/net/usb/usbnet.c:1694
 usb_probe_interface+0x5b6/0xa90 drivers/usb/core/driver.c:396
 really_probe+0x28d/0x970 drivers/base/dd.c:595
 __driver_probe_device+0x1bb/0x290 drivers/base/dd.c:750
 driver_probe_device+0x54/0x3d0 drivers/base/dd.c:780
 __device_attach_driver+0x2c5/0x470 drivers/base/dd.c:902
 bus_for_each_drv+0x183/0x200 drivers/base/bus.c:427
 __device_attach+0x312/0x510 drivers/base/dd.c:974
 device_initial_probe+0x1a/0x20 drivers/base/dd.c:1023
 bus_probe_device+0xbe/0x1e0 drivers/base/bus.c:487
 device_add+0xb80/0xf30 drivers/base/core.c:3404
 usb_set_configuration+0x190f/0x1e80 drivers/usb/core/message.c:2170
 usb_generic_driver_probe+0x8b/0x150 drivers/usb/core/generic.c:238
 usb_probe_device+0x144/0x260 drivers/usb/core/driver.c:293
 really_probe+0x28d/0x970 drivers/base/dd.c:595
 __driver_probe_device+0x1bb/0x290 drivers/base/dd.c:750
 driver_probe_device+0x54/0x3d0 drivers/base/dd.c:780
 __device_attach_driver+0x2c5/0x470 drivers/base/dd.c:902
 bus_for_each_drv+0x183/0x200 drivers/base/bus.c:427
 __device_attach+0x312/0x510 drivers/base/dd.c:974
 device_initial_probe+0x1a/0x20 drivers/base/dd.c:1023
 bus_probe_device+0xbe/0x1e0 drivers/base/bus.c:487
 device_add+0xb80/0xf30 drivers/base/core.c:3404
 usb_new_device+0x1034/0x1bf0 drivers/usb/core/hub.c:2575
 hub_port_connect drivers/usb/core/hub.c:5417 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5561 [inline]
 port_event drivers/usb/core/hub.c:5711 [inline]
 hub_event+0x2da9/0x4a80 drivers/usb/core/hub.c:5793
 process_one_work+0x6bb/0xc10 kernel/workqueue.c:2313
 worker_thread+0xad5/0x12a0 kernel/workqueue.c:2460
 kthread+0x421/0x510 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 <unknown>:298

Freed by task 496:
 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+0x126/0x160 mm/kasan/common.c:365
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:373
 kasan_slab_free include/linux/kasan.h:193 [inline]
 slab_free_hook mm/slub.c:1723 [inline]
 slab_free_freelist_hook+0xbd/0x190 mm/slub.c:1749
 slab_free mm/slub.c:3517 [inline]
 kfree+0xc8/0x220 mm/slub.c:4577
 kvfree+0x35/0x40 mm/util.c:658
 netdev_freemem+0x3f/0x60 net/core/dev.c:10782
 netdev_release+0x7f/0xb0 net/core/net-sysfs.c:1903
 device_release+0x95/0x1c0
 kobject_cleanup lib/kobject.c:705 [inline]
 kobject_release lib/kobject.c:736 [inline]
 kref_put include/linux/kref.h:65 [inline]
 kobject_put+0x178/0x260 lib/kobject.c:753
 put_device+0x1f/0x30 drivers/base/core.c:3511
 free_netdev+0x34f/0x440 net/core/dev.c:10968
 usbnet_disconnect+0x245/0x390 drivers/net/usb/usbnet.c:1633
 usb_unbind_interface+0x1fa/0x8c0 drivers/usb/core/driver.c:458
 __device_release_driver drivers/base/dd.c:1224 [inline]
 device_release_driver_internal+0x50b/0x7d0 drivers/base/dd.c:1257
 device_release_driver+0x19/0x20 drivers/base/dd.c:1280
 bus_remove_device+0x2f8/0x360 drivers/base/bus.c:529
 device_del+0x663/0xe90 drivers/base/core.c:3591
 usb_disable_device+0x380/0x720 drivers/usb/core/message.c:1419
 usb_disconnect+0x32a/0x890 drivers/usb/core/hub.c:2232
 hub_port_connect drivers/usb/core/hub.c:5256 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5561 [inline]
 port_event drivers/usb/core/hub.c:5711 [inline]
 hub_event+0x1ccf/0x4a80 drivers/usb/core/hub.c:5793
 process_one_work+0x6bb/0xc10 kernel/workqueue.c:2313
 process_scheduled_works kernel/workqueue.c:2376 [inline]
 worker_thread+0xe02/0x12a0 kernel/workqueue.c:2462
 kthread+0x421/0x510 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 <unknown>:298

Last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xd3/0xf0 mm/kasan/generic.c:348
 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358
 insert_work+0x56/0x320 kernel/workqueue.c:1369
 __queue_work+0x923/0xcd0 kernel/workqueue.c:1535
 queue_work_on+0x105/0x170 kernel/workqueue.c:1562
 usbnet_link_change+0xeb/0x100
 usbnet_probe+0x1c5a/0x2670 drivers/net/usb/usbnet.c:1835
 usb_probe_interface+0x5b6/0xa90 drivers/usb/core/driver.c:396
 really_probe+0x28d/0x970 drivers/base/dd.c:595
 __driver_probe_device+0x1bb/0x290 drivers/base/dd.c:750
 driver_probe_device+0x54/0x3d0 drivers/base/dd.c:780
 __device_attach_driver+0x2c5/0x470 drivers/base/dd.c:902
 bus_for_each_drv+0x183/0x200 drivers/base/bus.c:427
 __device_attach+0x312/0x510 drivers/base/dd.c:974
 device_initial_probe+0x1a/0x20 drivers/base/dd.c:1023
 bus_probe_device+0xbe/0x1e0 drivers/base/bus.c:487
 device_add+0xb80/0xf30 drivers/base/core.c:3404
 usb_set_configuration+0x190f/0x1e80 drivers/usb/core/message.c:2170
 usb_generic_driver_probe+0x8b/0x150 drivers/usb/core/generic.c:238
 usb_probe_device+0x144/0x260 drivers/usb/core/driver.c:293
 really_probe+0x28d/0x970 drivers/base/dd.c:595
 __driver_probe_device+0x1bb/0x290 drivers/base/dd.c:750
 driver_probe_device+0x54/0x3d0 drivers/base/dd.c:780
 __device_attach_driver+0x2c5/0x470 drivers/base/dd.c:902
 bus_for_each_drv+0x183/0x200 drivers/base/bus.c:427
 __device_attach+0x312/0x510 drivers/base/dd.c:974
 device_initial_probe+0x1a/0x20 drivers/base/dd.c:1023
 bus_probe_device+0xbe/0x1e0 drivers/base/bus.c:487
 device_add+0xb80/0xf30 drivers/base/core.c:3404
 usb_new_device+0x1034/0x1bf0 drivers/usb/core/hub.c:2575
 hub_port_connect drivers/usb/core/hub.c:5417 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5561 [inline]
 port_event drivers/usb/core/hub.c:5711 [inline]
 hub_event+0x2da9/0x4a80 drivers/usb/core/hub.c:5793
 process_one_work+0x6bb/0xc10 kernel/workqueue.c:2313
 worker_thread+0xad5/0x12a0 kernel/workqueue.c:2460
 kthread+0x421/0x510 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 <unknown>:298

The buggy address belongs to the object at ffff888162836000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 3184 bytes inside of
 4096-byte region [ffff888162836000, ffff888162837000)
The buggy address belongs to the page:
page:ffffea00058a0c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x162830
head:ffffea00058a0c00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head|zone=1)
raw: 4000000000010200 0000000000000000 dead000000000122 ffff888100043380
raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 589, ts 1040593848274, free_ts 1039141676695
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x1a3/0x1b0 mm/page_alloc.c:2502
 prep_new_page mm/page_alloc.c:2508 [inline]
 get_page_from_freelist+0x2c14/0x2cf0 mm/page_alloc.c:4291
 __alloc_pages+0x386/0x7b0 mm/page_alloc.c:5569
 allocate_slab mm/slub.c:1930 [inline]
 new_slab+0x92/0x490 mm/slub.c:1993
 ___slab_alloc+0x39e/0x830 mm/slub.c:3026
 __slab_alloc+0x4a/0x90 mm/slub.c:3113
 slab_alloc_node mm/slub.c:3204 [inline]
 slab_alloc mm/slub.c:3246 [inline]
 kmem_cache_alloc_trace+0x142/0x210 mm/slub.c:3263
 kmalloc include/linux/slab.h:608 [inline]
 kzalloc include/linux/slab.h:738 [inline]
 uevent_show+0x160/0x310 drivers/base/core.c:2398
 dev_attr_show+0x56/0xd0 drivers/base/core.c:2105
 sysfs_kf_seq_show+0x265/0x3e0 fs/sysfs/file.c:61
 kernfs_seq_show+0x119/0x160 fs/kernfs/file.c:168
 seq_read_iter+0x430/0xd00 fs/seq_file.c:230
 kernfs_fop_read_iter+0x145/0x470 fs/kernfs/file.c:241
 call_read_iter include/linux/fs.h:2151 [inline]
 new_sync_read fs/read_write.c:404 [inline]
 vfs_read+0xa7e/0xd40 fs/read_write.c:485
 ksys_read+0x199/0x2c0 fs/read_write.c:623
 __do_sys_read fs/read_write.c:633 [inline]
 __se_sys_read fs/read_write.c:631 [inline]
 __x64_sys_read+0x7b/0x90 fs/read_write.c:631
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:26 [inline]
 free_pages_prepare mm/page_alloc.c:1370 [inline]
 free_pcp_prepare mm/page_alloc.c:1442 [inline]
 free_unref_page_prepare+0x7c8/0x7d0 mm/page_alloc.c:3441
 free_unref_page+0xac/0x2c0 mm/page_alloc.c:3521
 free_the_page mm/page_alloc.c:711 [inline]
 __free_pages+0x61/0xf0 mm/page_alloc.c:5645
 __free_slab+0xec/0x1d0 mm/slub.c:2018
 free_slab mm/slub.c:2033 [inline]
 discard_slab mm/slub.c:2039 [inline]
 __unfreeze_partials+0x165/0x1a0 mm/slub.c:2525
 put_cpu_partial+0xc4/0x120 mm/slub.c:2605
 __slab_free+0x1c8/0x290 mm/slub.c:3386
 do_slab_free mm/slub.c:3505 [inline]
 ___cache_free+0x109/0x120 mm/slub.c:3524
 qlink_free+0x4d/0x90 mm/kasan/quarantine.c:157
 qlist_free_all+0x44/0xb0 mm/kasan/quarantine.c:176
 kasan_quarantine_reduce+0x15a/0x180 mm/kasan/quarantine.c:283
 __kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:443
 kasan_slab_alloc include/linux/kasan.h:217 [inline]
 slab_post_alloc_hook+0x53/0x2c0 mm/slab.h:550
 slab_alloc_node mm/slub.c:3238 [inline]
 slab_alloc mm/slub.c:3246 [inline]
 kmem_cache_alloc+0xf5/0x200 mm/slub.c:3251
 getname_flags+0xba/0x520 fs/namei.c:138
 getname+0x19/0x20 fs/namei.c:217

Memory state around the buggy address:
 ffff888162836b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888162836b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888162836c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                             ^
 ffff888162836c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888162836d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
usb 5-1: USB disconnect, device number 81
usb 5-1: new high-speed USB device number 82 using dummy_hcd
usb 5-1: config 1 interface 0 altsetting 0 endpoint 0x81 has an invalid bInterval 0, changing to 7
usb 5-1: New USB device found, idVendor=0525, idProduct=a4a1, bcdDevice= 0.40
usb 5-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 5-1: Product: syz
usb 5-1: Manufacturer: syz
usb 5-1: SerialNumber: syz
cdc_ncm 5-1:1.0: MAC-Address: 42:42:42:42:42:42
cdc_ncm 5-1:1.0: dwNtbInMaxSize=0 is too small. Using 2048
cdc_ncm 5-1:1.0: setting rx_max = 2048
cdc_ncm 5-1:1.0: setting tx_max = 184
cdc_ncm 5-1:1.0 usb1: register 'cdc_ncm' at usb-dummy_hcd.4-1, CDC NCM, 42:42:42:42:42:42
usb 5-1: USB disconnect, device number 82
cdc_ncm 5-1:1.0 usb1: unregister 'cdc_ncm' usb-dummy_hcd.4-1, CDC NCM
usb 2-1: new high-speed USB device number 83 using dummy_hcd
usb 2-1: config 1 interface 0 altsetting 0 endpoint 0x81 has an invalid bInterval 0, changing to 7
usb 2-1: New USB device found, idVendor=0525, idProduct=a4a1, bcdDevice= 0.40
usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 2-1: Product: syz
usb 2-1: Manufacturer: syz
usb 2-1: SerialNumber: syz
cdc_ncm 2-1:1.0: MAC-Address: 42:42:42:42:42:42
cdc_ncm 2-1:1.0: dwNtbInMaxSize=0 is too small. Using 2048
cdc_ncm 2-1:1.0: setting rx_max = 2048
cdc_ncm 2-1:1.0: setting tx_max = 184
cdc_ncm 2-1:1.0 usb0: register 'cdc_ncm' at usb-dummy_hcd.1-1, CDC NCM, 42:42:42:42:42:42
usb 2-1: USB disconnect, device number 83
cdc_ncm 2-1:1.0 usb0: unregister 'cdc_ncm' usb-dummy_hcd.1-1, CDC NCM
usb 2-1: new high-speed USB device number 84 using dummy_hcd
usb 2-1: config 1 interface 0 altsetting 0 endpoint 0x81 has an invalid bInterval 0, changing to 7
usb 2-1: New USB device found, idVendor=0525, idProduct=a4a1, bcdDevice= 0.40
usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 2-1: Product: syz
usb 2-1: Manufacturer: syz
usb 2-1: SerialNumber: syz
cdc_ncm 2-1:1.0: MAC-Address: 42:42:42:42:42:42
cdc_ncm 2-1:1.0: dwNtbInMaxSize=0 is too small. Using 2048
cdc_ncm 2-1:1.0: setting rx_max = 2048
cdc_ncm 2-1:1.0: setting tx_max = 184
cdc_ncm 2-1:1.0 usb0: register 'cdc_ncm' at usb-dummy_hcd.1-1, CDC NCM, 42:42:42:42:42:42
usb 2-1: USB disconnect, device number 84
cdc_ncm 2-1:1.0 usb0: unregister 'cdc_ncm' usb-dummy_hcd.1-1, CDC NCM

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/02/20 05:13 android13-5.15-lts 5448b2fda85f bcdf85f8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in move_linked_works
* Struck through repros no longer work on HEAD.