Hay
Date
June 7, 2025, 10:40 a.m.

Environment
qemu-arm64
qemu-x86_64

[   22.148462] ==================================================================
[   22.149366] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x498/0x4c0
[   22.150185] Read of size 8 at addr fff00000c4227340 by task kunit_try_catch/188
[   22.150990] 
[   22.151334] CPU: 1 UID: 0 PID: 188 Comm: kunit_try_catch Tainted: G    B            N 6.12.33-rc1 #1
[   22.151563] Tainted: [B]=BAD_PAGE, [N]=TEST
[   22.151641] Hardware name: linux,dummy-virt (DT)
[   22.151730] Call trace:
[   22.151797]  dump_backtrace+0x9c/0x128
[   22.151914]  show_stack+0x20/0x38
[   22.152080]  dump_stack_lvl+0x8c/0xd0
[   22.152208]  print_report+0x118/0x5f0
[   22.152320]  kasan_report+0xdc/0x128
[   22.152427]  __asan_report_load8_noabort+0x20/0x30
[   22.152548]  workqueue_uaf+0x498/0x4c0
[   22.152660]  kunit_try_run_case+0x170/0x3f0
[   22.152805]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   22.152873]  kthread+0x24c/0x2d0
[   22.152918]  ret_from_fork+0x10/0x20
[   22.152996] 
[   22.160873] Allocated by task 188:
[   22.161479]  kasan_save_stack+0x3c/0x68
[   22.162157]  kasan_save_track+0x20/0x40
[   22.163816]  kasan_save_alloc_info+0x40/0x58
[   22.164432]  __kasan_kmalloc+0xd4/0xd8
[   22.164918]  __kmalloc_cache_noprof+0x154/0x320
[   22.165540]  workqueue_uaf+0x140/0x4c0
[   22.166032]  kunit_try_run_case+0x170/0x3f0
[   22.166583]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   22.167220]  kthread+0x24c/0x2d0
[   22.168101]  ret_from_fork+0x10/0x20
[   22.168515] 
[   22.168855] Freed by task 32:
[   22.169288]  kasan_save_stack+0x3c/0x68
[   22.169757]  kasan_save_track+0x20/0x40
[   22.170472]  kasan_save_free_info+0x4c/0x78
[   22.171036]  __kasan_slab_free+0x6c/0x98
[   22.171949]  kfree+0x110/0x3b8
[   22.172422]  workqueue_uaf_work+0x18/0x30
[   22.172936]  process_one_work+0x530/0xfa8
[   22.173450]  worker_thread+0x610/0xf18
[   22.173988]  kthread+0x24c/0x2d0
[   22.174466]  ret_from_fork+0x10/0x20
[   22.174996] 
[   22.175313] Last potentially related work creation:
[   22.176714]  kasan_save_stack+0x3c/0x68
[   22.177239]  __kasan_record_aux_stack+0xbc/0xe8
[   22.177813]  kasan_record_aux_stack_noalloc+0x14/0x20
[   22.178522]  __queue_work+0x654/0xfd8
[   22.178871]  queue_work_on+0xbc/0xf8
[   22.179848]  workqueue_uaf+0x218/0x4c0
[   22.180335]  kunit_try_run_case+0x170/0x3f0
[   22.180899]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   22.181539]  kthread+0x24c/0x2d0
[   22.181995]  ret_from_fork+0x10/0x20
[   22.182461] 
[   22.182778] The buggy address belongs to the object at fff00000c4227340
[   22.182778]  which belongs to the cache kmalloc-32 of size 32
[   22.185536] The buggy address is located 0 bytes inside of
[   22.185536]  freed 32-byte region [fff00000c4227340, fff00000c4227360)
[   22.186670] 
[   22.187069] The buggy address belongs to the physical page:
[   22.187866] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x104227
[   22.189162] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   22.189483] page_type: f5(slab)
[   22.189684] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   22.190110] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   22.190859] page dumped because: kasan: bad access detected
[   22.191538] 
[   22.191805] Memory state around the buggy address:
[   22.192839]  fff00000c4227200: 00 00 05 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   22.193620]  fff00000c4227280: fa fb fb fb fc fc fc fc 00 00 07 fc fc fc fc fc
[   22.194660] >fff00000c4227300: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   22.195318]                                            ^
[   22.196300]  fff00000c4227380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.197392]  fff00000c4227400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.198336] ==================================================================

[   18.684736] ==================================================================
[   18.685678] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x4d8/0x560
[   18.686255] Read of size 8 at addr ffff88810230cf00 by task kunit_try_catch/205
[   18.686756] 
[   18.687017] CPU: 1 UID: 0 PID: 205 Comm: kunit_try_catch Tainted: G    B            N 6.12.33-rc1 #1
[   18.687137] Tainted: [B]=BAD_PAGE, [N]=TEST
[   18.687165] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   18.687196] Call Trace:
[   18.687414]  <TASK>
[   18.687506]  dump_stack_lvl+0x73/0xb0
[   18.687583]  print_report+0xd1/0x640
[   18.687649]  ? __virt_addr_valid+0x1db/0x2d0
[   18.687723]  ? workqueue_uaf+0x4d8/0x560
[   18.687783]  ? kasan_complete_mode_report_info+0x64/0x200
[   18.687901]  ? workqueue_uaf+0x4d8/0x560
[   18.687965]  kasan_report+0x140/0x180
[   18.688041]  ? workqueue_uaf+0x4d8/0x560
[   18.688116]  __asan_report_load8_noabort+0x18/0x20
[   18.688186]  workqueue_uaf+0x4d8/0x560
[   18.688273]  ? __pfx_workqueue_uaf+0x10/0x10
[   18.688338]  ? __schedule+0xc49/0x27a0
[   18.688405]  ? __pfx_read_tsc+0x10/0x10
[   18.688474]  ? ktime_get_ts64+0x84/0x230
[   18.688532]  kunit_try_run_case+0x1a6/0x480
[   18.688566]  ? __pfx_kunit_try_run_case+0x10/0x10
[   18.688593]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   18.688620]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   18.688654]  ? __kthread_parkme+0x82/0x160
[   18.688680]  ? preempt_count_sub+0x50/0x80
[   18.688711]  ? __pfx_kunit_try_run_case+0x10/0x10
[   18.688738]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   18.688774]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   18.688840]  kthread+0x257/0x310
[   18.688869]  ? __pfx_kthread+0x10/0x10
[   18.688894]  ret_from_fork+0x41/0x80
[   18.688922]  ? __pfx_kthread+0x10/0x10
[   18.688946]  ret_from_fork_asm+0x1a/0x30
[   18.688987]  </TASK>
[   18.689000] 
[   18.713434] Allocated by task 205:
[   18.714494]  kasan_save_stack+0x45/0x70
[   18.715187]  kasan_save_track+0x18/0x40
[   18.715750]  kasan_save_alloc_info+0x3b/0x50
[   18.716551]  __kasan_kmalloc+0xb7/0xc0
[   18.717323]  __kmalloc_cache_noprof+0x168/0x350
[   18.718038]  workqueue_uaf+0x153/0x560
[   18.719268]  kunit_try_run_case+0x1a6/0x480
[   18.720243]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   18.721291]  kthread+0x257/0x310
[   18.722192]  ret_from_fork+0x41/0x80
[   18.722661]  ret_from_fork_asm+0x1a/0x30
[   18.723537] 
[   18.723949] Freed by task 43:
[   18.724250]  kasan_save_stack+0x45/0x70
[   18.725010]  kasan_save_track+0x18/0x40
[   18.725601]  kasan_save_free_info+0x3f/0x60
[   18.726358]  __kasan_slab_free+0x56/0x70
[   18.726883]  kfree+0x123/0x3d0
[   18.727569]  workqueue_uaf_work+0x12/0x20
[   18.728211]  process_one_work+0x5ee/0xf60
[   18.728630]  worker_thread+0x753/0x1200
[   18.729172]  kthread+0x257/0x310
[   18.729793]  ret_from_fork+0x41/0x80
[   18.730289]  ret_from_fork_asm+0x1a/0x30
[   18.730860] 
[   18.731079] Last potentially related work creation:
[   18.731555]  kasan_save_stack+0x45/0x70
[   18.732012]  __kasan_record_aux_stack+0xae/0xc0
[   18.732578]  kasan_record_aux_stack_noalloc+0xf/0x20
[   18.733057]  __queue_work+0x67e/0xf70
[   18.733415]  queue_work_on+0x74/0xa0
[   18.733960]  workqueue_uaf+0x26e/0x560
[   18.734374]  kunit_try_run_case+0x1a6/0x480
[   18.735287]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   18.735706]  kthread+0x257/0x310
[   18.736048]  ret_from_fork+0x41/0x80
[   18.736716]  ret_from_fork_asm+0x1a/0x30
[   18.737152] 
[   18.737395] The buggy address belongs to the object at ffff88810230cf00
[   18.737395]  which belongs to the cache kmalloc-32 of size 32
[   18.738414] The buggy address is located 0 bytes inside of
[   18.738414]  freed 32-byte region [ffff88810230cf00, ffff88810230cf20)
[   18.739451] 
[   18.739690] The buggy address belongs to the physical page:
[   18.740176] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10230c
[   18.741392] flags: 0x200000000000000(node=0|zone=2)
[   18.741970] page_type: f5(slab)
[   18.742354] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   18.743151] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   18.743881] page dumped because: kasan: bad access detected
[   18.744334] 
[   18.744921] Memory state around the buggy address:
[   18.745427]  ffff88810230ce00: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   18.746140]  ffff88810230ce80: 00 00 03 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   18.746862] >ffff88810230cf00: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   18.747417]                    ^
[   18.747937]  ffff88810230cf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.748432]  ffff88810230d000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   18.749199] ==================================================================