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

Environment
qemu-x86_64

[   13.138049] ==================================================================
[   13.138453] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x4d6/0x560
[   13.138827] Read of size 8 at addr ffff888102b87bc0 by task kunit_try_catch/218
[   13.139739] 
[   13.139876] CPU: 0 UID: 0 PID: 218 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5 #1 PREEMPT(voluntary) 
[   13.139924] Tainted: [B]=BAD_PAGE, [N]=TEST
[   13.139936] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   13.139957] Call Trace:
[   13.139971]  <TASK>
[   13.139989]  dump_stack_lvl+0x73/0xb0
[   13.140023]  print_report+0xd1/0x650
[   13.140047]  ? __virt_addr_valid+0x1db/0x2d0
[   13.140071]  ? workqueue_uaf+0x4d6/0x560
[   13.140092]  ? kasan_complete_mode_report_info+0x64/0x200
[   13.140115]  ? workqueue_uaf+0x4d6/0x560
[   13.140301]  kasan_report+0x141/0x180
[   13.140324]  ? workqueue_uaf+0x4d6/0x560
[   13.140350]  __asan_report_load8_noabort+0x18/0x20
[   13.140374]  workqueue_uaf+0x4d6/0x560
[   13.140395]  ? __pfx_workqueue_uaf+0x10/0x10
[   13.140417]  ? __schedule+0x10cc/0x2b60
[   13.140440]  ? __pfx_read_tsc+0x10/0x10
[   13.140462]  ? ktime_get_ts64+0x86/0x230
[   13.140488]  kunit_try_run_case+0x1a5/0x480
[   13.140512]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.140534]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   13.140559]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   13.140583]  ? __kthread_parkme+0x82/0x180
[   13.140615]  ? preempt_count_sub+0x50/0x80
[   13.140639]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.140663]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.140687]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   13.140711]  kthread+0x337/0x6f0
[   13.140730]  ? trace_preempt_on+0x20/0xc0
[   13.140754]  ? __pfx_kthread+0x10/0x10
[   13.140774]  ? _raw_spin_unlock_irq+0x47/0x80
[   13.140795]  ? calculate_sigpending+0x7b/0xa0
[   13.140819]  ? __pfx_kthread+0x10/0x10
[   13.140840]  ret_from_fork+0x116/0x1d0
[   13.140858]  ? __pfx_kthread+0x10/0x10
[   13.140878]  ret_from_fork_asm+0x1a/0x30
[   13.140911]  </TASK>
[   13.140981] 
[   13.150641] Allocated by task 218:
[   13.151037]  kasan_save_stack+0x45/0x70
[   13.151226]  kasan_save_track+0x18/0x40
[   13.151400]  kasan_save_alloc_info+0x3b/0x50
[   13.151852]  __kasan_kmalloc+0xb7/0xc0
[   13.152188]  __kmalloc_cache_noprof+0x189/0x420
[   13.152412]  workqueue_uaf+0x152/0x560
[   13.152577]  kunit_try_run_case+0x1a5/0x480
[   13.152777]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.153015]  kthread+0x337/0x6f0
[   13.153164]  ret_from_fork+0x116/0x1d0
[   13.153348]  ret_from_fork_asm+0x1a/0x30
[   13.153520] 
[   13.154095] Freed by task 9:
[   13.154245]  kasan_save_stack+0x45/0x70
[   13.154425]  kasan_save_track+0x18/0x40
[   13.154610]  kasan_save_free_info+0x3f/0x60
[   13.155129]  __kasan_slab_free+0x56/0x70
[   13.155322]  kfree+0x222/0x3f0
[   13.155621]  workqueue_uaf_work+0x12/0x20
[   13.155875]  process_one_work+0x5ee/0xf60
[   13.156162]  worker_thread+0x758/0x1220
[   13.156416]  kthread+0x337/0x6f0
[   13.156550]  ret_from_fork+0x116/0x1d0
[   13.156934]  ret_from_fork_asm+0x1a/0x30
[   13.157274] 
[   13.157379] Last potentially related work creation:
[   13.157651]  kasan_save_stack+0x45/0x70
[   13.158228]  kasan_record_aux_stack+0xb2/0xc0
[   13.158526]  __queue_work+0x626/0xeb0
[   13.158870]  queue_work_on+0xb6/0xc0
[   13.159086]  workqueue_uaf+0x26d/0x560
[   13.159395]  kunit_try_run_case+0x1a5/0x480
[   13.159593]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.159848]  kthread+0x337/0x6f0
[   13.160235]  ret_from_fork+0x116/0x1d0
[   13.160427]  ret_from_fork_asm+0x1a/0x30
[   13.160808] 
[   13.160898] The buggy address belongs to the object at ffff888102b87bc0
[   13.160898]  which belongs to the cache kmalloc-32 of size 32
[   13.161446] The buggy address is located 0 bytes inside of
[   13.161446]  freed 32-byte region [ffff888102b87bc0, ffff888102b87be0)
[   13.162354] 
[   13.162511] The buggy address belongs to the physical page:
[   13.162774] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102b87
[   13.163514] flags: 0x200000000000000(node=0|zone=2)
[   13.163841] page_type: f5(slab)
[   13.164149] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   13.164503] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   13.164912] page dumped because: kasan: bad access detected
[   13.165151] 
[   13.165222] Memory state around the buggy address:
[   13.165426]  ffff888102b87a80: 00 00 05 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   13.166104]  ffff888102b87b00: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   13.166357] >ffff888102b87b80: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   13.166934]                                            ^
[   13.167229]  ffff888102b87c00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   13.167724]  ffff888102b87c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   13.168097] ==================================================================