Hay
Date
July 5, 2025, 5:09 p.m.

Environment
qemu-arm64
qemu-x86_64

[   18.422142] ==================================================================
[   18.422235] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   18.422474] Write of size 33 at addr fff00000c7818980 by task kunit_try_catch/186
[   18.422613] 
[   18.422683] CPU: 1 UID: 0 PID: 186 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT 
[   18.422994] Tainted: [B]=BAD_PAGE, [N]=TEST
[   18.423021] Hardware name: linux,dummy-virt (DT)
[   18.423157] Call trace:
[   18.423256]  show_stack+0x20/0x38 (C)
[   18.423398]  dump_stack_lvl+0x8c/0xd0
[   18.423544]  print_report+0x118/0x608
[   18.423780]  kasan_report+0xdc/0x128
[   18.424413]  kasan_check_range+0x100/0x1a8
[   18.424503]  __asan_memset+0x34/0x78
[   18.424544]  kmalloc_uaf_memset+0x170/0x310
[   18.424591]  kunit_try_run_case+0x170/0x3f0
[   18.424637]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.424689]  kthread+0x328/0x630
[   18.424729]  ret_from_fork+0x10/0x20
[   18.424776] 
[   18.424795] Allocated by task 186:
[   18.424821]  kasan_save_stack+0x3c/0x68
[   18.424870]  kasan_save_track+0x20/0x40
[   18.424908]  kasan_save_alloc_info+0x40/0x58
[   18.424947]  __kasan_kmalloc+0xd4/0xd8
[   18.424986]  __kmalloc_cache_noprof+0x16c/0x3c0
[   18.425024]  kmalloc_uaf_memset+0xb8/0x310
[   18.425060]  kunit_try_run_case+0x170/0x3f0
[   18.425116]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.425159]  kthread+0x328/0x630
[   18.425192]  ret_from_fork+0x10/0x20
[   18.425353] 
[   18.425382] Freed by task 186:
[   18.425407]  kasan_save_stack+0x3c/0x68
[   18.425446]  kasan_save_track+0x20/0x40
[   18.425482]  kasan_save_free_info+0x4c/0x78
[   18.425521]  __kasan_slab_free+0x6c/0x98
[   18.425557]  kfree+0x214/0x3c8
[   18.425589]  kmalloc_uaf_memset+0x11c/0x310
[   18.425624]  kunit_try_run_case+0x170/0x3f0
[   18.425661]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.425712]  kthread+0x328/0x630
[   18.425830]  ret_from_fork+0x10/0x20
[   18.425881] 
[   18.425968] The buggy address belongs to the object at fff00000c7818980
[   18.425968]  which belongs to the cache kmalloc-64 of size 64
[   18.426023] The buggy address is located 0 bytes inside of
[   18.426023]  freed 64-byte region [fff00000c7818980, fff00000c78189c0)
[   18.426122] 
[   18.426184] The buggy address belongs to the physical page:
[   18.426214] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x107818
[   18.426411] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   18.426631] page_type: f5(slab)
[   18.426673] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   18.427206] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   18.427250] page dumped because: kasan: bad access detected
[   18.427281] 
[   18.427298] Memory state around the buggy address:
[   18.427356]  fff00000c7818880: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   18.427398]  fff00000c7818900: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
[   18.427445] >fff00000c7818980: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   18.427722]                    ^
[   18.427750]  fff00000c7818a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.427791]  fff00000c7818a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.428025] ==================================================================

[   11.888769] ==================================================================
[   11.889296] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   11.889646] Write of size 33 at addr ffff8881038d5880 by task kunit_try_catch/204
[   11.890102] 
[   11.890196] CPU: 1 UID: 0 PID: 204 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT(voluntary) 
[   11.890240] Tainted: [B]=BAD_PAGE, [N]=TEST
[   11.890251] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   11.890291] Call Trace:
[   11.890303]  <TASK>
[   11.890334]  dump_stack_lvl+0x73/0xb0
[   11.890361]  print_report+0xd1/0x650
[   11.890384]  ? __virt_addr_valid+0x1db/0x2d0
[   11.890405]  ? kmalloc_uaf_memset+0x1a3/0x360
[   11.890425]  ? kasan_complete_mode_report_info+0x64/0x200
[   11.890503]  ? kmalloc_uaf_memset+0x1a3/0x360
[   11.890524]  kasan_report+0x141/0x180
[   11.890545]  ? kmalloc_uaf_memset+0x1a3/0x360
[   11.890570]  kasan_check_range+0x10c/0x1c0
[   11.890593]  __asan_memset+0x27/0x50
[   11.890613]  kmalloc_uaf_memset+0x1a3/0x360
[   11.890634]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   11.890687]  ? __schedule+0x10cc/0x2b60
[   11.890709]  ? __pfx_read_tsc+0x10/0x10
[   11.890730]  ? ktime_get_ts64+0x86/0x230
[   11.890754]  kunit_try_run_case+0x1a5/0x480
[   11.890777]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.890799]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   11.890821]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   11.890861]  ? __kthread_parkme+0x82/0x180
[   11.890880]  ? preempt_count_sub+0x50/0x80
[   11.890903]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.890926]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.890947]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   11.890969]  kthread+0x337/0x6f0
[   11.890988]  ? trace_preempt_on+0x20/0xc0
[   11.891011]  ? __pfx_kthread+0x10/0x10
[   11.891031]  ? _raw_spin_unlock_irq+0x47/0x80
[   11.891051]  ? calculate_sigpending+0x7b/0xa0
[   11.891074]  ? __pfx_kthread+0x10/0x10
[   11.891094]  ret_from_fork+0x116/0x1d0
[   11.891112]  ? __pfx_kthread+0x10/0x10
[   11.891132]  ret_from_fork_asm+0x1a/0x30
[   11.891161]  </TASK>
[   11.891172] 
[   11.899378] Allocated by task 204:
[   11.899586]  kasan_save_stack+0x45/0x70
[   11.899790]  kasan_save_track+0x18/0x40
[   11.900170]  kasan_save_alloc_info+0x3b/0x50
[   11.900622]  __kasan_kmalloc+0xb7/0xc0
[   11.900930]  __kmalloc_cache_noprof+0x189/0x420
[   11.901092]  kmalloc_uaf_memset+0xa9/0x360
[   11.901500]  kunit_try_run_case+0x1a5/0x480
[   11.901749]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.901989]  kthread+0x337/0x6f0
[   11.902139]  ret_from_fork+0x116/0x1d0
[   11.902396]  ret_from_fork_asm+0x1a/0x30
[   11.902585] 
[   11.902657] Freed by task 204:
[   11.902768]  kasan_save_stack+0x45/0x70
[   11.902901]  kasan_save_track+0x18/0x40
[   11.903080]  kasan_save_free_info+0x3f/0x60
[   11.903485]  __kasan_slab_free+0x56/0x70
[   11.903681]  kfree+0x222/0x3f0
[   11.903839]  kmalloc_uaf_memset+0x12b/0x360
[   11.904040]  kunit_try_run_case+0x1a5/0x480
[   11.904413]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.904698]  kthread+0x337/0x6f0
[   11.904893]  ret_from_fork+0x116/0x1d0
[   11.905081]  ret_from_fork_asm+0x1a/0x30
[   11.905371] 
[   11.905469] The buggy address belongs to the object at ffff8881038d5880
[   11.905469]  which belongs to the cache kmalloc-64 of size 64
[   11.906024] The buggy address is located 0 bytes inside of
[   11.906024]  freed 64-byte region [ffff8881038d5880, ffff8881038d58c0)
[   11.906360] 
[   11.906521] The buggy address belongs to the physical page:
[   11.906992] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1038d5
[   11.907395] flags: 0x200000000000000(node=0|zone=2)
[   11.907697] page_type: f5(slab)
[   11.907918] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   11.908342] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   11.908712] page dumped because: kasan: bad access detected
[   11.908977] 
[   11.909046] Memory state around the buggy address:
[   11.909199]  ffff8881038d5780: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   11.909718]  ffff8881038d5800: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   11.910039] >ffff8881038d5880: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   11.910549]                    ^
[   11.910775]  ffff8881038d5900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.911000]  ffff8881038d5980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.911226] ==================================================================