Hay
Date
July 9, 2025, 12:11 a.m.

Environment
qemu-arm64
qemu-x86_64

[   20.022964] ==================================================================
[   20.023046] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x480/0x4a8
[   20.023443] Read of size 8 at addr fff00000c64b3f00 by task kunit_try_catch/201
[   20.023533] 
[   20.023569] CPU: 1 UID: 0 PID: 201 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5 #1 PREEMPT 
[   20.023743] Tainted: [B]=BAD_PAGE, [N]=TEST
[   20.023792] Hardware name: linux,dummy-virt (DT)
[   20.023831] Call trace:
[   20.023860]  show_stack+0x20/0x38 (C)
[   20.024080]  dump_stack_lvl+0x8c/0xd0
[   20.024316]  print_report+0x118/0x608
[   20.024484]  kasan_report+0xdc/0x128
[   20.024584]  __asan_report_load8_noabort+0x20/0x30
[   20.024672]  workqueue_uaf+0x480/0x4a8
[   20.024802]  kunit_try_run_case+0x170/0x3f0
[   20.024855]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   20.025058]  kthread+0x328/0x630
[   20.025119]  ret_from_fork+0x10/0x20
[   20.025318] 
[   20.025460] Allocated by task 201:
[   20.025528]  kasan_save_stack+0x3c/0x68
[   20.025610]  kasan_save_track+0x20/0x40
[   20.025741]  kasan_save_alloc_info+0x40/0x58
[   20.025807]  __kasan_kmalloc+0xd4/0xd8
[   20.025876]  __kmalloc_cache_noprof+0x16c/0x3c0
[   20.026226]  workqueue_uaf+0x13c/0x4a8
[   20.026365]  kunit_try_run_case+0x170/0x3f0
[   20.026440]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   20.026563]  kthread+0x328/0x630
[   20.026642]  ret_from_fork+0x10/0x20
[   20.026714] 
[   20.026785] Freed by task 48:
[   20.026823]  kasan_save_stack+0x3c/0x68
[   20.026879]  kasan_save_track+0x20/0x40
[   20.027233]  kasan_save_free_info+0x4c/0x78
[   20.027309]  __kasan_slab_free+0x6c/0x98
[   20.027459]  kfree+0x214/0x3c8
[   20.027526]  workqueue_uaf_work+0x18/0x30
[   20.027659]  process_one_work+0x530/0xf98
[   20.027730]  worker_thread+0x618/0xf38
[   20.027767]  kthread+0x328/0x630
[   20.028051]  ret_from_fork+0x10/0x20
[   20.028263] 
[   20.028376] Last potentially related work creation:
[   20.028477]  kasan_save_stack+0x3c/0x68
[   20.028619]  kasan_record_aux_stack+0xb4/0xc8
[   20.028785]  __queue_work+0x65c/0x1008
[   20.028832]  queue_work_on+0xbc/0xf8
[   20.028870]  workqueue_uaf+0x210/0x4a8
[   20.028915]  kunit_try_run_case+0x170/0x3f0
[   20.028959]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   20.029006]  kthread+0x328/0x630
[   20.029040]  ret_from_fork+0x10/0x20
[   20.029769] 
[   20.030234] The buggy address belongs to the object at fff00000c64b3f00
[   20.030234]  which belongs to the cache kmalloc-32 of size 32
[   20.030439] The buggy address is located 0 bytes inside of
[   20.030439]  freed 32-byte region [fff00000c64b3f00, fff00000c64b3f20)
[   20.030576] 
[   20.030616] The buggy address belongs to the physical page:
[   20.030665] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1064b3
[   20.032613] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   20.032960] page_type: f5(slab)
[   20.033178] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   20.033256] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   20.033564] page dumped because: kasan: bad access detected
[   20.033786] 
[   20.033832] Memory state around the buggy address:
[   20.033869]  fff00000c64b3e00: 00 00 03 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   20.034059]  fff00000c64b3e80: 00 00 00 07 fc fc fc fc 00 00 00 fc fc fc fc fc
[   20.034277] >fff00000c64b3f00: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   20.034361]                    ^
[   20.034433]  fff00000c64b3f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   20.034496]  fff00000c64b4000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   20.034810] ==================================================================

[   13.284676] ==================================================================
[   13.285138] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x4d6/0x560
[   13.285459] Read of size 8 at addr ffff8881026ae780 by task kunit_try_catch/217
[   13.286106] 
[   13.286216] CPU: 0 UID: 0 PID: 217 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5 #1 PREEMPT(voluntary) 
[   13.286273] Tainted: [B]=BAD_PAGE, [N]=TEST
[   13.286285] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   13.286307] Call Trace:
[   13.286319]  <TASK>
[   13.286337]  dump_stack_lvl+0x73/0xb0
[   13.286372]  print_report+0xd1/0x650
[   13.286395]  ? __virt_addr_valid+0x1db/0x2d0
[   13.286419]  ? workqueue_uaf+0x4d6/0x560
[   13.286439]  ? kasan_complete_mode_report_info+0x64/0x200
[   13.286462]  ? workqueue_uaf+0x4d6/0x560
[   13.286483]  kasan_report+0x141/0x180
[   13.286504]  ? workqueue_uaf+0x4d6/0x560
[   13.286530]  __asan_report_load8_noabort+0x18/0x20
[   13.286554]  workqueue_uaf+0x4d6/0x560
[   13.286576]  ? __pfx_workqueue_uaf+0x10/0x10
[   13.286597]  ? __schedule+0x10cc/0x2b60
[   13.286619]  ? __pfx_read_tsc+0x10/0x10
[   13.286640]  ? ktime_get_ts64+0x86/0x230
[   13.286665]  kunit_try_run_case+0x1a5/0x480
[   13.286690]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.286719]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   13.286743]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   13.286766]  ? __kthread_parkme+0x82/0x180
[   13.286787]  ? preempt_count_sub+0x50/0x80
[   13.286811]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.286834]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.286859]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   13.286883]  kthread+0x337/0x6f0
[   13.286901]  ? trace_preempt_on+0x20/0xc0
[   13.286935]  ? __pfx_kthread+0x10/0x10
[   13.287202]  ? _raw_spin_unlock_irq+0x47/0x80
[   13.287230]  ? calculate_sigpending+0x7b/0xa0
[   13.287255]  ? __pfx_kthread+0x10/0x10
[   13.287296]  ret_from_fork+0x116/0x1d0
[   13.287316]  ? __pfx_kthread+0x10/0x10
[   13.287375]  ret_from_fork_asm+0x1a/0x30
[   13.287406]  </TASK>
[   13.287419] 
[   13.298832] Allocated by task 217:
[   13.299182]  kasan_save_stack+0x45/0x70
[   13.299842]  kasan_save_track+0x18/0x40
[   13.300078]  kasan_save_alloc_info+0x3b/0x50
[   13.300462]  __kasan_kmalloc+0xb7/0xc0
[   13.300657]  __kmalloc_cache_noprof+0x189/0x420
[   13.300868]  workqueue_uaf+0x152/0x560
[   13.301441]  kunit_try_run_case+0x1a5/0x480
[   13.301630]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.301867]  kthread+0x337/0x6f0
[   13.302221]  ret_from_fork+0x116/0x1d0
[   13.302622]  ret_from_fork_asm+0x1a/0x30
[   13.302805] 
[   13.302897] Freed by task 9:
[   13.303243]  kasan_save_stack+0x45/0x70
[   13.303423]  kasan_save_track+0x18/0x40
[   13.303603]  kasan_save_free_info+0x3f/0x60
[   13.303797]  __kasan_slab_free+0x56/0x70
[   13.304215]  kfree+0x222/0x3f0
[   13.304500]  workqueue_uaf_work+0x12/0x20
[   13.304686]  process_one_work+0x5ee/0xf60
[   13.304871]  worker_thread+0x758/0x1220
[   13.305229]  kthread+0x337/0x6f0
[   13.305398]  ret_from_fork+0x116/0x1d0
[   13.305572]  ret_from_fork_asm+0x1a/0x30
[   13.305754] 
[   13.305841] Last potentially related work creation:
[   13.306099]  kasan_save_stack+0x45/0x70
[   13.306300]  kasan_record_aux_stack+0xb2/0xc0
[   13.306497]  __queue_work+0x626/0xeb0
[   13.306670]  queue_work_on+0xb6/0xc0
[   13.306842]  workqueue_uaf+0x26d/0x560
[   13.307065]  kunit_try_run_case+0x1a5/0x480
[   13.307262]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.307490]  kthread+0x337/0x6f0
[   13.307638]  ret_from_fork+0x116/0x1d0
[   13.307806]  ret_from_fork_asm+0x1a/0x30
[   13.308038] 
[   13.308127] The buggy address belongs to the object at ffff8881026ae780
[   13.308127]  which belongs to the cache kmalloc-32 of size 32
[   13.308743] The buggy address is located 0 bytes inside of
[   13.308743]  freed 32-byte region [ffff8881026ae780, ffff8881026ae7a0)
[   13.309621] 
[   13.309723] The buggy address belongs to the physical page:
[   13.310030] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1026ae
[   13.310472] flags: 0x200000000000000(node=0|zone=2)
[   13.310691] page_type: f5(slab)
[   13.310853] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   13.311222] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   13.311754] page dumped because: kasan: bad access detected
[   13.312074] 
[   13.312165] Memory state around the buggy address:
[   13.313220]  ffff8881026ae680: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   13.313470]  ffff8881026ae700: 00 00 07 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   13.313704] >ffff8881026ae780: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   13.314284]                    ^
[   13.314450]  ffff8881026ae800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   13.314746]  ffff8881026ae880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   13.315106] ==================================================================