Hay
Date
July 2, 2025, 11:09 p.m.

Environment
qemu-arm64
qemu-x86_64

[   18.676856] ==================================================================
[   18.677071] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x480/0x4a8
[   18.677135] Read of size 8 at addr fff00000c706cac0 by task kunit_try_catch/200
[   18.677443] 
[   18.677925] CPU: 0 UID: 0 PID: 200 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT 
[   18.678023] Tainted: [B]=BAD_PAGE, [N]=TEST
[   18.678252] Hardware name: linux,dummy-virt (DT)
[   18.678389] Call trace:
[   18.678487]  show_stack+0x20/0x38 (C)
[   18.678616]  dump_stack_lvl+0x8c/0xd0
[   18.678739]  print_report+0x118/0x608
[   18.678810]  kasan_report+0xdc/0x128
[   18.678888]  __asan_report_load8_noabort+0x20/0x30
[   18.678943]  workqueue_uaf+0x480/0x4a8
[   18.678990]  kunit_try_run_case+0x170/0x3f0
[   18.679048]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.679109]  kthread+0x328/0x630
[   18.679168]  ret_from_fork+0x10/0x20
[   18.679226] 
[   18.679245] Allocated by task 200:
[   18.679274]  kasan_save_stack+0x3c/0x68
[   18.679326]  kasan_save_track+0x20/0x40
[   18.679379]  kasan_save_alloc_info+0x40/0x58
[   18.679419]  __kasan_kmalloc+0xd4/0xd8
[   18.679465]  __kmalloc_cache_noprof+0x16c/0x3c0
[   18.679515]  workqueue_uaf+0x13c/0x4a8
[   18.679552]  kunit_try_run_case+0x170/0x3f0
[   18.679601]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.679654]  kthread+0x328/0x630
[   18.679687]  ret_from_fork+0x10/0x20
[   18.679738] 
[   18.679764] Freed by task 11:
[   18.679800]  kasan_save_stack+0x3c/0x68
[   18.679837]  kasan_save_track+0x20/0x40
[   18.679885]  kasan_save_free_info+0x4c/0x78
[   18.679923]  __kasan_slab_free+0x6c/0x98
[   18.679960]  kfree+0x214/0x3c8
[   18.680002]  workqueue_uaf_work+0x18/0x30
[   18.680036]  process_one_work+0x530/0xf98
[   18.680073]  worker_thread+0x618/0xf38
[   18.680107]  kthread+0x328/0x630
[   18.680149]  ret_from_fork+0x10/0x20
[   18.680185] 
[   18.680225] Last potentially related work creation:
[   18.680261]  kasan_save_stack+0x3c/0x68
[   18.680309]  kasan_record_aux_stack+0xb4/0xc8
[   18.680357]  __queue_work+0x65c/0x1008
[   18.680393]  queue_work_on+0xbc/0xf8
[   18.680437]  workqueue_uaf+0x210/0x4a8
[   18.680486]  kunit_try_run_case+0x170/0x3f0
[   18.680523]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.680566]  kthread+0x328/0x630
[   18.680745]  ret_from_fork+0x10/0x20
[   18.680799] 
[   18.680946] The buggy address belongs to the object at fff00000c706cac0
[   18.680946]  which belongs to the cache kmalloc-32 of size 32
[   18.681365] The buggy address is located 0 bytes inside of
[   18.681365]  freed 32-byte region [fff00000c706cac0, fff00000c706cae0)
[   18.681662] 
[   18.681691] The buggy address belongs to the physical page:
[   18.681723] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10706c
[   18.681779] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   18.681943] page_type: f5(slab)
[   18.682136] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   18.682297] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   18.682371] page dumped because: kasan: bad access detected
[   18.682519] 
[   18.682584] Memory state around the buggy address:
[   18.682620]  fff00000c706c980: 00 00 03 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   18.682893]  fff00000c706ca00: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   18.682998] >fff00000c706ca80: 00 00 00 07 fc fc fc fc fa fb fb fb fc fc fc fc
[   18.683040]                                            ^
[   18.683077]  fff00000c706cb00: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.683138]  fff00000c706cb80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.683286] ==================================================================

[   11.998869] ==================================================================
[   11.999312] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x4d6/0x560
[   11.999554] Read of size 8 at addr ffff88810312f180 by task kunit_try_catch/219
[   12.000963] 
[   12.001227] CPU: 1 UID: 0 PID: 219 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT(voluntary) 
[   12.001277] Tainted: [B]=BAD_PAGE, [N]=TEST
[   12.001289] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   12.001309] Call Trace:
[   12.001322]  <TASK>
[   12.001340]  dump_stack_lvl+0x73/0xb0
[   12.001381]  print_report+0xd1/0x650
[   12.001405]  ? __virt_addr_valid+0x1db/0x2d0
[   12.001428]  ? workqueue_uaf+0x4d6/0x560
[   12.001448]  ? kasan_complete_mode_report_info+0x64/0x200
[   12.001469]  ? workqueue_uaf+0x4d6/0x560
[   12.001489]  kasan_report+0x141/0x180
[   12.001510]  ? workqueue_uaf+0x4d6/0x560
[   12.001534]  __asan_report_load8_noabort+0x18/0x20
[   12.001557]  workqueue_uaf+0x4d6/0x560
[   12.001604]  ? __pfx_workqueue_uaf+0x10/0x10
[   12.001626]  ? __schedule+0x10cc/0x2b60
[   12.001647]  ? __pfx_read_tsc+0x10/0x10
[   12.001667]  ? ktime_get_ts64+0x86/0x230
[   12.001691]  kunit_try_run_case+0x1a5/0x480
[   12.001715]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.001735]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   12.001757]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   12.001778]  ? __kthread_parkme+0x82/0x180
[   12.001798]  ? preempt_count_sub+0x50/0x80
[   12.001821]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.001843]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.001864]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   12.001885]  kthread+0x337/0x6f0
[   12.001903]  ? trace_preempt_on+0x20/0xc0
[   12.001926]  ? __pfx_kthread+0x10/0x10
[   12.001945]  ? _raw_spin_unlock_irq+0x47/0x80
[   12.001964]  ? calculate_sigpending+0x7b/0xa0
[   12.001987]  ? __pfx_kthread+0x10/0x10
[   12.002006]  ret_from_fork+0x116/0x1d0
[   12.002023]  ? __pfx_kthread+0x10/0x10
[   12.002042]  ret_from_fork_asm+0x1a/0x30
[   12.002072]  </TASK>
[   12.002083] 
[   12.013261] Allocated by task 219:
[   12.013465]  kasan_save_stack+0x45/0x70
[   12.013877]  kasan_save_track+0x18/0x40
[   12.014060]  kasan_save_alloc_info+0x3b/0x50
[   12.014253]  __kasan_kmalloc+0xb7/0xc0
[   12.014439]  __kmalloc_cache_noprof+0x189/0x420
[   12.014932]  workqueue_uaf+0x152/0x560
[   12.015161]  kunit_try_run_case+0x1a5/0x480
[   12.015516]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.015981]  kthread+0x337/0x6f0
[   12.016255]  ret_from_fork+0x116/0x1d0
[   12.016515]  ret_from_fork_asm+0x1a/0x30
[   12.017206] 
[   12.017314] Freed by task 24:
[   12.017666]  kasan_save_stack+0x45/0x70
[   12.017855]  kasan_save_track+0x18/0x40
[   12.018240]  kasan_save_free_info+0x3f/0x60
[   12.018546]  __kasan_slab_free+0x56/0x70
[   12.018958]  kfree+0x222/0x3f0
[   12.019139]  workqueue_uaf_work+0x12/0x20
[   12.019589]  process_one_work+0x5ee/0xf60
[   12.019983]  worker_thread+0x758/0x1220
[   12.020286]  kthread+0x337/0x6f0
[   12.020881]  ret_from_fork+0x116/0x1d0
[   12.021068]  ret_from_fork_asm+0x1a/0x30
[   12.021211] 
[   12.021310] Last potentially related work creation:
[   12.021556]  kasan_save_stack+0x45/0x70
[   12.022073]  kasan_record_aux_stack+0xb2/0xc0
[   12.022388]  __queue_work+0x626/0xeb0
[   12.022824]  queue_work_on+0xb6/0xc0
[   12.023010]  workqueue_uaf+0x26d/0x560
[   12.023308]  kunit_try_run_case+0x1a5/0x480
[   12.023565]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.024053]  kthread+0x337/0x6f0
[   12.024321]  ret_from_fork+0x116/0x1d0
[   12.024758]  ret_from_fork_asm+0x1a/0x30
[   12.025068] 
[   12.025169] The buggy address belongs to the object at ffff88810312f180
[   12.025169]  which belongs to the cache kmalloc-32 of size 32
[   12.026056] The buggy address is located 0 bytes inside of
[   12.026056]  freed 32-byte region [ffff88810312f180, ffff88810312f1a0)
[   12.026755] 
[   12.026847] The buggy address belongs to the physical page:
[   12.027082] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10312f
[   12.027456] flags: 0x200000000000000(node=0|zone=2)
[   12.027713] page_type: f5(slab)
[   12.028262] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   12.028830] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   12.029290] page dumped because: kasan: bad access detected
[   12.029701] 
[   12.029853] Memory state around the buggy address:
[   12.030309]  ffff88810312f080: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   12.030859]  ffff88810312f100: fa fb fb fb fc fc fc fc 00 00 00 07 fc fc fc fc
[   12.031272] >ffff88810312f180: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   12.031904]                    ^
[   12.032053]  ffff88810312f200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.032455]  ffff88810312f280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.033018] ==================================================================