Hay
Date
July 9, 2025, 1:08 p.m.

Environment
qemu-arm64
qemu-x86_64

[   29.711353] ==================================================================
[   29.711419] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x480/0x4a8
[   29.711710] Read of size 8 at addr fff00000c5999f00 by task kunit_try_catch/232
[   29.712314] 
[   29.712461] CPU: 0 UID: 0 PID: 232 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5-next-20250709 #1 PREEMPT 
[   29.712648] Tainted: [B]=BAD_PAGE, [N]=TEST
[   29.712698] Hardware name: linux,dummy-virt (DT)
[   29.712775] Call trace:
[   29.712800]  show_stack+0x20/0x38 (C)
[   29.712875]  dump_stack_lvl+0x8c/0xd0
[   29.712925]  print_report+0x118/0x5d0
[   29.713286]  kasan_report+0xdc/0x128
[   29.713350]  __asan_report_load8_noabort+0x20/0x30
[   29.713618]  workqueue_uaf+0x480/0x4a8
[   29.713783]  kunit_try_run_case+0x170/0x3f0
[   29.713843]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   29.713899]  kthread+0x328/0x630
[   29.713941]  ret_from_fork+0x10/0x20
[   29.713987] 
[   29.714007] Allocated by task 232:
[   29.714036]  kasan_save_stack+0x3c/0x68
[   29.714093]  kasan_save_track+0x20/0x40
[   29.714138]  kasan_save_alloc_info+0x40/0x58
[   29.714183]  __kasan_kmalloc+0xd4/0xd8
[   29.714225]  __kmalloc_cache_noprof+0x16c/0x3c0
[   29.714270]  workqueue_uaf+0x13c/0x4a8
[   29.714308]  kunit_try_run_case+0x170/0x3f0
[   29.714347]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   29.714391]  kthread+0x328/0x630
[   29.714428]  ret_from_fork+0x10/0x20
[   29.714465] 
[   29.714484] Freed by task 9:
[   29.714510]  kasan_save_stack+0x3c/0x68
[   29.714554]  kasan_save_track+0x20/0x40
[   29.714593]  kasan_save_free_info+0x4c/0x78
[   29.714630]  __kasan_slab_free+0x6c/0x98
[   29.714669]  kfree+0x214/0x3c8
[   29.714705]  workqueue_uaf_work+0x18/0x30
[   29.714742]  process_one_work+0x530/0xf98
[   29.714780]  worker_thread+0x618/0xf38
[   29.714821]  kthread+0x328/0x630
[   29.714871]  ret_from_fork+0x10/0x20
[   29.714910] 
[   29.714944] Last potentially related work creation:
[   29.714982]  kasan_save_stack+0x3c/0x68
[   29.715030]  kasan_record_aux_stack+0xb4/0xc8
[   29.715410]  __queue_work+0x65c/0xfe0
[   29.715457]  queue_work_on+0xbc/0xf8
[   29.715836]  workqueue_uaf+0x210/0x4a8
[   29.715963]  kunit_try_run_case+0x170/0x3f0
[   29.716031]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   29.716088]  kthread+0x328/0x630
[   29.716144]  ret_from_fork+0x10/0x20
[   29.716179] 
[   29.716201] The buggy address belongs to the object at fff00000c5999f00
[   29.716201]  which belongs to the cache kmalloc-32 of size 32
[   29.716293] The buggy address is located 0 bytes inside of
[   29.716293]  freed 32-byte region [fff00000c5999f00, fff00000c5999f20)
[   29.716355] 
[   29.716533] The buggy address belongs to the physical page:
[   29.716618] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105999
[   29.716709] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   29.716823] page_type: f5(slab)
[   29.716889] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   29.716959] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   29.716999] page dumped because: kasan: bad access detected
[   29.717233] 
[   29.717387] Memory state around the buggy address:
[   29.717533]  fff00000c5999e00: 00 00 03 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   29.717599]  fff00000c5999e80: 00 00 00 fc fc fc fc fc 00 00 00 07 fc fc fc fc
[   29.717662] >fff00000c5999f00: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   29.718176]                    ^
[   29.718290]  fff00000c5999f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   29.718335]  fff00000c599a000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   29.718517] ==================================================================

[   24.674278] ==================================================================
[   24.674741] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x4d6/0x560
[   24.675018] Read of size 8 at addr ffff8881058cf5c0 by task kunit_try_catch/250
[   24.675550] 
[   24.675648] CPU: 0 UID: 0 PID: 250 Comm: kunit_try_catch Tainted: G    B   W        N  6.16.0-rc5-next-20250709 #1 PREEMPT(voluntary) 
[   24.675713] Tainted: [B]=BAD_PAGE, [W]=WARN, [N]=TEST
[   24.675727] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   24.675747] Call Trace:
[   24.675759]  <TASK>
[   24.675777]  dump_stack_lvl+0x73/0xb0
[   24.675828]  print_report+0xd1/0x610
[   24.675849]  ? __virt_addr_valid+0x1db/0x2d0
[   24.675872]  ? workqueue_uaf+0x4d6/0x560
[   24.675943]  ? kasan_complete_mode_report_info+0x64/0x200
[   24.675971]  ? workqueue_uaf+0x4d6/0x560
[   24.675993]  kasan_report+0x141/0x180
[   24.676015]  ? workqueue_uaf+0x4d6/0x560
[   24.676040]  __asan_report_load8_noabort+0x18/0x20
[   24.676063]  workqueue_uaf+0x4d6/0x560
[   24.676086]  ? __pfx_workqueue_uaf+0x10/0x10
[   24.676109]  ? __pfx_workqueue_uaf+0x10/0x10
[   24.676133]  kunit_try_run_case+0x1a5/0x480
[   24.676155]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.676175]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   24.676198]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   24.676222]  ? __kthread_parkme+0x82/0x180
[   24.676242]  ? preempt_count_sub+0x50/0x80
[   24.676266]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.676287]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.676311]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   24.676335]  kthread+0x337/0x6f0
[   24.676354]  ? trace_preempt_on+0x20/0xc0
[   24.676378]  ? __pfx_kthread+0x10/0x10
[   24.676398]  ? _raw_spin_unlock_irq+0x47/0x80
[   24.676419]  ? calculate_sigpending+0x7b/0xa0
[   24.676443]  ? __pfx_kthread+0x10/0x10
[   24.676464]  ret_from_fork+0x116/0x1d0
[   24.676483]  ? __pfx_kthread+0x10/0x10
[   24.676502]  ret_from_fork_asm+0x1a/0x30
[   24.676533]  </TASK>
[   24.676544] 
[   24.683161] Allocated by task 250:
[   24.683284]  kasan_save_stack+0x45/0x70
[   24.683459]  kasan_save_track+0x18/0x40
[   24.683647]  kasan_save_alloc_info+0x3b/0x50
[   24.684580]  __kasan_kmalloc+0xb7/0xc0
[   24.685196]  __kmalloc_cache_noprof+0x189/0x420
[   24.685771]  workqueue_uaf+0x152/0x560
[   24.686187]  kunit_try_run_case+0x1a5/0x480
[   24.686341]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.686514]  kthread+0x337/0x6f0
[   24.686629]  ret_from_fork+0x116/0x1d0
[   24.686771]  ret_from_fork_asm+0x1a/0x30
[   24.686905] 
[   24.686970] Freed by task 9:
[   24.687072]  kasan_save_stack+0x45/0x70
[   24.687203]  kasan_save_track+0x18/0x40
[   24.687332]  kasan_save_free_info+0x3f/0x60
[   24.687470]  __kasan_slab_free+0x56/0x70
[   24.687599]  kfree+0x222/0x3f0
[   24.687755]  workqueue_uaf_work+0x12/0x20
[   24.688097]  process_one_work+0x5ee/0xf60
[   24.688462]  worker_thread+0x758/0x1220
[   24.688817]  kthread+0x337/0x6f0
[   24.689102]  ret_from_fork+0x116/0x1d0
[   24.689424]  ret_from_fork_asm+0x1a/0x30
[   24.689940] 
[   24.690117] Last potentially related work creation:
[   24.690622]  kasan_save_stack+0x45/0x70
[   24.691065]  kasan_record_aux_stack+0xb2/0xc0
[   24.691446]  __queue_work+0x61a/0xe70
[   24.691792]  queue_work_on+0xb6/0xc0
[   24.692188]  workqueue_uaf+0x26d/0x560
[   24.692528]  kunit_try_run_case+0x1a5/0x480
[   24.693019]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.693490]  kthread+0x337/0x6f0
[   24.693801]  ret_from_fork+0x116/0x1d0
[   24.694193]  ret_from_fork_asm+0x1a/0x30
[   24.694540] 
[   24.694689] The buggy address belongs to the object at ffff8881058cf5c0
[   24.694689]  which belongs to the cache kmalloc-32 of size 32
[   24.696110] The buggy address is located 0 bytes inside of
[   24.696110]  freed 32-byte region [ffff8881058cf5c0, ffff8881058cf5e0)
[   24.697633] 
[   24.697911] The buggy address belongs to the physical page:
[   24.698953] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1058cf
[   24.699269] flags: 0x200000000000000(node=0|zone=2)
[   24.699433] page_type: f5(slab)
[   24.699553] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   24.699840] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   24.700159] page dumped because: kasan: bad access detected
[   24.700360] 
[   24.700425] Memory state around the buggy address:
[   24.700574]  ffff8881058cf480: 00 00 00 fc fc fc fc fc 00 00 05 fc fc fc fc fc
[   24.702147]  ffff8881058cf500: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   24.703342] >ffff8881058cf580: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   24.704033]                                            ^
[   24.704685]  ffff8881058cf600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.705400]  ffff8881058cf680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.706088] ==================================================================