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

Environment
qemu-x86_64

[   13.553539] ==================================================================
[   13.554179] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x4d6/0x560
[   13.554525] Read of size 8 at addr ffff88810389fc40 by task kunit_try_catch/218
[   13.554855] 
[   13.554999] CPU: 1 UID: 0 PID: 218 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc6 #1 PREEMPT(voluntary) 
[   13.555047] Tainted: [B]=BAD_PAGE, [N]=TEST
[   13.555058] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   13.555081] Call Trace:
[   13.555094]  <TASK>
[   13.555111]  dump_stack_lvl+0x73/0xb0
[   13.555142]  print_report+0xd1/0x610
[   13.555166]  ? __virt_addr_valid+0x1db/0x2d0
[   13.555271]  ? workqueue_uaf+0x4d6/0x560
[   13.555293]  ? kasan_complete_mode_report_info+0x64/0x200
[   13.555315]  ? workqueue_uaf+0x4d6/0x560
[   13.555337]  kasan_report+0x141/0x180
[   13.555359]  ? workqueue_uaf+0x4d6/0x560
[   13.555386]  __asan_report_load8_noabort+0x18/0x20
[   13.555410]  workqueue_uaf+0x4d6/0x560
[   13.555432]  ? __pfx_workqueue_uaf+0x10/0x10
[   13.555455]  ? __schedule+0x10c6/0x2b60
[   13.555492]  ? __pfx_read_tsc+0x10/0x10
[   13.555515]  ? ktime_get_ts64+0x86/0x230
[   13.555540]  kunit_try_run_case+0x1a5/0x480
[   13.555565]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.555608]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   13.555634]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   13.555657]  ? __kthread_parkme+0x82/0x180
[   13.555679]  ? preempt_count_sub+0x50/0x80
[   13.555703]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.555727]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.555751]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   13.555774]  kthread+0x337/0x6f0
[   13.555806]  ? trace_preempt_on+0x20/0xc0
[   13.555849]  ? __pfx_kthread+0x10/0x10
[   13.555870]  ? _raw_spin_unlock_irq+0x47/0x80
[   13.555892]  ? calculate_sigpending+0x7b/0xa0
[   13.555917]  ? __pfx_kthread+0x10/0x10
[   13.555938]  ret_from_fork+0x116/0x1d0
[   13.555957]  ? __pfx_kthread+0x10/0x10
[   13.555978]  ret_from_fork_asm+0x1a/0x30
[   13.556009]  </TASK>
[   13.556018] 
[   13.565001] Allocated by task 218:
[   13.565198]  kasan_save_stack+0x45/0x70
[   13.565426]  kasan_save_track+0x18/0x40
[   13.565657]  kasan_save_alloc_info+0x3b/0x50
[   13.565886]  __kasan_kmalloc+0xb7/0xc0
[   13.566231]  __kmalloc_cache_noprof+0x189/0x420
[   13.566461]  workqueue_uaf+0x152/0x560
[   13.566774]  kunit_try_run_case+0x1a5/0x480
[   13.567135]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.567323]  kthread+0x337/0x6f0
[   13.567483]  ret_from_fork+0x116/0x1d0
[   13.567680]  ret_from_fork_asm+0x1a/0x30
[   13.568019] 
[   13.568119] Freed by task 44:
[   13.568258]  kasan_save_stack+0x45/0x70
[   13.568526]  kasan_save_track+0x18/0x40
[   13.568712]  kasan_save_free_info+0x3f/0x60
[   13.568942]  __kasan_slab_free+0x56/0x70
[   13.569212]  kfree+0x222/0x3f0
[   13.569494]  workqueue_uaf_work+0x12/0x20
[   13.569679]  process_one_work+0x5ee/0xf60
[   13.569901]  worker_thread+0x758/0x1220
[   13.570244]  kthread+0x337/0x6f0
[   13.570392]  ret_from_fork+0x116/0x1d0
[   13.570623]  ret_from_fork_asm+0x1a/0x30
[   13.570867] 
[   13.570993] Last potentially related work creation:
[   13.571356]  kasan_save_stack+0x45/0x70
[   13.571633]  kasan_record_aux_stack+0xb2/0xc0
[   13.571884]  __queue_work+0x626/0xeb0
[   13.572087]  queue_work_on+0xb6/0xc0
[   13.572263]  workqueue_uaf+0x26d/0x560
[   13.572510]  kunit_try_run_case+0x1a5/0x480
[   13.572706]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.573031]  kthread+0x337/0x6f0
[   13.573232]  ret_from_fork+0x116/0x1d0
[   13.573412]  ret_from_fork_asm+0x1a/0x30
[   13.573611] 
[   13.573728] The buggy address belongs to the object at ffff88810389fc40
[   13.573728]  which belongs to the cache kmalloc-32 of size 32
[   13.574296] The buggy address is located 0 bytes inside of
[   13.574296]  freed 32-byte region [ffff88810389fc40, ffff88810389fc60)
[   13.574835] 
[   13.574941] The buggy address belongs to the physical page:
[   13.575198] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10389f
[   13.575550] flags: 0x200000000000000(node=0|zone=2)
[   13.575721] page_type: f5(slab)
[   13.575846] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   13.576080] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   13.576790] page dumped because: kasan: bad access detected
[   13.577241] 
[   13.577381] Memory state around the buggy address:
[   13.577657]  ffff88810389fb00: 00 00 00 fc fc fc fc fc 00 00 03 fc fc fc fc fc
[   13.578381]  ffff88810389fb80: 00 00 07 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   13.578735] >ffff88810389fc00: 00 00 00 07 fc fc fc fc fa fb fb fb fc fc fc fc
[   13.579119]                                            ^
[   13.579341]  ffff88810389fc80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   13.579577]  ffff88810389fd00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   13.579999] ==================================================================