Hay
Date
May 12, 2025, 11:48 a.m.

Environment
qemu-arm64
qemu-x86_64

[   16.985440] ==================================================================
[   16.986018] BUG: KASAN: slab-use-after-free in kmalloc_double_kzfree+0x168/0x308
[   16.986364] Read of size 1 at addr fff00000c10cc860 by task kunit_try_catch/192
[   16.986743] 
[   16.986834] CPU: 1 UID: 0 PID: 192 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250512 #1 PREEMPT 
[   16.987245] Tainted: [B]=BAD_PAGE, [N]=TEST
[   16.987395] Hardware name: linux,dummy-virt (DT)
[   16.987464] Call trace:
[   16.987756]  show_stack+0x20/0x38 (C)
[   16.987885]  dump_stack_lvl+0x8c/0xd0
[   16.987991]  print_report+0x118/0x608
[   16.988711]  kasan_report+0xdc/0x128
[   16.988842]  __kasan_check_byte+0x54/0x70
[   16.988947]  kfree_sensitive+0x30/0xb0
[   16.989060]  kmalloc_double_kzfree+0x168/0x308
[   16.989170]  kunit_try_run_case+0x170/0x3f0
[   16.989795]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   16.990307]  kthread+0x328/0x630
[   16.990477]  ret_from_fork+0x10/0x20
[   16.990816] 
[   16.990865] Allocated by task 192:
[   16.991106]  kasan_save_stack+0x3c/0x68
[   16.991399]  kasan_save_track+0x20/0x40
[   16.991528]  kasan_save_alloc_info+0x40/0x58
[   16.992109]  __kasan_kmalloc+0xd4/0xd8
[   16.992274]  __kmalloc_cache_noprof+0x15c/0x3c0
[   16.992376]  kmalloc_double_kzfree+0xb8/0x308
[   16.992468]  kunit_try_run_case+0x170/0x3f0
[   16.992544]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   16.993003]  kthread+0x328/0x630
[   16.993294]  ret_from_fork+0x10/0x20
[   16.993393] 
[   16.993661] Freed by task 192:
[   16.993961]  kasan_save_stack+0x3c/0x68
[   16.994185]  kasan_save_track+0x20/0x40
[   16.994335]  kasan_save_free_info+0x4c/0x78
[   16.994444]  __kasan_slab_free+0x6c/0x98
[   16.994532]  kfree+0x214/0x3c8
[   16.994848]  kfree_sensitive+0x80/0xb0
[   16.995147]  kmalloc_double_kzfree+0x11c/0x308
[   16.995242]  kunit_try_run_case+0x170/0x3f0
[   16.995324]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   16.995490]  kthread+0x328/0x630
[   16.995578]  ret_from_fork+0x10/0x20
[   16.995956] 
[   16.996288] The buggy address belongs to the object at fff00000c10cc860
[   16.996288]  which belongs to the cache kmalloc-16 of size 16
[   16.996708] The buggy address is located 0 bytes inside of
[   16.996708]  freed 16-byte region [fff00000c10cc860, fff00000c10cc870)
[   16.996910] 
[   16.996974] The buggy address belongs to the physical page:
[   16.997248] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1010cc
[   16.997431] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   16.997622] page_type: f5(slab)
[   16.997714] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   16.998038] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   16.998320] page dumped because: kasan: bad access detected
[   16.998604] 
[   16.998729] Memory state around the buggy address:
[   16.998856]  fff00000c10cc700: fa fb fc fc 00 07 fc fc fa fb fc fc fa fb fc fc
[   16.999032]  fff00000c10cc780: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   16.999142] >fff00000c10cc800: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   16.999287]                                                        ^
[   16.999372]  fff00000c10cc880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   16.999468]  fff00000c10cc900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   16.999561] ==================================================================

[   17.041375] ==================================================================
[   17.042175] BUG: KASAN: slab-use-after-free in kmalloc_double_kzfree+0x19c/0x350
[   17.043211] Read of size 1 at addr ffff88810229d6c0 by task kunit_try_catch/209
[   17.043526] 
[   17.043912] CPU: 0 UID: 0 PID: 209 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250512 #1 PREEMPT(voluntary) 
[   17.044166] Tainted: [B]=BAD_PAGE, [N]=TEST
[   17.044204] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   17.044255] Call Trace:
[   17.044298]  <TASK>
[   17.044337]  dump_stack_lvl+0x73/0xb0
[   17.044399]  print_report+0xd1/0x650
[   17.044440]  ? __virt_addr_valid+0x1db/0x2d0
[   17.044468]  ? kmalloc_double_kzfree+0x19c/0x350
[   17.044493]  ? kasan_complete_mode_report_info+0x64/0x200
[   17.044516]  ? kmalloc_double_kzfree+0x19c/0x350
[   17.044540]  kasan_report+0x141/0x180
[   17.044563]  ? kmalloc_double_kzfree+0x19c/0x350
[   17.044590]  ? kmalloc_double_kzfree+0x19c/0x350
[   17.044614]  __kasan_check_byte+0x3d/0x50
[   17.044636]  kfree_sensitive+0x22/0x90
[   17.044682]  kmalloc_double_kzfree+0x19c/0x350
[   17.044740]  ? __pfx_kmalloc_double_kzfree+0x10/0x10
[   17.044766]  ? __schedule+0x10cc/0x2b60
[   17.044789]  ? __pfx_read_tsc+0x10/0x10
[   17.044812]  ? ktime_get_ts64+0x86/0x230
[   17.044838]  kunit_try_run_case+0x1a5/0x480
[   17.044865]  ? __pfx_kunit_try_run_case+0x10/0x10
[   17.044888]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   17.044912]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   17.044934]  ? __kthread_parkme+0x82/0x180
[   17.044956]  ? preempt_count_sub+0x50/0x80
[   17.044980]  ? __pfx_kunit_try_run_case+0x10/0x10
[   17.045004]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   17.045027]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   17.045059]  kthread+0x337/0x6f0
[   17.045097]  ? trace_preempt_on+0x20/0xc0
[   17.045135]  ? __pfx_kthread+0x10/0x10
[   17.045166]  ? _raw_spin_unlock_irq+0x47/0x80
[   17.045197]  ? calculate_sigpending+0x7b/0xa0
[   17.045235]  ? __pfx_kthread+0x10/0x10
[   17.045273]  ret_from_fork+0x116/0x1d0
[   17.045298]  ? __pfx_kthread+0x10/0x10
[   17.045319]  ret_from_fork_asm+0x1a/0x30
[   17.045350]  </TASK>
[   17.045365] 
[   17.057687] Allocated by task 209:
[   17.057857]  kasan_save_stack+0x45/0x70
[   17.059080]  kasan_save_track+0x18/0x40
[   17.059466]  kasan_save_alloc_info+0x3b/0x50
[   17.059633]  __kasan_kmalloc+0xb7/0xc0
[   17.060596]  __kmalloc_cache_noprof+0x189/0x420
[   17.061095]  kmalloc_double_kzfree+0xa9/0x350
[   17.062060]  kunit_try_run_case+0x1a5/0x480
[   17.062387]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   17.062615]  kthread+0x337/0x6f0
[   17.062934]  ret_from_fork+0x116/0x1d0
[   17.063861]  ret_from_fork_asm+0x1a/0x30
[   17.064469] 
[   17.064895] Freed by task 209:
[   17.065404]  kasan_save_stack+0x45/0x70
[   17.065968]  kasan_save_track+0x18/0x40
[   17.066419]  kasan_save_free_info+0x3f/0x60
[   17.066623]  __kasan_slab_free+0x56/0x70
[   17.067021]  kfree+0x222/0x3f0
[   17.067319]  kfree_sensitive+0x67/0x90
[   17.067912]  kmalloc_double_kzfree+0x12b/0x350
[   17.068635]  kunit_try_run_case+0x1a5/0x480
[   17.069101]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   17.069731]  kthread+0x337/0x6f0
[   17.070068]  ret_from_fork+0x116/0x1d0
[   17.070531]  ret_from_fork_asm+0x1a/0x30
[   17.070748] 
[   17.070902] The buggy address belongs to the object at ffff88810229d6c0
[   17.070902]  which belongs to the cache kmalloc-16 of size 16
[   17.072183] The buggy address is located 0 bytes inside of
[   17.072183]  freed 16-byte region [ffff88810229d6c0, ffff88810229d6d0)
[   17.073375] 
[   17.073661] The buggy address belongs to the physical page:
[   17.074054] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10229d
[   17.074899] flags: 0x200000000000000(node=0|zone=2)
[   17.075615] page_type: f5(slab)
[   17.075906] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   17.076781] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   17.077489] page dumped because: kasan: bad access detected
[   17.077773] 
[   17.078288] Memory state around the buggy address:
[   17.078524]  ffff88810229d580: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   17.079282]  ffff88810229d600: fa fb fc fc fa fb fc fc 00 05 fc fc fa fb fc fc
[   17.079642] >ffff88810229d680: fa fb fc fc fa fb fc fc fa fb fc fc fc fc fc fc
[   17.079885]                                            ^
[   17.080989]  ffff88810229d700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.081674]  ffff88810229d780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.082421] ==================================================================