Hay
Date
July 24, 2025, 4:41 a.m.

Environment
qemu-arm64
qemu-x86_64

[   32.659098] ==================================================================
[   32.659377] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   32.659513] Write of size 33 at addr fff00000c9a87c80 by task kunit_try_catch/217
[   32.659595] 
[   32.659822] CPU: 0 UID: 0 PID: 217 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc7-next-20250724 #1 PREEMPT 
[   32.660069] Tainted: [B]=BAD_PAGE, [N]=TEST
[   32.660107] Hardware name: linux,dummy-virt (DT)
[   32.660472] Call trace:
[   32.660629]  show_stack+0x20/0x38 (C)
[   32.660727]  dump_stack_lvl+0x8c/0xd0
[   32.661137]  print_report+0x118/0x5e8
[   32.661242]  kasan_report+0xdc/0x128
[   32.661328]  kasan_check_range+0x100/0x1a8
[   32.661521]  __asan_memset+0x34/0x78
[   32.661801]  kmalloc_uaf_memset+0x170/0x310
[   32.661859]  kunit_try_run_case+0x170/0x3f0
[   32.662260]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   32.662392]  kthread+0x328/0x630
[   32.662450]  ret_from_fork+0x10/0x20
[   32.662742] 
[   32.662927] Allocated by task 217:
[   32.663006]  kasan_save_stack+0x3c/0x68
[   32.663124]  kasan_save_track+0x20/0x40
[   32.663166]  kasan_save_alloc_info+0x40/0x58
[   32.663203]  __kasan_kmalloc+0xd4/0xd8
[   32.663409]  __kmalloc_cache_noprof+0x16c/0x3c0
[   32.663744]  kmalloc_uaf_memset+0xb8/0x310
[   32.663985]  kunit_try_run_case+0x170/0x3f0
[   32.664226]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   32.664297]  kthread+0x328/0x630
[   32.664336]  ret_from_fork+0x10/0x20
[   32.664373] 
[   32.664392] Freed by task 217:
[   32.664419]  kasan_save_stack+0x3c/0x68
[   32.664455]  kasan_save_track+0x20/0x40
[   32.664511]  kasan_save_free_info+0x4c/0x78
[   32.664563]  __kasan_slab_free+0x6c/0x98
[   32.664599]  kfree+0x214/0x3c8
[   32.664642]  kmalloc_uaf_memset+0x11c/0x310
[   32.664683]  kunit_try_run_case+0x170/0x3f0
[   32.664727]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   32.664788]  kthread+0x328/0x630
[   32.664821]  ret_from_fork+0x10/0x20
[   32.664855] 
[   32.664876] The buggy address belongs to the object at fff00000c9a87c80
[   32.664876]  which belongs to the cache kmalloc-64 of size 64
[   32.664948] The buggy address is located 0 bytes inside of
[   32.664948]  freed 64-byte region [fff00000c9a87c80, fff00000c9a87cc0)
[   32.665015] 
[   32.665039] The buggy address belongs to the physical page:
[   32.665077] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x109a87
[   32.665133] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   32.665205] page_type: f5(slab)
[   32.665249] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   32.665298] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   32.665347] page dumped because: kasan: bad access detected
[   32.665387] 
[   32.665405] Memory state around the buggy address:
[   32.665448]  fff00000c9a87b80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   32.665509]  fff00000c9a87c00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   32.665561] >fff00000c9a87c80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   32.665601]                    ^
[   32.665627]  fff00000c9a87d00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.665670]  fff00000c9a87d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.665724] ==================================================================

[   27.124621] ==================================================================
[   27.125184] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   27.125477] Write of size 33 at addr ffff888105464000 by task kunit_try_catch/234
[   27.125778] 
[   27.125946] CPU: 0 UID: 0 PID: 234 Comm: kunit_try_catch Tainted: G    B   W        N  6.16.0-rc7-next-20250724 #1 PREEMPT(voluntary) 
[   27.125998] Tainted: [B]=BAD_PAGE, [W]=WARN, [N]=TEST
[   27.126012] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   27.126033] Call Trace:
[   27.126046]  <TASK>
[   27.126064]  dump_stack_lvl+0x73/0xb0
[   27.126092]  print_report+0xd1/0x640
[   27.126172]  ? __virt_addr_valid+0x1db/0x2d0
[   27.126197]  ? kmalloc_uaf_memset+0x1a3/0x360
[   27.126218]  ? kasan_complete_mode_report_info+0x64/0x200
[   27.126242]  ? kmalloc_uaf_memset+0x1a3/0x360
[   27.126263]  kasan_report+0x141/0x180
[   27.126284]  ? kmalloc_uaf_memset+0x1a3/0x360
[   27.126309]  kasan_check_range+0x10c/0x1c0
[   27.126332]  __asan_memset+0x27/0x50
[   27.126354]  kmalloc_uaf_memset+0x1a3/0x360
[   27.126375]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   27.126396]  ? __schedule+0x10da/0x2b60
[   27.126425]  ? __pfx_read_tsc+0x10/0x10
[   27.126447]  ? ktime_get_ts64+0x86/0x230
[   27.126472]  kunit_try_run_case+0x1a5/0x480
[   27.126498]  ? __pfx_kunit_try_run_case+0x10/0x10
[   27.126519]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   27.126544]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   27.126568]  ? __kthread_parkme+0x82/0x180
[   27.126600]  ? preempt_count_sub+0x50/0x80
[   27.126622]  ? __pfx_kunit_try_run_case+0x10/0x10
[   27.126645]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   27.126667]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   27.126690]  kthread+0x337/0x6f0
[   27.126709]  ? trace_preempt_on+0x20/0xc0
[   27.126733]  ? __pfx_kthread+0x10/0x10
[   27.126753]  ? _raw_spin_unlock_irq+0x47/0x80
[   27.126775]  ? calculate_sigpending+0x7b/0xa0
[   27.126954]  ? __pfx_kthread+0x10/0x10
[   27.126976]  ret_from_fork+0x116/0x1d0
[   27.126996]  ? __pfx_kthread+0x10/0x10
[   27.127016]  ret_from_fork_asm+0x1a/0x30
[   27.127048]  </TASK>
[   27.127058] 
[   27.134180] Allocated by task 234:
[   27.134356]  kasan_save_stack+0x45/0x70
[   27.134534]  kasan_save_track+0x18/0x40
[   27.134689]  kasan_save_alloc_info+0x3b/0x50
[   27.134831]  __kasan_kmalloc+0xb7/0xc0
[   27.135237]  __kmalloc_cache_noprof+0x189/0x420
[   27.135492]  kmalloc_uaf_memset+0xa9/0x360
[   27.135674]  kunit_try_run_case+0x1a5/0x480
[   27.135980]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   27.136248]  kthread+0x337/0x6f0
[   27.136363]  ret_from_fork+0x116/0x1d0
[   27.136487]  ret_from_fork_asm+0x1a/0x30
[   27.136653] 
[   27.136744] Freed by task 234:
[   27.136890]  kasan_save_stack+0x45/0x70
[   27.137081]  kasan_save_track+0x18/0x40
[   27.137376]  kasan_save_free_info+0x3f/0x60
[   27.137672]  __kasan_slab_free+0x56/0x70
[   27.139153]  kfree+0x222/0x3f0
[   27.139365]  kmalloc_uaf_memset+0x12b/0x360
[   27.139570]  kunit_try_run_case+0x1a5/0x480
[   27.139746]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   27.140036]  kthread+0x337/0x6f0
[   27.140209]  ret_from_fork+0x116/0x1d0
[   27.140357]  ret_from_fork_asm+0x1a/0x30
[   27.140555] 
[   27.140649] The buggy address belongs to the object at ffff888105464000
[   27.140649]  which belongs to the cache kmalloc-64 of size 64
[   27.141202] The buggy address is located 0 bytes inside of
[   27.141202]  freed 64-byte region [ffff888105464000, ffff888105464040)
[   27.141557] 
[   27.141663] The buggy address belongs to the physical page:
[   27.141924] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105464
[   27.142558] flags: 0x200000000000000(node=0|zone=2)
[   27.142739] page_type: f5(slab)
[   27.143044] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   27.143356] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   27.143650] page dumped because: kasan: bad access detected
[   27.143864] 
[   27.143949] Memory state around the buggy address:
[   27.144134]  ffff888105463f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   27.144680]  ffff888105463f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   27.145080] >ffff888105464000: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   27.145293]                    ^
[   27.145433]  ffff888105464080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   27.145756]  ffff888105464100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   27.146055] ==================================================================