Hay
Date
July 1, 2025, 11:08 a.m.

Environment
qemu-arm64
qemu-x86_64

[   18.481757] ==================================================================
[   18.481888] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x300/0x338
[   18.482007] Read of size 1 at addr fff00000c5d4da48 by task kunit_try_catch/185
[   18.482066] 
[   18.482128] CPU: 1 UID: 0 PID: 185 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT 
[   18.482243] Tainted: [B]=BAD_PAGE, [N]=TEST
[   18.482273] Hardware name: linux,dummy-virt (DT)
[   18.482587] Call trace:
[   18.482662]  show_stack+0x20/0x38 (C)
[   18.482883]  dump_stack_lvl+0x8c/0xd0
[   18.482975]  print_report+0x118/0x608
[   18.483048]  kasan_report+0xdc/0x128
[   18.483096]  __asan_report_load1_noabort+0x20/0x30
[   18.483281]  kmalloc_uaf+0x300/0x338
[   18.483367]  kunit_try_run_case+0x170/0x3f0
[   18.483459]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.483560]  kthread+0x328/0x630
[   18.483644]  ret_from_fork+0x10/0x20
[   18.483859] 
[   18.483995] Allocated by task 185:
[   18.484062]  kasan_save_stack+0x3c/0x68
[   18.484193]  kasan_save_track+0x20/0x40
[   18.484312]  kasan_save_alloc_info+0x40/0x58
[   18.484430]  __kasan_kmalloc+0xd4/0xd8
[   18.484532]  __kmalloc_cache_noprof+0x16c/0x3c0
[   18.484628]  kmalloc_uaf+0xb8/0x338
[   18.484702]  kunit_try_run_case+0x170/0x3f0
[   18.484849]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.484931]  kthread+0x328/0x630
[   18.484977]  ret_from_fork+0x10/0x20
[   18.485019] 
[   18.485039] Freed by task 185:
[   18.485068]  kasan_save_stack+0x3c/0x68
[   18.485279]  kasan_save_track+0x20/0x40
[   18.485330]  kasan_save_free_info+0x4c/0x78
[   18.485372]  __kasan_slab_free+0x6c/0x98
[   18.485413]  kfree+0x214/0x3c8
[   18.485448]  kmalloc_uaf+0x11c/0x338
[   18.485485]  kunit_try_run_case+0x170/0x3f0
[   18.485672]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.485802]  kthread+0x328/0x630
[   18.485837]  ret_from_fork+0x10/0x20
[   18.485876] 
[   18.486067] The buggy address belongs to the object at fff00000c5d4da40
[   18.486067]  which belongs to the cache kmalloc-16 of size 16
[   18.486282] The buggy address is located 8 bytes inside of
[   18.486282]  freed 16-byte region [fff00000c5d4da40, fff00000c5d4da50)
[   18.486451] 
[   18.486519] The buggy address belongs to the physical page:
[   18.486568] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105d4d
[   18.486630] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   18.486689] page_type: f5(slab)
[   18.486737] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   18.486792] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   18.486840] page dumped because: kasan: bad access detected
[   18.486876] 
[   18.486895] Memory state around the buggy address:
[   18.486951]  fff00000c5d4d900: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   18.487010]  fff00000c5d4d980: 00 04 fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   18.487076] >fff00000c5d4da00: fa fb fc fc fa fb fc fc fa fb fc fc fc fc fc fc
[   18.487554]                                               ^
[   18.487605]  fff00000c5d4da80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.487654]  fff00000c5d4db00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.487701] ==================================================================

[   11.741685] ==================================================================
[   11.742210] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x320/0x380
[   11.742556] Read of size 1 at addr ffff888102531768 by task kunit_try_catch/201
[   11.742903] 
[   11.743001] CPU: 0 UID: 0 PID: 201 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT(voluntary) 
[   11.743049] Tainted: [B]=BAD_PAGE, [N]=TEST
[   11.743061] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   11.743085] Call Trace:
[   11.743099]  <TASK>
[   11.743120]  dump_stack_lvl+0x73/0xb0
[   11.743150]  print_report+0xd1/0x650
[   11.743174]  ? __virt_addr_valid+0x1db/0x2d0
[   11.743198]  ? kmalloc_uaf+0x320/0x380
[   11.743217]  ? kasan_complete_mode_report_info+0x64/0x200
[   11.743238]  ? kmalloc_uaf+0x320/0x380
[   11.743257]  kasan_report+0x141/0x180
[   11.743278]  ? kmalloc_uaf+0x320/0x380
[   11.743301]  __asan_report_load1_noabort+0x18/0x20
[   11.743326]  kmalloc_uaf+0x320/0x380
[   11.743345]  ? __pfx_kmalloc_uaf+0x10/0x10
[   11.743365]  ? __schedule+0x10cc/0x2b60
[   11.743398]  ? __pfx_read_tsc+0x10/0x10
[   11.743419]  ? ktime_get_ts64+0x86/0x230
[   11.743443]  kunit_try_run_case+0x1a5/0x480
[   11.743468]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.743489]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   11.743512]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   11.743533]  ? __kthread_parkme+0x82/0x180
[   11.743554]  ? preempt_count_sub+0x50/0x80
[   11.743734]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.743763]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.743785]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   11.743807]  kthread+0x337/0x6f0
[   11.743827]  ? trace_preempt_on+0x20/0xc0
[   11.743851]  ? __pfx_kthread+0x10/0x10
[   11.743871]  ? _raw_spin_unlock_irq+0x47/0x80
[   11.743892]  ? calculate_sigpending+0x7b/0xa0
[   11.743915]  ? __pfx_kthread+0x10/0x10
[   11.743935]  ret_from_fork+0x116/0x1d0
[   11.743952]  ? __pfx_kthread+0x10/0x10
[   11.744020]  ret_from_fork_asm+0x1a/0x30
[   11.744053]  </TASK>
[   11.744065] 
[   11.751910] Allocated by task 201:
[   11.752072]  kasan_save_stack+0x45/0x70
[   11.752270]  kasan_save_track+0x18/0x40
[   11.752459]  kasan_save_alloc_info+0x3b/0x50
[   11.752713]  __kasan_kmalloc+0xb7/0xc0
[   11.752878]  __kmalloc_cache_noprof+0x189/0x420
[   11.753082]  kmalloc_uaf+0xaa/0x380
[   11.753223]  kunit_try_run_case+0x1a5/0x480
[   11.753381]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.753679]  kthread+0x337/0x6f0
[   11.753850]  ret_from_fork+0x116/0x1d0
[   11.754043]  ret_from_fork_asm+0x1a/0x30
[   11.754243] 
[   11.754331] Freed by task 201:
[   11.754453]  kasan_save_stack+0x45/0x70
[   11.754589]  kasan_save_track+0x18/0x40
[   11.754723]  kasan_save_free_info+0x3f/0x60
[   11.754896]  __kasan_slab_free+0x56/0x70
[   11.755088]  kfree+0x222/0x3f0
[   11.755253]  kmalloc_uaf+0x12c/0x380
[   11.755508]  kunit_try_run_case+0x1a5/0x480
[   11.755883]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.756341]  kthread+0x337/0x6f0
[   11.756540]  ret_from_fork+0x116/0x1d0
[   11.756719]  ret_from_fork_asm+0x1a/0x30
[   11.756888] 
[   11.757106] The buggy address belongs to the object at ffff888102531760
[   11.757106]  which belongs to the cache kmalloc-16 of size 16
[   11.757597] The buggy address is located 8 bytes inside of
[   11.757597]  freed 16-byte region [ffff888102531760, ffff888102531770)
[   11.758126] 
[   11.758205] The buggy address belongs to the physical page:
[   11.758390] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102531
[   11.758750] flags: 0x200000000000000(node=0|zone=2)
[   11.759208] page_type: f5(slab)
[   11.759383] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   11.759623] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   11.759850] page dumped because: kasan: bad access detected
[   11.760079] 
[   11.760171] Memory state around the buggy address:
[   11.760456]  ffff888102531600: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   11.761162]  ffff888102531680: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   11.761464] >ffff888102531700: fa fb fc fc fa fb fc fc 00 05 fc fc fa fb fc fc
[   11.761749]                                                           ^
[   11.761953]  ffff888102531780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.762404]  ffff888102531800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.762656] ==================================================================