Hay
Date
July 19, 2025, 11:11 a.m.

Environment
qemu-arm64
qemu-x86_64

[   15.493386] ==================================================================
[   15.493448] BUG: KASAN: slab-use-after-free in kmalloc_double_kzfree+0x168/0x308
[   15.493507] Read of size 1 at addr fff00000c5f9c4c0 by task kunit_try_catch/193
[   15.493577] 
[   15.493613] CPU: 1 UID: 0 PID: 193 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc6 #1 PREEMPT 
[   15.494581] Tainted: [B]=BAD_PAGE, [N]=TEST
[   15.494910] Hardware name: linux,dummy-virt (DT)
[   15.495141] Call trace:
[   15.497171]  show_stack+0x20/0x38 (C)
[   15.497285]  dump_stack_lvl+0x8c/0xd0
[   15.497334]  print_report+0x118/0x5d0
[   15.497381]  kasan_report+0xdc/0x128
[   15.497427]  __kasan_check_byte+0x54/0x70
[   15.497474]  kfree_sensitive+0x30/0xb0
[   15.497525]  kmalloc_double_kzfree+0x168/0x308
[   15.497582]  kunit_try_run_case+0x170/0x3f0
[   15.498347]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   15.499003]  kthread+0x328/0x630
[   15.499046]  ret_from_fork+0x10/0x20
[   15.499433] 
[   15.499453] Allocated by task 193:
[   15.499498]  kasan_save_stack+0x3c/0x68
[   15.499557]  kasan_save_track+0x20/0x40
[   15.499602]  kasan_save_alloc_info+0x40/0x58
[   15.499648]  __kasan_kmalloc+0xd4/0xd8
[   15.499685]  __kmalloc_cache_noprof+0x16c/0x3c0
[   15.499730]  kmalloc_double_kzfree+0xb8/0x308
[   15.501018]  kunit_try_run_case+0x170/0x3f0
[   15.501071]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   15.501416]  kthread+0x328/0x630
[   15.501596]  ret_from_fork+0x10/0x20
[   15.501644] 
[   15.501673] Freed by task 193:
[   15.501701]  kasan_save_stack+0x3c/0x68
[   15.501741]  kasan_save_track+0x20/0x40
[   15.501776]  kasan_save_free_info+0x4c/0x78
[   15.501816]  __kasan_slab_free+0x6c/0x98
[   15.502183]  kfree+0x214/0x3c8
[   15.502251]  kfree_sensitive+0x80/0xb0
[   15.502295]  kmalloc_double_kzfree+0x11c/0x308
[   15.502345]  kunit_try_run_case+0x170/0x3f0
[   15.502382]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   15.502434]  kthread+0x328/0x630
[   15.502466]  ret_from_fork+0x10/0x20
[   15.502595] 
[   15.502627] The buggy address belongs to the object at fff00000c5f9c4c0
[   15.502627]  which belongs to the cache kmalloc-16 of size 16
[   15.502789] The buggy address is located 0 bytes inside of
[   15.502789]  freed 16-byte region [fff00000c5f9c4c0, fff00000c5f9c4d0)
[   15.502850] 
[   15.503101] The buggy address belongs to the physical page:
[   15.503297] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105f9c
[   15.503402] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   15.503569] page_type: f5(slab)
[   15.503611] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   15.503785] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   15.503834] page dumped because: kasan: bad access detected
[   15.504114] 
[   15.504138] Memory state around the buggy address:
[   15.504173]  fff00000c5f9c380: fa fb fc fc fa fb fc fc fa fb fc fc 00 04 fc fc
[   15.504216]  fff00000c5f9c400: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   15.504259] >fff00000c5f9c480: fa fb fc fc fa fb fc fc fa fb fc fc fc fc fc fc
[   15.505839]                                            ^
[   15.506009]  fff00000c5f9c500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   15.506061]  fff00000c5f9c580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   15.506100] ==================================================================

[   12.414248] ==================================================================
[   12.414857] BUG: KASAN: slab-use-after-free in kmalloc_double_kzfree+0x19c/0x350
[   12.415199] Read of size 1 at addr ffff888101994600 by task kunit_try_catch/210
[   12.415563] 
[   12.415679] CPU: 1 UID: 0 PID: 210 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc6 #1 PREEMPT(voluntary) 
[   12.415726] Tainted: [B]=BAD_PAGE, [N]=TEST
[   12.415736] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   12.415757] Call Trace:
[   12.415770]  <TASK>
[   12.415787]  dump_stack_lvl+0x73/0xb0
[   12.415816]  print_report+0xd1/0x610
[   12.415837]  ? __virt_addr_valid+0x1db/0x2d0
[   12.415860]  ? kmalloc_double_kzfree+0x19c/0x350
[   12.415882]  ? kasan_complete_mode_report_info+0x64/0x200
[   12.415904]  ? kmalloc_double_kzfree+0x19c/0x350
[   12.415927]  kasan_report+0x141/0x180
[   12.415948]  ? kmalloc_double_kzfree+0x19c/0x350
[   12.415973]  ? kmalloc_double_kzfree+0x19c/0x350
[   12.415996]  __kasan_check_byte+0x3d/0x50
[   12.416017]  kfree_sensitive+0x22/0x90
[   12.416039]  kmalloc_double_kzfree+0x19c/0x350
[   12.416061]  ? __pfx_kmalloc_double_kzfree+0x10/0x10
[   12.416083]  ? sysvec_apic_timer_interrupt+0x50/0x90
[   12.416108]  ? trace_hardirqs_on+0x37/0xe0
[   12.416130]  ? __pfx_read_tsc+0x10/0x10
[   12.416151]  ? ktime_get_ts64+0x86/0x230
[   12.416174]  kunit_try_run_case+0x1a5/0x480
[   12.416199]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.416222]  ? queued_spin_lock_slowpath+0x116/0xb40
[   12.416246]  ? __kthread_parkme+0x82/0x180
[   12.416266]  ? preempt_count_sub+0x50/0x80
[   12.416290]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.416312]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.416336]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   12.416359]  kthread+0x337/0x6f0
[   12.416532]  ? trace_preempt_on+0x20/0xc0
[   12.416554]  ? __pfx_kthread+0x10/0x10
[   12.416574]  ? _raw_spin_unlock_irq+0x47/0x80
[   12.416595]  ? calculate_sigpending+0x7b/0xa0
[   12.416619]  ? __pfx_kthread+0x10/0x10
[   12.416639]  ret_from_fork+0x116/0x1d0
[   12.416658]  ? __pfx_kthread+0x10/0x10
[   12.416677]  ret_from_fork_asm+0x1a/0x30
[   12.416707]  </TASK>
[   12.416717] 
[   12.424728] Allocated by task 210:
[   12.424908]  kasan_save_stack+0x45/0x70
[   12.425149]  kasan_save_track+0x18/0x40
[   12.425321]  kasan_save_alloc_info+0x3b/0x50
[   12.425526]  __kasan_kmalloc+0xb7/0xc0
[   12.425694]  __kmalloc_cache_noprof+0x189/0x420
[   12.425885]  kmalloc_double_kzfree+0xa9/0x350
[   12.426035]  kunit_try_run_case+0x1a5/0x480
[   12.426179]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.426857]  kthread+0x337/0x6f0
[   12.427035]  ret_from_fork+0x116/0x1d0
[   12.427396]  ret_from_fork_asm+0x1a/0x30
[   12.427582] 
[   12.427656] Freed by task 210:
[   12.427790]  kasan_save_stack+0x45/0x70
[   12.427966]  kasan_save_track+0x18/0x40
[   12.428219]  kasan_save_free_info+0x3f/0x60
[   12.428363]  __kasan_slab_free+0x56/0x70
[   12.428505]  kfree+0x222/0x3f0
[   12.428717]  kfree_sensitive+0x67/0x90
[   12.428904]  kmalloc_double_kzfree+0x12b/0x350
[   12.429193]  kunit_try_run_case+0x1a5/0x480
[   12.429429]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.429617]  kthread+0x337/0x6f0
[   12.429737]  ret_from_fork+0x116/0x1d0
[   12.429868]  ret_from_fork_asm+0x1a/0x30
[   12.430005] 
[   12.430074] The buggy address belongs to the object at ffff888101994600
[   12.430074]  which belongs to the cache kmalloc-16 of size 16
[   12.430664] The buggy address is located 0 bytes inside of
[   12.430664]  freed 16-byte region [ffff888101994600, ffff888101994610)
[   12.431167] 
[   12.431408] The buggy address belongs to the physical page:
[   12.431686] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101994
[   12.432034] flags: 0x200000000000000(node=0|zone=2)
[   12.432260] page_type: f5(slab)
[   12.432381] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   12.432618] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   12.433326] page dumped because: kasan: bad access detected
[   12.433621] 
[   12.433716] Memory state around the buggy address:
[   12.433944]  ffff888101994500: 00 02 fc fc 00 02 fc fc 00 02 fc fc fa fb fc fc
[   12.434538]  ffff888101994580: fa fb fc fc 00 05 fc fc fa fb fc fc fa fb fc fc
[   12.434910] >ffff888101994600: fa fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.435246]                    ^
[   12.435365]  ffff888101994680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.435604]  ffff888101994700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.435923] ==================================================================