Hay
Date
July 10, 2025, 9:07 a.m.

Environment
qemu-arm64
qemu-x86_64

[   29.583466] ==================================================================
[   29.583535] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x300/0x338
[   29.583682] Read of size 1 at addr fff00000c8686b08 by task kunit_try_catch/215
[   29.584159] 
[   29.584469] CPU: 0 UID: 0 PID: 215 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5-next-20250710 #1 PREEMPT 
[   29.584566] Tainted: [B]=BAD_PAGE, [N]=TEST
[   29.584593] Hardware name: linux,dummy-virt (DT)
[   29.584625] Call trace:
[   29.585343]  show_stack+0x20/0x38 (C)
[   29.585492]  dump_stack_lvl+0x8c/0xd0
[   29.585985]  print_report+0x118/0x5d0
[   29.586152]  kasan_report+0xdc/0x128
[   29.586199]  __asan_report_load1_noabort+0x20/0x30
[   29.586249]  kmalloc_uaf+0x300/0x338
[   29.586292]  kunit_try_run_case+0x170/0x3f0
[   29.586736]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   29.586809]  kthread+0x328/0x630
[   29.586880]  ret_from_fork+0x10/0x20
[   29.587250] 
[   29.587269] Allocated by task 215:
[   29.587317]  kasan_save_stack+0x3c/0x68
[   29.587370]  kasan_save_track+0x20/0x40
[   29.587417]  kasan_save_alloc_info+0x40/0x58
[   29.587456]  __kasan_kmalloc+0xd4/0xd8
[   29.587904]  __kmalloc_cache_noprof+0x16c/0x3c0
[   29.587946]  kmalloc_uaf+0xb8/0x338
[   29.588199]  kunit_try_run_case+0x170/0x3f0
[   29.588248]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   29.588353]  kthread+0x328/0x630
[   29.588389]  ret_from_fork+0x10/0x20
[   29.588424] 
[   29.588818] Freed by task 215:
[   29.588846]  kasan_save_stack+0x3c/0x68
[   29.589328]  kasan_save_track+0x20/0x40
[   29.589481]  kasan_save_free_info+0x4c/0x78
[   29.589518]  __kasan_slab_free+0x6c/0x98
[   29.589846]  kfree+0x214/0x3c8
[   29.589888]  kmalloc_uaf+0x11c/0x338
[   29.590259]  kunit_try_run_case+0x170/0x3f0
[   29.590305]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   29.590677]  kthread+0x328/0x630
[   29.590722]  ret_from_fork+0x10/0x20
[   29.590770] 
[   29.590825] The buggy address belongs to the object at fff00000c8686b00
[   29.590825]  which belongs to the cache kmalloc-16 of size 16
[   29.591026] The buggy address is located 8 bytes inside of
[   29.591026]  freed 16-byte region [fff00000c8686b00, fff00000c8686b10)
[   29.591091] 
[   29.591392] The buggy address belongs to the physical page:
[   29.591560] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xfff00000c8686a40 pfn:0x108686
[   29.591621] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   29.591672] page_type: f5(slab)
[   29.591711] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   29.591762] raw: fff00000c8686a40 000000008080007f 00000000f5000000 0000000000000000
[   29.591807] page dumped because: kasan: bad access detected
[   29.591840] 
[   29.592767] Memory state around the buggy address:
[   29.592995]  fff00000c8686a00: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   29.593048]  fff00000c8686a80: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   29.593094] >fff00000c8686b00: fa fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   29.593210]                       ^
[   29.593243]  fff00000c8686b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   29.593288]  fff00000c8686c00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   29.593644] ==================================================================

[   25.291351] ==================================================================
[   25.292138] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x320/0x380
[   25.292602] Read of size 1 at addr ffff888105807f88 by task kunit_try_catch/232
[   25.293210] 
[   25.293335] CPU: 0 UID: 0 PID: 232 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5-next-20250710 #1 PREEMPT(voluntary) 
[   25.293391] Tainted: [B]=BAD_PAGE, [N]=TEST
[   25.293403] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   25.293427] Call Trace:
[   25.293441]  <TASK>
[   25.293462]  dump_stack_lvl+0x73/0xb0
[   25.293655]  print_report+0xd1/0x610
[   25.293685]  ? __virt_addr_valid+0x1db/0x2d0
[   25.293731]  ? kmalloc_uaf+0x320/0x380
[   25.293750]  ? kasan_complete_mode_report_info+0x64/0x200
[   25.293776]  ? kmalloc_uaf+0x320/0x380
[   25.293892]  kasan_report+0x141/0x180
[   25.293914]  ? kmalloc_uaf+0x320/0x380
[   25.293940]  __asan_report_load1_noabort+0x18/0x20
[   25.293963]  kmalloc_uaf+0x320/0x380
[   25.293983]  ? __pfx_kmalloc_uaf+0x10/0x10
[   25.294004]  ? __schedule+0x10cc/0x2b60
[   25.294027]  ? __pfx_read_tsc+0x10/0x10
[   25.294050]  ? ktime_get_ts64+0x86/0x230
[   25.294076]  kunit_try_run_case+0x1a5/0x480
[   25.294099]  ? __pfx_kunit_try_run_case+0x10/0x10
[   25.294119]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   25.294142]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   25.294165]  ? __kthread_parkme+0x82/0x180
[   25.294187]  ? preempt_count_sub+0x50/0x80
[   25.294210]  ? __pfx_kunit_try_run_case+0x10/0x10
[   25.294233]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.294258]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   25.294282]  kthread+0x337/0x6f0
[   25.294302]  ? trace_preempt_on+0x20/0xc0
[   25.294326]  ? __pfx_kthread+0x10/0x10
[   25.294346]  ? _raw_spin_unlock_irq+0x47/0x80
[   25.294367]  ? calculate_sigpending+0x7b/0xa0
[   25.294392]  ? __pfx_kthread+0x10/0x10
[   25.294413]  ret_from_fork+0x116/0x1d0
[   25.294433]  ? __pfx_kthread+0x10/0x10
[   25.294454]  ret_from_fork_asm+0x1a/0x30
[   25.294486]  </TASK>
[   25.294511] 
[   25.306408] Allocated by task 232:
[   25.306589]  kasan_save_stack+0x45/0x70
[   25.307018]  kasan_save_track+0x18/0x40
[   25.307216]  kasan_save_alloc_info+0x3b/0x50
[   25.307413]  __kasan_kmalloc+0xb7/0xc0
[   25.308036]  __kmalloc_cache_noprof+0x189/0x420
[   25.308409]  kmalloc_uaf+0xaa/0x380
[   25.308857]  kunit_try_run_case+0x1a5/0x480
[   25.309115]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.309361]  kthread+0x337/0x6f0
[   25.309745]  ret_from_fork+0x116/0x1d0
[   25.310023]  ret_from_fork_asm+0x1a/0x30
[   25.310217] 
[   25.310304] Freed by task 232:
[   25.310447]  kasan_save_stack+0x45/0x70
[   25.311057]  kasan_save_track+0x18/0x40
[   25.311394]  kasan_save_free_info+0x3f/0x60
[   25.311997]  __kasan_slab_free+0x56/0x70
[   25.312196]  kfree+0x222/0x3f0
[   25.312345]  kmalloc_uaf+0x12c/0x380
[   25.312742]  kunit_try_run_case+0x1a5/0x480
[   25.313104]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.313355]  kthread+0x337/0x6f0
[   25.313729]  ret_from_fork+0x116/0x1d0
[   25.314219]  ret_from_fork_asm+0x1a/0x30
[   25.314466] 
[   25.314744] The buggy address belongs to the object at ffff888105807f80
[   25.314744]  which belongs to the cache kmalloc-16 of size 16
[   25.315299] The buggy address is located 8 bytes inside of
[   25.315299]  freed 16-byte region [ffff888105807f80, ffff888105807f90)
[   25.316291] 
[   25.316389] The buggy address belongs to the physical page:
[   25.317057] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105807
[   25.317396] flags: 0x200000000000000(node=0|zone=2)
[   25.317811] page_type: f5(slab)
[   25.318193] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   25.318817] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   25.319137] page dumped because: kasan: bad access detected
[   25.319348] 
[   25.319434] Memory state around the buggy address:
[   25.319989]  ffff888105807e80: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   25.320494]  ffff888105807f00: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   25.321117] >ffff888105807f80: fa fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.321595]                       ^
[   25.321783]  ffff888105808000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   25.322359]  ffff888105808080: fb fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb
[   25.322930] ==================================================================