Hay
Date
July 8, 2025, 11:10 a.m.

Environment
qemu-arm64
qemu-x86_64

[   31.140927] ==================================================================
[   31.141019] BUG: KASAN: slab-use-after-free in kmalloc_uaf_16+0x3bc/0x438
[   31.141109] Read of size 16 at addr fff00000c7981680 by task kunit_try_catch/199
[   31.141160] 
[   31.141196] CPU: 0 UID: 0 PID: 199 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5-next-20250708 #1 PREEMPT 
[   31.141314] Tainted: [B]=BAD_PAGE, [N]=TEST
[   31.141340] Hardware name: linux,dummy-virt (DT)
[   31.141372] Call trace:
[   31.141396]  show_stack+0x20/0x38 (C)
[   31.141445]  dump_stack_lvl+0x8c/0xd0
[   31.141493]  print_report+0x118/0x5d0
[   31.141540]  kasan_report+0xdc/0x128
[   31.141595]  __asan_report_load16_noabort+0x20/0x30
[   31.141679]  kmalloc_uaf_16+0x3bc/0x438
[   31.141726]  kunit_try_run_case+0x170/0x3f0
[   31.141782]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.141964]  kthread+0x328/0x630
[   31.142008]  ret_from_fork+0x10/0x20
[   31.142216] 
[   31.142277] Allocated by task 199:
[   31.142593]  kasan_save_stack+0x3c/0x68
[   31.142654]  kasan_save_track+0x20/0x40
[   31.142692]  kasan_save_alloc_info+0x40/0x58
[   31.142947]  __kasan_kmalloc+0xd4/0xd8
[   31.143004]  __kmalloc_cache_noprof+0x16c/0x3c0
[   31.143065]  kmalloc_uaf_16+0x140/0x438
[   31.143136]  kunit_try_run_case+0x170/0x3f0
[   31.143194]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.143282]  kthread+0x328/0x630
[   31.143364]  ret_from_fork+0x10/0x20
[   31.143416] 
[   31.143470] Freed by task 199:
[   31.143559]  kasan_save_stack+0x3c/0x68
[   31.143628]  kasan_save_track+0x20/0x40
[   31.143703]  kasan_save_free_info+0x4c/0x78
[   31.143739]  __kasan_slab_free+0x6c/0x98
[   31.143802]  kfree+0x214/0x3c8
[   31.144095]  kmalloc_uaf_16+0x190/0x438
[   31.144183]  kunit_try_run_case+0x170/0x3f0
[   31.144261]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.144329]  kthread+0x328/0x630
[   31.144400]  ret_from_fork+0x10/0x20
[   31.144436] 
[   31.144455] The buggy address belongs to the object at fff00000c7981680
[   31.144455]  which belongs to the cache kmalloc-16 of size 16
[   31.144512] The buggy address is located 0 bytes inside of
[   31.144512]  freed 16-byte region [fff00000c7981680, fff00000c7981690)
[   31.144598] 
[   31.144667] The buggy address belongs to the physical page:
[   31.144778] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x107981
[   31.144887] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   31.144957] page_type: f5(slab)
[   31.145014] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   31.145112] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   31.145170] page dumped because: kasan: bad access detected
[   31.145201] 
[   31.145230] Memory state around the buggy address:
[   31.145285]  fff00000c7981580: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   31.145330]  fff00000c7981600: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   31.145372] >fff00000c7981680: fa fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.145486]                    ^
[   31.145518]  fff00000c7981700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.145559]  fff00000c7981780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.145595] ==================================================================

[   23.370355] ==================================================================
[   23.371233] BUG: KASAN: slab-use-after-free in kmalloc_uaf_16+0x47b/0x4c0
[   23.371585] Read of size 16 at addr ffff88810598a240 by task kunit_try_catch/216
[   23.372090] 
[   23.372194] CPU: 0 UID: 0 PID: 216 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5-next-20250708 #1 PREEMPT(voluntary) 
[   23.372259] Tainted: [B]=BAD_PAGE, [N]=TEST
[   23.372272] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   23.372294] Call Trace:
[   23.372307]  <TASK>
[   23.372326]  dump_stack_lvl+0x73/0xb0
[   23.372357]  print_report+0xd1/0x610
[   23.372381]  ? __virt_addr_valid+0x1db/0x2d0
[   23.372406]  ? kmalloc_uaf_16+0x47b/0x4c0
[   23.372426]  ? kasan_complete_mode_report_info+0x64/0x200
[   23.372455]  ? kmalloc_uaf_16+0x47b/0x4c0
[   23.372476]  kasan_report+0x141/0x180
[   23.372499]  ? kmalloc_uaf_16+0x47b/0x4c0
[   23.372525]  __asan_report_load16_noabort+0x18/0x20
[   23.372552]  kmalloc_uaf_16+0x47b/0x4c0
[   23.372573]  ? __pfx_kmalloc_uaf_16+0x10/0x10
[   23.372596]  ? __schedule+0x10cc/0x2b60
[   23.372624]  ? __pfx_read_tsc+0x10/0x10
[   23.372649]  ? ktime_get_ts64+0x86/0x230
[   23.372676]  kunit_try_run_case+0x1a5/0x480
[   23.372699]  ? __pfx_kunit_try_run_case+0x10/0x10
[   23.372719]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   23.372741]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   23.372836]  ? __kthread_parkme+0x82/0x180
[   23.372858]  ? preempt_count_sub+0x50/0x80
[   23.372883]  ? __pfx_kunit_try_run_case+0x10/0x10
[   23.372906]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   23.372933]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   23.372962]  kthread+0x337/0x6f0
[   23.372984]  ? trace_preempt_on+0x20/0xc0
[   23.373009]  ? __pfx_kthread+0x10/0x10
[   23.373032]  ? _raw_spin_unlock_irq+0x47/0x80
[   23.373058]  ? calculate_sigpending+0x7b/0xa0
[   23.373086]  ? __pfx_kthread+0x10/0x10
[   23.373109]  ret_from_fork+0x116/0x1d0
[   23.373129]  ? __pfx_kthread+0x10/0x10
[   23.373151]  ret_from_fork_asm+0x1a/0x30
[   23.373186]  </TASK>
[   23.373203] 
[   23.379639] Allocated by task 216:
[   23.379764]  kasan_save_stack+0x45/0x70
[   23.379952]  kasan_save_track+0x18/0x40
[   23.380158]  kasan_save_alloc_info+0x3b/0x50
[   23.380370]  __kasan_kmalloc+0xb7/0xc0
[   23.380546]  __kmalloc_cache_noprof+0x189/0x420
[   23.380757]  kmalloc_uaf_16+0x15b/0x4c0
[   23.381078]  kunit_try_run_case+0x1a5/0x480
[   23.381408]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   23.381585]  kthread+0x337/0x6f0
[   23.381747]  ret_from_fork+0x116/0x1d0
[   23.381984]  ret_from_fork_asm+0x1a/0x30
[   23.382149] 
[   23.382249] Freed by task 216:
[   23.382361]  kasan_save_stack+0x45/0x70
[   23.382553]  kasan_save_track+0x18/0x40
[   23.382712]  kasan_save_free_info+0x3f/0x60
[   23.383058]  __kasan_slab_free+0x56/0x70
[   23.383225]  kfree+0x222/0x3f0
[   23.383394]  kmalloc_uaf_16+0x1d6/0x4c0
[   23.383559]  kunit_try_run_case+0x1a5/0x480
[   23.383740]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   23.383983]  kthread+0x337/0x6f0
[   23.384179]  ret_from_fork+0x116/0x1d0
[   23.384409]  ret_from_fork_asm+0x1a/0x30
[   23.384554] 
[   23.384639] The buggy address belongs to the object at ffff88810598a240
[   23.384639]  which belongs to the cache kmalloc-16 of size 16
[   23.385276] The buggy address is located 0 bytes inside of
[   23.385276]  freed 16-byte region [ffff88810598a240, ffff88810598a250)
[   23.385636] 
[   23.385704] The buggy address belongs to the physical page:
[   23.385937] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10598a
[   23.386293] flags: 0x200000000000000(node=0|zone=2)
[   23.386557] page_type: f5(slab)
[   23.386674] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   23.387359] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   23.387659] page dumped because: kasan: bad access detected
[   23.387823] 
[   23.387885] Memory state around the buggy address:
[   23.388077]  ffff88810598a100: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   23.388529]  ffff88810598a180: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   23.388746] >ffff88810598a200: fa fb fc fc 00 00 fc fc fa fb fc fc fc fc fc fc
[   23.389266]                                            ^
[   23.389433]  ffff88810598a280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.389672]  ffff88810598a300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.390150] ==================================================================