Hay
Date
July 9, 2025, 2:07 p.m.

Environment
qemu-arm64
qemu-x86_64

[   17.763141] ==================================================================
[   17.763202] BUG: KASAN: slab-use-after-free in kmalloc_uaf2+0x3f4/0x468
[   17.763257] Read of size 1 at addr fff00000c7708da8 by task kunit_try_catch/188
[   17.763757] 
[   17.764322] CPU: 0 UID: 0 PID: 188 Comm: kunit_try_catch Tainted: G    B   W        N  6.16.0-rc5 #1 PREEMPT 
[   17.764636] Tainted: [B]=BAD_PAGE, [W]=WARN, [N]=TEST
[   17.764686] Hardware name: linux,dummy-virt (DT)
[   17.764717] Call trace:
[   17.764740]  show_stack+0x20/0x38 (C)
[   17.764792]  dump_stack_lvl+0x8c/0xd0
[   17.764842]  print_report+0x118/0x608
[   17.764897]  kasan_report+0xdc/0x128
[   17.764950]  __asan_report_load1_noabort+0x20/0x30
[   17.765118]  kmalloc_uaf2+0x3f4/0x468
[   17.765164]  kunit_try_run_case+0x170/0x3f0
[   17.765213]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.765878]  kthread+0x328/0x630
[   17.766141]  ret_from_fork+0x10/0x20
[   17.766195] 
[   17.766238] Allocated by task 188:
[   17.766270]  kasan_save_stack+0x3c/0x68
[   17.766314]  kasan_save_track+0x20/0x40
[   17.766630]  kasan_save_alloc_info+0x40/0x58
[   17.766745]  __kasan_kmalloc+0xd4/0xd8
[   17.766847]  __kmalloc_cache_noprof+0x16c/0x3c0
[   17.766888]  kmalloc_uaf2+0xc4/0x468
[   17.766925]  kunit_try_run_case+0x170/0x3f0
[   17.766964]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.767018]  kthread+0x328/0x630
[   17.767064]  ret_from_fork+0x10/0x20
[   17.767161] 
[   17.767227] Freed by task 188:
[   17.767371]  kasan_save_stack+0x3c/0x68
[   17.767445]  kasan_save_track+0x20/0x40
[   17.767580]  kasan_save_free_info+0x4c/0x78
[   17.767740]  __kasan_slab_free+0x6c/0x98
[   17.767791]  kfree+0x214/0x3c8
[   17.767825]  kmalloc_uaf2+0x134/0x468
[   17.767879]  kunit_try_run_case+0x170/0x3f0
[   17.768096]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.768145]  kthread+0x328/0x630
[   17.768179]  ret_from_fork+0x10/0x20
[   17.768217] 
[   17.768235] The buggy address belongs to the object at fff00000c7708d80
[   17.768235]  which belongs to the cache kmalloc-64 of size 64
[   17.768298] The buggy address is located 40 bytes inside of
[   17.768298]  freed 64-byte region [fff00000c7708d80, fff00000c7708dc0)
[   17.768629] 
[   17.768759] The buggy address belongs to the physical page:
[   17.768855] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x107708
[   17.768927] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   17.769016] page_type: f5(slab)
[   17.769078] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   17.769231] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   17.769275] page dumped because: kasan: bad access detected
[   17.769306] 
[   17.769323] Memory state around the buggy address:
[   17.769359]  fff00000c7708c80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   17.769480]  fff00000c7708d00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   17.769643] >fff00000c7708d80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   17.769856]                                   ^
[   17.769933]  fff00000c7708e00: 00 00 00 00 00 03 fc fc fc fc fc fc fc fc fc fc
[   17.770006]  fff00000c7708e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.770050] ==================================================================

[   13.086493] ==================================================================
[   13.087070] BUG: KASAN: slab-use-after-free in kmalloc_uaf2+0x4a8/0x520
[   13.087416] Read of size 1 at addr ffff8881029b5928 by task kunit_try_catch/205
[   13.087756] 
[   13.087921] CPU: 0 UID: 0 PID: 205 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5 #1 PREEMPT(voluntary) 
[   13.087969] Tainted: [B]=BAD_PAGE, [N]=TEST
[   13.088560] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   13.088588] Call Trace:
[   13.088615]  <TASK>
[   13.088633]  dump_stack_lvl+0x73/0xb0
[   13.088670]  print_report+0xd1/0x650
[   13.088693]  ? __virt_addr_valid+0x1db/0x2d0
[   13.088718]  ? kmalloc_uaf2+0x4a8/0x520
[   13.088738]  ? kasan_complete_mode_report_info+0x64/0x200
[   13.088761]  ? kmalloc_uaf2+0x4a8/0x520
[   13.088796]  kasan_report+0x141/0x180
[   13.088861]  ? kmalloc_uaf2+0x4a8/0x520
[   13.088887]  __asan_report_load1_noabort+0x18/0x20
[   13.088911]  kmalloc_uaf2+0x4a8/0x520
[   13.088931]  ? __pfx_kmalloc_uaf2+0x10/0x10
[   13.088950]  ? finish_task_switch.isra.0+0x153/0x700
[   13.088976]  ? __switch_to+0x47/0xf50
[   13.089003]  ? __schedule+0x10cc/0x2b60
[   13.089025]  ? __pfx_read_tsc+0x10/0x10
[   13.089047]  ? ktime_get_ts64+0x86/0x230
[   13.089072]  kunit_try_run_case+0x1a5/0x480
[   13.089098]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.089120]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   13.089145]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   13.089169]  ? __kthread_parkme+0x82/0x180
[   13.089190]  ? preempt_count_sub+0x50/0x80
[   13.089213]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.089238]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.089264]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   13.089290]  kthread+0x337/0x6f0
[   13.089308]  ? trace_preempt_on+0x20/0xc0
[   13.089332]  ? __pfx_kthread+0x10/0x10
[   13.089352]  ? _raw_spin_unlock_irq+0x47/0x80
[   13.089373]  ? calculate_sigpending+0x7b/0xa0
[   13.089398]  ? __pfx_kthread+0x10/0x10
[   13.089418]  ret_from_fork+0x116/0x1d0
[   13.089436]  ? __pfx_kthread+0x10/0x10
[   13.089456]  ret_from_fork_asm+0x1a/0x30
[   13.089487]  </TASK>
[   13.089498] 
[   13.101463] Allocated by task 205:
[   13.101664]  kasan_save_stack+0x45/0x70
[   13.101866]  kasan_save_track+0x18/0x40
[   13.102058]  kasan_save_alloc_info+0x3b/0x50
[   13.102260]  __kasan_kmalloc+0xb7/0xc0
[   13.102424]  __kmalloc_cache_noprof+0x189/0x420
[   13.103235]  kmalloc_uaf2+0xc6/0x520
[   13.103590]  kunit_try_run_case+0x1a5/0x480
[   13.104016]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.104380]  kthread+0x337/0x6f0
[   13.104646]  ret_from_fork+0x116/0x1d0
[   13.105033]  ret_from_fork_asm+0x1a/0x30
[   13.105332] 
[   13.105453] Freed by task 205:
[   13.105739]  kasan_save_stack+0x45/0x70
[   13.106142]  kasan_save_track+0x18/0x40
[   13.106435]  kasan_save_free_info+0x3f/0x60
[   13.106739]  __kasan_slab_free+0x56/0x70
[   13.107144]  kfree+0x222/0x3f0
[   13.107413]  kmalloc_uaf2+0x14c/0x520
[   13.107613]  kunit_try_run_case+0x1a5/0x480
[   13.107831]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.108079]  kthread+0x337/0x6f0
[   13.108254]  ret_from_fork+0x116/0x1d0
[   13.108444]  ret_from_fork_asm+0x1a/0x30
[   13.109168] 
[   13.109273] The buggy address belongs to the object at ffff8881029b5900
[   13.109273]  which belongs to the cache kmalloc-64 of size 64
[   13.110018] The buggy address is located 40 bytes inside of
[   13.110018]  freed 64-byte region [ffff8881029b5900, ffff8881029b5940)
[   13.110741] 
[   13.110859] The buggy address belongs to the physical page:
[   13.111359] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1029b5
[   13.111821] flags: 0x200000000000000(node=0|zone=2)
[   13.112230] page_type: f5(slab)
[   13.112501] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   13.113011] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   13.113451] page dumped because: kasan: bad access detected
[   13.113896] 
[   13.113979] Memory state around the buggy address:
[   13.114364]  ffff8881029b5800: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   13.114997]  ffff8881029b5880: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   13.115323] >ffff8881029b5900: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   13.115731]                                   ^
[   13.116143]  ffff8881029b5980: 00 00 00 00 00 03 fc fc fc fc fc fc fc fc fc fc
[   13.116564]  ffff8881029b5a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   13.117062] ==================================================================