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

Environment
qemu-arm64
qemu-x86_64

[   18.547878] ==================================================================
[   18.547943] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x480/0x4a8
[   18.548012] Read of size 8 at addr fff00000c56eb640 by task kunit_try_catch/200
[   18.548061] 
[   18.548094] CPU: 1 UID: 0 PID: 200 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT 
[   18.548188] Tainted: [B]=BAD_PAGE, [N]=TEST
[   18.548229] Hardware name: linux,dummy-virt (DT)
[   18.548261] Call trace:
[   18.548282]  show_stack+0x20/0x38 (C)
[   18.548332]  dump_stack_lvl+0x8c/0xd0
[   18.548379]  print_report+0x118/0x608
[   18.548425]  kasan_report+0xdc/0x128
[   18.548470]  __asan_report_load8_noabort+0x20/0x30
[   18.548517]  workqueue_uaf+0x480/0x4a8
[   18.548561]  kunit_try_run_case+0x170/0x3f0
[   18.548701]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.548767]  kthread+0x328/0x630
[   18.548808]  ret_from_fork+0x10/0x20
[   18.548855] 
[   18.548875] Allocated by task 200:
[   18.548904]  kasan_save_stack+0x3c/0x68
[   18.548945]  kasan_save_track+0x20/0x40
[   18.548983]  kasan_save_alloc_info+0x40/0x58
[   18.549024]  __kasan_kmalloc+0xd4/0xd8
[   18.549059]  __kmalloc_cache_noprof+0x16c/0x3c0
[   18.549099]  workqueue_uaf+0x13c/0x4a8
[   18.549134]  kunit_try_run_case+0x170/0x3f0
[   18.549172]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.549225]  kthread+0x328/0x630
[   18.549258]  ret_from_fork+0x10/0x20
[   18.549873] 
[   18.549918] Freed by task 24:
[   18.549947]  kasan_save_stack+0x3c/0x68
[   18.549989]  kasan_save_track+0x20/0x40
[   18.550027]  kasan_save_free_info+0x4c/0x78
[   18.550065]  __kasan_slab_free+0x6c/0x98
[   18.550238]  kfree+0x214/0x3c8
[   18.550316]  workqueue_uaf_work+0x18/0x30
[   18.550415]  process_one_work+0x530/0xf98
[   18.550571]  worker_thread+0x618/0xf38
[   18.550704]  kthread+0x328/0x630
[   18.550772]  ret_from_fork+0x10/0x20
[   18.550809] 
[   18.550827] Last potentially related work creation:
[   18.550852]  kasan_save_stack+0x3c/0x68
[   18.550891]  kasan_record_aux_stack+0xb4/0xc8
[   18.551109]  __queue_work+0x65c/0x1008
[   18.551235]  queue_work_on+0xbc/0xf8
[   18.551327]  workqueue_uaf+0x210/0x4a8
[   18.551364]  kunit_try_run_case+0x170/0x3f0
[   18.551638]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.551775]  kthread+0x328/0x630
[   18.551871]  ret_from_fork+0x10/0x20
[   18.551992] 
[   18.552012] The buggy address belongs to the object at fff00000c56eb640
[   18.552012]  which belongs to the cache kmalloc-32 of size 32
[   18.552306] The buggy address is located 0 bytes inside of
[   18.552306]  freed 32-byte region [fff00000c56eb640, fff00000c56eb660)
[   18.552470] 
[   18.552594] The buggy address belongs to the physical page:
[   18.552681] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1056eb
[   18.552734] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   18.553001] page_type: f5(slab)
[   18.553093] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   18.553202] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   18.553286] page dumped because: kasan: bad access detected
[   18.553383] 
[   18.553401] Memory state around the buggy address:
[   18.553434]  fff00000c56eb500: 00 00 00 fc fc fc fc fc 00 00 03 fc fc fc fc fc
[   18.553704]  fff00000c56eb580: 00 00 07 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   18.553789] >fff00000c56eb600: 00 00 00 07 fc fc fc fc fa fb fb fb fc fc fc fc
[   18.553889]                                            ^
[   18.553958]  fff00000c56eb680: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.554069]  fff00000c56eb700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.554130] ==================================================================

[   12.229055] ==================================================================
[   12.229689] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x4d6/0x560
[   12.230431] Read of size 8 at addr ffff88810279d640 by task kunit_try_catch/217
[   12.230928] 
[   12.231137] CPU: 1 UID: 0 PID: 217 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT(voluntary) 
[   12.231186] Tainted: [B]=BAD_PAGE, [N]=TEST
[   12.231198] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   12.231219] Call Trace:
[   12.231233]  <TASK>
[   12.231252]  dump_stack_lvl+0x73/0xb0
[   12.231284]  print_report+0xd1/0x650
[   12.231308]  ? __virt_addr_valid+0x1db/0x2d0
[   12.231333]  ? workqueue_uaf+0x4d6/0x560
[   12.231353]  ? kasan_complete_mode_report_info+0x64/0x200
[   12.231374]  ? workqueue_uaf+0x4d6/0x560
[   12.231395]  kasan_report+0x141/0x180
[   12.231417]  ? workqueue_uaf+0x4d6/0x560
[   12.231442]  __asan_report_load8_noabort+0x18/0x20
[   12.231636]  workqueue_uaf+0x4d6/0x560
[   12.231679]  ? __pfx_workqueue_uaf+0x10/0x10
[   12.231702]  ? __schedule+0x10cc/0x2b60
[   12.231726]  ? __pfx_read_tsc+0x10/0x10
[   12.231748]  ? ktime_get_ts64+0x86/0x230
[   12.231773]  kunit_try_run_case+0x1a5/0x480
[   12.231798]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.231819]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   12.231843]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   12.231865]  ? __kthread_parkme+0x82/0x180
[   12.231885]  ? preempt_count_sub+0x50/0x80
[   12.231909]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.231943]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.231965]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   12.231987]  kthread+0x337/0x6f0
[   12.232006]  ? trace_preempt_on+0x20/0xc0
[   12.232030]  ? __pfx_kthread+0x10/0x10
[   12.232049]  ? _raw_spin_unlock_irq+0x47/0x80
[   12.232069]  ? calculate_sigpending+0x7b/0xa0
[   12.232093]  ? __pfx_kthread+0x10/0x10
[   12.232114]  ret_from_fork+0x116/0x1d0
[   12.232132]  ? __pfx_kthread+0x10/0x10
[   12.232151]  ret_from_fork_asm+0x1a/0x30
[   12.232183]  </TASK>
[   12.232194] 
[   12.244509] Allocated by task 217:
[   12.244661]  kasan_save_stack+0x45/0x70
[   12.244814]  kasan_save_track+0x18/0x40
[   12.244960]  kasan_save_alloc_info+0x3b/0x50
[   12.245118]  __kasan_kmalloc+0xb7/0xc0
[   12.245305]  __kmalloc_cache_noprof+0x189/0x420
[   12.245561]  workqueue_uaf+0x152/0x560
[   12.245698]  kunit_try_run_case+0x1a5/0x480
[   12.245843]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.246388]  kthread+0x337/0x6f0
[   12.246777]  ret_from_fork+0x116/0x1d0
[   12.247160]  ret_from_fork_asm+0x1a/0x30
[   12.247682] 
[   12.247849] Freed by task 24:
[   12.248164]  kasan_save_stack+0x45/0x70
[   12.248578]  kasan_save_track+0x18/0x40
[   12.248719]  kasan_save_free_info+0x3f/0x60
[   12.248864]  __kasan_slab_free+0x56/0x70
[   12.249015]  kfree+0x222/0x3f0
[   12.249322]  workqueue_uaf_work+0x12/0x20
[   12.249739]  process_one_work+0x5ee/0xf60
[   12.250147]  worker_thread+0x758/0x1220
[   12.250577]  kthread+0x337/0x6f0
[   12.250874]  ret_from_fork+0x116/0x1d0
[   12.251253]  ret_from_fork_asm+0x1a/0x30
[   12.251683] 
[   12.251763] Last potentially related work creation:
[   12.251919]  kasan_save_stack+0x45/0x70
[   12.252076]  kasan_record_aux_stack+0xb2/0xc0
[   12.252360]  __queue_work+0x626/0xeb0
[   12.252779]  queue_work_on+0xb6/0xc0
[   12.253174]  workqueue_uaf+0x26d/0x560
[   12.253514]  kunit_try_run_case+0x1a5/0x480
[   12.253954]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.254456]  kthread+0x337/0x6f0
[   12.254835]  ret_from_fork+0x116/0x1d0
[   12.255190]  ret_from_fork_asm+0x1a/0x30
[   12.255333] 
[   12.255405] The buggy address belongs to the object at ffff88810279d640
[   12.255405]  which belongs to the cache kmalloc-32 of size 32
[   12.256386] The buggy address is located 0 bytes inside of
[   12.256386]  freed 32-byte region [ffff88810279d640, ffff88810279d660)
[   12.257616] 
[   12.257785] The buggy address belongs to the physical page:
[   12.258286] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10279d
[   12.259168] flags: 0x200000000000000(node=0|zone=2)
[   12.260068] page_type: f5(slab)
[   12.260261] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   12.260539] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   12.260767] page dumped because: kasan: bad access detected
[   12.260952] 
[   12.261026] Memory state around the buggy address:
[   12.261184]  ffff88810279d500: 00 00 07 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   12.261404]  ffff88810279d580: 00 00 03 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   12.261618] >ffff88810279d600: 00 00 00 07 fc fc fc fc fa fb fb fb fc fc fc fc
[   12.261827]                                            ^
[   12.263382]  ffff88810279d680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.264595]  ffff88810279d700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.265711] ==================================================================