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

Environment
qemu-arm64
qemu-x86_64

[   18.240754] ==================================================================
[   18.240815] BUG: KASAN: slab-use-after-free in kmalloc_double_kzfree+0x168/0x308
[   18.240889] Read of size 1 at addr fff00000c1cea960 by task kunit_try_catch/192
[   18.240947] 
[   18.240980] CPU: 1 UID: 0 PID: 192 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT 
[   18.241060] Tainted: [B]=BAD_PAGE, [N]=TEST
[   18.241096] Hardware name: linux,dummy-virt (DT)
[   18.241127] Call trace:
[   18.241157]  show_stack+0x20/0x38 (C)
[   18.241219]  dump_stack_lvl+0x8c/0xd0
[   18.241264]  print_report+0x118/0x608
[   18.241309]  kasan_report+0xdc/0x128
[   18.241364]  __kasan_check_byte+0x54/0x70
[   18.241411]  kfree_sensitive+0x30/0xb0
[   18.241807]  kmalloc_double_kzfree+0x168/0x308
[   18.242066]  kunit_try_run_case+0x170/0x3f0
[   18.242354]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.242419]  kthread+0x328/0x630
[   18.242465]  ret_from_fork+0x10/0x20
[   18.242520] 
[   18.242541] Allocated by task 192:
[   18.242926]  kasan_save_stack+0x3c/0x68
[   18.243088]  kasan_save_track+0x20/0x40
[   18.243235]  kasan_save_alloc_info+0x40/0x58
[   18.243278]  __kasan_kmalloc+0xd4/0xd8
[   18.243366]  __kmalloc_cache_noprof+0x16c/0x3c0
[   18.243733]  kmalloc_double_kzfree+0xb8/0x308
[   18.243816]  kunit_try_run_case+0x170/0x3f0
[   18.243870]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.244065]  kthread+0x328/0x630
[   18.244268]  ret_from_fork+0x10/0x20
[   18.244356] 
[   18.244404] Freed by task 192:
[   18.244432]  kasan_save_stack+0x3c/0x68
[   18.244664]  kasan_save_track+0x20/0x40
[   18.244880]  kasan_save_free_info+0x4c/0x78
[   18.244978]  __kasan_slab_free+0x6c/0x98
[   18.245107]  kfree+0x214/0x3c8
[   18.245545]  kfree_sensitive+0x80/0xb0
[   18.245691]  kmalloc_double_kzfree+0x11c/0x308
[   18.245736]  kunit_try_run_case+0x170/0x3f0
[   18.245801]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.245850]  kthread+0x328/0x630
[   18.246217]  ret_from_fork+0x10/0x20
[   18.246347] 
[   18.246384] The buggy address belongs to the object at fff00000c1cea960
[   18.246384]  which belongs to the cache kmalloc-16 of size 16
[   18.246729] The buggy address is located 0 bytes inside of
[   18.246729]  freed 16-byte region [fff00000c1cea960, fff00000c1cea970)
[   18.247100] 
[   18.247360] The buggy address belongs to the physical page:
[   18.247474] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101cea
[   18.247657] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   18.247748] page_type: f5(slab)
[   18.248028] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   18.248150] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   18.248297] page dumped because: kasan: bad access detected
[   18.248330] 
[   18.248369] Memory state around the buggy address:
[   18.248689]  fff00000c1cea800: fa fb fc fc 00 04 fc fc fa fb fc fc fa fb fc fc
[   18.248823]  fff00000c1cea880: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   18.248905] >fff00000c1cea900: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   18.249160]                                                        ^
[   18.249404]  fff00000c1cea980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.249623]  fff00000c1ceaa00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.249794] ==================================================================

[   11.907692] ==================================================================
[   11.908352] BUG: KASAN: slab-use-after-free in kmalloc_double_kzfree+0x19c/0x350
[   11.908952] Read of size 1 at addr ffff888101e8f4e0 by task kunit_try_catch/209
[   11.909292] 
[   11.909412] CPU: 0 UID: 0 PID: 209 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT(voluntary) 
[   11.909458] Tainted: [B]=BAD_PAGE, [N]=TEST
[   11.909653] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   11.909678] Call Trace:
[   11.909690]  <TASK>
[   11.909707]  dump_stack_lvl+0x73/0xb0
[   11.909739]  print_report+0xd1/0x650
[   11.909762]  ? __virt_addr_valid+0x1db/0x2d0
[   11.909786]  ? kmalloc_double_kzfree+0x19c/0x350
[   11.909808]  ? kasan_complete_mode_report_info+0x64/0x200
[   11.909829]  ? kmalloc_double_kzfree+0x19c/0x350
[   11.909852]  kasan_report+0x141/0x180
[   11.909873]  ? kmalloc_double_kzfree+0x19c/0x350
[   11.909898]  ? kmalloc_double_kzfree+0x19c/0x350
[   11.909921]  __kasan_check_byte+0x3d/0x50
[   11.909956]  kfree_sensitive+0x22/0x90
[   11.909978]  kmalloc_double_kzfree+0x19c/0x350
[   11.910001]  ? __pfx_kmalloc_double_kzfree+0x10/0x10
[   11.910024]  ? __schedule+0x10cc/0x2b60
[   11.910046]  ? __pfx_read_tsc+0x10/0x10
[   11.910067]  ? ktime_get_ts64+0x86/0x230
[   11.910092]  kunit_try_run_case+0x1a5/0x480
[   11.910116]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.910138]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   11.910161]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   11.910184]  ? __kthread_parkme+0x82/0x180
[   11.910205]  ? preempt_count_sub+0x50/0x80
[   11.910229]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.910253]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.910275]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   11.910298]  kthread+0x337/0x6f0
[   11.910317]  ? trace_preempt_on+0x20/0xc0
[   11.910339]  ? __pfx_kthread+0x10/0x10
[   11.910360]  ? _raw_spin_unlock_irq+0x47/0x80
[   11.910380]  ? calculate_sigpending+0x7b/0xa0
[   11.910403]  ? __pfx_kthread+0x10/0x10
[   11.910424]  ret_from_fork+0x116/0x1d0
[   11.910442]  ? __pfx_kthread+0x10/0x10
[   11.910504]  ret_from_fork_asm+0x1a/0x30
[   11.910538]  </TASK>
[   11.910549] 
[   11.922653] Allocated by task 209:
[   11.922852]  kasan_save_stack+0x45/0x70
[   11.923255]  kasan_save_track+0x18/0x40
[   11.923499]  kasan_save_alloc_info+0x3b/0x50
[   11.923816]  __kasan_kmalloc+0xb7/0xc0
[   11.924192]  __kmalloc_cache_noprof+0x189/0x420
[   11.924419]  kmalloc_double_kzfree+0xa9/0x350
[   11.924953]  kunit_try_run_case+0x1a5/0x480
[   11.925198]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.925438]  kthread+0x337/0x6f0
[   11.925746]  ret_from_fork+0x116/0x1d0
[   11.926147]  ret_from_fork_asm+0x1a/0x30
[   11.926437] 
[   11.926798] Freed by task 209:
[   11.927013]  kasan_save_stack+0x45/0x70
[   11.927238]  kasan_save_track+0x18/0x40
[   11.927423]  kasan_save_free_info+0x3f/0x60
[   11.927915]  __kasan_slab_free+0x56/0x70
[   11.928210]  kfree+0x222/0x3f0
[   11.928375]  kfree_sensitive+0x67/0x90
[   11.928759]  kmalloc_double_kzfree+0x12b/0x350
[   11.929251]  kunit_try_run_case+0x1a5/0x480
[   11.929640]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.929875]  kthread+0x337/0x6f0
[   11.930051]  ret_from_fork+0x116/0x1d0
[   11.930227]  ret_from_fork_asm+0x1a/0x30
[   11.930411] 
[   11.930761] The buggy address belongs to the object at ffff888101e8f4e0
[   11.930761]  which belongs to the cache kmalloc-16 of size 16
[   11.931760] The buggy address is located 0 bytes inside of
[   11.931760]  freed 16-byte region [ffff888101e8f4e0, ffff888101e8f4f0)
[   11.932616] 
[   11.932720] The buggy address belongs to the physical page:
[   11.932980] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101e8f
[   11.933768] flags: 0x200000000000000(node=0|zone=2)
[   11.934083] page_type: f5(slab)
[   11.934258] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   11.934736] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   11.935378] page dumped because: kasan: bad access detected
[   11.935898] 
[   11.936138] Memory state around the buggy address:
[   11.936464]  ffff888101e8f380: 00 02 fc fc 00 02 fc fc 00 02 fc fc fa fb fc fc
[   11.937177]  ffff888101e8f400: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   11.937703] >ffff888101e8f480: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   11.938291]                                                        ^
[   11.938760]  ffff888101e8f500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.939263]  ffff888101e8f580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.939775] ==================================================================