Hay
Date
July 8, 2025, 7:07 p.m.

Environment
qemu-arm64
qemu-x86_64

[   19.459239] ==================================================================
[   19.459301] BUG: KASAN: slab-use-after-free in kmalloc_double_kzfree+0x168/0x308
[   19.459746] Read of size 1 at addr fff00000c564f380 by task kunit_try_catch/192
[   19.459865] 
[   19.460010] CPU: 1 UID: 0 PID: 192 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5 #1 PREEMPT 
[   19.460118] Tainted: [B]=BAD_PAGE, [N]=TEST
[   19.460497] Hardware name: linux,dummy-virt (DT)
[   19.460553] Call trace:
[   19.460623]  show_stack+0x20/0x38 (C)
[   19.460765]  dump_stack_lvl+0x8c/0xd0
[   19.460835]  print_report+0x118/0x608
[   19.461021]  kasan_report+0xdc/0x128
[   19.461399]  __kasan_check_byte+0x54/0x70
[   19.461467]  kfree_sensitive+0x30/0xb0
[   19.461922]  kmalloc_double_kzfree+0x168/0x308
[   19.462197]  kunit_try_run_case+0x170/0x3f0
[   19.462367]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.462479]  kthread+0x328/0x630
[   19.462722]  ret_from_fork+0x10/0x20
[   19.462928] 
[   19.462995] Allocated by task 192:
[   19.463037]  kasan_save_stack+0x3c/0x68
[   19.463287]  kasan_save_track+0x20/0x40
[   19.463511]  kasan_save_alloc_info+0x40/0x58
[   19.463609]  __kasan_kmalloc+0xd4/0xd8
[   19.463645]  __kmalloc_cache_noprof+0x16c/0x3c0
[   19.463685]  kmalloc_double_kzfree+0xb8/0x308
[   19.463985]  kunit_try_run_case+0x170/0x3f0
[   19.464145]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.464216]  kthread+0x328/0x630
[   19.464468]  ret_from_fork+0x10/0x20
[   19.464674] 
[   19.464749] Freed by task 192:
[   19.464853]  kasan_save_stack+0x3c/0x68
[   19.464914]  kasan_save_track+0x20/0x40
[   19.465122]  kasan_save_free_info+0x4c/0x78
[   19.465183]  __kasan_slab_free+0x6c/0x98
[   19.465224]  kfree+0x214/0x3c8
[   19.465256]  kfree_sensitive+0x80/0xb0
[   19.465305]  kmalloc_double_kzfree+0x11c/0x308
[   19.465375]  kunit_try_run_case+0x170/0x3f0
[   19.465412]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.465465]  kthread+0x328/0x630
[   19.465501]  ret_from_fork+0x10/0x20
[   19.465538] 
[   19.465557] The buggy address belongs to the object at fff00000c564f380
[   19.465557]  which belongs to the cache kmalloc-16 of size 16
[   19.465630] The buggy address is located 0 bytes inside of
[   19.465630]  freed 16-byte region [fff00000c564f380, fff00000c564f390)
[   19.465691] 
[   19.465727] The buggy address belongs to the physical page:
[   19.465772] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10564f
[   19.465823] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   19.465872] page_type: f5(slab)
[   19.465910] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   19.465960] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   19.466010] page dumped because: kasan: bad access detected
[   19.466052] 
[   19.466086] Memory state around the buggy address:
[   19.466134]  fff00000c564f280: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   19.466175]  fff00000c564f300: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   19.466218] >fff00000c564f380: fa fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.466256]                    ^
[   19.466288]  fff00000c564f400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.466340]  fff00000c564f480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.466385] ==================================================================

[   13.268366] ==================================================================
[   13.269122] BUG: KASAN: slab-use-after-free in kmalloc_double_kzfree+0x19c/0x350
[   13.269717] Read of size 1 at addr ffff8881022baca0 by task kunit_try_catch/209
[   13.270385] 
[   13.270520] CPU: 0 UID: 0 PID: 209 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5 #1 PREEMPT(voluntary) 
[   13.270745] Tainted: [B]=BAD_PAGE, [N]=TEST
[   13.270826] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   13.270851] Call Trace:
[   13.270864]  <TASK>
[   13.270883]  dump_stack_lvl+0x73/0xb0
[   13.270916]  print_report+0xd1/0x650
[   13.270939]  ? __virt_addr_valid+0x1db/0x2d0
[   13.270964]  ? kmalloc_double_kzfree+0x19c/0x350
[   13.270986]  ? kasan_complete_mode_report_info+0x64/0x200
[   13.271010]  ? kmalloc_double_kzfree+0x19c/0x350
[   13.271032]  kasan_report+0x141/0x180
[   13.271088]  ? kmalloc_double_kzfree+0x19c/0x350
[   13.271114]  ? kmalloc_double_kzfree+0x19c/0x350
[   13.271135]  __kasan_check_byte+0x3d/0x50
[   13.271156]  kfree_sensitive+0x22/0x90
[   13.271178]  kmalloc_double_kzfree+0x19c/0x350
[   13.271200]  ? __pfx_kmalloc_double_kzfree+0x10/0x10
[   13.271221]  ? sysvec_apic_timer_interrupt+0x50/0x90
[   13.271245]  ? trace_hardirqs_on+0x37/0xe0
[   13.271267]  ? __pfx_read_tsc+0x10/0x10
[   13.271288]  ? ktime_get_ts64+0x86/0x230
[   13.271313]  kunit_try_run_case+0x1a5/0x480
[   13.271338]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.271360]  ? queued_spin_lock_slowpath+0x116/0xb40
[   13.271384]  ? __kthread_parkme+0x82/0x180
[   13.271405]  ? preempt_count_sub+0x50/0x80
[   13.271429]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.271451]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.271473]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   13.271494]  kthread+0x337/0x6f0
[   13.271512]  ? trace_preempt_on+0x20/0xc0
[   13.271532]  ? __pfx_kthread+0x10/0x10
[   13.271552]  ? _raw_spin_unlock_irq+0x47/0x80
[   13.271571]  ? calculate_sigpending+0x7b/0xa0
[   13.271595]  ? __pfx_kthread+0x10/0x10
[   13.271615]  ret_from_fork+0x116/0x1d0
[   13.271632]  ? __pfx_kthread+0x10/0x10
[   13.271652]  ret_from_fork_asm+0x1a/0x30
[   13.271684]  </TASK>
[   13.271695] 
[   13.285120] Allocated by task 209:
[   13.285255]  kasan_save_stack+0x45/0x70
[   13.285402]  kasan_save_track+0x18/0x40
[   13.285538]  kasan_save_alloc_info+0x3b/0x50
[   13.285708]  __kasan_kmalloc+0xb7/0xc0
[   13.285838]  __kmalloc_cache_noprof+0x189/0x420
[   13.286056]  kmalloc_double_kzfree+0xa9/0x350
[   13.286483]  kunit_try_run_case+0x1a5/0x480
[   13.286969]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.287463]  kthread+0x337/0x6f0
[   13.287798]  ret_from_fork+0x116/0x1d0
[   13.288147]  ret_from_fork_asm+0x1a/0x30
[   13.288540] 
[   13.288683] Freed by task 209:
[   13.288982]  kasan_save_stack+0x45/0x70
[   13.289225]  kasan_save_track+0x18/0x40
[   13.289377]  kasan_save_free_info+0x3f/0x60
[   13.289858]  __kasan_slab_free+0x56/0x70
[   13.290290]  kfree+0x222/0x3f0
[   13.290458]  kfree_sensitive+0x67/0x90
[   13.290609]  kmalloc_double_kzfree+0x12b/0x350
[   13.291101]  kunit_try_run_case+0x1a5/0x480
[   13.291584]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.292175]  kthread+0x337/0x6f0
[   13.292478]  ret_from_fork+0x116/0x1d0
[   13.292638]  ret_from_fork_asm+0x1a/0x30
[   13.292855] 
[   13.293012] The buggy address belongs to the object at ffff8881022baca0
[   13.293012]  which belongs to the cache kmalloc-16 of size 16
[   13.294153] The buggy address is located 0 bytes inside of
[   13.294153]  freed 16-byte region [ffff8881022baca0, ffff8881022bacb0)
[   13.294754] 
[   13.294916] The buggy address belongs to the physical page:
[   13.295215] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1022ba
[   13.295750] flags: 0x200000000000000(node=0|zone=2)
[   13.296301] page_type: f5(slab)
[   13.296669] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   13.297415] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   13.297693] page dumped because: kasan: bad access detected
[   13.298289] 
[   13.298504] Memory state around the buggy address:
[   13.299019]  ffff8881022bab80: 00 04 fc fc 00 04 fc fc 00 01 fc fc 00 01 fc fc
[   13.299559]  ffff8881022bac00: 00 04 fc fc 00 04 fc fc fa fb fc fc fa fb fc fc
[   13.299768] >ffff8881022bac80: fa fb fc fc fa fb fc fc fc fc fc fc fc fc fc fc
[   13.299970]                                ^
[   13.300145]  ffff8881022bad00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   13.300526]  ffff8881022bad80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   13.300818] ==================================================================