Hay
Date
June 18, 2025, 6:43 a.m.

Environment
qemu-arm64
qemu-x86_64

[   21.685965] ==================================================================
[   21.686102] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x480/0x4a8
[   21.686259] Read of size 8 at addr fff00000c7707100 by task kunit_try_catch/210
[   21.686316] 
[   21.686567] CPU: 0 UID: 0 PID: 210 Comm: kunit_try_catch Tainted: G    B   W        N  6.16.0-rc2-next-20250618 #1 PREEMPT 
[   21.686713] Tainted: [B]=BAD_PAGE, [W]=WARN, [N]=TEST
[   21.686844] Hardware name: linux,dummy-virt (DT)
[   21.687000] Call trace:
[   21.687084]  show_stack+0x20/0x38 (C)
[   21.687359]  dump_stack_lvl+0x8c/0xd0
[   21.687602]  print_report+0x118/0x608
[   21.687670]  kasan_report+0xdc/0x128
[   21.687771]  __asan_report_load8_noabort+0x20/0x30
[   21.688086]  workqueue_uaf+0x480/0x4a8
[   21.688341]  kunit_try_run_case+0x170/0x3f0
[   21.688560]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   21.688755]  kthread+0x328/0x630
[   21.689145]  ret_from_fork+0x10/0x20
[   21.689280] 
[   21.689463] Allocated by task 210:
[   21.689597]  kasan_save_stack+0x3c/0x68
[   21.689740]  kasan_save_track+0x20/0x40
[   21.689792]  kasan_save_alloc_info+0x40/0x58
[   21.690114]  __kasan_kmalloc+0xd4/0xd8
[   21.690216]  __kmalloc_cache_noprof+0x16c/0x3c0
[   21.690314]  workqueue_uaf+0x13c/0x4a8
[   21.690552]  kunit_try_run_case+0x170/0x3f0
[   21.690610]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   21.690660]  kthread+0x328/0x630
[   21.690753]  ret_from_fork+0x10/0x20
[   21.690807] 
[   21.690833] Freed by task 11:
[   21.690901]  kasan_save_stack+0x3c/0x68
[   21.690954]  kasan_save_track+0x20/0x40
[   21.691037]  kasan_save_free_info+0x4c/0x78
[   21.691258]  __kasan_slab_free+0x6c/0x98
[   21.691324]  kfree+0x214/0x3c8
[   21.691360]  workqueue_uaf_work+0x18/0x30
[   21.691404]  process_one_work+0x530/0xf98
[   21.691443]  worker_thread+0x618/0xf38
[   21.691483]  kthread+0x328/0x630
[   21.691514]  ret_from_fork+0x10/0x20
[   21.691552] 
[   21.692108] Last potentially related work creation:
[   21.692151]  kasan_save_stack+0x3c/0x68
[   21.692206]  kasan_record_aux_stack+0xb4/0xc8
[   21.692261]  __queue_work+0x65c/0xfe0
[   21.692304]  queue_work_on+0xbc/0xf8
[   21.692340]  workqueue_uaf+0x210/0x4a8
[   21.692381]  kunit_try_run_case+0x170/0x3f0
[   21.692422]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   21.692470]  kthread+0x328/0x630
[   21.692507]  ret_from_fork+0x10/0x20
[   21.692557] 
[   21.692582] The buggy address belongs to the object at fff00000c7707100
[   21.692582]  which belongs to the cache kmalloc-32 of size 32
[   21.694252] The buggy address is located 0 bytes inside of
[   21.694252]  freed 32-byte region [fff00000c7707100, fff00000c7707120)
[   21.694362] 
[   21.694542] The buggy address belongs to the physical page:
[   21.694582] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x107707
[   21.694794] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   21.694860] page_type: f5(slab)
[   21.694914] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   21.695149] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   21.695342] page dumped because: kasan: bad access detected
[   21.695561] 
[   21.695597] Memory state around the buggy address:
[   21.695640]  fff00000c7707000: 00 00 03 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   21.695693]  fff00000c7707080: 00 00 00 fc fc fc fc fc 00 00 00 07 fc fc fc fc
[   21.695761] >fff00000c7707100: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   21.695806]                    ^
[   21.695839]  fff00000c7707180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   21.695888]  fff00000c7707200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   21.695933] ==================================================================

[   11.752067] ==================================================================
[   11.752785] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x4d6/0x560
[   11.753328] Read of size 8 at addr ffff88810387ab40 by task kunit_try_catch/226
[   11.753581] 
[   11.753881] CPU: 1 UID: 0 PID: 226 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc2-next-20250618 #1 PREEMPT(voluntary) 
[   11.753933] Tainted: [B]=BAD_PAGE, [N]=TEST
[   11.753945] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   11.753966] Call Trace:
[   11.753978]  <TASK>
[   11.754152]  dump_stack_lvl+0x73/0xb0
[   11.754186]  print_report+0xd1/0x650
[   11.754220]  ? __virt_addr_valid+0x1db/0x2d0
[   11.754241]  ? workqueue_uaf+0x4d6/0x560
[   11.754261]  ? kasan_complete_mode_report_info+0x64/0x200
[   11.754285]  ? workqueue_uaf+0x4d6/0x560
[   11.754304]  kasan_report+0x141/0x180
[   11.754324]  ? workqueue_uaf+0x4d6/0x560
[   11.754348]  __asan_report_load8_noabort+0x18/0x20
[   11.754370]  workqueue_uaf+0x4d6/0x560
[   11.754391]  ? __pfx_workqueue_uaf+0x10/0x10
[   11.754412]  ? __schedule+0x10cc/0x2b60
[   11.754433]  ? __pfx_read_tsc+0x10/0x10
[   11.754453]  ? ktime_get_ts64+0x86/0x230
[   11.754477]  kunit_try_run_case+0x1a5/0x480
[   11.754499]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.754520]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   11.754542]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   11.754562]  ? __kthread_parkme+0x82/0x180
[   11.754582]  ? preempt_count_sub+0x50/0x80
[   11.754606]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.754628]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.754649]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   11.754670]  kthread+0x337/0x6f0
[   11.754688]  ? trace_preempt_on+0x20/0xc0
[   11.754711]  ? __pfx_kthread+0x10/0x10
[   11.754730]  ? _raw_spin_unlock_irq+0x47/0x80
[   11.754749]  ? calculate_sigpending+0x7b/0xa0
[   11.754771]  ? __pfx_kthread+0x10/0x10
[   11.754791]  ret_from_fork+0x116/0x1d0
[   11.754809]  ? __pfx_kthread+0x10/0x10
[   11.754828]  ret_from_fork_asm+0x1a/0x30
[   11.754856]  </TASK>
[   11.754866] 
[   11.765515] Allocated by task 226:
[   11.765842]  kasan_save_stack+0x45/0x70
[   11.766133]  kasan_save_track+0x18/0x40
[   11.766326]  kasan_save_alloc_info+0x3b/0x50
[   11.766527]  __kasan_kmalloc+0xb7/0xc0
[   11.766694]  __kmalloc_cache_noprof+0x189/0x420
[   11.766896]  workqueue_uaf+0x152/0x560
[   11.767075]  kunit_try_run_case+0x1a5/0x480
[   11.767274]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.767505]  kthread+0x337/0x6f0
[   11.767654]  ret_from_fork+0x116/0x1d0
[   11.767822]  ret_from_fork_asm+0x1a/0x30
[   11.768001] 
[   11.768075] Freed by task 41:
[   11.768875]  kasan_save_stack+0x45/0x70
[   11.769115]  kasan_save_track+0x18/0x40
[   11.769413]  kasan_save_free_info+0x3f/0x60
[   11.769641]  __kasan_slab_free+0x56/0x70
[   11.769820]  kfree+0x222/0x3f0
[   11.770150]  workqueue_uaf_work+0x12/0x20
[   11.770536]  process_one_work+0x5ee/0xf60
[   11.770730]  worker_thread+0x758/0x1220
[   11.770938]  kthread+0x337/0x6f0
[   11.771051]  ret_from_fork+0x116/0x1d0
[   11.771306]  ret_from_fork_asm+0x1a/0x30
[   11.771787] 
[   11.771898] Last potentially related work creation:
[   11.772246]  kasan_save_stack+0x45/0x70
[   11.772590]  kasan_record_aux_stack+0xb2/0xc0
[   11.772815]  __queue_work+0x61a/0xe70
[   11.772995]  queue_work_on+0xb6/0xc0
[   11.773340]  workqueue_uaf+0x26d/0x560
[   11.773613]  kunit_try_run_case+0x1a5/0x480
[   11.773910]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.774245]  kthread+0x337/0x6f0
[   11.774421]  ret_from_fork+0x116/0x1d0
[   11.774834]  ret_from_fork_asm+0x1a/0x30
[   11.775023] 
[   11.775111] The buggy address belongs to the object at ffff88810387ab40
[   11.775111]  which belongs to the cache kmalloc-32 of size 32
[   11.775937] The buggy address is located 0 bytes inside of
[   11.775937]  freed 32-byte region [ffff88810387ab40, ffff88810387ab60)
[   11.776763] 
[   11.776864] The buggy address belongs to the physical page:
[   11.777079] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10387a
[   11.777851] flags: 0x200000000000000(node=0|zone=2)
[   11.778109] page_type: f5(slab)
[   11.778471] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   11.778925] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   11.779482] page dumped because: kasan: bad access detected
[   11.779742] 
[   11.779954] Memory state around the buggy address:
[   11.780140]  ffff88810387aa00: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   11.780570]  ffff88810387aa80: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   11.781047] >ffff88810387ab00: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   11.781572]                                            ^
[   11.781990]  ffff88810387ab80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.782673]  ffff88810387ac00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.783080] ==================================================================