Hay
Date
May 12, 2025, 6:12 p.m.

Environment
qemu-arm64
qemu-x86_64

[   19.416504] ==================================================================
[   19.417283] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x480/0x4a8
[   19.418000] Read of size 8 at addr fff00000c6534e40 by task kunit_try_catch/189
[   19.418763] 
[   19.419099] CPU: 0 UID: 0 PID: 189 Comm: kunit_try_catch Tainted: G    B            N 6.14.7-rc1 #1
[   19.419305] Tainted: [B]=BAD_PAGE, [N]=TEST
[   19.419365] Hardware name: linux,dummy-virt (DT)
[   19.419466] Call trace:
[   19.419516]  show_stack+0x20/0x38 (C)
[   19.419643]  dump_stack_lvl+0x8c/0xd0
[   19.419783]  print_report+0x118/0x608
[   19.419906]  kasan_report+0xdc/0x128
[   19.420001]  __asan_report_load8_noabort+0x20/0x30
[   19.420104]  workqueue_uaf+0x480/0x4a8
[   19.420199]  kunit_try_run_case+0x170/0x3f0
[   19.420309]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.420438]  kthread+0x318/0x620
[   19.420552]  ret_from_fork+0x10/0x20
[   19.420660] 
[   19.425805] Allocated by task 189:
[   19.426311]  kasan_save_stack+0x3c/0x68
[   19.427231]  kasan_save_track+0x20/0x40
[   19.427667]  kasan_save_alloc_info+0x40/0x58
[   19.428252]  __kasan_kmalloc+0xd4/0xd8
[   19.428648]  __kmalloc_cache_noprof+0x15c/0x3c0
[   19.429229]  workqueue_uaf+0x13c/0x4a8
[   19.429676]  kunit_try_run_case+0x170/0x3f0
[   19.430227]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.431239]  kthread+0x318/0x620
[   19.431796]  ret_from_fork+0x10/0x20
[   19.431994] 
[   19.432101] Freed by task 47:
[   19.432238]  kasan_save_stack+0x3c/0x68
[   19.432405]  kasan_save_track+0x20/0x40
[   19.432560]  kasan_save_free_info+0x4c/0x78
[   19.432720]  __kasan_slab_free+0x6c/0x98
[   19.433219]  kfree+0x214/0x3c8
[   19.433661]  workqueue_uaf_work+0x18/0x30
[   19.434198]  process_one_work+0x530/0xf98
[   19.435065]  worker_thread+0x614/0xf28
[   19.435600]  kthread+0x318/0x620
[   19.436051]  ret_from_fork+0x10/0x20
[   19.436547] 
[   19.436822] Last potentially related work creation:
[   19.437319]  kasan_save_stack+0x3c/0x68
[   19.437869]  kasan_record_aux_stack+0xb4/0xc8
[   19.438366]  __queue_work+0x65c/0x1010
[   19.439340]  queue_work_on+0xbc/0xf8
[   19.439761]  workqueue_uaf+0x210/0x4a8
[   19.440233]  kunit_try_run_case+0x170/0x3f0
[   19.440650]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.441184]  kthread+0x318/0x620
[   19.441582]  ret_from_fork+0x10/0x20
[   19.442006] 
[   19.442263] The buggy address belongs to the object at fff00000c6534e40
[   19.442263]  which belongs to the cache kmalloc-32 of size 32
[   19.443324] The buggy address is located 0 bytes inside of
[   19.443324]  freed 32-byte region [fff00000c6534e40, fff00000c6534e60)
[   19.444373] 
[   19.444693] The buggy address belongs to the physical page:
[   19.445195] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106534
[   19.445947] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   19.446746] page_type: f5(slab)
[   19.447158] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   19.447785] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   19.448370] page dumped because: kasan: bad access detected
[   19.448865] 
[   19.449138] Memory state around the buggy address:
[   19.449683]  fff00000c6534d00: 00 00 00 fc fc fc fc fc 00 00 05 fc fc fc fc fc
[   19.450302]  fff00000c6534d80: 00 00 07 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   19.451298] >fff00000c6534e00: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   19.451726]                                            ^
[   19.452133]  fff00000c6534e80: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.452821]  fff00000c6534f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.453432] ==================================================================

[   13.014744] ==================================================================
[   13.016031] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x4d8/0x560
[   13.016429] Read of size 8 at addr ffff888101b25f00 by task kunit_try_catch/208
[   13.017017] 
[   13.017214] CPU: 1 UID: 0 PID: 208 Comm: kunit_try_catch Tainted: G    B            N 6.14.7-rc1 #1
[   13.017264] Tainted: [B]=BAD_PAGE, [N]=TEST
[   13.017276] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   13.017298] Call Trace:
[   13.017314]  <TASK>
[   13.017335]  dump_stack_lvl+0x73/0xb0
[   13.017366]  print_report+0xd1/0x650
[   13.017388]  ? __virt_addr_valid+0x1db/0x2d0
[   13.017410]  ? workqueue_uaf+0x4d8/0x560
[   13.017431]  ? kasan_complete_mode_report_info+0x64/0x200
[   13.017455]  ? workqueue_uaf+0x4d8/0x560
[   13.017475]  kasan_report+0x140/0x180
[   13.017496]  ? workqueue_uaf+0x4d8/0x560
[   13.017520]  __asan_report_load8_noabort+0x18/0x20
[   13.017543]  workqueue_uaf+0x4d8/0x560
[   13.017576]  ? __pfx_workqueue_uaf+0x10/0x10
[   13.017597]  ? __schedule+0xce8/0x2840
[   13.017633]  ? __pfx_read_tsc+0x10/0x10
[   13.017656]  ? ktime_get_ts64+0x86/0x230
[   13.017681]  kunit_try_run_case+0x1a6/0x480
[   13.017705]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.017725]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   13.017759]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   13.017783]  ? __kthread_parkme+0x82/0x160
[   13.017806]  ? preempt_count_sub+0x50/0x80
[   13.017830]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.017861]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.017886]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   13.017911]  kthread+0x324/0x6e0
[   13.017932]  ? trace_preempt_on+0x20/0xc0
[   13.017956]  ? __pfx_kthread+0x10/0x10
[   13.017977]  ? _raw_spin_unlock_irq+0x47/0x80
[   13.017999]  ? calculate_sigpending+0x7b/0xa0
[   13.018021]  ? __pfx_kthread+0x10/0x10
[   13.018056]  ret_from_fork+0x41/0x80
[   13.018075]  ? __pfx_kthread+0x10/0x10
[   13.018096]  ret_from_fork_asm+0x1a/0x30
[   13.018128]  </TASK>
[   13.018139] 
[   13.029829] Allocated by task 208:
[   13.030332]  kasan_save_stack+0x45/0x70
[   13.030768]  kasan_save_track+0x18/0x40
[   13.031193]  kasan_save_alloc_info+0x3b/0x50
[   13.031351]  __kasan_kmalloc+0xb7/0xc0
[   13.031485]  __kmalloc_cache_noprof+0x18a/0x420
[   13.031644]  workqueue_uaf+0x153/0x560
[   13.031778]  kunit_try_run_case+0x1a6/0x480
[   13.032536]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.033189]  kthread+0x324/0x6e0
[   13.033691]  ret_from_fork+0x41/0x80
[   13.034280]  ret_from_fork_asm+0x1a/0x30
[   13.034773] 
[   13.035245] Freed by task 84:
[   13.035397]  kasan_save_stack+0x45/0x70
[   13.035551]  kasan_save_track+0x18/0x40
[   13.035686]  kasan_save_free_info+0x3f/0x60
[   13.035834]  __kasan_slab_free+0x56/0x70
[   13.035986]  kfree+0x224/0x3f0
[   13.036700]  workqueue_uaf_work+0x12/0x20
[   13.037297]  process_one_work+0x5ee/0xf60
[   13.037812]  worker_thread+0x720/0x1300
[   13.038387]  kthread+0x324/0x6e0
[   13.038830]  ret_from_fork+0x41/0x80
[   13.039338]  ret_from_fork_asm+0x1a/0x30
[   13.039849] 
[   13.040017] Last potentially related work creation:
[   13.040714]  kasan_save_stack+0x45/0x70
[   13.040878]  kasan_record_aux_stack+0xb2/0xc0
[   13.041042]  __queue_work+0x626/0xeb0
[   13.041608]  queue_work_on+0x74/0xa0
[   13.042146]  workqueue_uaf+0x26e/0x560
[   13.042644]  kunit_try_run_case+0x1a6/0x480
[   13.043177]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.043377]  kthread+0x324/0x6e0
[   13.043989]  ret_from_fork+0x41/0x80
[   13.044497]  ret_from_fork_asm+0x1a/0x30
[   13.044651] 
[   13.044746] The buggy address belongs to the object at ffff888101b25f00
[   13.044746]  which belongs to the cache kmalloc-32 of size 32
[   13.046346] The buggy address is located 0 bytes inside of
[   13.046346]  freed 32-byte region [ffff888101b25f00, ffff888101b25f20)
[   13.046702] 
[   13.046777] The buggy address belongs to the physical page:
[   13.046968] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101b25
[   13.047999] flags: 0x200000000000000(node=0|zone=2)
[   13.048442] page_type: f5(slab)
[   13.049013] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   13.049851] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   13.050801] page dumped because: kasan: bad access detected
[   13.051464] 
[   13.051544] Memory state around the buggy address:
[   13.051707]  ffff888101b25e00: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   13.051940]  ffff888101b25e80: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   13.052489] >ffff888101b25f00: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   13.052809]                    ^
[   13.052993]  ffff888101b25f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   13.053558]  ffff888101b26000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   13.054023] ==================================================================