Hay
Date
June 17, 2025, 6:35 a.m.

Environment
qemu-arm64
qemu-x86_64

[   17.439231] ==================================================================
[   17.439313] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x480/0x4a8
[   17.439386] Read of size 8 at addr fff00000c4f8cd40 by task kunit_try_catch/209
[   17.439440] 
[   17.439478] CPU: 1 UID: 0 PID: 209 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc2-next-20250617 #1 PREEMPT 
[   17.439573] Tainted: [B]=BAD_PAGE, [N]=TEST
[   17.439600] Hardware name: linux,dummy-virt (DT)
[   17.439633] Call trace:
[   17.439658]  show_stack+0x20/0x38 (C)
[   17.439710]  dump_stack_lvl+0x8c/0xd0
[   17.439761]  print_report+0x118/0x608
[   17.439808]  kasan_report+0xdc/0x128
[   17.439856]  __asan_report_load8_noabort+0x20/0x30
[   17.439904]  workqueue_uaf+0x480/0x4a8
[   17.439968]  kunit_try_run_case+0x170/0x3f0
[   17.440018]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.440072]  kthread+0x328/0x630
[   17.440115]  ret_from_fork+0x10/0x20
[   17.440163] 
[   17.440181] Allocated by task 209:
[   17.440209]  kasan_save_stack+0x3c/0x68
[   17.440251]  kasan_save_track+0x20/0x40
[   17.440289]  kasan_save_alloc_info+0x40/0x58
[   17.440326]  __kasan_kmalloc+0xd4/0xd8
[   17.440364]  __kmalloc_cache_noprof+0x16c/0x3c0
[   17.440405]  workqueue_uaf+0x13c/0x4a8
[   17.440442]  kunit_try_run_case+0x170/0x3f0
[   17.440479]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.440523]  kthread+0x328/0x630
[   17.440556]  ret_from_fork+0x10/0x20
[   17.440593] 
[   17.440611] Freed by task 57:
[   17.440636]  kasan_save_stack+0x3c/0x68
[   17.440674]  kasan_save_track+0x20/0x40
[   17.440710]  kasan_save_free_info+0x4c/0x78
[   17.440746]  __kasan_slab_free+0x6c/0x98
[   17.440783]  kfree+0x214/0x3c8
[   17.440822]  workqueue_uaf_work+0x18/0x30
[   17.440860]  process_one_work+0x530/0xf98
[   17.440899]  worker_thread+0x618/0xf38
[   17.441013]  kthread+0x328/0x630
[   17.441076]  ret_from_fork+0x10/0x20
[   17.441168] 
[   17.441194] Last potentially related work creation:
[   17.441264]  kasan_save_stack+0x3c/0x68
[   17.441310]  kasan_record_aux_stack+0xb4/0xc8
[   17.441369]  __queue_work+0x65c/0xfe0
[   17.441471]  queue_work_on+0xbc/0xf8
[   17.441512]  workqueue_uaf+0x210/0x4a8
[   17.441550]  kunit_try_run_case+0x170/0x3f0
[   17.441596]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.441887]  kthread+0x328/0x630
[   17.442390]  ret_from_fork+0x10/0x20
[   17.442501] 
[   17.442571] The buggy address belongs to the object at fff00000c4f8cd40
[   17.442571]  which belongs to the cache kmalloc-32 of size 32
[   17.442633] The buggy address is located 0 bytes inside of
[   17.442633]  freed 32-byte region [fff00000c4f8cd40, fff00000c4f8cd60)
[   17.443002] 
[   17.443059] The buggy address belongs to the physical page:
[   17.443142] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x104f8c
[   17.443250] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   17.443339] page_type: f5(slab)
[   17.443746] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   17.443889] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   17.444071] page dumped because: kasan: bad access detected
[   17.444162] 
[   17.444292] Memory state around the buggy address:
[   17.444364]  fff00000c4f8cc00: 00 00 00 fc fc fc fc fc 00 00 03 fc fc fc fc fc
[   17.444528]  fff00000c4f8cc80: 00 00 07 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   17.444772] >fff00000c4f8cd00: 00 00 00 07 fc fc fc fc fa fb fb fb fc fc fc fc
[   17.445006]                                            ^
[   17.445060]  fff00000c4f8cd80: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.445751]  fff00000c4f8ce00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.445942] ==================================================================

[   18.954130] ==================================================================
[   18.955287] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x4d6/0x560
[   18.956049] Read of size 8 at addr ffff888102a1a180 by task kunit_try_catch/227
[   18.957077] 
[   18.957463] CPU: 1 UID: 0 PID: 227 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc2-next-20250617 #1 PREEMPT(voluntary) 
[   18.957621] Tainted: [B]=BAD_PAGE, [N]=TEST
[   18.957660] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   18.957748] Call Trace:
[   18.957787]  <TASK>
[   18.957852]  dump_stack_lvl+0x73/0xb0
[   18.957940]  print_report+0xd1/0x650
[   18.958012]  ? __virt_addr_valid+0x1db/0x2d0
[   18.958082]  ? workqueue_uaf+0x4d6/0x560
[   18.958147]  ? kasan_complete_mode_report_info+0x64/0x200
[   18.958214]  ? workqueue_uaf+0x4d6/0x560
[   18.958303]  kasan_report+0x141/0x180
[   18.958378]  ? workqueue_uaf+0x4d6/0x560
[   18.958445]  __asan_report_load8_noabort+0x18/0x20
[   18.958483]  workqueue_uaf+0x4d6/0x560
[   18.958515]  ? __pfx_workqueue_uaf+0x10/0x10
[   18.958546]  ? __schedule+0x10cc/0x2b60
[   18.958579]  ? __pfx_read_tsc+0x10/0x10
[   18.958609]  ? ktime_get_ts64+0x86/0x230
[   18.958644]  kunit_try_run_case+0x1a5/0x480
[   18.958679]  ? __pfx_kunit_try_run_case+0x10/0x10
[   18.958712]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   18.958741]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   18.958778]  ? __kthread_parkme+0x82/0x180
[   18.958806]  ? preempt_count_sub+0x50/0x80
[   18.958863]  ? __pfx_kunit_try_run_case+0x10/0x10
[   18.958901]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   18.958934]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   18.958966]  kthread+0x337/0x6f0
[   18.958993]  ? trace_preempt_on+0x20/0xc0
[   18.959028]  ? __pfx_kthread+0x10/0x10
[   18.959058]  ? _raw_spin_unlock_irq+0x47/0x80
[   18.959092]  ? calculate_sigpending+0x7b/0xa0
[   18.959127]  ? __pfx_kthread+0x10/0x10
[   18.959156]  ret_from_fork+0x116/0x1d0
[   18.959181]  ? __pfx_kthread+0x10/0x10
[   18.959209]  ret_from_fork_asm+0x1a/0x30
[   18.959291]  </TASK>
[   18.959507] 
[   18.978812] Allocated by task 227:
[   18.979283]  kasan_save_stack+0x45/0x70
[   18.979721]  kasan_save_track+0x18/0x40
[   18.980029]  kasan_save_alloc_info+0x3b/0x50
[   18.980526]  __kasan_kmalloc+0xb7/0xc0
[   18.981167]  __kmalloc_cache_noprof+0x189/0x420
[   18.981529]  workqueue_uaf+0x152/0x560
[   18.982106]  kunit_try_run_case+0x1a5/0x480
[   18.982663]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   18.983031]  kthread+0x337/0x6f0
[   18.983582]  ret_from_fork+0x116/0x1d0
[   18.984025]  ret_from_fork_asm+0x1a/0x30
[   18.984592] 
[   18.984807] Freed by task 40:
[   18.985073]  kasan_save_stack+0x45/0x70
[   18.985609]  kasan_save_track+0x18/0x40
[   18.986010]  kasan_save_free_info+0x3f/0x60
[   18.986699]  __kasan_slab_free+0x56/0x70
[   18.987148]  kfree+0x222/0x3f0
[   18.987644]  workqueue_uaf_work+0x12/0x20
[   18.988011]  process_one_work+0x5ee/0xf60
[   18.988413]  worker_thread+0x758/0x1220
[   18.988714]  kthread+0x337/0x6f0
[   18.989392]  ret_from_fork+0x116/0x1d0
[   18.989848]  ret_from_fork_asm+0x1a/0x30
[   18.990348] 
[   18.990564] Last potentially related work creation:
[   18.991050]  kasan_save_stack+0x45/0x70
[   18.991715]  kasan_record_aux_stack+0xb2/0xc0
[   18.992198]  __queue_work+0x61a/0xe70
[   18.992687]  queue_work_on+0xb6/0xc0
[   18.992981]  workqueue_uaf+0x26d/0x560
[   18.993541]  kunit_try_run_case+0x1a5/0x480
[   18.993963]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   18.994589]  kthread+0x337/0x6f0
[   18.995006]  ret_from_fork+0x116/0x1d0
[   18.995561]  ret_from_fork_asm+0x1a/0x30
[   18.995910] 
[   18.996157] The buggy address belongs to the object at ffff888102a1a180
[   18.996157]  which belongs to the cache kmalloc-32 of size 32
[   18.997014] The buggy address is located 0 bytes inside of
[   18.997014]  freed 32-byte region [ffff888102a1a180, ffff888102a1a1a0)
[   18.998183] 
[   18.998522] The buggy address belongs to the physical page:
[   18.999046] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a1a
[   18.999743] flags: 0x200000000000000(node=0|zone=2)
[   19.000397] page_type: f5(slab)
[   19.000792] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   19.001586] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   19.002154] page dumped because: kasan: bad access detected
[   19.003045] 
[   19.003347] Memory state around the buggy address:
[   19.003802]  ffff888102a1a080: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   19.004540]  ffff888102a1a100: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   19.005161] >ffff888102a1a180: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   19.005798]                    ^
[   19.006191]  ffff888102a1a200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.006898]  ffff888102a1a280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.007954] ==================================================================