Hay
Date
June 5, 2025, 7:08 a.m.

Environment
qemu-arm64
qemu-x86_64

[   25.410777] ==================================================================
[   25.411040] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   25.411190] Write of size 33 at addr fff00000c776e200 by task kunit_try_catch/186
[   25.411430] 
[   25.411558] CPU: 0 UID: 0 PID: 186 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-next-20250605 #1 PREEMPT 
[   25.411788] Tainted: [B]=BAD_PAGE, [N]=TEST
[   25.411941] Hardware name: linux,dummy-virt (DT)
[   25.412034] Call trace:
[   25.412131]  show_stack+0x20/0x38 (C)
[   25.412254]  dump_stack_lvl+0x8c/0xd0
[   25.412387]  print_report+0x118/0x608
[   25.412505]  kasan_report+0xdc/0x128
[   25.412622]  kasan_check_range+0x100/0x1a8
[   25.413078]  __asan_memset+0x34/0x78
[   25.413287]  kmalloc_uaf_memset+0x170/0x310
[   25.413849]  kunit_try_run_case+0x170/0x3f0
[   25.413984]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   25.414116]  kthread+0x328/0x630
[   25.414223]  ret_from_fork+0x10/0x20
[   25.414434] 
[   25.414549] Allocated by task 186:
[   25.414623]  kasan_save_stack+0x3c/0x68
[   25.414727]  kasan_save_track+0x20/0x40
[   25.414988]  kasan_save_alloc_info+0x40/0x58
[   25.415245]  __kasan_kmalloc+0xd4/0xd8
[   25.415357]  __kmalloc_cache_noprof+0x16c/0x3c0
[   25.415467]  kmalloc_uaf_memset+0xb8/0x310
[   25.415937]  kunit_try_run_case+0x170/0x3f0
[   25.416129]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   25.416347]  kthread+0x328/0x630
[   25.416850]  ret_from_fork+0x10/0x20
[   25.417314] 
[   25.417381] Freed by task 186:
[   25.417485]  kasan_save_stack+0x3c/0x68
[   25.419889]  kasan_save_track+0x20/0x40
[   25.420000]  kasan_save_free_info+0x4c/0x78
[   25.420102]  __kasan_slab_free+0x6c/0x98
[   25.420202]  kfree+0x214/0x3c8
[   25.420946]  kmalloc_uaf_memset+0x11c/0x310
[   25.421213]  kunit_try_run_case+0x170/0x3f0
[   25.421344]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   25.421469]  kthread+0x328/0x630
[   25.421707]  ret_from_fork+0x10/0x20
[   25.421800] 
[   25.421884] The buggy address belongs to the object at fff00000c776e200
[   25.421884]  which belongs to the cache kmalloc-64 of size 64
[   25.422274] The buggy address is located 0 bytes inside of
[   25.422274]  freed 64-byte region [fff00000c776e200, fff00000c776e240)
[   25.422684] 
[   25.422738] The buggy address belongs to the physical page:
[   25.422809] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10776e
[   25.422932] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   25.423080] page_type: f5(slab)
[   25.423874] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   25.424389] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   25.424523] page dumped because: kasan: bad access detected
[   25.424602] 
[   25.424655] Memory state around the buggy address:
[   25.424741]  fff00000c776e100: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   25.425021]  fff00000c776e180: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   25.425201] >fff00000c776e200: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   25.425786]                    ^
[   25.425932]  fff00000c776e280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.426078]  fff00000c776e300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.426209] ==================================================================


[   11.680807] ==================================================================
[   11.682096] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   11.682572] Write of size 33 at addr ffff88810277f480 by task kunit_try_catch/203
[   11.683287] 
[   11.683502] CPU: 1 UID: 0 PID: 203 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-next-20250605 #1 PREEMPT(voluntary) 
[   11.683546] Tainted: [B]=BAD_PAGE, [N]=TEST
[   11.683558] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   11.683578] Call Trace:
[   11.683589]  <TASK>
[   11.683603]  dump_stack_lvl+0x73/0xb0
[   11.683629]  print_report+0xd1/0x650
[   11.683661]  ? __virt_addr_valid+0x1db/0x2d0
[   11.683684]  ? kmalloc_uaf_memset+0x1a3/0x360
[   11.683705]  ? kasan_complete_mode_report_info+0x64/0x200
[   11.683727]  ? kmalloc_uaf_memset+0x1a3/0x360
[   11.683748]  kasan_report+0x141/0x180
[   11.683769]  ? kmalloc_uaf_memset+0x1a3/0x360
[   11.683795]  kasan_check_range+0x10c/0x1c0
[   11.683818]  __asan_memset+0x27/0x50
[   11.683837]  kmalloc_uaf_memset+0x1a3/0x360
[   11.683857]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   11.683879]  ? __schedule+0x10cc/0x2b60
[   11.683915]  ? __pfx_read_tsc+0x10/0x10
[   11.683936]  ? ktime_get_ts64+0x86/0x230
[   11.684001]  kunit_try_run_case+0x1a5/0x480
[   11.684022]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.684042]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   11.684065]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   11.684089]  ? __kthread_parkme+0x82/0x180
[   11.684109]  ? preempt_count_sub+0x50/0x80
[   11.684132]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.684152]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.684176]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   11.684200]  kthread+0x337/0x6f0
[   11.684220]  ? trace_preempt_on+0x20/0xc0
[   11.684241]  ? __pfx_kthread+0x10/0x10
[   11.684261]  ? _raw_spin_unlock_irq+0x47/0x80
[   11.684283]  ? calculate_sigpending+0x7b/0xa0
[   11.684308]  ? __pfx_kthread+0x10/0x10
[   11.684330]  ret_from_fork+0x116/0x1d0
[   11.684349]  ? __pfx_kthread+0x10/0x10
[   11.684369]  ret_from_fork_asm+0x1a/0x30
[   11.684399]  </TASK>
[   11.684409] 
[   11.696608] Allocated by task 203:
[   11.696946]  kasan_save_stack+0x45/0x70
[   11.697312]  kasan_save_track+0x18/0x40
[   11.697473]  kasan_save_alloc_info+0x3b/0x50
[   11.697698]  __kasan_kmalloc+0xb7/0xc0
[   11.698263]  __kmalloc_cache_noprof+0x189/0x420
[   11.698706]  kmalloc_uaf_memset+0xa9/0x360
[   11.699154]  kunit_try_run_case+0x1a5/0x480
[   11.699530]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.699813]  kthread+0x337/0x6f0
[   11.699957]  ret_from_fork+0x116/0x1d0
[   11.700355]  ret_from_fork_asm+0x1a/0x30
[   11.700714] 
[   11.700909] Freed by task 203:
[   11.701293]  kasan_save_stack+0x45/0x70
[   11.701449]  kasan_save_track+0x18/0x40
[   11.701586]  kasan_save_free_info+0x3f/0x60
[   11.701763]  __kasan_slab_free+0x56/0x70
[   11.701921]  kfree+0x222/0x3f0
[   11.702046]  kmalloc_uaf_memset+0x12b/0x360
[   11.702317]  kunit_try_run_case+0x1a5/0x480
[   11.702484]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.702821]  kthread+0x337/0x6f0
[   11.703034]  ret_from_fork+0x116/0x1d0
[   11.703218]  ret_from_fork_asm+0x1a/0x30
[   11.703390] 
[   11.703461] The buggy address belongs to the object at ffff88810277f480
[   11.703461]  which belongs to the cache kmalloc-64 of size 64
[   11.703952] The buggy address is located 0 bytes inside of
[   11.703952]  freed 64-byte region [ffff88810277f480, ffff88810277f4c0)
[   11.704434] 
[   11.704534] The buggy address belongs to the physical page:
[   11.704804] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10277f
[   11.705159] flags: 0x200000000000000(node=0|zone=2)
[   11.705403] page_type: f5(slab)
[   11.705557] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   11.705787] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   11.706243] page dumped because: kasan: bad access detected
[   11.706430] 
[   11.706498] Memory state around the buggy address:
[   11.706774]  ffff88810277f380: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
[   11.707322]  ffff88810277f400: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   11.707613] >ffff88810277f480: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   11.707883]                    ^
[   11.708132]  ffff88810277f500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.708408]  ffff88810277f580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.708690] ==================================================================