Hay
Date
July 4, 2025, 11:10 a.m.

Environment
qemu-arm64
qemu-x86_64

[   29.674577] ==================================================================
[   29.674762] BUG: KASAN: slab-use-after-free in kmalloc_uaf2+0x3f4/0x468
[   29.674883] Read of size 1 at addr fff00000c9b70ba8 by task kunit_try_catch/221
[   29.675027] 
[   29.675085] CPU: 0 UID: 0 PID: 221 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4-next-20250704 #1 PREEMPT 
[   29.675171] Tainted: [B]=BAD_PAGE, [N]=TEST
[   29.675239] Hardware name: linux,dummy-virt (DT)
[   29.675277] Call trace:
[   29.675345]  show_stack+0x20/0x38 (C)
[   29.675435]  dump_stack_lvl+0x8c/0xd0
[   29.675482]  print_report+0x118/0x608
[   29.675567]  kasan_report+0xdc/0x128
[   29.675614]  __asan_report_load1_noabort+0x20/0x30
[   29.675662]  kmalloc_uaf2+0x3f4/0x468
[   29.675815]  kunit_try_run_case+0x170/0x3f0
[   29.675869]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   29.676024]  kthread+0x328/0x630
[   29.676066]  ret_from_fork+0x10/0x20
[   29.676113] 
[   29.676130] Allocated by task 221:
[   29.676159]  kasan_save_stack+0x3c/0x68
[   29.676206]  kasan_save_track+0x20/0x40
[   29.676243]  kasan_save_alloc_info+0x40/0x58
[   29.676280]  __kasan_kmalloc+0xd4/0xd8
[   29.676318]  __kmalloc_cache_noprof+0x16c/0x3c0
[   29.676355]  kmalloc_uaf2+0xc4/0x468
[   29.676391]  kunit_try_run_case+0x170/0x3f0
[   29.676430]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   29.676474]  kthread+0x328/0x630
[   29.676506]  ret_from_fork+0x10/0x20
[   29.676540] 
[   29.676559] Freed by task 221:
[   29.676585]  kasan_save_stack+0x3c/0x68
[   29.676623]  kasan_save_track+0x20/0x40
[   29.676659]  kasan_save_free_info+0x4c/0x78
[   29.676696]  __kasan_slab_free+0x6c/0x98
[   29.676733]  kfree+0x214/0x3c8
[   29.676767]  kmalloc_uaf2+0x134/0x468
[   29.677762]  kunit_try_run_case+0x170/0x3f0
[   29.677812]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   29.677857]  kthread+0x328/0x630
[   29.677888]  ret_from_fork+0x10/0x20
[   29.677934] 
[   29.677953] The buggy address belongs to the object at fff00000c9b70b80
[   29.677953]  which belongs to the cache kmalloc-64 of size 64
[   29.678012] The buggy address is located 40 bytes inside of
[   29.678012]  freed 64-byte region [fff00000c9b70b80, fff00000c9b70bc0)
[   29.678073] 
[   29.678093] The buggy address belongs to the physical page:
[   29.678123] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x109b70
[   29.678174] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   29.678221] page_type: f5(slab)
[   29.678257] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   29.678308] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   29.678348] page dumped because: kasan: bad access detected
[   29.678379] 
[   29.678396] Memory state around the buggy address:
[   29.678427]  fff00000c9b70a80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   29.678469]  fff00000c9b70b00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   29.678513] >fff00000c9b70b80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   29.678551]                                   ^
[   29.678583]  fff00000c9b70c00: 00 00 00 00 00 03 fc fc fc fc fc fc fc fc fc fc
[   29.678624]  fff00000c9b70c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   29.678663] ==================================================================

[   25.237755] ==================================================================
[   25.238734] BUG: KASAN: slab-use-after-free in kmalloc_uaf2+0x4a8/0x520
[   25.239455] Read of size 1 at addr ffff888105aaaaa8 by task kunit_try_catch/237
[   25.240024] 
[   25.240146] CPU: 0 UID: 0 PID: 237 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4-next-20250704 #1 PREEMPT(voluntary) 
[   25.240201] Tainted: [B]=BAD_PAGE, [N]=TEST
[   25.240214] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   25.240372] Call Trace:
[   25.240387]  <TASK>
[   25.240420]  dump_stack_lvl+0x73/0xb0
[   25.240451]  print_report+0xd1/0x650
[   25.240475]  ? __virt_addr_valid+0x1db/0x2d0
[   25.240499]  ? kmalloc_uaf2+0x4a8/0x520
[   25.240519]  ? kasan_complete_mode_report_info+0x64/0x200
[   25.240545]  ? kmalloc_uaf2+0x4a8/0x520
[   25.240566]  kasan_report+0x141/0x180
[   25.240587]  ? kmalloc_uaf2+0x4a8/0x520
[   25.240612]  __asan_report_load1_noabort+0x18/0x20
[   25.240637]  kmalloc_uaf2+0x4a8/0x520
[   25.240657]  ? __pfx_kmalloc_uaf2+0x10/0x10
[   25.240677]  ? finish_task_switch.isra.0+0x153/0x700
[   25.240700]  ? __switch_to+0x47/0xf50
[   25.240728]  ? __schedule+0x10cc/0x2b60
[   25.240754]  ? __pfx_read_tsc+0x10/0x10
[   25.240776]  ? ktime_get_ts64+0x86/0x230
[   25.240802]  kunit_try_run_case+0x1a5/0x480
[   25.240829]  ? __pfx_kunit_try_run_case+0x10/0x10
[   25.240853]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   25.240879]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   25.240904]  ? __kthread_parkme+0x82/0x180
[   25.240925]  ? preempt_count_sub+0x50/0x80
[   25.240948]  ? __pfx_kunit_try_run_case+0x10/0x10
[   25.240973]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.240999]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   25.241023]  kthread+0x337/0x6f0
[   25.241044]  ? trace_preempt_on+0x20/0xc0
[   25.241069]  ? __pfx_kthread+0x10/0x10
[   25.241091]  ? _raw_spin_unlock_irq+0x47/0x80
[   25.241114]  ? calculate_sigpending+0x7b/0xa0
[   25.241139]  ? __pfx_kthread+0x10/0x10
[   25.241173]  ret_from_fork+0x116/0x1d0
[   25.241193]  ? __pfx_kthread+0x10/0x10
[   25.241215]  ret_from_fork_asm+0x1a/0x30
[   25.241247]  </TASK>
[   25.241260] 
[   25.251581] Allocated by task 237:
[   25.251761]  kasan_save_stack+0x45/0x70
[   25.252117]  kasan_save_track+0x18/0x40
[   25.252502]  kasan_save_alloc_info+0x3b/0x50
[   25.252703]  __kasan_kmalloc+0xb7/0xc0
[   25.253090]  __kmalloc_cache_noprof+0x189/0x420
[   25.253437]  kmalloc_uaf2+0xc6/0x520
[   25.253771]  kunit_try_run_case+0x1a5/0x480
[   25.253979]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.254243]  kthread+0x337/0x6f0
[   25.254634]  ret_from_fork+0x116/0x1d0
[   25.254830]  ret_from_fork_asm+0x1a/0x30
[   25.255113] 
[   25.255267] Freed by task 237:
[   25.255434]  kasan_save_stack+0x45/0x70
[   25.255637]  kasan_save_track+0x18/0x40
[   25.255840]  kasan_save_free_info+0x3f/0x60
[   25.256401]  __kasan_slab_free+0x56/0x70
[   25.256607]  kfree+0x222/0x3f0
[   25.256760]  kmalloc_uaf2+0x14c/0x520
[   25.257067]  kunit_try_run_case+0x1a5/0x480
[   25.257459]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.257722]  kthread+0x337/0x6f0
[   25.258062]  ret_from_fork+0x116/0x1d0
[   25.258249]  ret_from_fork_asm+0x1a/0x30
[   25.258597] 
[   25.258698] The buggy address belongs to the object at ffff888105aaaa80
[   25.258698]  which belongs to the cache kmalloc-64 of size 64
[   25.259466] The buggy address is located 40 bytes inside of
[   25.259466]  freed 64-byte region [ffff888105aaaa80, ffff888105aaaac0)
[   25.259976] 
[   25.260571] The buggy address belongs to the physical page:
[   25.260829] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105aaa
[   25.261343] flags: 0x200000000000000(node=0|zone=2)
[   25.261584] page_type: f5(slab)
[   25.261932] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   25.262474] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   25.262897] page dumped because: kasan: bad access detected
[   25.263132] 
[   25.263202] Memory state around the buggy address:
[   25.263650]  ffff888105aaa980: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   25.264040]  ffff888105aaaa00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   25.264534] >ffff888105aaaa80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   25.264844]                                   ^
[   25.265054]  ffff888105aaab00: 00 00 00 00 00 03 fc fc fc fc fc fc fc fc fc fc
[   25.265409]  ffff888105aaab80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.265722] ==================================================================