Hay
Date
July 25, 2025, 3:13 a.m.

Environment
qemu-arm64
qemu-x86_64

[   32.541122] ==================================================================
[   32.541513] BUG: KASAN: slab-use-after-free in kmalloc_uaf2+0x3f4/0x468
[   32.541710] Read of size 1 at addr fff00000c9b220a8 by task kunit_try_catch/220
[   32.541769] 
[   32.541922] CPU: 1 UID: 0 PID: 220 Comm: kunit_try_catch Tainted: G    B   W        N  6.16.0-rc7-next-20250725 #1 PREEMPT 
[   32.542192] Tainted: [B]=BAD_PAGE, [W]=WARN, [N]=TEST
[   32.542237] Hardware name: linux,dummy-virt (DT)
[   32.542306] Call trace:
[   32.542500]  show_stack+0x20/0x38 (C)
[   32.542663]  dump_stack_lvl+0x8c/0xd0
[   32.542725]  print_report+0x118/0x5e8
[   32.542997]  kasan_report+0xdc/0x128
[   32.543162]  __asan_report_load1_noabort+0x20/0x30
[   32.543218]  kmalloc_uaf2+0x3f4/0x468
[   32.543539]  kunit_try_run_case+0x170/0x3f0
[   32.543744]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   32.543948]  kthread+0x328/0x630
[   32.544044]  ret_from_fork+0x10/0x20
[   32.544180] 
[   32.544200] Allocated by task 220:
[   32.544248]  kasan_save_stack+0x3c/0x68
[   32.544333]  kasan_save_track+0x20/0x40
[   32.544573]  kasan_save_alloc_info+0x40/0x58
[   32.544763]  __kasan_kmalloc+0xd4/0xd8
[   32.544905]  __kmalloc_cache_noprof+0x16c/0x3c0
[   32.545049]  kmalloc_uaf2+0xc4/0x468
[   32.545091]  kunit_try_run_case+0x170/0x3f0
[   32.545431]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   32.545588]  kthread+0x328/0x630
[   32.545726]  ret_from_fork+0x10/0x20
[   32.545834] 
[   32.545963] Freed by task 220:
[   32.546101]  kasan_save_stack+0x3c/0x68
[   32.546452]  kasan_save_track+0x20/0x40
[   32.546552]  kasan_save_free_info+0x4c/0x78
[   32.546727]  __kasan_slab_free+0x7c/0xa8
[   32.546805]  kfree+0x214/0x3c8
[   32.546859]  kmalloc_uaf2+0x134/0x468
[   32.547253]  kunit_try_run_case+0x170/0x3f0
[   32.547406]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   32.547556]  kthread+0x328/0x630
[   32.547761]  ret_from_fork+0x10/0x20
[   32.547806] 
[   32.547826] The buggy address belongs to the object at fff00000c9b22080
[   32.547826]  which belongs to the cache kmalloc-64 of size 64
[   32.548042] The buggy address is located 40 bytes inside of
[   32.548042]  freed 64-byte region [fff00000c9b22080, fff00000c9b220c0)
[   32.548304] 
[   32.548398] The buggy address belongs to the physical page:
[   32.548518] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x109b22
[   32.548677] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   32.548743] page_type: f5(slab)
[   32.549094] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   32.549310] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   32.549404] page dumped because: kasan: bad access detected
[   32.549586] 
[   32.549632] Memory state around the buggy address:
[   32.549951]  fff00000c9b21f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   32.550114]  fff00000c9b22000: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   32.550549] >fff00000c9b22080: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   32.550877]                                   ^
[   32.551546]  fff00000c9b22100: 00 00 00 00 00 03 fc fc fc fc fc fc fc fc fc fc
[   32.552130]  fff00000c9b22180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.552201] ==================================================================

[   26.083156] ==================================================================
[   26.083596] BUG: KASAN: slab-use-after-free in kmalloc_uaf2+0x4a8/0x520
[   26.084337] Read of size 1 at addr ffff888106254228 by task kunit_try_catch/237
[   26.084734] 
[   26.084826] CPU: 1 UID: 0 PID: 237 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc7-next-20250725 #1 PREEMPT(voluntary) 
[   26.084878] Tainted: [B]=BAD_PAGE, [N]=TEST
[   26.084926] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   26.084960] Call Trace:
[   26.085045]  <TASK>
[   26.085105]  dump_stack_lvl+0x73/0xb0
[   26.085151]  print_report+0xd1/0x640
[   26.085175]  ? __virt_addr_valid+0x1db/0x2d0
[   26.085200]  ? kmalloc_uaf2+0x4a8/0x520
[   26.085221]  ? kasan_complete_mode_report_info+0x64/0x200
[   26.085247]  ? kmalloc_uaf2+0x4a8/0x520
[   26.085302]  kasan_report+0x141/0x180
[   26.085326]  ? kmalloc_uaf2+0x4a8/0x520
[   26.085351]  __asan_report_load1_noabort+0x18/0x20
[   26.085376]  kmalloc_uaf2+0x4a8/0x520
[   26.085397]  ? __pfx_kmalloc_uaf2+0x10/0x10
[   26.085417]  ? finish_task_switch.isra.0+0x153/0x700
[   26.085440]  ? __switch_to+0x47/0xf80
[   26.085468]  ? __schedule+0x10da/0x2b60
[   26.085490]  ? __pfx_read_tsc+0x10/0x10
[   26.085513]  ? ktime_get_ts64+0x86/0x230
[   26.085539]  kunit_try_run_case+0x1a5/0x480
[   26.085564]  ? __pfx_kunit_try_run_case+0x10/0x10
[   26.085587]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   26.085610]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   26.085636]  ? __kthread_parkme+0x82/0x180
[   26.085656]  ? preempt_count_sub+0x50/0x80
[   26.085680]  ? __pfx_kunit_try_run_case+0x10/0x10
[   26.085704]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.085728]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   26.085752]  kthread+0x337/0x6f0
[   26.085772]  ? trace_preempt_on+0x20/0xc0
[   26.085844]  ? __pfx_kthread+0x10/0x10
[   26.085866]  ? _raw_spin_unlock_irq+0x47/0x80
[   26.085890]  ? calculate_sigpending+0x7b/0xa0
[   26.085915]  ? __pfx_kthread+0x10/0x10
[   26.085937]  ret_from_fork+0x116/0x1d0
[   26.085970]  ? __pfx_kthread+0x10/0x10
[   26.085991]  ret_from_fork_asm+0x1a/0x30
[   26.086022]  </TASK>
[   26.086034] 
[   26.094642] Allocated by task 237:
[   26.094837]  kasan_save_stack+0x45/0x70
[   26.095110]  kasan_save_track+0x18/0x40
[   26.095308]  kasan_save_alloc_info+0x3b/0x50
[   26.095549]  __kasan_kmalloc+0xb7/0xc0
[   26.095741]  __kmalloc_cache_noprof+0x189/0x420
[   26.096133]  kmalloc_uaf2+0xc6/0x520
[   26.096393]  kunit_try_run_case+0x1a5/0x480
[   26.096642]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.096996]  kthread+0x337/0x6f0
[   26.097297]  ret_from_fork+0x116/0x1d0
[   26.097523]  ret_from_fork_asm+0x1a/0x30
[   26.097722] 
[   26.097809] Freed by task 237:
[   26.097962]  kasan_save_stack+0x45/0x70
[   26.098272]  kasan_save_track+0x18/0x40
[   26.098507]  kasan_save_free_info+0x3f/0x60
[   26.098738]  __kasan_slab_free+0x5e/0x80
[   26.099015]  kfree+0x222/0x3f0
[   26.099233]  kmalloc_uaf2+0x14c/0x520
[   26.099457]  kunit_try_run_case+0x1a5/0x480
[   26.099704]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.100040]  kthread+0x337/0x6f0
[   26.100379]  ret_from_fork+0x116/0x1d0
[   26.100545]  ret_from_fork_asm+0x1a/0x30
[   26.100740] 
[   26.101117] The buggy address belongs to the object at ffff888106254200
[   26.101117]  which belongs to the cache kmalloc-64 of size 64
[   26.101912] The buggy address is located 40 bytes inside of
[   26.101912]  freed 64-byte region [ffff888106254200, ffff888106254240)
[   26.102450] 
[   26.102541] The buggy address belongs to the physical page:
[   26.102797] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106254
[   26.103362] flags: 0x200000000000000(node=0|zone=2)
[   26.103540] page_type: f5(slab)
[   26.103702] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   26.104709] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   26.105302] page dumped because: kasan: bad access detected
[   26.105575] 
[   26.105667] Memory state around the buggy address:
[   26.106002]  ffff888106254100: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   26.106363]  ffff888106254180: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   26.106710] >ffff888106254200: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   26.107176]                                   ^
[   26.107430]  ffff888106254280: 00 00 00 00 00 03 fc fc fc fc fc fc fc fc fc fc
[   26.107730]  ffff888106254300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   26.108093] ==================================================================