Hay
Date
July 3, 2025, 11:10 p.m.

Environment
qemu-arm64
qemu-x86_64

[   20.129738] ==================================================================
[   20.130074] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x480/0x4a8
[   20.130276] Read of size 8 at addr fff00000c6674300 by task kunit_try_catch/200
[   20.130375] 
[   20.130655] CPU: 0 UID: 0 PID: 200 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT 
[   20.130837] Tainted: [B]=BAD_PAGE, [N]=TEST
[   20.130895] Hardware name: linux,dummy-virt (DT)
[   20.130963] Call trace:
[   20.131251]  show_stack+0x20/0x38 (C)
[   20.131446]  dump_stack_lvl+0x8c/0xd0
[   20.131566]  print_report+0x118/0x608
[   20.131745]  kasan_report+0xdc/0x128
[   20.131853]  __asan_report_load8_noabort+0x20/0x30
[   20.132171]  workqueue_uaf+0x480/0x4a8
[   20.132279]  kunit_try_run_case+0x170/0x3f0
[   20.132389]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   20.132519]  kthread+0x328/0x630
[   20.132812]  ret_from_fork+0x10/0x20
[   20.132919] 
[   20.133414] Allocated by task 200:
[   20.133506]  kasan_save_stack+0x3c/0x68
[   20.133669]  kasan_save_track+0x20/0x40
[   20.133761]  kasan_save_alloc_info+0x40/0x58
[   20.133850]  __kasan_kmalloc+0xd4/0xd8
[   20.134140]  __kmalloc_cache_noprof+0x16c/0x3c0
[   20.134463]  workqueue_uaf+0x13c/0x4a8
[   20.134543]  kunit_try_run_case+0x170/0x3f0
[   20.134652]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   20.134751]  kthread+0x328/0x630
[   20.134898]  ret_from_fork+0x10/0x20
[   20.134989] 
[   20.135048] Freed by task 75:
[   20.135197]  kasan_save_stack+0x3c/0x68
[   20.135364]  kasan_save_track+0x20/0x40
[   20.135444]  kasan_save_free_info+0x4c/0x78
[   20.135544]  __kasan_slab_free+0x6c/0x98
[   20.135627]  kfree+0x214/0x3c8
[   20.135932]  workqueue_uaf_work+0x18/0x30
[   20.136381]  process_one_work+0x530/0xf98
[   20.136497]  worker_thread+0x618/0xf38
[   20.136584]  kthread+0x328/0x630
[   20.136668]  ret_from_fork+0x10/0x20
[   20.137603] 
[   20.137668] Last potentially related work creation:
[   20.137929]  kasan_save_stack+0x3c/0x68
[   20.138055]  kasan_record_aux_stack+0xb4/0xc8
[   20.138147]  __queue_work+0x65c/0x1008
[   20.138439]  queue_work_on+0xbc/0xf8
[   20.138540]  workqueue_uaf+0x210/0x4a8
[   20.138779]  kunit_try_run_case+0x170/0x3f0
[   20.139470]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   20.139745]  kthread+0x328/0x630
[   20.139830]  ret_from_fork+0x10/0x20
[   20.139956] 
[   20.140002] The buggy address belongs to the object at fff00000c6674300
[   20.140002]  which belongs to the cache kmalloc-32 of size 32
[   20.140539] The buggy address is located 0 bytes inside of
[   20.140539]  freed 32-byte region [fff00000c6674300, fff00000c6674320)
[   20.140735] 
[   20.140795] The buggy address belongs to the physical page:
[   20.140877] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106674
[   20.141260] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   20.141703] page_type: f5(slab)
[   20.141806] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   20.142109] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   20.142245] page dumped because: kasan: bad access detected
[   20.142321] 
[   20.142354] Memory state around the buggy address:
[   20.142600]  fff00000c6674200: 00 00 03 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   20.142715]  fff00000c6674280: 00 00 00 fc fc fc fc fc 00 00 00 07 fc fc fc fc
[   20.142968] >fff00000c6674300: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   20.143067]                    ^
[   20.143132]  fff00000c6674380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   20.143641]  fff00000c6674400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   20.143966] ==================================================================

[   12.147025] ==================================================================
[   12.147754] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x4d6/0x560
[   12.148062] Read of size 8 at addr ffff888103180f80 by task kunit_try_catch/217
[   12.148821] 
[   12.149215] CPU: 0 UID: 0 PID: 217 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT(voluntary) 
[   12.149366] Tainted: [B]=BAD_PAGE, [N]=TEST
[   12.149392] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   12.149415] Call Trace:
[   12.149430]  <TASK>
[   12.149449]  dump_stack_lvl+0x73/0xb0
[   12.149516]  print_report+0xd1/0x650
[   12.149539]  ? __virt_addr_valid+0x1db/0x2d0
[   12.149561]  ? workqueue_uaf+0x4d6/0x560
[   12.149581]  ? kasan_complete_mode_report_info+0x64/0x200
[   12.149601]  ? workqueue_uaf+0x4d6/0x560
[   12.149621]  kasan_report+0x141/0x180
[   12.149642]  ? workqueue_uaf+0x4d6/0x560
[   12.149666]  __asan_report_load8_noabort+0x18/0x20
[   12.149689]  workqueue_uaf+0x4d6/0x560
[   12.149710]  ? __pfx_workqueue_uaf+0x10/0x10
[   12.149731]  ? __schedule+0x10cc/0x2b60
[   12.149751]  ? __pfx_read_tsc+0x10/0x10
[   12.149772]  ? ktime_get_ts64+0x86/0x230
[   12.149796]  kunit_try_run_case+0x1a5/0x480
[   12.149819]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.149840]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   12.149862]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   12.149883]  ? __kthread_parkme+0x82/0x180
[   12.149903]  ? preempt_count_sub+0x50/0x80
[   12.149926]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.149948]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.149969]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   12.149990]  kthread+0x337/0x6f0
[   12.150008]  ? trace_preempt_on+0x20/0xc0
[   12.150032]  ? __pfx_kthread+0x10/0x10
[   12.150051]  ? _raw_spin_unlock_irq+0x47/0x80
[   12.150071]  ? calculate_sigpending+0x7b/0xa0
[   12.150094]  ? __pfx_kthread+0x10/0x10
[   12.150131]  ret_from_fork+0x116/0x1d0
[   12.150149]  ? __pfx_kthread+0x10/0x10
[   12.150168]  ret_from_fork_asm+0x1a/0x30
[   12.150197]  </TASK>
[   12.150209] 
[   12.163622] Allocated by task 217:
[   12.164089]  kasan_save_stack+0x45/0x70
[   12.164315]  kasan_save_track+0x18/0x40
[   12.164474]  kasan_save_alloc_info+0x3b/0x50
[   12.164917]  __kasan_kmalloc+0xb7/0xc0
[   12.165136]  __kmalloc_cache_noprof+0x189/0x420
[   12.165450]  workqueue_uaf+0x152/0x560
[   12.165763]  kunit_try_run_case+0x1a5/0x480
[   12.165915]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.166424]  kthread+0x337/0x6f0
[   12.166592]  ret_from_fork+0x116/0x1d0
[   12.166913]  ret_from_fork_asm+0x1a/0x30
[   12.167210] 
[   12.167287] Freed by task 9:
[   12.167552]  kasan_save_stack+0x45/0x70
[   12.167950]  kasan_save_track+0x18/0x40
[   12.168144]  kasan_save_free_info+0x3f/0x60
[   12.168373]  __kasan_slab_free+0x56/0x70
[   12.168548]  kfree+0x222/0x3f0
[   12.168676]  workqueue_uaf_work+0x12/0x20
[   12.168875]  process_one_work+0x5ee/0xf60
[   12.169068]  worker_thread+0x758/0x1220
[   12.169743]  kthread+0x337/0x6f0
[   12.169925]  ret_from_fork+0x116/0x1d0
[   12.170074]  ret_from_fork_asm+0x1a/0x30
[   12.170629] 
[   12.170733] Last potentially related work creation:
[   12.171027]  kasan_save_stack+0x45/0x70
[   12.171422]  kasan_record_aux_stack+0xb2/0xc0
[   12.171618]  __queue_work+0x626/0xeb0
[   12.171919]  queue_work_on+0xb6/0xc0
[   12.172089]  workqueue_uaf+0x26d/0x560
[   12.172457]  kunit_try_run_case+0x1a5/0x480
[   12.172721]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.172953]  kthread+0x337/0x6f0
[   12.173111]  ret_from_fork+0x116/0x1d0
[   12.173544]  ret_from_fork_asm+0x1a/0x30
[   12.173805] 
[   12.173884] The buggy address belongs to the object at ffff888103180f80
[   12.173884]  which belongs to the cache kmalloc-32 of size 32
[   12.174735] The buggy address is located 0 bytes inside of
[   12.174735]  freed 32-byte region [ffff888103180f80, ffff888103180fa0)
[   12.175252] 
[   12.175374] The buggy address belongs to the physical page:
[   12.175909] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x103180
[   12.176398] flags: 0x200000000000000(node=0|zone=2)
[   12.176625] page_type: f5(slab)
[   12.176919] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   12.177329] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   12.177647] page dumped because: kasan: bad access detected
[   12.177892] 
[   12.177980] Memory state around the buggy address:
[   12.178532]  ffff888103180e80: 00 00 00 fc fc fc fc fc 00 00 03 fc fc fc fc fc
[   12.178814]  ffff888103180f00: 00 00 07 fc fc fc fc fc 00 00 00 07 fc fc fc fc
[   12.179316] >ffff888103180f80: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   12.179846]                    ^
[   12.180004]  ffff888103181000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   12.180440]  ffff888103181080: fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc
[   12.180804] ==================================================================