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

Environment
qemu-arm64
qemu-x86_64

[   19.952251] ==================================================================
[   19.952442] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x480/0x4a8
[   19.952922] Read of size 8 at addr fff00000c599ef80 by task kunit_try_catch/201
[   19.953070] 
[   19.953174] CPU: 0 UID: 0 PID: 201 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5 #1 PREEMPT 
[   19.953385] Tainted: [B]=BAD_PAGE, [N]=TEST
[   19.953457] Hardware name: linux,dummy-virt (DT)
[   19.953522] Call trace:
[   19.953570]  show_stack+0x20/0x38 (C)
[   19.953724]  dump_stack_lvl+0x8c/0xd0
[   19.953853]  print_report+0x118/0x608
[   19.953956]  kasan_report+0xdc/0x128
[   19.954058]  __asan_report_load8_noabort+0x20/0x30
[   19.954193]  workqueue_uaf+0x480/0x4a8
[   19.954356]  kunit_try_run_case+0x170/0x3f0
[   19.954515]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.954710]  kthread+0x328/0x630
[   19.954816]  ret_from_fork+0x10/0x20
[   19.954932] 
[   19.954976] Allocated by task 201:
[   19.955044]  kasan_save_stack+0x3c/0x68
[   19.955161]  kasan_save_track+0x20/0x40
[   19.955254]  kasan_save_alloc_info+0x40/0x58
[   19.955360]  __kasan_kmalloc+0xd4/0xd8
[   19.955437]  __kmalloc_cache_noprof+0x16c/0x3c0
[   19.955560]  workqueue_uaf+0x13c/0x4a8
[   19.955673]  kunit_try_run_case+0x170/0x3f0
[   19.955798]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.955918]  kthread+0x328/0x630
[   19.955998]  ret_from_fork+0x10/0x20
[   19.956082] 
[   19.956123] Freed by task 9:
[   19.956184]  kasan_save_stack+0x3c/0x68
[   19.956283]  kasan_save_track+0x20/0x40
[   19.956371]  kasan_save_free_info+0x4c/0x78
[   19.956462]  __kasan_slab_free+0x6c/0x98
[   19.956572]  kfree+0x214/0x3c8
[   19.956662]  workqueue_uaf_work+0x18/0x30
[   19.956770]  process_one_work+0x530/0xf98
[   19.956904]  worker_thread+0x618/0xf38
[   19.957006]  kthread+0x328/0x630
[   19.957088]  ret_from_fork+0x10/0x20
[   19.957177] 
[   19.957223] Last potentially related work creation:
[   19.957289]  kasan_save_stack+0x3c/0x68
[   19.957387]  kasan_record_aux_stack+0xb4/0xc8
[   19.957519]  __queue_work+0x65c/0x1008
[   19.957604]  queue_work_on+0xbc/0xf8
[   19.957680]  workqueue_uaf+0x210/0x4a8
[   19.957783]  kunit_try_run_case+0x170/0x3f0
[   19.957885]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.958027]  kthread+0x328/0x630
[   19.958102]  ret_from_fork+0x10/0x20
[   19.958221] 
[   19.958261] The buggy address belongs to the object at fff00000c599ef80
[   19.958261]  which belongs to the cache kmalloc-32 of size 32
[   19.958407] The buggy address is located 0 bytes inside of
[   19.958407]  freed 32-byte region [fff00000c599ef80, fff00000c599efa0)
[   19.958572] 
[   19.958634] The buggy address belongs to the physical page:
[   19.958756] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10599e
[   19.958888] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   19.959003] page_type: f5(slab)
[   19.959132] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   19.959288] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   19.959416] page dumped because: kasan: bad access detected
[   19.959499] 
[   19.959558] Memory state around the buggy address:
[   19.959640]  fff00000c599ee80: 00 00 03 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   19.959760]  fff00000c599ef00: 00 00 00 fc fc fc fc fc 00 00 00 07 fc fc fc fc
[   19.959920] >fff00000c599ef80: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   19.960016]                    ^
[   19.960081]  fff00000c599f000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   19.960175]  fff00000c599f080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.960272] ==================================================================

[   13.217696] ==================================================================
[   13.218270] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x4d6/0x560
[   13.218670] Read of size 8 at addr ffff888103abf200 by task kunit_try_catch/218
[   13.219116] 
[   13.219305] CPU: 0 UID: 0 PID: 218 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5 #1 PREEMPT(voluntary) 
[   13.219411] Tainted: [B]=BAD_PAGE, [N]=TEST
[   13.219423] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   13.219442] Call Trace:
[   13.219455]  <TASK>
[   13.219470]  dump_stack_lvl+0x73/0xb0
[   13.219602]  print_report+0xd1/0x650
[   13.219629]  ? __virt_addr_valid+0x1db/0x2d0
[   13.219664]  ? workqueue_uaf+0x4d6/0x560
[   13.219685]  ? kasan_complete_mode_report_info+0x64/0x200
[   13.219707]  ? workqueue_uaf+0x4d6/0x560
[   13.219728]  kasan_report+0x141/0x180
[   13.219762]  ? workqueue_uaf+0x4d6/0x560
[   13.219788]  __asan_report_load8_noabort+0x18/0x20
[   13.219812]  workqueue_uaf+0x4d6/0x560
[   13.219834]  ? __pfx_workqueue_uaf+0x10/0x10
[   13.219856]  ? __schedule+0x10cc/0x2b60
[   13.219877]  ? __pfx_read_tsc+0x10/0x10
[   13.219897]  ? ktime_get_ts64+0x86/0x230
[   13.219921]  kunit_try_run_case+0x1a5/0x480
[   13.219945]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.219968]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   13.219991]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   13.220015]  ? __kthread_parkme+0x82/0x180
[   13.220035]  ? preempt_count_sub+0x50/0x80
[   13.220058]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.220083]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.220107]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   13.220133]  kthread+0x337/0x6f0
[   13.220152]  ? trace_preempt_on+0x20/0xc0
[   13.220176]  ? __pfx_kthread+0x10/0x10
[   13.220196]  ? _raw_spin_unlock_irq+0x47/0x80
[   13.220217]  ? calculate_sigpending+0x7b/0xa0
[   13.220241]  ? __pfx_kthread+0x10/0x10
[   13.220262]  ret_from_fork+0x116/0x1d0
[   13.220280]  ? __pfx_kthread+0x10/0x10
[   13.220300]  ret_from_fork_asm+0x1a/0x30
[   13.220331]  </TASK>
[   13.220341] 
[   13.229964] Allocated by task 218:
[   13.230137]  kasan_save_stack+0x45/0x70
[   13.230334]  kasan_save_track+0x18/0x40
[   13.230520]  kasan_save_alloc_info+0x3b/0x50
[   13.230935]  __kasan_kmalloc+0xb7/0xc0
[   13.231179]  __kmalloc_cache_noprof+0x189/0x420
[   13.231354]  workqueue_uaf+0x152/0x560
[   13.231667]  kunit_try_run_case+0x1a5/0x480
[   13.231977]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.232328]  kthread+0x337/0x6f0
[   13.232498]  ret_from_fork+0x116/0x1d0
[   13.232795]  ret_from_fork_asm+0x1a/0x30
[   13.232983] 
[   13.233083] Freed by task 9:
[   13.233228]  kasan_save_stack+0x45/0x70
[   13.233411]  kasan_save_track+0x18/0x40
[   13.233579]  kasan_save_free_info+0x3f/0x60
[   13.233803]  __kasan_slab_free+0x56/0x70
[   13.234403]  kfree+0x222/0x3f0
[   13.234530]  workqueue_uaf_work+0x12/0x20
[   13.234840]  process_one_work+0x5ee/0xf60
[   13.235287]  worker_thread+0x758/0x1220
[   13.235482]  kthread+0x337/0x6f0
[   13.235758]  ret_from_fork+0x116/0x1d0
[   13.236160]  ret_from_fork_asm+0x1a/0x30
[   13.236423] 
[   13.236514] Last potentially related work creation:
[   13.236696]  kasan_save_stack+0x45/0x70
[   13.237148]  kasan_record_aux_stack+0xb2/0xc0
[   13.237320]  __queue_work+0x626/0xeb0
[   13.237512]  queue_work_on+0xb6/0xc0
[   13.237680]  workqueue_uaf+0x26d/0x560
[   13.238123]  kunit_try_run_case+0x1a5/0x480
[   13.238312]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.238657]  kthread+0x337/0x6f0
[   13.238997]  ret_from_fork+0x116/0x1d0
[   13.239156]  ret_from_fork_asm+0x1a/0x30
[   13.239361] 
[   13.239436] The buggy address belongs to the object at ffff888103abf200
[   13.239436]  which belongs to the cache kmalloc-32 of size 32
[   13.240253] The buggy address is located 0 bytes inside of
[   13.240253]  freed 32-byte region [ffff888103abf200, ffff888103abf220)
[   13.240915] 
[   13.241024] The buggy address belongs to the physical page:
[   13.241248] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x103abf
[   13.241728] flags: 0x200000000000000(node=0|zone=2)
[   13.242076] page_type: f5(slab)
[   13.242256] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   13.242893] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   13.243326] page dumped because: kasan: bad access detected
[   13.243706] 
[   13.243831] Memory state around the buggy address:
[   13.244145]  ffff888103abf100: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   13.244403]  ffff888103abf180: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   13.244928] >ffff888103abf200: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   13.245235]                    ^
[   13.245377]  ffff888103abf280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   13.245814]  ffff888103abf300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   13.246294] ==================================================================