Hay
Date
July 5, 2025, 11:09 a.m.

Environment
qemu-arm64
qemu-x86_64

[   19.228577] ==================================================================
[   19.229225] BUG: KASAN: slab-use-after-free in kmalloc_double_kzfree+0x168/0x308
[   19.229759] Read of size 1 at addr fff00000c56728e0 by task kunit_try_catch/193
[   19.229892] 
[   19.229981] CPU: 0 UID: 0 PID: 193 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT 
[   19.230237] Tainted: [B]=BAD_PAGE, [N]=TEST
[   19.230722] Hardware name: linux,dummy-virt (DT)
[   19.230804] Call trace:
[   19.230970]  show_stack+0x20/0x38 (C)
[   19.231174]  dump_stack_lvl+0x8c/0xd0
[   19.231287]  print_report+0x118/0x608
[   19.231422]  kasan_report+0xdc/0x128
[   19.231937]  __kasan_check_byte+0x54/0x70
[   19.232121]  kfree_sensitive+0x30/0xb0
[   19.232657]  kmalloc_double_kzfree+0x168/0x308
[   19.232864]  kunit_try_run_case+0x170/0x3f0
[   19.233056]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.233267]  kthread+0x328/0x630
[   19.233380]  ret_from_fork+0x10/0x20
[   19.233859] 
[   19.233921] Allocated by task 193:
[   19.233999]  kasan_save_stack+0x3c/0x68
[   19.234142]  kasan_save_track+0x20/0x40
[   19.234232]  kasan_save_alloc_info+0x40/0x58
[   19.234413]  __kasan_kmalloc+0xd4/0xd8
[   19.234748]  __kmalloc_cache_noprof+0x16c/0x3c0
[   19.234860]  kmalloc_double_kzfree+0xb8/0x308
[   19.234950]  kunit_try_run_case+0x170/0x3f0
[   19.235380]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.235581]  kthread+0x328/0x630
[   19.235664]  ret_from_fork+0x10/0x20
[   19.235834] 
[   19.235903] Freed by task 193:
[   19.235971]  kasan_save_stack+0x3c/0x68
[   19.236469]  kasan_save_track+0x20/0x40
[   19.236585]  kasan_save_free_info+0x4c/0x78
[   19.236682]  __kasan_slab_free+0x6c/0x98
[   19.236814]  kfree+0x214/0x3c8
[   19.236894]  kfree_sensitive+0x80/0xb0
[   19.237405]  kmalloc_double_kzfree+0x11c/0x308
[   19.237528]  kunit_try_run_case+0x170/0x3f0
[   19.237703]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.237819]  kthread+0x328/0x630
[   19.237961]  ret_from_fork+0x10/0x20
[   19.238044] 
[   19.238276] The buggy address belongs to the object at fff00000c56728e0
[   19.238276]  which belongs to the cache kmalloc-16 of size 16
[   19.238422] The buggy address is located 0 bytes inside of
[   19.238422]  freed 16-byte region [fff00000c56728e0, fff00000c56728f0)
[   19.238563] 
[   19.238612] The buggy address belongs to the physical page:
[   19.239067] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105672
[   19.239217] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   19.239726] page_type: f5(slab)
[   19.240134] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   19.240316] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   19.240426] page dumped because: kasan: bad access detected
[   19.240500] 
[   19.240942] Memory state around the buggy address:
[   19.241044]  fff00000c5672780: 00 03 fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   19.241233]  fff00000c5672800: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   19.241365] >fff00000c5672880: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   19.241455]                                                        ^
[   19.241542]  fff00000c5672900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.242078]  fff00000c5672980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.242297] ==================================================================

[   13.995320] ==================================================================
[   13.996359] BUG: KASAN: slab-use-after-free in kmalloc_double_kzfree+0x19c/0x350
[   13.997157] Read of size 1 at addr ffff8881018868c0 by task kunit_try_catch/209
[   13.997516] 
[   13.997675] CPU: 1 UID: 0 PID: 209 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT(voluntary) 
[   13.997746] Tainted: [B]=BAD_PAGE, [N]=TEST
[   13.997762] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   13.997803] Call Trace:
[   13.997818]  <TASK>
[   13.997852]  dump_stack_lvl+0x73/0xb0
[   13.997888]  print_report+0xd1/0x650
[   13.997914]  ? __virt_addr_valid+0x1db/0x2d0
[   13.998000]  ? kmalloc_double_kzfree+0x19c/0x350
[   13.998027]  ? kasan_complete_mode_report_info+0x64/0x200
[   13.998053]  ? kmalloc_double_kzfree+0x19c/0x350
[   13.998096]  kasan_report+0x141/0x180
[   13.998122]  ? kmalloc_double_kzfree+0x19c/0x350
[   13.998166]  ? kmalloc_double_kzfree+0x19c/0x350
[   13.998193]  __kasan_check_byte+0x3d/0x50
[   13.998219]  kfree_sensitive+0x22/0x90
[   13.998259]  kmalloc_double_kzfree+0x19c/0x350
[   13.998286]  ? __pfx_kmalloc_double_kzfree+0x10/0x10
[   13.998327]  ? __schedule+0x10cc/0x2b60
[   13.998353]  ? __pfx_read_tsc+0x10/0x10
[   13.998379]  ? ktime_get_ts64+0x86/0x230
[   13.998428]  kunit_try_run_case+0x1a5/0x480
[   13.998458]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.998496]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   13.998524]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   13.998550]  ? __kthread_parkme+0x82/0x180
[   13.998574]  ? preempt_count_sub+0x50/0x80
[   13.998602]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.998629]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.998666]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   13.998693]  kthread+0x337/0x6f0
[   13.998719]  ? trace_preempt_on+0x20/0xc0
[   13.998749]  ? __pfx_kthread+0x10/0x10
[   13.998794]  ? _raw_spin_unlock_irq+0x47/0x80
[   13.998833]  ? calculate_sigpending+0x7b/0xa0
[   13.998864]  ? __pfx_kthread+0x10/0x10
[   13.998889]  ret_from_fork+0x116/0x1d0
[   13.998912]  ? __pfx_kthread+0x10/0x10
[   13.998935]  ret_from_fork_asm+0x1a/0x30
[   13.998972]  </TASK>
[   13.998987] 
[   14.012332] Allocated by task 209:
[   14.012573]  kasan_save_stack+0x45/0x70
[   14.012953]  kasan_save_track+0x18/0x40
[   14.013229]  kasan_save_alloc_info+0x3b/0x50
[   14.013509]  __kasan_kmalloc+0xb7/0xc0
[   14.013750]  __kmalloc_cache_noprof+0x189/0x420
[   14.014065]  kmalloc_double_kzfree+0xa9/0x350
[   14.014252]  kunit_try_run_case+0x1a5/0x480
[   14.014439]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   14.014662]  kthread+0x337/0x6f0
[   14.014926]  ret_from_fork+0x116/0x1d0
[   14.015220]  ret_from_fork_asm+0x1a/0x30
[   14.015797] 
[   14.015996] Freed by task 209:
[   14.016139]  kasan_save_stack+0x45/0x70
[   14.016320]  kasan_save_track+0x18/0x40
[   14.016550]  kasan_save_free_info+0x3f/0x60
[   14.017242]  __kasan_slab_free+0x56/0x70
[   14.018108]  kfree+0x222/0x3f0
[   14.018338]  kfree_sensitive+0x67/0x90
[   14.018680]  kmalloc_double_kzfree+0x12b/0x350
[   14.018883]  kunit_try_run_case+0x1a5/0x480
[   14.019177]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   14.019964]  kthread+0x337/0x6f0
[   14.020183]  ret_from_fork+0x116/0x1d0
[   14.020731]  ret_from_fork_asm+0x1a/0x30
[   14.021307] 
[   14.021419] The buggy address belongs to the object at ffff8881018868c0
[   14.021419]  which belongs to the cache kmalloc-16 of size 16
[   14.022664] The buggy address is located 0 bytes inside of
[   14.022664]  freed 16-byte region [ffff8881018868c0, ffff8881018868d0)
[   14.023694] 
[   14.023936] The buggy address belongs to the physical page:
[   14.024591] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101886
[   14.025210] flags: 0x200000000000000(node=0|zone=2)
[   14.025531] page_type: f5(slab)
[   14.025768] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   14.026217] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   14.026551] page dumped because: kasan: bad access detected
[   14.026855] 
[   14.027121] Memory state around the buggy address:
[   14.027385]  ffff888101886780: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   14.027768]  ffff888101886800: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   14.028143] >ffff888101886880: fa fb fc fc fa fb fc fc fa fb fc fc fc fc fc fc
[   14.028544]                                            ^
[   14.029232]  ffff888101886900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   14.029542]  ffff888101886980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   14.030183] ==================================================================