Hay
Date
July 1, 2025, 12:10 a.m.

Environment
qemu-arm64
qemu-x86_64

[   17.560822] ==================================================================
[   17.560898] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   17.561011] Write of size 33 at addr fff00000c58f4d80 by task kunit_try_catch/186
[   17.561065] 
[   17.561186] CPU: 1 UID: 0 PID: 186 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT 
[   17.561323] Tainted: [B]=BAD_PAGE, [N]=TEST
[   17.561353] Hardware name: linux,dummy-virt (DT)
[   17.561385] Call trace:
[   17.561648]  show_stack+0x20/0x38 (C)
[   17.561743]  dump_stack_lvl+0x8c/0xd0
[   17.561804]  print_report+0x118/0x608
[   17.561849]  kasan_report+0xdc/0x128
[   17.561895]  kasan_check_range+0x100/0x1a8
[   17.562151]  __asan_memset+0x34/0x78
[   17.562212]  kmalloc_uaf_memset+0x170/0x310
[   17.562310]  kunit_try_run_case+0x170/0x3f0
[   17.562361]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.562414]  kthread+0x328/0x630
[   17.562470]  ret_from_fork+0x10/0x20
[   17.562527] 
[   17.562546] Allocated by task 186:
[   17.562575]  kasan_save_stack+0x3c/0x68
[   17.562614]  kasan_save_track+0x20/0x40
[   17.562652]  kasan_save_alloc_info+0x40/0x58
[   17.562693]  __kasan_kmalloc+0xd4/0xd8
[   17.562735]  __kmalloc_cache_noprof+0x16c/0x3c0
[   17.562784]  kmalloc_uaf_memset+0xb8/0x310
[   17.562820]  kunit_try_run_case+0x170/0x3f0
[   17.562857]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.562909]  kthread+0x328/0x630
[   17.562941]  ret_from_fork+0x10/0x20
[   17.563240] 
[   17.563262] Freed by task 186:
[   17.563293]  kasan_save_stack+0x3c/0x68
[   17.563333]  kasan_save_track+0x20/0x40
[   17.563371]  kasan_save_free_info+0x4c/0x78
[   17.563522]  __kasan_slab_free+0x6c/0x98
[   17.563962]  kfree+0x214/0x3c8
[   17.564171]  kmalloc_uaf_memset+0x11c/0x310
[   17.564302]  kunit_try_run_case+0x170/0x3f0
[   17.564609]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.564852]  kthread+0x328/0x630
[   17.565076]  ret_from_fork+0x10/0x20
[   17.565304] 
[   17.565461] The buggy address belongs to the object at fff00000c58f4d80
[   17.565461]  which belongs to the cache kmalloc-64 of size 64
[   17.565726] The buggy address is located 0 bytes inside of
[   17.565726]  freed 64-byte region [fff00000c58f4d80, fff00000c58f4dc0)
[   17.566087] 
[   17.566114] The buggy address belongs to the physical page:
[   17.566182] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1058f4
[   17.566388] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   17.566535] page_type: f5(slab)
[   17.566579] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   17.566848] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   17.567024] page dumped because: kasan: bad access detected
[   17.567158] 
[   17.567350] Memory state around the buggy address:
[   17.567482]  fff00000c58f4c80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   17.567629]  fff00000c58f4d00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   17.567675] >fff00000c58f4d80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   17.567730]                    ^
[   17.568006]  fff00000c58f4e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.568235]  fff00000c58f4e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.568551] ==================================================================

[   11.726253] ==================================================================
[   11.726765] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   11.726999] Write of size 33 at addr ffff88810310c000 by task kunit_try_catch/203
[   11.728795] 
[   11.729307] CPU: 0 UID: 0 PID: 203 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT(voluntary) 
[   11.729564] Tainted: [B]=BAD_PAGE, [N]=TEST
[   11.729577] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   11.729598] Call Trace:
[   11.729611]  <TASK>
[   11.729628]  dump_stack_lvl+0x73/0xb0
[   11.729657]  print_report+0xd1/0x650
[   11.729679]  ? __virt_addr_valid+0x1db/0x2d0
[   11.729700]  ? kmalloc_uaf_memset+0x1a3/0x360
[   11.729719]  ? kasan_complete_mode_report_info+0x64/0x200
[   11.729740]  ? kmalloc_uaf_memset+0x1a3/0x360
[   11.729760]  kasan_report+0x141/0x180
[   11.729781]  ? kmalloc_uaf_memset+0x1a3/0x360
[   11.729805]  kasan_check_range+0x10c/0x1c0
[   11.729827]  __asan_memset+0x27/0x50
[   11.729845]  kmalloc_uaf_memset+0x1a3/0x360
[   11.729864]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   11.729885]  ? __schedule+0x10cc/0x2b60
[   11.729907]  ? __pfx_read_tsc+0x10/0x10
[   11.729927]  ? ktime_get_ts64+0x86/0x230
[   11.729949]  kunit_try_run_case+0x1a5/0x480
[   11.729973]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.729993]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   11.730015]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   11.730050]  ? __kthread_parkme+0x82/0x180
[   11.730070]  ? preempt_count_sub+0x50/0x80
[   11.730093]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.730115]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.730136]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   11.730157]  kthread+0x337/0x6f0
[   11.730175]  ? trace_preempt_on+0x20/0xc0
[   11.730197]  ? __pfx_kthread+0x10/0x10
[   11.730216]  ? _raw_spin_unlock_irq+0x47/0x80
[   11.730235]  ? calculate_sigpending+0x7b/0xa0
[   11.730257]  ? __pfx_kthread+0x10/0x10
[   11.730277]  ret_from_fork+0x116/0x1d0
[   11.730293]  ? __pfx_kthread+0x10/0x10
[   11.730312]  ret_from_fork_asm+0x1a/0x30
[   11.730341]  </TASK>
[   11.730352] 
[   11.740828] Allocated by task 203:
[   11.741185]  kasan_save_stack+0x45/0x70
[   11.741366]  kasan_save_track+0x18/0x40
[   11.741679]  kasan_save_alloc_info+0x3b/0x50
[   11.741854]  __kasan_kmalloc+0xb7/0xc0
[   11.742051]  __kmalloc_cache_noprof+0x189/0x420
[   11.742444]  kmalloc_uaf_memset+0xa9/0x360
[   11.742667]  kunit_try_run_case+0x1a5/0x480
[   11.742878]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.743308]  kthread+0x337/0x6f0
[   11.743485]  ret_from_fork+0x116/0x1d0
[   11.743627]  ret_from_fork_asm+0x1a/0x30
[   11.743823] 
[   11.743951] Freed by task 203:
[   11.744216]  kasan_save_stack+0x45/0x70
[   11.744407]  kasan_save_track+0x18/0x40
[   11.744660]  kasan_save_free_info+0x3f/0x60
[   11.744876]  __kasan_slab_free+0x56/0x70
[   11.745070]  kfree+0x222/0x3f0
[   11.745256]  kmalloc_uaf_memset+0x12b/0x360
[   11.745448]  kunit_try_run_case+0x1a5/0x480
[   11.745608]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.745862]  kthread+0x337/0x6f0
[   11.746036]  ret_from_fork+0x116/0x1d0
[   11.746209]  ret_from_fork_asm+0x1a/0x30
[   11.746467] 
[   11.746567] The buggy address belongs to the object at ffff88810310c000
[   11.746567]  which belongs to the cache kmalloc-64 of size 64
[   11.746959] The buggy address is located 0 bytes inside of
[   11.746959]  freed 64-byte region [ffff88810310c000, ffff88810310c040)
[   11.747436] 
[   11.747575] The buggy address belongs to the physical page:
[   11.747943] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10310c
[   11.748591] flags: 0x200000000000000(node=0|zone=2)
[   11.748827] page_type: f5(slab)
[   11.748987] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   11.749396] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   11.749745] page dumped because: kasan: bad access detected
[   11.750215] 
[   11.750429] Memory state around the buggy address:
[   11.751005]  ffff88810310bf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.751439]  ffff88810310bf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.751765] >ffff88810310c000: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   11.752379]                    ^
[   11.752502]  ffff88810310c080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.752895]  ffff88810310c100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.753998] ==================================================================