Hay
Date
July 5, 2025, 11:09 a.m.

Environment
qemu-arm64
qemu-x86_64

[   19.124574] ==================================================================
[   19.124740] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x300/0x338
[   19.124846] Read of size 1 at addr fff00000c56728c8 by task kunit_try_catch/185
[   19.124963] 
[   19.125027] CPU: 0 UID: 0 PID: 185 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT 
[   19.125213] Tainted: [B]=BAD_PAGE, [N]=TEST
[   19.125272] Hardware name: linux,dummy-virt (DT)
[   19.125341] Call trace:
[   19.126004]  show_stack+0x20/0x38 (C)
[   19.126243]  dump_stack_lvl+0x8c/0xd0
[   19.126429]  print_report+0x118/0x608
[   19.126714]  kasan_report+0xdc/0x128
[   19.127214]  __asan_report_load1_noabort+0x20/0x30
[   19.127485]  kmalloc_uaf+0x300/0x338
[   19.127611]  kunit_try_run_case+0x170/0x3f0
[   19.128134]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.128493]  kthread+0x328/0x630
[   19.128695]  ret_from_fork+0x10/0x20
[   19.128807] 
[   19.128881] Allocated by task 185:
[   19.128957]  kasan_save_stack+0x3c/0x68
[   19.129190]  kasan_save_track+0x20/0x40
[   19.129422]  kasan_save_alloc_info+0x40/0x58
[   19.129921]  __kasan_kmalloc+0xd4/0xd8
[   19.130171]  __kmalloc_cache_noprof+0x16c/0x3c0
[   19.130398]  kmalloc_uaf+0xb8/0x338
[   19.130638]  kunit_try_run_case+0x170/0x3f0
[   19.130955]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.131065]  kthread+0x328/0x630
[   19.131129]  ret_from_fork+0x10/0x20
[   19.131301] 
[   19.131399] Freed by task 185:
[   19.131503]  kasan_save_stack+0x3c/0x68
[   19.131745]  kasan_save_track+0x20/0x40
[   19.131831]  kasan_save_free_info+0x4c/0x78
[   19.131921]  __kasan_slab_free+0x6c/0x98
[   19.132003]  kfree+0x214/0x3c8
[   19.132079]  kmalloc_uaf+0x11c/0x338
[   19.132150]  kunit_try_run_case+0x170/0x3f0
[   19.132484]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.132703]  kthread+0x328/0x630
[   19.132822]  ret_from_fork+0x10/0x20
[   19.133067] 
[   19.133246] The buggy address belongs to the object at fff00000c56728c0
[   19.133246]  which belongs to the cache kmalloc-16 of size 16
[   19.133688] The buggy address is located 8 bytes inside of
[   19.133688]  freed 16-byte region [fff00000c56728c0, fff00000c56728d0)
[   19.133923] 
[   19.134063] The buggy address belongs to the physical page:
[   19.134153] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105672
[   19.134421] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   19.134795] page_type: f5(slab)
[   19.134916] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   19.135075] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   19.135219] page dumped because: kasan: bad access detected
[   19.135449] 
[   19.135562] Memory state around the buggy address:
[   19.135644]  fff00000c5672780: 00 03 fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   19.135758]  fff00000c5672800: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   19.135860] >fff00000c5672880: fa fb fc fc fa fb fc fc fa fb fc fc fc fc fc fc
[   19.135942]                                               ^
[   19.136024]  fff00000c5672900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.136128]  fff00000c5672980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.136215] ==================================================================

[   13.880097] ==================================================================
[   13.880589] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x320/0x380
[   13.881318] Read of size 1 at addr ffff8881018868a8 by task kunit_try_catch/201
[   13.881583] 
[   13.881709] CPU: 1 UID: 0 PID: 201 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT(voluntary) 
[   13.881765] Tainted: [B]=BAD_PAGE, [N]=TEST
[   13.881781] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   13.882069] Call Trace:
[   13.882093]  <TASK>
[   13.882115]  dump_stack_lvl+0x73/0xb0
[   13.882153]  print_report+0xd1/0x650
[   13.882179]  ? __virt_addr_valid+0x1db/0x2d0
[   13.882216]  ? kmalloc_uaf+0x320/0x380
[   13.882239]  ? kasan_complete_mode_report_info+0x64/0x200
[   13.882264]  ? kmalloc_uaf+0x320/0x380
[   13.882288]  kasan_report+0x141/0x180
[   13.882313]  ? kmalloc_uaf+0x320/0x380
[   13.882342]  __asan_report_load1_noabort+0x18/0x20
[   13.882369]  kmalloc_uaf+0x320/0x380
[   13.882392]  ? __pfx_kmalloc_uaf+0x10/0x10
[   13.882416]  ? __schedule+0x10cc/0x2b60
[   13.882447]  ? __pfx_read_tsc+0x10/0x10
[   13.882504]  ? ktime_get_ts64+0x86/0x230
[   13.882533]  kunit_try_run_case+0x1a5/0x480
[   13.882592]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.882619]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   13.882681]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   13.882708]  ? __kthread_parkme+0x82/0x180
[   13.882732]  ? preempt_count_sub+0x50/0x80
[   13.882759]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.882786]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.882812]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   13.882838]  kthread+0x337/0x6f0
[   13.882860]  ? trace_preempt_on+0x20/0xc0
[   13.882888]  ? __pfx_kthread+0x10/0x10
[   13.882911]  ? _raw_spin_unlock_irq+0x47/0x80
[   13.882935]  ? calculate_sigpending+0x7b/0xa0
[   13.882964]  ? __pfx_kthread+0x10/0x10
[   13.882988]  ret_from_fork+0x116/0x1d0
[   13.883010]  ? __pfx_kthread+0x10/0x10
[   13.883047]  ret_from_fork_asm+0x1a/0x30
[   13.883084]  </TASK>
[   13.883097] 
[   13.895686] Allocated by task 201:
[   13.896193]  kasan_save_stack+0x45/0x70
[   13.896553]  kasan_save_track+0x18/0x40
[   13.896919]  kasan_save_alloc_info+0x3b/0x50
[   13.897177]  __kasan_kmalloc+0xb7/0xc0
[   13.897394]  __kmalloc_cache_noprof+0x189/0x420
[   13.897670]  kmalloc_uaf+0xaa/0x380
[   13.898144]  kunit_try_run_case+0x1a5/0x480
[   13.898343]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.898642]  kthread+0x337/0x6f0
[   13.898840]  ret_from_fork+0x116/0x1d0
[   13.899103]  ret_from_fork_asm+0x1a/0x30
[   13.899382] 
[   13.899505] Freed by task 201:
[   13.899689]  kasan_save_stack+0x45/0x70
[   13.899987]  kasan_save_track+0x18/0x40
[   13.900199]  kasan_save_free_info+0x3f/0x60
[   13.900435]  __kasan_slab_free+0x56/0x70
[   13.900695]  kfree+0x222/0x3f0
[   13.901186]  kmalloc_uaf+0x12c/0x380
[   13.901389]  kunit_try_run_case+0x1a5/0x480
[   13.901567]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.902097]  kthread+0x337/0x6f0
[   13.902289]  ret_from_fork+0x116/0x1d0
[   13.902506]  ret_from_fork_asm+0x1a/0x30
[   13.902725] 
[   13.902896] The buggy address belongs to the object at ffff8881018868a0
[   13.902896]  which belongs to the cache kmalloc-16 of size 16
[   13.903641] The buggy address is located 8 bytes inside of
[   13.903641]  freed 16-byte region [ffff8881018868a0, ffff8881018868b0)
[   13.904296] 
[   13.904537] The buggy address belongs to the physical page:
[   13.904891] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101886
[   13.905456] flags: 0x200000000000000(node=0|zone=2)
[   13.905767] page_type: f5(slab)
[   13.905960] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   13.906434] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   13.906889] page dumped because: kasan: bad access detected
[   13.907160] 
[   13.907275] Memory state around the buggy address:
[   13.907482]  ffff888101886780: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   13.907855]  ffff888101886800: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   13.908251] >ffff888101886880: fa fb fc fc fa fb fc fc fc fc fc fc fc fc fc fc
[   13.908556]                                   ^
[   13.909421]  ffff888101886900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   13.910186]  ffff888101886980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   13.910572] ==================================================================