Hay
Date
July 9, 2025, 2:07 p.m.

Environment
qemu-arm64
qemu-x86_64

[   17.749194] ==================================================================
[   17.749257] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   17.749640] Write of size 33 at addr fff00000c7708c00 by task kunit_try_catch/186
[   17.749702] 
[   17.749934] CPU: 0 UID: 0 PID: 186 Comm: kunit_try_catch Tainted: G    B   W        N  6.16.0-rc5 #1 PREEMPT 
[   17.750030] Tainted: [B]=BAD_PAGE, [W]=WARN, [N]=TEST
[   17.750061] Hardware name: linux,dummy-virt (DT)
[   17.750105] Call trace:
[   17.750128]  show_stack+0x20/0x38 (C)
[   17.750964]  dump_stack_lvl+0x8c/0xd0
[   17.751112]  print_report+0x118/0x608
[   17.751212]  kasan_report+0xdc/0x128
[   17.751260]  kasan_check_range+0x100/0x1a8
[   17.751501]  __asan_memset+0x34/0x78
[   17.751644]  kmalloc_uaf_memset+0x170/0x310
[   17.751694]  kunit_try_run_case+0x170/0x3f0
[   17.751903]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.752248]  kthread+0x328/0x630
[   17.752302]  ret_from_fork+0x10/0x20
[   17.752353] 
[   17.752408] Allocated by task 186:
[   17.752484]  kasan_save_stack+0x3c/0x68
[   17.752556]  kasan_save_track+0x20/0x40
[   17.752595]  kasan_save_alloc_info+0x40/0x58
[   17.752704]  __kasan_kmalloc+0xd4/0xd8
[   17.752761]  __kmalloc_cache_noprof+0x16c/0x3c0
[   17.752907]  kmalloc_uaf_memset+0xb8/0x310
[   17.752990]  kunit_try_run_case+0x170/0x3f0
[   17.753030]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.753133]  kthread+0x328/0x630
[   17.753187]  ret_from_fork+0x10/0x20
[   17.753329] 
[   17.753393] Freed by task 186:
[   17.753421]  kasan_save_stack+0x3c/0x68
[   17.753458]  kasan_save_track+0x20/0x40
[   17.753495]  kasan_save_free_info+0x4c/0x78
[   17.753536]  __kasan_slab_free+0x6c/0x98
[   17.753574]  kfree+0x214/0x3c8
[   17.753654]  kmalloc_uaf_memset+0x11c/0x310
[   17.753691]  kunit_try_run_case+0x170/0x3f0
[   17.753731]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.753775]  kthread+0x328/0x630
[   17.753807]  ret_from_fork+0x10/0x20
[   17.754108] 
[   17.754129] The buggy address belongs to the object at fff00000c7708c00
[   17.754129]  which belongs to the cache kmalloc-64 of size 64
[   17.754192] The buggy address is located 0 bytes inside of
[   17.754192]  freed 64-byte region [fff00000c7708c00, fff00000c7708c40)
[   17.754254] 
[   17.754762] The buggy address belongs to the physical page:
[   17.754812] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x107708
[   17.754872] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   17.754924] page_type: f5(slab)
[   17.754965] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   17.755017] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   17.755061] page dumped because: kasan: bad access detected
[   17.755104] 
[   17.755123] Memory state around the buggy address:
[   17.755156]  fff00000c7708b00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   17.755214]  fff00000c7708b80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   17.755258] >fff00000c7708c00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   17.755298]                    ^
[   17.755326]  fff00000c7708c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.755570]  fff00000c7708d00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.755764] ==================================================================

[   13.053526] ==================================================================
[   13.054018] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   13.054369] Write of size 33 at addr ffff888102c36c80 by task kunit_try_catch/203
[   13.054745] 
[   13.055040] CPU: 1 UID: 0 PID: 203 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5 #1 PREEMPT(voluntary) 
[   13.055091] Tainted: [B]=BAD_PAGE, [N]=TEST
[   13.055104] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   13.055126] Call Trace:
[   13.055332]  <TASK>
[   13.055354]  dump_stack_lvl+0x73/0xb0
[   13.055636]  print_report+0xd1/0x650
[   13.055661]  ? __virt_addr_valid+0x1db/0x2d0
[   13.055685]  ? kmalloc_uaf_memset+0x1a3/0x360
[   13.055706]  ? kasan_complete_mode_report_info+0x64/0x200
[   13.055730]  ? kmalloc_uaf_memset+0x1a3/0x360
[   13.055751]  kasan_report+0x141/0x180
[   13.055808]  ? kmalloc_uaf_memset+0x1a3/0x360
[   13.055837]  kasan_check_range+0x10c/0x1c0
[   13.055860]  __asan_memset+0x27/0x50
[   13.055879]  kmalloc_uaf_memset+0x1a3/0x360
[   13.055900]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   13.055922]  ? __schedule+0x10cc/0x2b60
[   13.055944]  ? __pfx_read_tsc+0x10/0x10
[   13.055965]  ? ktime_get_ts64+0x86/0x230
[   13.055992]  kunit_try_run_case+0x1a5/0x480
[   13.056017]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.056039]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   13.056063]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   13.056086]  ? __kthread_parkme+0x82/0x180
[   13.056108]  ? preempt_count_sub+0x50/0x80
[   13.056132]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.056155]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.056180]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   13.056204]  kthread+0x337/0x6f0
[   13.056222]  ? trace_preempt_on+0x20/0xc0
[   13.056245]  ? __pfx_kthread+0x10/0x10
[   13.056265]  ? _raw_spin_unlock_irq+0x47/0x80
[   13.056286]  ? calculate_sigpending+0x7b/0xa0
[   13.056310]  ? __pfx_kthread+0x10/0x10
[   13.056331]  ret_from_fork+0x116/0x1d0
[   13.056349]  ? __pfx_kthread+0x10/0x10
[   13.056369]  ret_from_fork_asm+0x1a/0x30
[   13.056400]  </TASK>
[   13.056411] 
[   13.066484] Allocated by task 203:
[   13.067034]  kasan_save_stack+0x45/0x70
[   13.067227]  kasan_save_track+0x18/0x40
[   13.067640]  kasan_save_alloc_info+0x3b/0x50
[   13.068065]  __kasan_kmalloc+0xb7/0xc0
[   13.068406]  __kmalloc_cache_noprof+0x189/0x420
[   13.068744]  kmalloc_uaf_memset+0xa9/0x360
[   13.069187]  kunit_try_run_case+0x1a5/0x480
[   13.069551]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.070056]  kthread+0x337/0x6f0
[   13.070202]  ret_from_fork+0x116/0x1d0
[   13.070646]  ret_from_fork_asm+0x1a/0x30
[   13.071056] 
[   13.071135] Freed by task 203:
[   13.071493]  kasan_save_stack+0x45/0x70
[   13.071689]  kasan_save_track+0x18/0x40
[   13.071879]  kasan_save_free_info+0x3f/0x60
[   13.072076]  __kasan_slab_free+0x56/0x70
[   13.072259]  kfree+0x222/0x3f0
[   13.072416]  kmalloc_uaf_memset+0x12b/0x360
[   13.073060]  kunit_try_run_case+0x1a5/0x480
[   13.073397]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.074117]  kthread+0x337/0x6f0
[   13.074292]  ret_from_fork+0x116/0x1d0
[   13.074446]  ret_from_fork_asm+0x1a/0x30
[   13.074960] 
[   13.075254] The buggy address belongs to the object at ffff888102c36c80
[   13.075254]  which belongs to the cache kmalloc-64 of size 64
[   13.075779] The buggy address is located 0 bytes inside of
[   13.075779]  freed 64-byte region [ffff888102c36c80, ffff888102c36cc0)
[   13.076521] 
[   13.076638] The buggy address belongs to the physical page:
[   13.076820] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102c36
[   13.077065] flags: 0x200000000000000(node=0|zone=2)
[   13.077232] page_type: f5(slab)
[   13.077353] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   13.077583] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   13.078196] page dumped because: kasan: bad access detected
[   13.078374] 
[   13.078444] Memory state around the buggy address:
[   13.078616]  ffff888102c36b80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   13.080015]  ffff888102c36c00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   13.080388] >ffff888102c36c80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   13.080963]                    ^
[   13.081138]  ffff888102c36d00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   13.081412]  ffff888102c36d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   13.081714] ==================================================================