Hay
Date
June 3, 2025, 7:38 a.m.

Environment
qemu-arm64
qemu-x86_64

[   18.429968] ==================================================================
[   18.430042] BUG: KASAN: slab-use-after-free in kmalloc_uaf2+0x3f4/0x468
[   18.430109] Read of size 1 at addr fff00000c65b5e28 by task kunit_try_catch/188
[   18.430160] 
[   18.430199] CPU: 1 UID: 0 PID: 188 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-next-20250603 #1 PREEMPT 
[   18.430286] Tainted: [B]=BAD_PAGE, [N]=TEST
[   18.430314] Hardware name: linux,dummy-virt (DT)
[   18.430346] Call trace:
[   18.430369]  show_stack+0x20/0x38 (C)
[   18.430420]  dump_stack_lvl+0x8c/0xd0
[   18.433986]  print_report+0x118/0x608
[   18.434036]  kasan_report+0xdc/0x128
[   18.434083]  __asan_report_load1_noabort+0x20/0x30
[   18.434133]  kmalloc_uaf2+0x3f4/0x468
[   18.434179]  kunit_try_run_case+0x170/0x3f0
[   18.434234]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.434287]  kthread+0x328/0x630
[   18.434335]  ret_from_fork+0x10/0x20
[   18.434386] 
[   18.434406] Allocated by task 188:
[   18.434695]  kasan_save_stack+0x3c/0x68
[   18.434815]  kasan_save_track+0x20/0x40
[   18.434914]  kasan_save_alloc_info+0x40/0x58
[   18.434969]  __kasan_kmalloc+0xd4/0xd8
[   18.435058]  __kmalloc_cache_noprof+0x16c/0x3c0
[   18.435197]  kmalloc_uaf2+0xc4/0x468
[   18.435275]  kunit_try_run_case+0x170/0x3f0
[   18.435550]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.435685]  kthread+0x328/0x630
[   18.435744]  ret_from_fork+0x10/0x20
[   18.435826] 
[   18.435934] Freed by task 188:
[   18.436016]  kasan_save_stack+0x3c/0x68
[   18.436055]  kasan_save_track+0x20/0x40
[   18.436092]  kasan_save_free_info+0x4c/0x78
[   18.436136]  __kasan_slab_free+0x6c/0x98
[   18.436173]  kfree+0x214/0x3c8
[   18.436207]  kmalloc_uaf2+0x134/0x468
[   18.436240]  kunit_try_run_case+0x170/0x3f0
[   18.436311]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.436388]  kthread+0x328/0x630
[   18.436419]  ret_from_fork+0x10/0x20
[   18.436502] 
[   18.436524] The buggy address belongs to the object at fff00000c65b5e00
[   18.436524]  which belongs to the cache kmalloc-64 of size 64
[   18.436582] The buggy address is located 40 bytes inside of
[   18.436582]  freed 64-byte region [fff00000c65b5e00, fff00000c65b5e40)
[   18.436642] 
[   18.436664] The buggy address belongs to the physical page:
[   18.436696] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1065b5
[   18.436812] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   18.436888] page_type: f5(slab)
[   18.436929] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   18.436981] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   18.437023] page dumped because: kasan: bad access detected
[   18.437054] 
[   18.437072] Memory state around the buggy address:
[   18.437165]  fff00000c65b5d00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   18.437254]  fff00000c65b5d80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   18.437328] >fff00000c65b5e00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   18.437377]                                   ^
[   18.437409]  fff00000c65b5e80: 00 00 00 00 00 03 fc fc fc fc fc fc fc fc fc fc
[   18.437470]  fff00000c65b5f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.437510] ==================================================================


[   14.925403] ==================================================================
[   14.925978] BUG: KASAN: slab-use-after-free in kmalloc_uaf2+0x4a8/0x520
[   14.926980] Read of size 1 at addr ffff888103333928 by task kunit_try_catch/205
[   14.927407] 
[   14.927779] CPU: 1 UID: 0 PID: 205 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-next-20250603 #1 PREEMPT(voluntary) 
[   14.927915] Tainted: [B]=BAD_PAGE, [N]=TEST
[   14.927933] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   14.927983] Call Trace:
[   14.928011]  <TASK>
[   14.928049]  dump_stack_lvl+0x73/0xb0
[   14.928121]  print_report+0xd1/0x650
[   14.928174]  ? __virt_addr_valid+0x1db/0x2d0
[   14.928311]  ? kmalloc_uaf2+0x4a8/0x520
[   14.928366]  ? kasan_complete_mode_report_info+0x64/0x200
[   14.928418]  ? kmalloc_uaf2+0x4a8/0x520
[   14.928481]  kasan_report+0x141/0x180
[   14.928535]  ? kmalloc_uaf2+0x4a8/0x520
[   14.928589]  __asan_report_load1_noabort+0x18/0x20
[   14.928618]  kmalloc_uaf2+0x4a8/0x520
[   14.928641]  ? __pfx_kmalloc_uaf2+0x10/0x10
[   14.928662]  ? finish_task_switch.isra.0+0x153/0x700
[   14.928689]  ? __switch_to+0x47/0xf50
[   14.928718]  ? __schedule+0x10cc/0x2b60
[   14.928745]  ? __pfx_read_tsc+0x10/0x10
[   14.928768]  ? ktime_get_ts64+0x86/0x230
[   14.928797]  kunit_try_run_case+0x1a5/0x480
[   14.928821]  ? __pfx_kunit_try_run_case+0x10/0x10
[   14.928842]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   14.928867]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   14.928892]  ? __kthread_parkme+0x82/0x180
[   14.928913]  ? preempt_count_sub+0x50/0x80
[   14.928937]  ? __pfx_kunit_try_run_case+0x10/0x10
[   14.928958]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   14.928983]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   14.929007]  kthread+0x337/0x6f0
[   14.929027]  ? trace_preempt_on+0x20/0xc0
[   14.929051]  ? __pfx_kthread+0x10/0x10
[   14.929073]  ? _raw_spin_unlock_irq+0x47/0x80
[   14.929096]  ? calculate_sigpending+0x7b/0xa0
[   14.929120]  ? __pfx_kthread+0x10/0x10
[   14.929142]  ret_from_fork+0x116/0x1d0
[   14.929162]  ? __pfx_kthread+0x10/0x10
[   14.929184]  ret_from_fork_asm+0x1a/0x30
[   14.929260]  </TASK>
[   14.929275] 
[   14.941424] Allocated by task 205:
[   14.941913]  kasan_save_stack+0x45/0x70
[   14.942389]  kasan_save_track+0x18/0x40
[   14.942788]  kasan_save_alloc_info+0x3b/0x50
[   14.943337]  __kasan_kmalloc+0xb7/0xc0
[   14.943775]  __kmalloc_cache_noprof+0x189/0x420
[   14.944231]  kmalloc_uaf2+0xc6/0x520
[   14.944592]  kunit_try_run_case+0x1a5/0x480
[   14.944972]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   14.945360]  kthread+0x337/0x6f0
[   14.945730]  ret_from_fork+0x116/0x1d0
[   14.945942]  ret_from_fork_asm+0x1a/0x30
[   14.946356] 
[   14.946541] Freed by task 205:
[   14.946761]  kasan_save_stack+0x45/0x70
[   14.947164]  kasan_save_track+0x18/0x40
[   14.947623]  kasan_save_free_info+0x3f/0x60
[   14.947978]  __kasan_slab_free+0x56/0x70
[   14.948254]  kfree+0x222/0x3f0
[   14.948567]  kmalloc_uaf2+0x14c/0x520
[   14.948892]  kunit_try_run_case+0x1a5/0x480
[   14.949153]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   14.949607]  kthread+0x337/0x6f0
[   14.949870]  ret_from_fork+0x116/0x1d0
[   14.950176]  ret_from_fork_asm+0x1a/0x30
[   14.950424] 
[   14.950648] The buggy address belongs to the object at ffff888103333900
[   14.950648]  which belongs to the cache kmalloc-64 of size 64
[   14.951409] The buggy address is located 40 bytes inside of
[   14.951409]  freed 64-byte region [ffff888103333900, ffff888103333940)
[   14.951943] 
[   14.952162] The buggy address belongs to the physical page:
[   14.952646] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x103333
[   14.953120] flags: 0x200000000000000(node=0|zone=2)
[   14.953591] page_type: f5(slab)
[   14.953839] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   14.954374] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   14.954811] page dumped because: kasan: bad access detected
[   14.955160] 
[   14.955312] Memory state around the buggy address:
[   14.955726]  ffff888103333800: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   14.956279]  ffff888103333880: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   14.956614] >ffff888103333900: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   14.957028]                                   ^
[   14.957445]  ffff888103333980: 00 00 00 00 00 03 fc fc fc fc fc fc fc fc fc fc
[   14.957955]  ffff888103333a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   14.958403] ==================================================================