Hay
Date
June 23, 2025, 7:07 a.m.

Environment
qemu-arm64
qemu-x86_64

[   33.173832] ==================================================================
[   33.173902] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   33.173968] Write of size 33 at addr fff00000c570b600 by task kunit_try_catch/198
[   33.174056] 
[   33.174125] CPU: 1 UID: 0 PID: 198 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc3-next-20250623 #1 PREEMPT 
[   33.174339] Tainted: [B]=BAD_PAGE, [N]=TEST
[   33.174404] Hardware name: linux,dummy-virt (DT)
[   33.174475] Call trace:
[   33.174530]  show_stack+0x20/0x38 (C)
[   33.174762]  dump_stack_lvl+0x8c/0xd0
[   33.175154]  print_report+0x118/0x608
[   33.175286]  kasan_report+0xdc/0x128
[   33.175411]  kasan_check_range+0x100/0x1a8
[   33.175697]  __asan_memset+0x34/0x78
[   33.175851]  kmalloc_uaf_memset+0x170/0x310
[   33.176105]  kunit_try_run_case+0x170/0x3f0
[   33.176265]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.176398]  kthread+0x328/0x630
[   33.176502]  ret_from_fork+0x10/0x20
[   33.176616] 
[   33.176662] Allocated by task 198:
[   33.176738]  kasan_save_stack+0x3c/0x68
[   33.177010]  kasan_save_track+0x20/0x40
[   33.177134]  kasan_save_alloc_info+0x40/0x58
[   33.177624]  __kasan_kmalloc+0xd4/0xd8
[   33.178051]  __kmalloc_cache_noprof+0x16c/0x3c0
[   33.178248]  kmalloc_uaf_memset+0xb8/0x310
[   33.178347]  kunit_try_run_case+0x170/0x3f0
[   33.178446]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.178596]  kthread+0x328/0x630
[   33.178787]  ret_from_fork+0x10/0x20
[   33.178969] 
[   33.179021] Freed by task 198:
[   33.179107]  kasan_save_stack+0x3c/0x68
[   33.179222]  kasan_save_track+0x20/0x40
[   33.179395]  kasan_save_free_info+0x4c/0x78
[   33.179500]  __kasan_slab_free+0x6c/0x98
[   33.179805]  kfree+0x214/0x3c8
[   33.179937]  kmalloc_uaf_memset+0x11c/0x310
[   33.180106]  kunit_try_run_case+0x170/0x3f0
[   33.180381]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.180567]  kthread+0x328/0x630
[   33.180689]  ret_from_fork+0x10/0x20
[   33.180802] 
[   33.180916] The buggy address belongs to the object at fff00000c570b600
[   33.180916]  which belongs to the cache kmalloc-64 of size 64
[   33.181130] The buggy address is located 0 bytes inside of
[   33.181130]  freed 64-byte region [fff00000c570b600, fff00000c570b640)
[   33.181378] 
[   33.181436] The buggy address belongs to the physical page:
[   33.181507] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10570b
[   33.181651] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   33.181837] page_type: f5(slab)
[   33.181976] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   33.182118] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   33.182226] page dumped because: kasan: bad access detected
[   33.182309] 
[   33.182351] Memory state around the buggy address:
[   33.182423]  fff00000c570b500: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   33.182522]  fff00000c570b580: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   33.183121] >fff00000c570b600: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   33.183364]                    ^
[   33.183440]  fff00000c570b680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   33.183585]  fff00000c570b700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   33.183720] ==================================================================

[   22.070659] ==================================================================
[   22.071056] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   22.071501] Write of size 33 at addr ffff888102c0a000 by task kunit_try_catch/215
[   22.071892] 
[   22.072005] CPU: 1 UID: 0 PID: 215 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc3-next-20250623 #1 PREEMPT(voluntary) 
[   22.072119] Tainted: [B]=BAD_PAGE, [N]=TEST
[   22.072138] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   22.072164] Call Trace:
[   22.072184]  <TASK>
[   22.072207]  dump_stack_lvl+0x73/0xb0
[   22.072252]  print_report+0xd1/0x650
[   22.072287]  ? __virt_addr_valid+0x1db/0x2d0
[   22.072325]  ? kmalloc_uaf_memset+0x1a3/0x360
[   22.072357]  ? kasan_complete_mode_report_info+0x64/0x200
[   22.072413]  ? kmalloc_uaf_memset+0x1a3/0x360
[   22.072449]  kasan_report+0x141/0x180
[   22.072487]  ? kmalloc_uaf_memset+0x1a3/0x360
[   22.072526]  kasan_check_range+0x10c/0x1c0
[   22.072556]  __asan_memset+0x27/0x50
[   22.072587]  kmalloc_uaf_memset+0x1a3/0x360
[   22.072619]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   22.072654]  ? __schedule+0x10cc/0x2b60
[   22.072692]  ? __pfx_read_tsc+0x10/0x10
[   22.072727]  ? ktime_get_ts64+0x86/0x230
[   22.072771]  kunit_try_run_case+0x1a5/0x480
[   22.072801]  ? __pfx_kunit_try_run_case+0x10/0x10
[   22.072819]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   22.073058]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   22.073117]  ? __kthread_parkme+0x82/0x180
[   22.073185]  ? preempt_count_sub+0x50/0x80
[   22.073550]  ? __pfx_kunit_try_run_case+0x10/0x10
[   22.073596]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   22.073640]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   22.073680]  kthread+0x337/0x6f0
[   22.073701]  ? trace_preempt_on+0x20/0xc0
[   22.073721]  ? __pfx_kthread+0x10/0x10
[   22.073738]  ? _raw_spin_unlock_irq+0x47/0x80
[   22.073756]  ? calculate_sigpending+0x7b/0xa0
[   22.073775]  ? __pfx_kthread+0x10/0x10
[   22.073794]  ret_from_fork+0x116/0x1d0
[   22.073810]  ? __pfx_kthread+0x10/0x10
[   22.073827]  ret_from_fork_asm+0x1a/0x30
[   22.073864]  </TASK>
[   22.073875] 
[   22.084734] Allocated by task 215:
[   22.085057]  kasan_save_stack+0x45/0x70
[   22.085540]  kasan_save_track+0x18/0x40
[   22.085824]  kasan_save_alloc_info+0x3b/0x50
[   22.086420]  __kasan_kmalloc+0xb7/0xc0
[   22.086791]  __kmalloc_cache_noprof+0x189/0x420
[   22.087293]  kmalloc_uaf_memset+0xa9/0x360
[   22.087447]  kunit_try_run_case+0x1a5/0x480
[   22.087761]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   22.088340]  kthread+0x337/0x6f0
[   22.088504]  ret_from_fork+0x116/0x1d0
[   22.088818]  ret_from_fork_asm+0x1a/0x30
[   22.089159] 
[   22.089247] Freed by task 215:
[   22.089409]  kasan_save_stack+0x45/0x70
[   22.089677]  kasan_save_track+0x18/0x40
[   22.089956]  kasan_save_free_info+0x3f/0x60
[   22.090282]  __kasan_slab_free+0x56/0x70
[   22.090575]  kfree+0x222/0x3f0
[   22.090793]  kmalloc_uaf_memset+0x12b/0x360
[   22.091092]  kunit_try_run_case+0x1a5/0x480
[   22.091343]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   22.091714]  kthread+0x337/0x6f0
[   22.091887]  ret_from_fork+0x116/0x1d0
[   22.092031]  ret_from_fork_asm+0x1a/0x30
[   22.092355] 
[   22.092511] The buggy address belongs to the object at ffff888102c0a000
[   22.092511]  which belongs to the cache kmalloc-64 of size 64
[   22.093446] The buggy address is located 0 bytes inside of
[   22.093446]  freed 64-byte region [ffff888102c0a000, ffff888102c0a040)
[   22.094335] 
[   22.094469] The buggy address belongs to the physical page:
[   22.094663] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102c0a
[   22.094952] flags: 0x200000000000000(node=0|zone=2)
[   22.095310] page_type: f5(slab)
[   22.095576] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   22.096395] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   22.096920] page dumped because: kasan: bad access detected
[   22.097588] 
[   22.097710] Memory state around the buggy address:
[   22.097899]  ffff888102c09f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.098826]  ffff888102c09f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.099268] >ffff888102c0a000: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   22.099572]                    ^
[   22.099697]  ffff888102c0a080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.100259]  ffff888102c0a100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.100560] ==================================================================