Hay
Date
July 20, 2025, 11:12 a.m.

Environment
qemu-arm64
qemu-x86_64

[   15.432875] ==================================================================
[   15.432934] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   15.432985] Write of size 33 at addr fff00000c7010800 by task kunit_try_catch/186
[   15.433064] 
[   15.433097] CPU: 0 UID: 0 PID: 186 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc6 #1 PREEMPT 
[   15.433177] Tainted: [B]=BAD_PAGE, [N]=TEST
[   15.433205] Hardware name: linux,dummy-virt (DT)
[   15.433236] Call trace:
[   15.433257]  show_stack+0x20/0x38 (C)
[   15.433305]  dump_stack_lvl+0x8c/0xd0
[   15.433351]  print_report+0x118/0x5d0
[   15.433398]  kasan_report+0xdc/0x128
[   15.433454]  kasan_check_range+0x100/0x1a8
[   15.433502]  __asan_memset+0x34/0x78
[   15.433552]  kmalloc_uaf_memset+0x170/0x310
[   15.433597]  kunit_try_run_case+0x170/0x3f0
[   15.433645]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   15.433709]  kthread+0x328/0x630
[   15.433750]  ret_from_fork+0x10/0x20
[   15.433798] 
[   15.433816] Allocated by task 186:
[   15.433844]  kasan_save_stack+0x3c/0x68
[   15.433920]  kasan_save_track+0x20/0x40
[   15.433959]  kasan_save_alloc_info+0x40/0x58
[   15.434096]  __kasan_kmalloc+0xd4/0xd8
[   15.434264]  __kmalloc_cache_noprof+0x16c/0x3c0
[   15.434476]  kmalloc_uaf_memset+0xb8/0x310
[   15.434516]  kunit_try_run_case+0x170/0x3f0
[   15.434552]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   15.434594]  kthread+0x328/0x630
[   15.434625]  ret_from_fork+0x10/0x20
[   15.434671] 
[   15.434691] Freed by task 186:
[   15.434718]  kasan_save_stack+0x3c/0x68
[   15.434782]  kasan_save_track+0x20/0x40
[   15.434948]  kasan_save_free_info+0x4c/0x78
[   15.435037]  __kasan_slab_free+0x6c/0x98
[   15.435156]  kfree+0x214/0x3c8
[   15.435234]  kmalloc_uaf_memset+0x11c/0x310
[   15.435320]  kunit_try_run_case+0x170/0x3f0
[   15.435356]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   15.435421]  kthread+0x328/0x630
[   15.435454]  ret_from_fork+0x10/0x20
[   15.435488] 
[   15.435508] The buggy address belongs to the object at fff00000c7010800
[   15.435508]  which belongs to the cache kmalloc-64 of size 64
[   15.435602] The buggy address is located 0 bytes inside of
[   15.435602]  freed 64-byte region [fff00000c7010800, fff00000c7010840)
[   15.435804] 
[   15.435865] The buggy address belongs to the physical page:
[   15.435960] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x107010
[   15.436034] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   15.436083] page_type: f5(slab)
[   15.436164] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   15.436243] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   15.436285] page dumped because: kasan: bad access detected
[   15.436317] 
[   15.436336] Memory state around the buggy address:
[   15.436520]  fff00000c7010700: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   15.436588]  fff00000c7010780: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   15.436743] >fff00000c7010800: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   15.436852]                    ^
[   15.436879]  fff00000c7010880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   15.436949]  fff00000c7010900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   15.437165] ==================================================================

[   12.579508] ==================================================================
[   12.580432] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   12.580957] Write of size 33 at addr ffff888102add100 by task kunit_try_catch/203
[   12.581492] 
[   12.581703] CPU: 0 UID: 0 PID: 203 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc6 #1 PREEMPT(voluntary) 
[   12.581747] Tainted: [B]=BAD_PAGE, [N]=TEST
[   12.581758] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   12.581790] Call Trace:
[   12.581801]  <TASK>
[   12.581816]  dump_stack_lvl+0x73/0xb0
[   12.581845]  print_report+0xd1/0x610
[   12.581866]  ? __virt_addr_valid+0x1db/0x2d0
[   12.581896]  ? kmalloc_uaf_memset+0x1a3/0x360
[   12.581924]  ? kasan_complete_mode_report_info+0x64/0x200
[   12.581945]  ? kmalloc_uaf_memset+0x1a3/0x360
[   12.581976]  kasan_report+0x141/0x180
[   12.582018]  ? kmalloc_uaf_memset+0x1a3/0x360
[   12.582065]  kasan_check_range+0x10c/0x1c0
[   12.582087]  __asan_memset+0x27/0x50
[   12.582105]  kmalloc_uaf_memset+0x1a3/0x360
[   12.582124]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   12.582146]  ? __schedule+0x10cc/0x2b60
[   12.582166]  ? __pfx_read_tsc+0x10/0x10
[   12.582186]  ? ktime_get_ts64+0x86/0x230
[   12.582209]  kunit_try_run_case+0x1a5/0x480
[   12.582232]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.582253]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   12.582274]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   12.582296]  ? __kthread_parkme+0x82/0x180
[   12.582314]  ? preempt_count_sub+0x50/0x80
[   12.582353]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.582375]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.582397]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   12.582443]  kthread+0x337/0x6f0
[   12.582463]  ? trace_preempt_on+0x20/0xc0
[   12.582484]  ? __pfx_kthread+0x10/0x10
[   12.582503]  ? _raw_spin_unlock_irq+0x47/0x80
[   12.582523]  ? calculate_sigpending+0x7b/0xa0
[   12.582545]  ? __pfx_kthread+0x10/0x10
[   12.582565]  ret_from_fork+0x116/0x1d0
[   12.582581]  ? __pfx_kthread+0x10/0x10
[   12.582610]  ret_from_fork_asm+0x1a/0x30
[   12.582639]  </TASK>
[   12.582648] 
[   12.595165] Allocated by task 203:
[   12.595353]  kasan_save_stack+0x45/0x70
[   12.595558]  kasan_save_track+0x18/0x40
[   12.595752]  kasan_save_alloc_info+0x3b/0x50
[   12.595999]  __kasan_kmalloc+0xb7/0xc0
[   12.596270]  __kmalloc_cache_noprof+0x189/0x420
[   12.596519]  kmalloc_uaf_memset+0xa9/0x360
[   12.596661]  kunit_try_run_case+0x1a5/0x480
[   12.596824]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.597007]  kthread+0x337/0x6f0
[   12.597175]  ret_from_fork+0x116/0x1d0
[   12.597359]  ret_from_fork_asm+0x1a/0x30
[   12.597552] 
[   12.597645] Freed by task 203:
[   12.597920]  kasan_save_stack+0x45/0x70
[   12.598130]  kasan_save_track+0x18/0x40
[   12.598327]  kasan_save_free_info+0x3f/0x60
[   12.598584]  __kasan_slab_free+0x56/0x70
[   12.598791]  kfree+0x222/0x3f0
[   12.598954]  kmalloc_uaf_memset+0x12b/0x360
[   12.599147]  kunit_try_run_case+0x1a5/0x480
[   12.599319]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.599554]  kthread+0x337/0x6f0
[   12.599753]  ret_from_fork+0x116/0x1d0
[   12.599949]  ret_from_fork_asm+0x1a/0x30
[   12.600147] 
[   12.600242] The buggy address belongs to the object at ffff888102add100
[   12.600242]  which belongs to the cache kmalloc-64 of size 64
[   12.600774] The buggy address is located 0 bytes inside of
[   12.600774]  freed 64-byte region [ffff888102add100, ffff888102add140)
[   12.601247] 
[   12.601409] The buggy address belongs to the physical page:
[   12.601600] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102add
[   12.601865] flags: 0x200000000000000(node=0|zone=2)
[   12.602039] page_type: f5(slab)
[   12.602158] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   12.602598] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   12.602972] page dumped because: kasan: bad access detected
[   12.603229] 
[   12.603320] Memory state around the buggy address:
[   12.603605]  ffff888102add000: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.603961]  ffff888102add080: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.604276] >ffff888102add100: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.604633]                    ^
[   12.604800]  ffff888102add180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.605070]  ffff888102add200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.605452] ==================================================================