Hay
Date
June 19, 2025, 12:07 p.m.

Environment
qemu-arm64
qemu-x86_64

[   31.191351] ==================================================================
[   31.191559] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x480/0x4a8
[   31.192890] Read of size 8 at addr fff00000c771ef40 by task kunit_try_catch/211
[   31.193476] 
[   31.193584] CPU: 1 UID: 0 PID: 211 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc2-next-20250619 #1 PREEMPT 
[   31.193863] Tainted: [B]=BAD_PAGE, [N]=TEST
[   31.193949] Hardware name: linux,dummy-virt (DT)
[   31.194022] Call trace:
[   31.194076]  show_stack+0x20/0x38 (C)
[   31.194209]  dump_stack_lvl+0x8c/0xd0
[   31.194313]  print_report+0x118/0x608
[   31.194435]  kasan_report+0xdc/0x128
[   31.194532]  __asan_report_load8_noabort+0x20/0x30
[   31.194641]  workqueue_uaf+0x480/0x4a8
[   31.194746]  kunit_try_run_case+0x170/0x3f0
[   31.194836]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.194967]  kthread+0x328/0x630
[   31.195089]  ret_from_fork+0x10/0x20
[   31.195213] 
[   31.195257] Allocated by task 211:
[   31.195330]  kasan_save_stack+0x3c/0x68
[   31.195481]  kasan_save_track+0x20/0x40
[   31.195605]  kasan_save_alloc_info+0x40/0x58
[   31.195708]  __kasan_kmalloc+0xd4/0xd8
[   31.195805]  __kmalloc_cache_noprof+0x16c/0x3c0
[   31.195917]  workqueue_uaf+0x13c/0x4a8
[   31.196012]  kunit_try_run_case+0x170/0x3f0
[   31.196123]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.196216]  kthread+0x328/0x630
[   31.196290]  ret_from_fork+0x10/0x20
[   31.196385] 
[   31.196435] Freed by task 32:
[   31.196508]  kasan_save_stack+0x3c/0x68
[   31.196637]  kasan_save_track+0x20/0x40
[   31.196737]  kasan_save_free_info+0x4c/0x78
[   31.196868]  __kasan_slab_free+0x6c/0x98
[   31.196996]  kfree+0x214/0x3c8
[   31.197100]  workqueue_uaf_work+0x18/0x30
[   31.197181]  process_one_work+0x530/0xf98
[   31.197297]  worker_thread+0x618/0xf38
[   31.197373]  kthread+0x328/0x630
[   31.197574]  ret_from_fork+0x10/0x20
[   31.197654] 
[   31.197756] Last potentially related work creation:
[   31.197817]  kasan_save_stack+0x3c/0x68
[   31.197927]  kasan_record_aux_stack+0xb4/0xc8
[   31.198070]  __queue_work+0x65c/0xfe0
[   31.198179]  queue_work_on+0xbc/0xf8
[   31.198378]  workqueue_uaf+0x210/0x4a8
[   31.198535]  kunit_try_run_case+0x170/0x3f0
[   31.198673]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.198799]  kthread+0x328/0x630
[   31.198900]  ret_from_fork+0x10/0x20
[   31.199003] 
[   31.199852] The buggy address belongs to the object at fff00000c771ef40
[   31.199852]  which belongs to the cache kmalloc-32 of size 32
[   31.200080] The buggy address is located 0 bytes inside of
[   31.200080]  freed 32-byte region [fff00000c771ef40, fff00000c771ef60)
[   31.200451] 
[   31.200519] The buggy address belongs to the physical page:
[   31.200611] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10771e
[   31.200753] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   31.200892] page_type: f5(slab)
[   31.201241] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   31.202009] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   31.202125] page dumped because: kasan: bad access detected
[   31.202200] 
[   31.202244] Memory state around the buggy address:
[   31.202348]  fff00000c771ee00: 00 00 00 fc fc fc fc fc 00 00 03 fc fc fc fc fc
[   31.202504]  fff00000c771ee80: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   31.202640] >fff00000c771ef00: 00 00 00 07 fc fc fc fc fa fb fb fb fc fc fc fc
[   31.202740]                                            ^
[   31.202824]  fff00000c771ef80: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.202926]  fff00000c771f000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   31.203013] ==================================================================

[   27.735617] ==================================================================
[   27.736738] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x4d6/0x560
[   27.737124] Read of size 8 at addr ffff88810325e500 by task kunit_try_catch/229
[   27.737628] 
[   27.737865] CPU: 0 UID: 0 PID: 229 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc2-next-20250619 #1 PREEMPT(voluntary) 
[   27.737968] Tainted: [B]=BAD_PAGE, [N]=TEST
[   27.737992] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   27.738032] Call Trace:
[   27.738061]  <TASK>
[   27.738115]  dump_stack_lvl+0x73/0xb0
[   27.738194]  print_report+0xd1/0x650
[   27.738246]  ? __virt_addr_valid+0x1db/0x2d0
[   27.738303]  ? workqueue_uaf+0x4d6/0x560
[   27.738340]  ? kasan_complete_mode_report_info+0x64/0x200
[   27.738388]  ? workqueue_uaf+0x4d6/0x560
[   27.738430]  kasan_report+0x141/0x180
[   27.738518]  ? workqueue_uaf+0x4d6/0x560
[   27.738574]  __asan_report_load8_noabort+0x18/0x20
[   27.738640]  workqueue_uaf+0x4d6/0x560
[   27.738683]  ? __pfx_workqueue_uaf+0x10/0x10
[   27.738722]  ? __schedule+0x10cc/0x2b60
[   27.738761]  ? __pfx_read_tsc+0x10/0x10
[   27.738798]  ? ktime_get_ts64+0x86/0x230
[   27.738843]  kunit_try_run_case+0x1a5/0x480
[   27.738891]  ? __pfx_kunit_try_run_case+0x10/0x10
[   27.738948]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   27.739004]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   27.739047]  ? __kthread_parkme+0x82/0x180
[   27.739089]  ? preempt_count_sub+0x50/0x80
[   27.739153]  ? __pfx_kunit_try_run_case+0x10/0x10
[   27.739228]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   27.739274]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   27.739317]  kthread+0x337/0x6f0
[   27.739356]  ? trace_preempt_on+0x20/0xc0
[   27.739409]  ? __pfx_kthread+0x10/0x10
[   27.739455]  ? _raw_spin_unlock_irq+0x47/0x80
[   27.739501]  ? calculate_sigpending+0x7b/0xa0
[   27.739554]  ? __pfx_kthread+0x10/0x10
[   27.739598]  ret_from_fork+0x116/0x1d0
[   27.739638]  ? __pfx_kthread+0x10/0x10
[   27.739679]  ret_from_fork_asm+0x1a/0x30
[   27.739765]  </TASK>
[   27.739789] 
[   27.749878] Allocated by task 229:
[   27.750485]  kasan_save_stack+0x45/0x70
[   27.750871]  kasan_save_track+0x18/0x40
[   27.751461]  kasan_save_alloc_info+0x3b/0x50
[   27.751862]  __kasan_kmalloc+0xb7/0xc0
[   27.752311]  __kmalloc_cache_noprof+0x189/0x420
[   27.752712]  workqueue_uaf+0x152/0x560
[   27.752957]  kunit_try_run_case+0x1a5/0x480
[   27.753413]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   27.753702]  kthread+0x337/0x6f0
[   27.753888]  ret_from_fork+0x116/0x1d0
[   27.754310]  ret_from_fork_asm+0x1a/0x30
[   27.754675] 
[   27.754841] Freed by task 9:
[   27.755259]  kasan_save_stack+0x45/0x70
[   27.755497]  kasan_save_track+0x18/0x40
[   27.755807]  kasan_save_free_info+0x3f/0x60
[   27.756155]  __kasan_slab_free+0x56/0x70
[   27.756681]  kfree+0x222/0x3f0
[   27.756903]  workqueue_uaf_work+0x12/0x20
[   27.757247]  process_one_work+0x5ee/0xf60
[   27.757617]  worker_thread+0x758/0x1220
[   27.758013]  kthread+0x337/0x6f0
[   27.758316]  ret_from_fork+0x116/0x1d0
[   27.758770]  ret_from_fork_asm+0x1a/0x30
[   27.759302] 
[   27.759452] Last potentially related work creation:
[   27.759643]  kasan_save_stack+0x45/0x70
[   27.759830]  kasan_record_aux_stack+0xb2/0xc0
[   27.760173]  __queue_work+0x61a/0xe70
[   27.760534]  queue_work_on+0xb6/0xc0
[   27.760955]  workqueue_uaf+0x26d/0x560
[   27.761297]  kunit_try_run_case+0x1a5/0x480
[   27.761770]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   27.762574]  kthread+0x337/0x6f0
[   27.762899]  ret_from_fork+0x116/0x1d0
[   27.763118]  ret_from_fork_asm+0x1a/0x30
[   27.763339] 
[   27.763448] The buggy address belongs to the object at ffff88810325e500
[   27.763448]  which belongs to the cache kmalloc-32 of size 32
[   27.763965] The buggy address is located 0 bytes inside of
[   27.763965]  freed 32-byte region [ffff88810325e500, ffff88810325e520)
[   27.765181] 
[   27.765380] The buggy address belongs to the physical page:
[   27.765821] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10325e
[   27.766480] flags: 0x200000000000000(node=0|zone=2)
[   27.766809] page_type: f5(slab)
[   27.767200] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   27.767577] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   27.767853] page dumped because: kasan: bad access detected
[   27.768058] 
[   27.768173] Memory state around the buggy address:
[   27.768380]  ffff88810325e400: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   27.768643]  ffff88810325e480: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   27.768900] >ffff88810325e500: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   27.769359]                    ^
[   27.769684]  ffff88810325e580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   27.770278]  ffff88810325e600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   27.770893] ==================================================================