Hay
Date
May 29, 2025, 7:10 a.m.

Environment
qemu-arm64
qemu-x86_64

[   22.431681] ==================================================================
[   22.432087] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x480/0x4a8
[   22.432620] Read of size 8 at addr fff00000c669e640 by task kunit_try_catch/200
[   22.432787] 
[   22.433072] CPU: 1 UID: 0 PID: 200 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-next-20250529 #1 PREEMPT 
[   22.433556] Tainted: [B]=BAD_PAGE, [N]=TEST
[   22.433630] Hardware name: linux,dummy-virt (DT)
[   22.433716] Call trace:
[   22.433778]  show_stack+0x20/0x38 (C)
[   22.433911]  dump_stack_lvl+0x8c/0xd0
[   22.434383]  print_report+0x118/0x608
[   22.434532]  kasan_report+0xdc/0x128
[   22.434664]  __asan_report_load8_noabort+0x20/0x30
[   22.434793]  workqueue_uaf+0x480/0x4a8
[   22.434907]  kunit_try_run_case+0x170/0x3f0
[   22.435012]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   22.435612]  kthread+0x328/0x630
[   22.436111]  ret_from_fork+0x10/0x20
[   22.436347] 
[   22.436791] Allocated by task 200:
[   22.436927]  kasan_save_stack+0x3c/0x68
[   22.437049]  kasan_save_track+0x20/0x40
[   22.437513]  kasan_save_alloc_info+0x40/0x58
[   22.437694]  __kasan_kmalloc+0xd4/0xd8
[   22.437811]  __kmalloc_cache_noprof+0x15c/0x3c0
[   22.438448]  workqueue_uaf+0x13c/0x4a8
[   22.438669]  kunit_try_run_case+0x170/0x3f0
[   22.439422]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   22.439646]  kthread+0x328/0x630
[   22.439829]  ret_from_fork+0x10/0x20
[   22.439922] 
[   22.440456] Freed by task 44:
[   22.440540]  kasan_save_stack+0x3c/0x68
[   22.441032]  kasan_save_track+0x20/0x40
[   22.441146]  kasan_save_free_info+0x4c/0x78
[   22.441789]  __kasan_slab_free+0x6c/0x98
[   22.442086]  kfree+0x214/0x3c8
[   22.442188]  workqueue_uaf_work+0x18/0x30
[   22.442284]  process_one_work+0x530/0xf98
[   22.443032]  worker_thread+0x8ac/0xf28
[   22.443156]  kthread+0x328/0x630
[   22.443320]  ret_from_fork+0x10/0x20
[   22.443518] 
[   22.443830] Last potentially related work creation:
[   22.443957]  kasan_save_stack+0x3c/0x68
[   22.444319]  kasan_record_aux_stack+0xb4/0xc8
[   22.444439]  __queue_work+0x65c/0x1010
[   22.444535]  queue_work_on+0xbc/0xf8
[   22.444914]  workqueue_uaf+0x210/0x4a8
[   22.445365]  kunit_try_run_case+0x170/0x3f0
[   22.445683]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   22.445804]  kthread+0x328/0x630
[   22.446165]  ret_from_fork+0x10/0x20
[   22.446274] 
[   22.446731] The buggy address belongs to the object at fff00000c669e640
[   22.446731]  which belongs to the cache kmalloc-32 of size 32
[   22.446922] The buggy address is located 0 bytes inside of
[   22.446922]  freed 32-byte region [fff00000c669e640, fff00000c669e660)
[   22.447084] 
[   22.447454] The buggy address belongs to the physical page:
[   22.447831] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10669e
[   22.448083] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   22.448300] page_type: f5(slab)
[   22.448642] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   22.448993] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   22.449318] page dumped because: kasan: bad access detected
[   22.449451] 
[   22.449512] Memory state around the buggy address:
[   22.449944]  fff00000c669e500: 00 00 00 fc fc fc fc fc 00 00 03 fc fc fc fc fc
[   22.450082]  fff00000c669e580: 00 00 00 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   22.450643] >fff00000c669e600: 00 00 00 07 fc fc fc fc fa fb fb fb fc fc fc fc
[   22.450931]                                            ^
[   22.451247]  fff00000c669e680: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.451384]  fff00000c669e700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.451503] ==================================================================


[   11.458669] ==================================================================
[   11.459459] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x4d6/0x560
[   11.459829] Read of size 8 at addr ffff8881028a3740 by task kunit_try_catch/217
[   11.460113] 
[   11.460221] CPU: 1 UID: 0 PID: 217 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-next-20250529 #1 PREEMPT(voluntary) 
[   11.460268] Tainted: [B]=BAD_PAGE, [N]=TEST
[   11.460280] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   11.460309] Call Trace:
[   11.460321]  <TASK>
[   11.460336]  dump_stack_lvl+0x73/0xb0
[   11.460362]  print_report+0xd1/0x650
[   11.460384]  ? __virt_addr_valid+0x1db/0x2d0
[   11.460406]  ? workqueue_uaf+0x4d6/0x560
[   11.460428]  ? kasan_complete_mode_report_info+0x64/0x200
[   11.460450]  ? workqueue_uaf+0x4d6/0x560
[   11.460472]  kasan_report+0x141/0x180
[   11.460494]  ? workqueue_uaf+0x4d6/0x560
[   11.460520]  __asan_report_load8_noabort+0x18/0x20
[   11.460541]  workqueue_uaf+0x4d6/0x560
[   11.460563]  ? __pfx_workqueue_uaf+0x10/0x10
[   11.460585]  ? __schedule+0x10cc/0x2b60
[   11.461012]  ? __pfx_read_tsc+0x10/0x10
[   11.461054]  ? ktime_get_ts64+0x86/0x230
[   11.461084]  kunit_try_run_case+0x1a5/0x480
[   11.461378]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.461404]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   11.461430]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   11.461454]  ? __kthread_parkme+0x82/0x180
[   11.461474]  ? preempt_count_sub+0x50/0x80
[   11.461498]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.461519]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.461542]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   11.461566]  kthread+0x337/0x6f0
[   11.461585]  ? trace_preempt_on+0x20/0xc0
[   11.461622]  ? __pfx_kthread+0x10/0x10
[   11.461643]  ? _raw_spin_unlock_irq+0x47/0x80
[   11.461665]  ? calculate_sigpending+0x7b/0xa0
[   11.461688]  ? __pfx_kthread+0x10/0x10
[   11.461710]  ret_from_fork+0x116/0x1d0
[   11.461727]  ? __pfx_kthread+0x10/0x10
[   11.461754]  ret_from_fork_asm+0x1a/0x30
[   11.461784]  </TASK>
[   11.461795] 
[   11.472184] Allocated by task 217:
[   11.472335]  kasan_save_stack+0x45/0x70
[   11.472679]  kasan_save_track+0x18/0x40
[   11.472923]  kasan_save_alloc_info+0x3b/0x50
[   11.473215]  __kasan_kmalloc+0xb7/0xc0
[   11.473474]  __kmalloc_cache_noprof+0x189/0x420
[   11.473715]  workqueue_uaf+0x152/0x560
[   11.474068]  kunit_try_run_case+0x1a5/0x480
[   11.474230]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.474487]  kthread+0x337/0x6f0
[   11.474801]  ret_from_fork+0x116/0x1d0
[   11.475029]  ret_from_fork_asm+0x1a/0x30
[   11.475224] 
[   11.475331] Freed by task 44:
[   11.475473]  kasan_save_stack+0x45/0x70
[   11.475667]  kasan_save_track+0x18/0x40
[   11.476227]  kasan_save_free_info+0x3f/0x60
[   11.476394]  __kasan_slab_free+0x56/0x70
[   11.476738]  kfree+0x222/0x3f0
[   11.477042]  workqueue_uaf_work+0x12/0x20
[   11.477222]  process_one_work+0x5ee/0xf60
[   11.477557]  worker_thread+0x758/0x1220
[   11.477888]  kthread+0x337/0x6f0
[   11.478136]  ret_from_fork+0x116/0x1d0
[   11.478452]  ret_from_fork_asm+0x1a/0x30
[   11.478656] 
[   11.478972] Last potentially related work creation:
[   11.479219]  kasan_save_stack+0x45/0x70
[   11.479412]  kasan_record_aux_stack+0xb2/0xc0
[   11.479628]  __queue_work+0x626/0xeb0
[   11.480090]  queue_work_on+0xb6/0xc0
[   11.480267]  workqueue_uaf+0x26d/0x560
[   11.480417]  kunit_try_run_case+0x1a5/0x480
[   11.480645]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.481058]  kthread+0x337/0x6f0
[   11.481321]  ret_from_fork+0x116/0x1d0
[   11.481651]  ret_from_fork_asm+0x1a/0x30
[   11.481990] 
[   11.482163] The buggy address belongs to the object at ffff8881028a3740
[   11.482163]  which belongs to the cache kmalloc-32 of size 32
[   11.482705] The buggy address is located 0 bytes inside of
[   11.482705]  freed 32-byte region [ffff8881028a3740, ffff8881028a3760)
[   11.483656] 
[   11.483821] The buggy address belongs to the physical page:
[   11.484284] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1028a3
[   11.484890] flags: 0x200000000000000(node=0|zone=2)
[   11.485232] page_type: f5(slab)
[   11.485416] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   11.485732] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   11.486426] page dumped because: kasan: bad access detected
[   11.486852] 
[   11.487045] Memory state around the buggy address:
[   11.487306]  ffff8881028a3600: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   11.487804]  ffff8881028a3680: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   11.488155] >ffff8881028a3700: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   11.488586]                                            ^
[   11.489014]  ffff8881028a3780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.489472]  ffff8881028a3800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.490062] ==================================================================