Hay
Date
May 13, 2025, 12:07 p.m.

Environment
qemu-arm64
qemu-x86_64

[   19.492069] ==================================================================
[   19.492215] BUG: KASAN: slab-use-after-free in kmalloc_double_kzfree+0x168/0x308
[   19.492356] Read of size 1 at addr fff00000c4035120 by task kunit_try_catch/192
[   19.492421] 
[   19.492493] CPU: 1 UID: 0 PID: 192 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250513 #1 PREEMPT 
[   19.492827] Tainted: [B]=BAD_PAGE, [N]=TEST
[   19.492891] Hardware name: linux,dummy-virt (DT)
[   19.492938] Call trace:
[   19.492968]  show_stack+0x20/0x38 (C)
[   19.493337]  dump_stack_lvl+0x8c/0xd0
[   19.493456]  print_report+0x118/0x608
[   19.493510]  kasan_report+0xdc/0x128
[   19.493562]  __kasan_check_byte+0x54/0x70
[   19.493612]  kfree_sensitive+0x30/0xb0
[   19.493664]  kmalloc_double_kzfree+0x168/0x308
[   19.493714]  kunit_try_run_case+0x170/0x3f0
[   19.493775]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.493896]  kthread+0x328/0x630
[   19.494041]  ret_from_fork+0x10/0x20
[   19.494213] 
[   19.494263] Allocated by task 192:
[   19.494308]  kasan_save_stack+0x3c/0x68
[   19.494364]  kasan_save_track+0x20/0x40
[   19.494408]  kasan_save_alloc_info+0x40/0x58
[   19.494469]  __kasan_kmalloc+0xd4/0xd8
[   19.494514]  __kmalloc_cache_noprof+0x15c/0x3c0
[   19.494559]  kmalloc_double_kzfree+0xb8/0x308
[   19.494603]  kunit_try_run_case+0x170/0x3f0
[   19.494665]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.494716]  kthread+0x328/0x630
[   19.494760]  ret_from_fork+0x10/0x20
[   19.494800] 
[   19.494824] Freed by task 192:
[   19.494853]  kasan_save_stack+0x3c/0x68
[   19.494895]  kasan_save_track+0x20/0x40
[   19.494937]  kasan_save_free_info+0x4c/0x78
[   19.494990]  __kasan_slab_free+0x6c/0x98
[   19.495037]  kfree+0x214/0x3c8
[   19.495073]  kfree_sensitive+0x80/0xb0
[   19.495115]  kmalloc_double_kzfree+0x11c/0x308
[   19.495159]  kunit_try_run_case+0x170/0x3f0
[   19.495943]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.496067]  kthread+0x328/0x630
[   19.496127]  ret_from_fork+0x10/0x20
[   19.496171] 
[   19.496200] The buggy address belongs to the object at fff00000c4035120
[   19.496200]  which belongs to the cache kmalloc-16 of size 16
[   19.496269] The buggy address is located 0 bytes inside of
[   19.496269]  freed 16-byte region [fff00000c4035120, fff00000c4035130)
[   19.496334] 
[   19.496360] The buggy address belongs to the physical page:
[   19.496399] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x104035
[   19.496459] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   19.496518] page_type: f5(slab)
[   19.496989] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   19.497422] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   19.497661] page dumped because: kasan: bad access detected
[   19.497706] 
[   19.497728] Memory state around the buggy address:
[   19.497768]  fff00000c4035000: 00 02 fc fc 00 05 fc fc fa fb fc fc fa fb fc fc
[   19.497839]  fff00000c4035080: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   19.497891] >fff00000c4035100: fa fb fc fc fa fb fc fc fc fc fc fc fc fc fc fc
[   19.497952]                                ^
[   19.498823]  fff00000c4035180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.499117]  fff00000c4035200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.499613] ==================================================================

[   11.465356] ==================================================================
[   11.466493] BUG: KASAN: slab-use-after-free in kmalloc_double_kzfree+0x19c/0x350
[   11.467095] Read of size 1 at addr ffff888101c869a0 by task kunit_try_catch/209
[   11.467708] 
[   11.467893] CPU: 1 UID: 0 PID: 209 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250513 #1 PREEMPT(voluntary) 
[   11.467944] Tainted: [B]=BAD_PAGE, [N]=TEST
[   11.467955] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   11.467975] Call Trace:
[   11.467987]  <TASK>
[   11.468004]  dump_stack_lvl+0x73/0xb0
[   11.468034]  print_report+0xd1/0x650
[   11.468057]  ? __virt_addr_valid+0x1db/0x2d0
[   11.468081]  ? kmalloc_double_kzfree+0x19c/0x350
[   11.468103]  ? kasan_complete_mode_report_info+0x64/0x200
[   11.468125]  ? kmalloc_double_kzfree+0x19c/0x350
[   11.468149]  kasan_report+0x141/0x180
[   11.468172]  ? kmalloc_double_kzfree+0x19c/0x350
[   11.468200]  ? kmalloc_double_kzfree+0x19c/0x350
[   11.468223]  __kasan_check_byte+0x3d/0x50
[   11.468246]  kfree_sensitive+0x22/0x90
[   11.468271]  kmalloc_double_kzfree+0x19c/0x350
[   11.468294]  ? __pfx_kmalloc_double_kzfree+0x10/0x10
[   11.468320]  ? __pfx_queued_spin_lock_slowpath+0x10/0x10
[   11.468344]  ? __pfx_read_tsc+0x10/0x10
[   11.468364]  ? ktime_get_ts64+0x86/0x230
[   11.468389]  kunit_try_run_case+0x1a5/0x480
[   11.468413]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.468434]  ? _raw_spin_lock_irqsave+0xf9/0x100
[   11.468455]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   11.468478]  ? __kthread_parkme+0x82/0x180
[   11.468498]  ? preempt_count_sub+0x50/0x80
[   11.468523]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.468547]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.468570]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   11.468592]  kthread+0x337/0x6f0
[   11.468622]  ? trace_preempt_on+0x20/0xc0
[   11.468717]  ? __pfx_kthread+0x10/0x10
[   11.468739]  ? _raw_spin_unlock_irq+0x47/0x80
[   11.468759]  ? calculate_sigpending+0x7b/0xa0
[   11.468784]  ? __pfx_kthread+0x10/0x10
[   11.468806]  ret_from_fork+0x116/0x1d0
[   11.468824]  ? __pfx_kthread+0x10/0x10
[   11.468845]  ret_from_fork_asm+0x1a/0x30
[   11.468881]  </TASK>
[   11.468892] 
[   11.479641] Allocated by task 209:
[   11.479968]  kasan_save_stack+0x45/0x70
[   11.480166]  kasan_save_track+0x18/0x40
[   11.480491]  kasan_save_alloc_info+0x3b/0x50
[   11.480859]  __kasan_kmalloc+0xb7/0xc0
[   11.481062]  __kmalloc_cache_noprof+0x189/0x420
[   11.481431]  kmalloc_double_kzfree+0xa9/0x350
[   11.481769]  kunit_try_run_case+0x1a5/0x480
[   11.481935]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.482184]  kthread+0x337/0x6f0
[   11.482652]  ret_from_fork+0x116/0x1d0
[   11.482851]  ret_from_fork_asm+0x1a/0x30
[   11.483281] 
[   11.483385] Freed by task 209:
[   11.483534]  kasan_save_stack+0x45/0x70
[   11.484019]  kasan_save_track+0x18/0x40
[   11.484287]  kasan_save_free_info+0x3f/0x60
[   11.484495]  __kasan_slab_free+0x56/0x70
[   11.484873]  kfree+0x222/0x3f0
[   11.485046]  kfree_sensitive+0x67/0x90
[   11.485204]  kmalloc_double_kzfree+0x12b/0x350
[   11.485488]  kunit_try_run_case+0x1a5/0x480
[   11.485728]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.486212]  kthread+0x337/0x6f0
[   11.486396]  ret_from_fork+0x116/0x1d0
[   11.486668]  ret_from_fork_asm+0x1a/0x30
[   11.486828] 
[   11.486922] The buggy address belongs to the object at ffff888101c869a0
[   11.486922]  which belongs to the cache kmalloc-16 of size 16
[   11.487768] The buggy address is located 0 bytes inside of
[   11.487768]  freed 16-byte region [ffff888101c869a0, ffff888101c869b0)
[   11.488339] 
[   11.488673] The buggy address belongs to the physical page:
[   11.489007] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101c86
[   11.489509] flags: 0x200000000000000(node=0|zone=2)
[   11.489889] page_type: f5(slab)
[   11.490074] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   11.490531] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   11.490947] page dumped because: kasan: bad access detected
[   11.491192] 
[   11.491464] Memory state around the buggy address:
[   11.491781]  ffff888101c86880: 00 00 fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   11.492293]  ffff888101c86900: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   11.492845] >ffff888101c86980: fa fb fc fc fa fb fc fc fc fc fc fc fc fc fc fc
[   11.493232]                                ^
[   11.493448]  ffff888101c86a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.494061]  ffff888101c86a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.494359] ==================================================================