Hay
Date
June 25, 2025, 8:08 a.m.

Environment
qemu-arm64
qemu-x86_64

[   27.220860] ==================================================================
[   27.220940] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x480/0x4a8
[   27.221008] Read of size 8 at addr fff00000c7894ec0 by task kunit_try_catch/212
[   27.221059] 
[   27.221097] CPU: 1 UID: 0 PID: 212 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc3-next-20250625 #1 PREEMPT 
[   27.221185] Tainted: [B]=BAD_PAGE, [N]=TEST
[   27.221212] Hardware name: linux,dummy-virt (DT)
[   27.221245] Call trace:
[   27.221268]  show_stack+0x20/0x38 (C)
[   27.221320]  dump_stack_lvl+0x8c/0xd0
[   27.221369]  print_report+0x118/0x608
[   27.221431]  kasan_report+0xdc/0x128
[   27.221491]  __asan_report_load8_noabort+0x20/0x30
[   27.221539]  workqueue_uaf+0x480/0x4a8
[   27.221582]  kunit_try_run_case+0x170/0x3f0
[   27.221631]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   27.222059]  kthread+0x328/0x630
[   27.222578]  ret_from_fork+0x10/0x20
[   27.222985] 
[   27.223232] Allocated by task 212:
[   27.223328]  kasan_save_stack+0x3c/0x68
[   27.223402]  kasan_save_track+0x20/0x40
[   27.223440]  kasan_save_alloc_info+0x40/0x58
[   27.223702]  __kasan_kmalloc+0xd4/0xd8
[   27.223805]  __kmalloc_cache_noprof+0x16c/0x3c0
[   27.224252]  workqueue_uaf+0x13c/0x4a8
[   27.224311]  kunit_try_run_case+0x170/0x3f0
[   27.224348]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   27.224392]  kthread+0x328/0x630
[   27.224436]  ret_from_fork+0x10/0x20
[   27.224474] 
[   27.224495] Freed by task 48:
[   27.224520]  kasan_save_stack+0x3c/0x68
[   27.224557]  kasan_save_track+0x20/0x40
[   27.224595]  kasan_save_free_info+0x4c/0x78
[   27.224630]  __kasan_slab_free+0x6c/0x98
[   27.224707]  kfree+0x214/0x3c8
[   27.224741]  workqueue_uaf_work+0x18/0x30
[   27.224778]  process_one_work+0x530/0xf98
[   27.225090]  worker_thread+0x618/0xf38
[   27.225132]  kthread+0x328/0x630
[   27.225166]  ret_from_fork+0x10/0x20
[   27.225203] 
[   27.225225] Last potentially related work creation:
[   27.225253]  kasan_save_stack+0x3c/0x68
[   27.225290]  kasan_record_aux_stack+0xb4/0xc8
[   27.225369]  __queue_work+0x65c/0xfe0
[   27.225829]  queue_work_on+0xbc/0xf8
[   27.225871]  workqueue_uaf+0x210/0x4a8
[   27.225934]  kunit_try_run_case+0x170/0x3f0
[   27.225971]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   27.226015]  kthread+0x328/0x630
[   27.226047]  ret_from_fork+0x10/0x20
[   27.226086] 
[   27.226106] The buggy address belongs to the object at fff00000c7894ec0
[   27.226106]  which belongs to the cache kmalloc-32 of size 32
[   27.226670] The buggy address is located 0 bytes inside of
[   27.226670]  freed 32-byte region [fff00000c7894ec0, fff00000c7894ee0)
[   27.226769] 
[   27.226844] The buggy address belongs to the physical page:
[   27.226906] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x107894
[   27.226960] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   27.227011] page_type: f5(slab)
[   27.227060] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   27.227240] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   27.227341] page dumped because: kasan: bad access detected
[   27.227374] 
[   27.227392] Memory state around the buggy address:
[   27.227436]  fff00000c7894d80: 00 00 00 fc fc fc fc fc 00 00 03 fc fc fc fc fc
[   27.227478]  fff00000c7894e00: 00 00 07 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   27.227725] >fff00000c7894e80: 00 00 00 07 fc fc fc fc fa fb fb fb fc fc fc fc
[   27.227769]                                            ^
[   27.227805]  fff00000c7894f00: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc
[   27.227847]  fff00000c7894f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   27.228104] ==================================================================

[   22.476579] ==================================================================
[   22.477024] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x4d6/0x560
[   22.477408] Read of size 8 at addr ffff88810258c8c0 by task kunit_try_catch/229
[   22.477705] 
[   22.477830] CPU: 0 UID: 0 PID: 229 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc3-next-20250625 #1 PREEMPT(voluntary) 
[   22.477878] Tainted: [B]=BAD_PAGE, [N]=TEST
[   22.477890] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   22.477911] Call Trace:
[   22.477926]  <TASK>
[   22.477954]  dump_stack_lvl+0x73/0xb0
[   22.477984]  print_report+0xd1/0x650
[   22.478005]  ? __virt_addr_valid+0x1db/0x2d0
[   22.478030]  ? workqueue_uaf+0x4d6/0x560
[   22.478083]  ? kasan_complete_mode_report_info+0x64/0x200
[   22.478110]  ? workqueue_uaf+0x4d6/0x560
[   22.478131]  kasan_report+0x141/0x180
[   22.478154]  ? workqueue_uaf+0x4d6/0x560
[   22.478179]  __asan_report_load8_noabort+0x18/0x20
[   22.478203]  workqueue_uaf+0x4d6/0x560
[   22.478225]  ? __pfx_workqueue_uaf+0x10/0x10
[   22.478248]  ? __schedule+0x10cc/0x2b60
[   22.478530]  ? __pfx_read_tsc+0x10/0x10
[   22.478567]  ? ktime_get_ts64+0x86/0x230
[   22.478610]  kunit_try_run_case+0x1a5/0x480
[   22.478638]  ? __pfx_kunit_try_run_case+0x10/0x10
[   22.478663]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   22.478686]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   22.478711]  ? __kthread_parkme+0x82/0x180
[   22.478733]  ? preempt_count_sub+0x50/0x80
[   22.478757]  ? __pfx_kunit_try_run_case+0x10/0x10
[   22.478782]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   22.478806]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   22.479133]  kthread+0x337/0x6f0
[   22.479158]  ? trace_preempt_on+0x20/0xc0
[   22.479184]  ? __pfx_kthread+0x10/0x10
[   22.479206]  ? _raw_spin_unlock_irq+0x47/0x80
[   22.479231]  ? calculate_sigpending+0x7b/0xa0
[   22.479255]  ? __pfx_kthread+0x10/0x10
[   22.479277]  ret_from_fork+0x116/0x1d0
[   22.479297]  ? __pfx_kthread+0x10/0x10
[   22.479318]  ret_from_fork_asm+0x1a/0x30
[   22.479348]  </TASK>
[   22.479360] 
[   22.488912] Allocated by task 229:
[   22.489085]  kasan_save_stack+0x45/0x70
[   22.489333]  kasan_save_track+0x18/0x40
[   22.489552]  kasan_save_alloc_info+0x3b/0x50
[   22.489735]  __kasan_kmalloc+0xb7/0xc0
[   22.489957]  __kmalloc_cache_noprof+0x189/0x420
[   22.490155]  workqueue_uaf+0x152/0x560
[   22.490276]  kunit_try_run_case+0x1a5/0x480
[   22.490411]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   22.491082]  kthread+0x337/0x6f0
[   22.491292]  ret_from_fork+0x116/0x1d0
[   22.491470]  ret_from_fork_asm+0x1a/0x30
[   22.491622] 
[   22.491721] Freed by task 9:
[   22.492032]  kasan_save_stack+0x45/0x70
[   22.492243]  kasan_save_track+0x18/0x40
[   22.492510]  kasan_save_free_info+0x3f/0x60
[   22.492722]  __kasan_slab_free+0x56/0x70
[   22.493030]  kfree+0x222/0x3f0
[   22.493158]  workqueue_uaf_work+0x12/0x20
[   22.493284]  process_one_work+0x5ee/0xf60
[   22.493412]  worker_thread+0x758/0x1220
[   22.493538]  kthread+0x337/0x6f0
[   22.493799]  ret_from_fork+0x116/0x1d0
[   22.494113]  ret_from_fork_asm+0x1a/0x30
[   22.494331] 
[   22.494431] Last potentially related work creation:
[   22.494714]  kasan_save_stack+0x45/0x70
[   22.495450]  kasan_record_aux_stack+0xb2/0xc0
[   22.495627]  __queue_work+0x61a/0xe70
[   22.496333]  queue_work_on+0xb6/0xc0
[   22.496477]  workqueue_uaf+0x26d/0x560
[   22.496877]  kunit_try_run_case+0x1a5/0x480
[   22.497351]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   22.497684]  kthread+0x337/0x6f0
[   22.497968]  ret_from_fork+0x116/0x1d0
[   22.498134]  ret_from_fork_asm+0x1a/0x30
[   22.498512] 
[   22.498609] The buggy address belongs to the object at ffff88810258c8c0
[   22.498609]  which belongs to the cache kmalloc-32 of size 32
[   22.499413] The buggy address is located 0 bytes inside of
[   22.499413]  freed 32-byte region [ffff88810258c8c0, ffff88810258c8e0)
[   22.500017] 
[   22.500117] The buggy address belongs to the physical page:
[   22.500374] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10258c
[   22.500702] flags: 0x200000000000000(node=0|zone=2)
[   22.501000] page_type: f5(slab)
[   22.501177] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   22.501500] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   22.501861] page dumped because: kasan: bad access detected
[   22.502202] 
[   22.502297] Memory state around the buggy address:
[   22.502514]  ffff88810258c780: 00 00 05 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   22.502823]  ffff88810258c800: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   22.503370] >ffff88810258c880: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   22.503639]                                            ^
[   22.503865]  ffff88810258c900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.504174]  ffff88810258c980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.504457] ==================================================================