Hay
Date
July 1, 2025, 12:10 a.m.

Environment
qemu-arm64
qemu-x86_64

[   17.577063] ==================================================================
[   17.577570] BUG: KASAN: slab-use-after-free in kmalloc_uaf2+0x3f4/0x468
[   17.577820] Read of size 1 at addr fff00000c58f4f28 by task kunit_try_catch/188
[   17.577966] 
[   17.578024] CPU: 1 UID: 0 PID: 188 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT 
[   17.578134] Tainted: [B]=BAD_PAGE, [N]=TEST
[   17.578257] Hardware name: linux,dummy-virt (DT)
[   17.578323] Call trace:
[   17.578594]  show_stack+0x20/0x38 (C)
[   17.578665]  dump_stack_lvl+0x8c/0xd0
[   17.578814]  print_report+0x118/0x608
[   17.578866]  kasan_report+0xdc/0x128
[   17.578940]  __asan_report_load1_noabort+0x20/0x30
[   17.578999]  kmalloc_uaf2+0x3f4/0x468
[   17.579043]  kunit_try_run_case+0x170/0x3f0
[   17.579098]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.579152]  kthread+0x328/0x630
[   17.579195]  ret_from_fork+0x10/0x20
[   17.579425] 
[   17.579619] Allocated by task 188:
[   17.579812]  kasan_save_stack+0x3c/0x68
[   17.579904]  kasan_save_track+0x20/0x40
[   17.579945]  kasan_save_alloc_info+0x40/0x58
[   17.579986]  __kasan_kmalloc+0xd4/0xd8
[   17.580309]  __kmalloc_cache_noprof+0x16c/0x3c0
[   17.580423]  kmalloc_uaf2+0xc4/0x468
[   17.580474]  kunit_try_run_case+0x170/0x3f0
[   17.580615]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.580780]  kthread+0x328/0x630
[   17.580867]  ret_from_fork+0x10/0x20
[   17.580965] 
[   17.581063] Freed by task 188:
[   17.581171]  kasan_save_stack+0x3c/0x68
[   17.581336]  kasan_save_track+0x20/0x40
[   17.581518]  kasan_save_free_info+0x4c/0x78
[   17.581688]  __kasan_slab_free+0x6c/0x98
[   17.581765]  kfree+0x214/0x3c8
[   17.581800]  kmalloc_uaf2+0x134/0x468
[   17.582075]  kunit_try_run_case+0x170/0x3f0
[   17.582238]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.582309]  kthread+0x328/0x630
[   17.582377]  ret_from_fork+0x10/0x20
[   17.582437] 
[   17.582481] The buggy address belongs to the object at fff00000c58f4f00
[   17.582481]  which belongs to the cache kmalloc-64 of size 64
[   17.582553] The buggy address is located 40 bytes inside of
[   17.582553]  freed 64-byte region [fff00000c58f4f00, fff00000c58f4f40)
[   17.582639] 
[   17.582659] The buggy address belongs to the physical page:
[   17.582702] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1058f4
[   17.582773] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   17.582828] page_type: f5(slab)
[   17.582869] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   17.582920] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   17.583213] page dumped because: kasan: bad access detected
[   17.583286] 
[   17.583305] Memory state around the buggy address:
[   17.583340]  fff00000c58f4e00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   17.583519]  fff00000c58f4e80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   17.583646] >fff00000c58f4f00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   17.583692]                                   ^
[   17.583725]  fff00000c58f4f80: 00 00 00 00 00 03 fc fc fc fc fc fc fc fc fc fc
[   17.583955]  fff00000c58f5000: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   17.584320] ==================================================================

[   11.756923] ==================================================================
[   11.757691] BUG: KASAN: slab-use-after-free in kmalloc_uaf2+0x4a8/0x520
[   11.757956] Read of size 1 at addr ffff88810310c0a8 by task kunit_try_catch/205
[   11.758235] 
[   11.758361] CPU: 0 UID: 0 PID: 205 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT(voluntary) 
[   11.758404] Tainted: [B]=BAD_PAGE, [N]=TEST
[   11.758478] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   11.758499] Call Trace:
[   11.758510]  <TASK>
[   11.758525]  dump_stack_lvl+0x73/0xb0
[   11.758552]  print_report+0xd1/0x650
[   11.758574]  ? __virt_addr_valid+0x1db/0x2d0
[   11.758596]  ? kmalloc_uaf2+0x4a8/0x520
[   11.758615]  ? kasan_complete_mode_report_info+0x64/0x200
[   11.758639]  ? kmalloc_uaf2+0x4a8/0x520
[   11.758660]  kasan_report+0x141/0x180
[   11.758680]  ? kmalloc_uaf2+0x4a8/0x520
[   11.758704]  __asan_report_load1_noabort+0x18/0x20
[   11.758727]  kmalloc_uaf2+0x4a8/0x520
[   11.758746]  ? __pfx_kmalloc_uaf2+0x10/0x10
[   11.758765]  ? finish_task_switch.isra.0+0x153/0x700
[   11.758785]  ? __switch_to+0x47/0xf50
[   11.758834]  ? __schedule+0x10cc/0x2b60
[   11.758868]  ? __pfx_read_tsc+0x10/0x10
[   11.758890]  ? ktime_get_ts64+0x86/0x230
[   11.758912]  kunit_try_run_case+0x1a5/0x480
[   11.758935]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.758955]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   11.758977]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   11.758998]  ? __kthread_parkme+0x82/0x180
[   11.759016]  ? preempt_count_sub+0x50/0x80
[   11.759060]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.759082]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.759104]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   11.759125]  kthread+0x337/0x6f0
[   11.759143]  ? trace_preempt_on+0x20/0xc0
[   11.759164]  ? __pfx_kthread+0x10/0x10
[   11.759184]  ? _raw_spin_unlock_irq+0x47/0x80
[   11.759203]  ? calculate_sigpending+0x7b/0xa0
[   11.759225]  ? __pfx_kthread+0x10/0x10
[   11.759245]  ret_from_fork+0x116/0x1d0
[   11.759262]  ? __pfx_kthread+0x10/0x10
[   11.759281]  ret_from_fork_asm+0x1a/0x30
[   11.759374]  </TASK>
[   11.759386] 
[   11.767508] Allocated by task 205:
[   11.767770]  kasan_save_stack+0x45/0x70
[   11.767996]  kasan_save_track+0x18/0x40
[   11.768342]  kasan_save_alloc_info+0x3b/0x50
[   11.768759]  __kasan_kmalloc+0xb7/0xc0
[   11.769100]  __kmalloc_cache_noprof+0x189/0x420
[   11.769395]  kmalloc_uaf2+0xc6/0x520
[   11.769584]  kunit_try_run_case+0x1a5/0x480
[   11.769730]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.769913]  kthread+0x337/0x6f0
[   11.770113]  ret_from_fork+0x116/0x1d0
[   11.770393]  ret_from_fork_asm+0x1a/0x30
[   11.770624] 
[   11.770735] Freed by task 205:
[   11.770910]  kasan_save_stack+0x45/0x70
[   11.771208]  kasan_save_track+0x18/0x40
[   11.771378]  kasan_save_free_info+0x3f/0x60
[   11.771529]  __kasan_slab_free+0x56/0x70
[   11.771746]  kfree+0x222/0x3f0
[   11.771926]  kmalloc_uaf2+0x14c/0x520
[   11.772265]  kunit_try_run_case+0x1a5/0x480
[   11.772458]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.772730]  kthread+0x337/0x6f0
[   11.772912]  ret_from_fork+0x116/0x1d0
[   11.773157]  ret_from_fork_asm+0x1a/0x30
[   11.773477] 
[   11.773607] The buggy address belongs to the object at ffff88810310c080
[   11.773607]  which belongs to the cache kmalloc-64 of size 64
[   11.774116] The buggy address is located 40 bytes inside of
[   11.774116]  freed 64-byte region [ffff88810310c080, ffff88810310c0c0)
[   11.774791] 
[   11.774887] The buggy address belongs to the physical page:
[   11.775086] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10310c
[   11.775511] flags: 0x200000000000000(node=0|zone=2)
[   11.775759] page_type: f5(slab)
[   11.775919] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   11.776383] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   11.776752] page dumped because: kasan: bad access detected
[   11.777003] 
[   11.777106] Memory state around the buggy address:
[   11.777322]  ffff88810310bf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.777634]  ffff88810310c000: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   11.777891] >ffff88810310c080: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   11.778122]                                   ^
[   11.778490]  ffff88810310c100: 00 00 00 00 00 03 fc fc fc fc fc fc fc fc fc fc
[   11.778814]  ffff88810310c180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.779325] ==================================================================