Hay
Date
July 20, 2025, 8:11 p.m.

Environment
qemu-arm64
qemu-x86_64

[   15.318610] ==================================================================
[   15.318670] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   15.318722] Write of size 33 at addr fff00000c770c500 by task kunit_try_catch/187
[   15.318773] 
[   15.318809] CPU: 1 UID: 0 PID: 187 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc6 #1 PREEMPT 
[   15.318915] Tainted: [B]=BAD_PAGE, [N]=TEST
[   15.318943] Hardware name: linux,dummy-virt (DT)
[   15.318976] Call trace:
[   15.318998]  show_stack+0x20/0x38 (C)
[   15.319050]  dump_stack_lvl+0x8c/0xd0
[   15.319099]  print_report+0x118/0x5d0
[   15.319146]  kasan_report+0xdc/0x128
[   15.319481]  kasan_check_range+0x100/0x1a8
[   15.319579]  __asan_memset+0x34/0x78
[   15.319820]  kmalloc_uaf_memset+0x170/0x310
[   15.319891]  kunit_try_run_case+0x170/0x3f0
[   15.320601]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   15.320695]  kthread+0x328/0x630
[   15.320753]  ret_from_fork+0x10/0x20
[   15.320813] 
[   15.321000] Allocated by task 187:
[   15.321050]  kasan_save_stack+0x3c/0x68
[   15.321469]  kasan_save_track+0x20/0x40
[   15.321702]  kasan_save_alloc_info+0x40/0x58
[   15.321908]  __kasan_kmalloc+0xd4/0xd8
[   15.322000]  __kmalloc_cache_noprof+0x16c/0x3c0
[   15.322042]  kmalloc_uaf_memset+0xb8/0x310
[   15.322084]  kunit_try_run_case+0x170/0x3f0
[   15.322122]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   15.322334]  kthread+0x328/0x630
[   15.322424]  ret_from_fork+0x10/0x20
[   15.322770] 
[   15.323159] Freed by task 187:
[   15.323259]  kasan_save_stack+0x3c/0x68
[   15.323580]  kasan_save_track+0x20/0x40
[   15.323824]  kasan_save_free_info+0x4c/0x78
[   15.323921]  __kasan_slab_free+0x6c/0x98
[   15.324054]  kfree+0x214/0x3c8
[   15.324114]  kmalloc_uaf_memset+0x11c/0x310
[   15.324246]  kunit_try_run_case+0x170/0x3f0
[   15.324289]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   15.324535]  kthread+0x328/0x630
[   15.324594]  ret_from_fork+0x10/0x20
[   15.324740] 
[   15.324861] The buggy address belongs to the object at fff00000c770c500
[   15.324861]  which belongs to the cache kmalloc-64 of size 64
[   15.325156] The buggy address is located 0 bytes inside of
[   15.325156]  freed 64-byte region [fff00000c770c500, fff00000c770c540)
[   15.325407] 
[   15.325658] The buggy address belongs to the physical page:
[   15.325706] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10770c
[   15.325906] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   15.326061] page_type: f5(slab)
[   15.326150] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   15.326291] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   15.326334] page dumped because: kasan: bad access detected
[   15.326586] 
[   15.326668] Memory state around the buggy address:
[   15.326715]  fff00000c770c400: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   15.326763]  fff00000c770c480: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   15.326938] >fff00000c770c500: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   15.327007]                    ^
[   15.327045]  fff00000c770c580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   15.327098]  fff00000c770c600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   15.327137] ==================================================================

[   13.219168] ==================================================================
[   13.219922] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   13.220381] Write of size 33 at addr ffff888103256980 by task kunit_try_catch/204
[   13.220729] 
[   13.220918] CPU: 0 UID: 0 PID: 204 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc6 #1 PREEMPT(voluntary) 
[   13.220964] Tainted: [B]=BAD_PAGE, [N]=TEST
[   13.220975] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   13.220995] Call Trace:
[   13.221006]  <TASK>
[   13.221021]  dump_stack_lvl+0x73/0xb0
[   13.221105]  print_report+0xd1/0x610
[   13.221128]  ? __virt_addr_valid+0x1db/0x2d0
[   13.221162]  ? kmalloc_uaf_memset+0x1a3/0x360
[   13.221184]  ? kasan_complete_mode_report_info+0x64/0x200
[   13.221206]  ? kmalloc_uaf_memset+0x1a3/0x360
[   13.221240]  kasan_report+0x141/0x180
[   13.221272]  ? kmalloc_uaf_memset+0x1a3/0x360
[   13.221298]  kasan_check_range+0x10c/0x1c0
[   13.221321]  __asan_memset+0x27/0x50
[   13.221352]  kmalloc_uaf_memset+0x1a3/0x360
[   13.221373]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   13.221395]  ? __schedule+0x10c6/0x2b60
[   13.221418]  ? __pfx_read_tsc+0x10/0x10
[   13.221439]  ? ktime_get_ts64+0x86/0x230
[   13.221463]  kunit_try_run_case+0x1a5/0x480
[   13.221497]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.221519]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   13.221542]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   13.221565]  ? __kthread_parkme+0x82/0x180
[   13.221586]  ? preempt_count_sub+0x50/0x80
[   13.221619]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.221643]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.221666]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   13.221701]  kthread+0x337/0x6f0
[   13.221720]  ? trace_preempt_on+0x20/0xc0
[   13.221743]  ? __pfx_kthread+0x10/0x10
[   13.221763]  ? _raw_spin_unlock_irq+0x47/0x80
[   13.221794]  ? calculate_sigpending+0x7b/0xa0
[   13.221827]  ? __pfx_kthread+0x10/0x10
[   13.221849]  ret_from_fork+0x116/0x1d0
[   13.221868]  ? __pfx_kthread+0x10/0x10
[   13.221888]  ret_from_fork_asm+0x1a/0x30
[   13.221930]  </TASK>
[   13.221940] 
[   13.229775] Allocated by task 204:
[   13.229992]  kasan_save_stack+0x45/0x70
[   13.230399]  kasan_save_track+0x18/0x40
[   13.230620]  kasan_save_alloc_info+0x3b/0x50
[   13.230852]  __kasan_kmalloc+0xb7/0xc0
[   13.231100]  __kmalloc_cache_noprof+0x189/0x420
[   13.231327]  kmalloc_uaf_memset+0xa9/0x360
[   13.231560]  kunit_try_run_case+0x1a5/0x480
[   13.231756]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.232026]  kthread+0x337/0x6f0
[   13.232245]  ret_from_fork+0x116/0x1d0
[   13.232401]  ret_from_fork_asm+0x1a/0x30
[   13.232633] 
[   13.232737] Freed by task 204:
[   13.232896]  kasan_save_stack+0x45/0x70
[   13.233042]  kasan_save_track+0x18/0x40
[   13.233184]  kasan_save_free_info+0x3f/0x60
[   13.233337]  __kasan_slab_free+0x56/0x70
[   13.233492]  kfree+0x222/0x3f0
[   13.233662]  kmalloc_uaf_memset+0x12b/0x360
[   13.234024]  kunit_try_run_case+0x1a5/0x480
[   13.234334]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.234592]  kthread+0x337/0x6f0
[   13.234721]  ret_from_fork+0x116/0x1d0
[   13.235110]  ret_from_fork_asm+0x1a/0x30
[   13.235350] 
[   13.235451] The buggy address belongs to the object at ffff888103256980
[   13.235451]  which belongs to the cache kmalloc-64 of size 64
[   13.236273] The buggy address is located 0 bytes inside of
[   13.236273]  freed 64-byte region [ffff888103256980, ffff8881032569c0)
[   13.236750] 
[   13.236865] The buggy address belongs to the physical page:
[   13.237252] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x103256
[   13.237518] flags: 0x200000000000000(node=0|zone=2)
[   13.237692] page_type: f5(slab)
[   13.237836] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   13.238406] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   13.238761] page dumped because: kasan: bad access detected
[   13.239018] 
[   13.239284] Memory state around the buggy address:
[   13.239537]  ffff888103256880: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
[   13.239933]  ffff888103256900: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   13.240289] >ffff888103256980: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   13.240623]                    ^
[   13.240820]  ffff888103256a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   13.241193]  ffff888103256a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   13.241521] ==================================================================