Hay
Date
July 15, 2025, 11:09 a.m.

Environment
qemu-arm64
qemu-x86_64

[   16.054779] ==================================================================
[   16.054861] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x480/0x4a8
[   16.054927] Read of size 8 at addr fff00000c5947200 by task kunit_try_catch/201
[   16.054978] 
[   16.055017] CPU: 1 UID: 0 PID: 201 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc6 #1 PREEMPT 
[   16.055104] Tainted: [B]=BAD_PAGE, [N]=TEST
[   16.055140] Hardware name: linux,dummy-virt (DT)
[   16.055210] Call trace:
[   16.055236]  show_stack+0x20/0x38 (C)
[   16.055293]  dump_stack_lvl+0x8c/0xd0
[   16.055343]  print_report+0x118/0x5d0
[   16.055389]  kasan_report+0xdc/0x128
[   16.055433]  __asan_report_load8_noabort+0x20/0x30
[   16.055483]  workqueue_uaf+0x480/0x4a8
[   16.055526]  kunit_try_run_case+0x170/0x3f0
[   16.055584]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   16.055636]  kthread+0x328/0x630
[   16.055677]  ret_from_fork+0x10/0x20
[   16.055734] 
[   16.055752] Allocated by task 201:
[   16.055782]  kasan_save_stack+0x3c/0x68
[   16.055823]  kasan_save_track+0x20/0x40
[   16.055861]  kasan_save_alloc_info+0x40/0x58
[   16.055901]  __kasan_kmalloc+0xd4/0xd8
[   16.055945]  __kmalloc_cache_noprof+0x16c/0x3c0
[   16.055994]  workqueue_uaf+0x13c/0x4a8
[   16.056030]  kunit_try_run_case+0x170/0x3f0
[   16.056068]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   16.056111]  kthread+0x328/0x630
[   16.056141]  ret_from_fork+0x10/0x20
[   16.056177] 
[   16.056203] Freed by task 58:
[   16.056229]  kasan_save_stack+0x3c/0x68
[   16.056265]  kasan_save_track+0x20/0x40
[   16.056302]  kasan_save_free_info+0x4c/0x78
[   16.056341]  __kasan_slab_free+0x6c/0x98
[   16.056377]  kfree+0x214/0x3c8
[   16.056408]  workqueue_uaf_work+0x18/0x30
[   16.056443]  process_one_work+0x530/0xf98
[   16.056484]  worker_thread+0x618/0xf38
[   16.056517]  kthread+0x328/0x630
[   16.056547]  ret_from_fork+0x10/0x20
[   16.056583] 
[   16.056601] Last potentially related work creation:
[   16.056627]  kasan_save_stack+0x3c/0x68
[   16.056664]  kasan_record_aux_stack+0xb4/0xc8
[   16.056705]  __queue_work+0x65c/0x1008
[   16.056739]  queue_work_on+0xbc/0xf8
[   16.056773]  workqueue_uaf+0x210/0x4a8
[   16.056809]  kunit_try_run_case+0x170/0x3f0
[   16.056845]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   16.056888]  kthread+0x328/0x630
[   16.056918]  ret_from_fork+0x10/0x20
[   16.056987] 
[   16.057016] The buggy address belongs to the object at fff00000c5947200
[   16.057016]  which belongs to the cache kmalloc-32 of size 32
[   16.057115] The buggy address is located 0 bytes inside of
[   16.057115]  freed 32-byte region [fff00000c5947200, fff00000c5947220)
[   16.057221] 
[   16.057302] The buggy address belongs to the physical page:
[   16.057385] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105947
[   16.057447] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   16.057618] page_type: f5(slab)
[   16.057735] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   16.057922] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   16.058024] page dumped because: kasan: bad access detected
[   16.058072] 
[   16.058089] Memory state around the buggy address:
[   16.058172]  fff00000c5947100: 00 00 03 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   16.058244]  fff00000c5947180: 00 00 00 fc fc fc fc fc 00 00 00 07 fc fc fc fc
[   16.058288] >fff00000c5947200: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   16.058325]                    ^
[   16.058352]  fff00000c5947280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   16.058395]  fff00000c5947300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   16.058434] ==================================================================

[   13.169014] ==================================================================
[   13.169453] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x4d6/0x560
[   13.169955] Read of size 8 at addr ffff8881032ef880 by task kunit_try_catch/217
[   13.170293] 
[   13.170481] CPU: 1 UID: 0 PID: 217 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc6 #1 PREEMPT(voluntary) 
[   13.170529] Tainted: [B]=BAD_PAGE, [N]=TEST
[   13.170540] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   13.170561] Call Trace:
[   13.170572]  <TASK>
[   13.170587]  dump_stack_lvl+0x73/0xb0
[   13.170618]  print_report+0xd1/0x610
[   13.170640]  ? __virt_addr_valid+0x1db/0x2d0
[   13.170662]  ? workqueue_uaf+0x4d6/0x560
[   13.170683]  ? kasan_complete_mode_report_info+0x64/0x200
[   13.170707]  ? workqueue_uaf+0x4d6/0x560
[   13.170728]  kasan_report+0x141/0x180
[   13.170750]  ? workqueue_uaf+0x4d6/0x560
[   13.170786]  __asan_report_load8_noabort+0x18/0x20
[   13.170812]  workqueue_uaf+0x4d6/0x560
[   13.170834]  ? __pfx_workqueue_uaf+0x10/0x10
[   13.170857]  ? __schedule+0x10cc/0x2b60
[   13.170879]  ? __pfx_read_tsc+0x10/0x10
[   13.170900]  ? ktime_get_ts64+0x86/0x230
[   13.170924]  kunit_try_run_case+0x1a5/0x480
[   13.170949]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.170972]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   13.170996]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   13.171020]  ? __kthread_parkme+0x82/0x180
[   13.171040]  ? preempt_count_sub+0x50/0x80
[   13.171064]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.171089]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.171113]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   13.171138]  kthread+0x337/0x6f0
[   13.171157]  ? trace_preempt_on+0x20/0xc0
[   13.171181]  ? __pfx_kthread+0x10/0x10
[   13.171201]  ? _raw_spin_unlock_irq+0x47/0x80
[   13.171223]  ? calculate_sigpending+0x7b/0xa0
[   13.171247]  ? __pfx_kthread+0x10/0x10
[   13.171268]  ret_from_fork+0x116/0x1d0
[   13.171316]  ? __pfx_kthread+0x10/0x10
[   13.171354]  ret_from_fork_asm+0x1a/0x30
[   13.171386]  </TASK>
[   13.171396] 
[   13.179085] Allocated by task 217:
[   13.179224]  kasan_save_stack+0x45/0x70
[   13.179661]  kasan_save_track+0x18/0x40
[   13.180012]  kasan_save_alloc_info+0x3b/0x50
[   13.180224]  __kasan_kmalloc+0xb7/0xc0
[   13.180600]  __kmalloc_cache_noprof+0x189/0x420
[   13.180841]  workqueue_uaf+0x152/0x560
[   13.181021]  kunit_try_run_case+0x1a5/0x480
[   13.181168]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.181456]  kthread+0x337/0x6f0
[   13.181667]  ret_from_fork+0x116/0x1d0
[   13.181875]  ret_from_fork_asm+0x1a/0x30
[   13.182072] 
[   13.182176] Freed by task 44:
[   13.182407]  kasan_save_stack+0x45/0x70
[   13.182618]  kasan_save_track+0x18/0x40
[   13.182834]  kasan_save_free_info+0x3f/0x60
[   13.183030]  __kasan_slab_free+0x56/0x70
[   13.183233]  kfree+0x222/0x3f0
[   13.183478]  workqueue_uaf_work+0x12/0x20
[   13.183673]  process_one_work+0x5ee/0xf60
[   13.183894]  worker_thread+0x758/0x1220
[   13.184071]  kthread+0x337/0x6f0
[   13.184243]  ret_from_fork+0x116/0x1d0
[   13.184564]  ret_from_fork_asm+0x1a/0x30
[   13.184793] 
[   13.184902] Last potentially related work creation:
[   13.185125]  kasan_save_stack+0x45/0x70
[   13.185265]  kasan_record_aux_stack+0xb2/0xc0
[   13.185417]  __queue_work+0x626/0xeb0
[   13.185550]  queue_work_on+0xb6/0xc0
[   13.185680]  workqueue_uaf+0x26d/0x560
[   13.185946]  kunit_try_run_case+0x1a5/0x480
[   13.186160]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.186619]  kthread+0x337/0x6f0
[   13.186815]  ret_from_fork+0x116/0x1d0
[   13.187037]  ret_from_fork_asm+0x1a/0x30
[   13.187236] 
[   13.187382] The buggy address belongs to the object at ffff8881032ef880
[   13.187382]  which belongs to the cache kmalloc-32 of size 32
[   13.188059] The buggy address is located 0 bytes inside of
[   13.188059]  freed 32-byte region [ffff8881032ef880, ffff8881032ef8a0)
[   13.188405] 
[   13.188475] The buggy address belongs to the physical page:
[   13.188726] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1032ef
[   13.189096] flags: 0x200000000000000(node=0|zone=2)
[   13.189339] page_type: f5(slab)
[   13.189511] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   13.189976] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   13.190364] page dumped because: kasan: bad access detected
[   13.190668] 
[   13.190895] Memory state around the buggy address:
[   13.191123]  ffff8881032ef780: 00 00 00 fc fc fc fc fc 00 00 03 fc fc fc fc fc
[   13.191507]  ffff8881032ef800: 00 00 07 fc fc fc fc fc 00 00 00 07 fc fc fc fc
[   13.191785] >ffff8881032ef880: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   13.192128]                    ^
[   13.192248]  ffff8881032ef900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   13.192823]  ffff8881032ef980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   13.193110] ==================================================================