Hay
Date
July 2, 2025, 11:09 p.m.

Environment
qemu-arm64
qemu-x86_64

[   18.279916] ==================================================================
[   18.280307] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   18.280379] Write of size 33 at addr fff00000c706b080 by task kunit_try_catch/186
[   18.280715] 
[   18.280803] CPU: 0 UID: 0 PID: 186 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT 
[   18.280950] Tainted: [B]=BAD_PAGE, [N]=TEST
[   18.281002] Hardware name: linux,dummy-virt (DT)
[   18.281194] Call trace:
[   18.281255]  show_stack+0x20/0x38 (C)
[   18.281434]  dump_stack_lvl+0x8c/0xd0
[   18.281539]  print_report+0x118/0x608
[   18.281598]  kasan_report+0xdc/0x128
[   18.281645]  kasan_check_range+0x100/0x1a8
[   18.281696]  __asan_memset+0x34/0x78
[   18.281741]  kmalloc_uaf_memset+0x170/0x310
[   18.282001]  kunit_try_run_case+0x170/0x3f0
[   18.282266]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.282400]  kthread+0x328/0x630
[   18.282481]  ret_from_fork+0x10/0x20
[   18.282673] 
[   18.282693] Allocated by task 186:
[   18.282731]  kasan_save_stack+0x3c/0x68
[   18.283233]  kasan_save_track+0x20/0x40
[   18.283383]  kasan_save_alloc_info+0x40/0x58
[   18.283565]  __kasan_kmalloc+0xd4/0xd8
[   18.283636]  __kmalloc_cache_noprof+0x16c/0x3c0
[   18.284044]  kmalloc_uaf_memset+0xb8/0x310
[   18.284291]  kunit_try_run_case+0x170/0x3f0
[   18.284499]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.284559]  kthread+0x328/0x630
[   18.284604]  ret_from_fork+0x10/0x20
[   18.284642] 
[   18.284772] Freed by task 186:
[   18.284803]  kasan_save_stack+0x3c/0x68
[   18.284854]  kasan_save_track+0x20/0x40
[   18.284895]  kasan_save_free_info+0x4c/0x78
[   18.285127]  __kasan_slab_free+0x6c/0x98
[   18.285199]  kfree+0x214/0x3c8
[   18.285401]  kmalloc_uaf_memset+0x11c/0x310
[   18.285616]  kunit_try_run_case+0x170/0x3f0
[   18.285716]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.286147]  kthread+0x328/0x630
[   18.286219]  ret_from_fork+0x10/0x20
[   18.286348] 
[   18.286404] The buggy address belongs to the object at fff00000c706b080
[   18.286404]  which belongs to the cache kmalloc-64 of size 64
[   18.286523] The buggy address is located 0 bytes inside of
[   18.286523]  freed 64-byte region [fff00000c706b080, fff00000c706b0c0)
[   18.286751] 
[   18.287055] The buggy address belongs to the physical page:
[   18.287101] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10706b
[   18.287214] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   18.287492] page_type: f5(slab)
[   18.287598] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   18.287731] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   18.287775] page dumped because: kasan: bad access detected
[   18.287806] 
[   18.287824] Memory state around the buggy address:
[   18.287868]  fff00000c706af80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   18.287911]  fff00000c706b000: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   18.287952] >fff00000c706b080: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   18.287993]                    ^
[   18.288020]  fff00000c706b100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.288075]  fff00000c706b180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.288114] ==================================================================

[   11.666036] ==================================================================
[   11.666481] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   11.667090] Write of size 33 at addr ffff888102c84f00 by task kunit_try_catch/205
[   11.667339] 
[   11.667466] CPU: 1 UID: 0 PID: 205 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT(voluntary) 
[   11.667514] Tainted: [B]=BAD_PAGE, [N]=TEST
[   11.667525] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   11.667547] Call Trace:
[   11.667760]  <TASK>
[   11.667794]  dump_stack_lvl+0x73/0xb0
[   11.667845]  print_report+0xd1/0x650
[   11.667869]  ? __virt_addr_valid+0x1db/0x2d0
[   11.667893]  ? kmalloc_uaf_memset+0x1a3/0x360
[   11.667913]  ? kasan_complete_mode_report_info+0x64/0x200
[   11.667933]  ? kmalloc_uaf_memset+0x1a3/0x360
[   11.667953]  kasan_report+0x141/0x180
[   11.667974]  ? kmalloc_uaf_memset+0x1a3/0x360
[   11.667998]  kasan_check_range+0x10c/0x1c0
[   11.668021]  __asan_memset+0x27/0x50
[   11.668039]  kmalloc_uaf_memset+0x1a3/0x360
[   11.668060]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   11.668080]  ? __schedule+0x10cc/0x2b60
[   11.668102]  ? __pfx_read_tsc+0x10/0x10
[   11.668123]  ? ktime_get_ts64+0x86/0x230
[   11.668147]  kunit_try_run_case+0x1a5/0x480
[   11.668173]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.668193]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   11.668216]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   11.668237]  ? __kthread_parkme+0x82/0x180
[   11.668257]  ? preempt_count_sub+0x50/0x80
[   11.668280]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.668303]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.668324]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   11.668345]  kthread+0x337/0x6f0
[   11.668363]  ? trace_preempt_on+0x20/0xc0
[   11.668398]  ? __pfx_kthread+0x10/0x10
[   11.668418]  ? _raw_spin_unlock_irq+0x47/0x80
[   11.668437]  ? calculate_sigpending+0x7b/0xa0
[   11.668461]  ? __pfx_kthread+0x10/0x10
[   11.668481]  ret_from_fork+0x116/0x1d0
[   11.668498]  ? __pfx_kthread+0x10/0x10
[   11.668517]  ret_from_fork_asm+0x1a/0x30
[   11.668547]  </TASK>
[   11.668558] 
[   11.678162] Allocated by task 205:
[   11.678492]  kasan_save_stack+0x45/0x70
[   11.678742]  kasan_save_track+0x18/0x40
[   11.679127]  kasan_save_alloc_info+0x3b/0x50
[   11.679410]  __kasan_kmalloc+0xb7/0xc0
[   11.679557]  __kmalloc_cache_noprof+0x189/0x420
[   11.680102]  kmalloc_uaf_memset+0xa9/0x360
[   11.680302]  kunit_try_run_case+0x1a5/0x480
[   11.680606]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.681071]  kthread+0x337/0x6f0
[   11.681236]  ret_from_fork+0x116/0x1d0
[   11.681531]  ret_from_fork_asm+0x1a/0x30
[   11.681733] 
[   11.681890] Freed by task 205:
[   11.682022]  kasan_save_stack+0x45/0x70
[   11.682222]  kasan_save_track+0x18/0x40
[   11.682400]  kasan_save_free_info+0x3f/0x60
[   11.682957]  __kasan_slab_free+0x56/0x70
[   11.683148]  kfree+0x222/0x3f0
[   11.683293]  kmalloc_uaf_memset+0x12b/0x360
[   11.683784]  kunit_try_run_case+0x1a5/0x480
[   11.684013]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.684244]  kthread+0x337/0x6f0
[   11.684422]  ret_from_fork+0x116/0x1d0
[   11.684600]  ret_from_fork_asm+0x1a/0x30
[   11.685114] 
[   11.685211] The buggy address belongs to the object at ffff888102c84f00
[   11.685211]  which belongs to the cache kmalloc-64 of size 64
[   11.686130] The buggy address is located 0 bytes inside of
[   11.686130]  freed 64-byte region [ffff888102c84f00, ffff888102c84f40)
[   11.686604] 
[   11.686704] The buggy address belongs to the physical page:
[   11.687234] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102c84
[   11.687552] flags: 0x200000000000000(node=0|zone=2)
[   11.687906] page_type: f5(slab)
[   11.688045] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   11.688392] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   11.689163] page dumped because: kasan: bad access detected
[   11.689416] 
[   11.689513] Memory state around the buggy address:
[   11.689735]  ffff888102c84e00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   11.690254]  ffff888102c84e80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   11.690619] >ffff888102c84f00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   11.691100]                    ^
[   11.691296]  ffff888102c84f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.691788]  ffff888102c85000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   11.692088] ==================================================================