Hay
Date
July 6, 2025, 11:09 a.m.

Environment
qemu-arm64
qemu-x86_64

[   18.192088] ==================================================================
[   18.192149] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   18.192214] Write of size 33 at addr fff00000c641ee80 by task kunit_try_catch/186
[   18.192771] 
[   18.192909] CPU: 1 UID: 0 PID: 186 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT 
[   18.192997] Tainted: [B]=BAD_PAGE, [N]=TEST
[   18.193024] Hardware name: linux,dummy-virt (DT)
[   18.193126] Call trace:
[   18.193152]  show_stack+0x20/0x38 (C)
[   18.193314]  dump_stack_lvl+0x8c/0xd0
[   18.193403]  print_report+0x118/0x608
[   18.193455]  kasan_report+0xdc/0x128
[   18.193913]  kasan_check_range+0x100/0x1a8
[   18.194116]  __asan_memset+0x34/0x78
[   18.194160]  kmalloc_uaf_memset+0x170/0x310
[   18.194223]  kunit_try_run_case+0x170/0x3f0
[   18.194406]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.194845]  kthread+0x328/0x630
[   18.195025]  ret_from_fork+0x10/0x20
[   18.195295] 
[   18.195319] Allocated by task 186:
[   18.195377]  kasan_save_stack+0x3c/0x68
[   18.195656]  kasan_save_track+0x20/0x40
[   18.195777]  kasan_save_alloc_info+0x40/0x58
[   18.196014]  __kasan_kmalloc+0xd4/0xd8
[   18.196226]  __kmalloc_cache_noprof+0x16c/0x3c0
[   18.196477]  kmalloc_uaf_memset+0xb8/0x310
[   18.196770]  kunit_try_run_case+0x170/0x3f0
[   18.197131]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.197418]  kthread+0x328/0x630
[   18.197637]  ret_from_fork+0x10/0x20
[   18.197983] 
[   18.198017] Freed by task 186:
[   18.198058]  kasan_save_stack+0x3c/0x68
[   18.198107]  kasan_save_track+0x20/0x40
[   18.198144]  kasan_save_free_info+0x4c/0x78
[   18.198213]  __kasan_slab_free+0x6c/0x98
[   18.198258]  kfree+0x214/0x3c8
[   18.198290]  kmalloc_uaf_memset+0x11c/0x310
[   18.198621]  kunit_try_run_case+0x170/0x3f0
[   18.198683]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.198978]  kthread+0x328/0x630
[   18.199219]  ret_from_fork+0x10/0x20
[   18.199342] 
[   18.199446] The buggy address belongs to the object at fff00000c641ee80
[   18.199446]  which belongs to the cache kmalloc-64 of size 64
[   18.199606] The buggy address is located 0 bytes inside of
[   18.199606]  freed 64-byte region [fff00000c641ee80, fff00000c641eec0)
[   18.199778] 
[   18.199828] The buggy address belongs to the physical page:
[   18.199860] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10641e
[   18.200254] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   18.200417] page_type: f5(slab)
[   18.200460] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   18.200795] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   18.200854] page dumped because: kasan: bad access detected
[   18.201004] 
[   18.201033] Memory state around the buggy address:
[   18.201068]  fff00000c641ed80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   18.201275]  fff00000c641ee00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   18.201515] >fff00000c641ee80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   18.201729]                    ^
[   18.201828]  fff00000c641ef00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.201960]  fff00000c641ef80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.202218] ==================================================================

[   11.853842] ==================================================================
[   11.854309] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   11.854621] Write of size 33 at addr ffff88810279c380 by task kunit_try_catch/203
[   11.854925] 
[   11.855343] CPU: 1 UID: 0 PID: 203 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT(voluntary) 
[   11.855396] Tainted: [B]=BAD_PAGE, [N]=TEST
[   11.855409] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   11.855432] Call Trace:
[   11.855446]  <TASK>
[   11.855465]  dump_stack_lvl+0x73/0xb0
[   11.855498]  print_report+0xd1/0x650
[   11.855522]  ? __virt_addr_valid+0x1db/0x2d0
[   11.855545]  ? kmalloc_uaf_memset+0x1a3/0x360
[   11.855567]  ? kasan_complete_mode_report_info+0x64/0x200
[   11.855588]  ? kmalloc_uaf_memset+0x1a3/0x360
[   11.855610]  kasan_report+0x141/0x180
[   11.855631]  ? kmalloc_uaf_memset+0x1a3/0x360
[   11.855656]  kasan_check_range+0x10c/0x1c0
[   11.855679]  __asan_memset+0x27/0x50
[   11.855698]  kmalloc_uaf_memset+0x1a3/0x360
[   11.855719]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   11.855741]  ? __schedule+0x10cc/0x2b60
[   11.855763]  ? __pfx_read_tsc+0x10/0x10
[   11.855784]  ? ktime_get_ts64+0x86/0x230
[   11.855810]  kunit_try_run_case+0x1a5/0x480
[   11.855835]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.855857]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   11.855880]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   11.855902]  ? __kthread_parkme+0x82/0x180
[   11.855924]  ? preempt_count_sub+0x50/0x80
[   11.855962]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.855985]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.856007]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   11.856029]  kthread+0x337/0x6f0
[   11.856049]  ? trace_preempt_on+0x20/0xc0
[   11.856129]  ? __pfx_kthread+0x10/0x10
[   11.856153]  ? _raw_spin_unlock_irq+0x47/0x80
[   11.856173]  ? calculate_sigpending+0x7b/0xa0
[   11.856198]  ? __pfx_kthread+0x10/0x10
[   11.856219]  ret_from_fork+0x116/0x1d0
[   11.856238]  ? __pfx_kthread+0x10/0x10
[   11.856258]  ret_from_fork_asm+0x1a/0x30
[   11.856289]  </TASK>
[   11.856302] 
[   11.863920] Allocated by task 203:
[   11.864146]  kasan_save_stack+0x45/0x70
[   11.864347]  kasan_save_track+0x18/0x40
[   11.864552]  kasan_save_alloc_info+0x3b/0x50
[   11.864772]  __kasan_kmalloc+0xb7/0xc0
[   11.864952]  __kmalloc_cache_noprof+0x189/0x420
[   11.865111]  kmalloc_uaf_memset+0xa9/0x360
[   11.865254]  kunit_try_run_case+0x1a5/0x480
[   11.865482]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.865734]  kthread+0x337/0x6f0
[   11.865913]  ret_from_fork+0x116/0x1d0
[   11.866114]  ret_from_fork_asm+0x1a/0x30
[   11.866325] 
[   11.866422] Freed by task 203:
[   11.866626]  kasan_save_stack+0x45/0x70
[   11.866793]  kasan_save_track+0x18/0x40
[   11.866942]  kasan_save_free_info+0x3f/0x60
[   11.867212]  __kasan_slab_free+0x56/0x70
[   11.867414]  kfree+0x222/0x3f0
[   11.867572]  kmalloc_uaf_memset+0x12b/0x360
[   11.867762]  kunit_try_run_case+0x1a5/0x480
[   11.867950]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.868202]  kthread+0x337/0x6f0
[   11.868329]  ret_from_fork+0x116/0x1d0
[   11.868520]  ret_from_fork_asm+0x1a/0x30
[   11.868720] 
[   11.868818] The buggy address belongs to the object at ffff88810279c380
[   11.868818]  which belongs to the cache kmalloc-64 of size 64
[   11.869193] The buggy address is located 0 bytes inside of
[   11.869193]  freed 64-byte region [ffff88810279c380, ffff88810279c3c0)
[   11.869536] 
[   11.869627] The buggy address belongs to the physical page:
[   11.869882] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10279c
[   11.870626] flags: 0x200000000000000(node=0|zone=2)
[   11.870874] page_type: f5(slab)
[   11.871062] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   11.871377] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   11.871729] page dumped because: kasan: bad access detected
[   11.871942] 
[   11.872015] Memory state around the buggy address:
[   11.872354]  ffff88810279c280: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   11.872765]  ffff88810279c300: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   11.872996] >ffff88810279c380: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   11.873441]                    ^
[   11.873956]  ffff88810279c400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.874519]  ffff88810279c480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.874748] ==================================================================