Hay
Date
June 18, 2025, 6:43 a.m.

Environment
qemu-arm64
qemu-x86_64

[   21.225430] ==================================================================
[   21.225614] BUG: KASAN: slab-use-after-free in kmalloc_uaf2+0x3f4/0x468
[   21.225766] Read of size 1 at addr fff00000c0b94228 by task kunit_try_catch/198
[   21.225893] 
[   21.226879] CPU: 0 UID: 0 PID: 198 Comm: kunit_try_catch Tainted: G    B   W        N  6.16.0-rc2-next-20250618 #1 PREEMPT 
[   21.227698] Tainted: [B]=BAD_PAGE, [W]=WARN, [N]=TEST
[   21.227793] Hardware name: linux,dummy-virt (DT)
[   21.227939] Call trace:
[   21.227996]  show_stack+0x20/0x38 (C)
[   21.228379]  dump_stack_lvl+0x8c/0xd0
[   21.229468]  print_report+0x118/0x608
[   21.230053]  kasan_report+0xdc/0x128
[   21.230472]  __asan_report_load1_noabort+0x20/0x30
[   21.230911]  kmalloc_uaf2+0x3f4/0x468
[   21.231107]  kunit_try_run_case+0x170/0x3f0
[   21.231438]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   21.231712]  kthread+0x328/0x630
[   21.231872]  ret_from_fork+0x10/0x20
[   21.232003] 
[   21.232058] Allocated by task 198:
[   21.232134]  kasan_save_stack+0x3c/0x68
[   21.232505]  kasan_save_track+0x20/0x40
[   21.232854]  kasan_save_alloc_info+0x40/0x58
[   21.233505]  __kasan_kmalloc+0xd4/0xd8
[   21.234001]  __kmalloc_cache_noprof+0x16c/0x3c0
[   21.234250]  kmalloc_uaf2+0xc4/0x468
[   21.234388]  kunit_try_run_case+0x170/0x3f0
[   21.235094]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   21.235267]  kthread+0x328/0x630
[   21.235516]  ret_from_fork+0x10/0x20
[   21.235613] 
[   21.235656] Freed by task 198:
[   21.235721]  kasan_save_stack+0x3c/0x68
[   21.235807]  kasan_save_track+0x20/0x40
[   21.236748]  kasan_save_free_info+0x4c/0x78
[   21.237123]  __kasan_slab_free+0x6c/0x98
[   21.237740]  kfree+0x214/0x3c8
[   21.237959]  kmalloc_uaf2+0x134/0x468
[   21.238310]  kunit_try_run_case+0x170/0x3f0
[   21.238420]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   21.238726]  kthread+0x328/0x630
[   21.238961]  ret_from_fork+0x10/0x20
[   21.239459] 
[   21.239572] The buggy address belongs to the object at fff00000c0b94200
[   21.239572]  which belongs to the cache kmalloc-64 of size 64
[   21.239919] The buggy address is located 40 bytes inside of
[   21.239919]  freed 64-byte region [fff00000c0b94200, fff00000c0b94240)
[   21.240366] 
[   21.240571] The buggy address belongs to the physical page:
[   21.240657] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x100b94
[   21.241537] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   21.242053] page_type: f5(slab)
[   21.242163] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   21.242269] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   21.242330] page dumped because: kasan: bad access detected
[   21.242363] 
[   21.242381] Memory state around the buggy address:
[   21.242420]  fff00000c0b94100: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   21.242465]  fff00000c0b94180: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   21.242509] >fff00000c0b94200: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   21.242547]                                   ^
[   21.242581]  fff00000c0b94280: 00 00 00 00 00 03 fc fc fc fc fc fc fc fc fc fc
[   21.242624]  fff00000c0b94300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   21.242663] ==================================================================

[   11.436890] ==================================================================
[   11.437703] BUG: KASAN: slab-use-after-free in kmalloc_uaf2+0x4a8/0x520
[   11.437971] Read of size 1 at addr ffff88810387b4a8 by task kunit_try_catch/214
[   11.438283] 
[   11.438393] CPU: 1 UID: 0 PID: 214 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc2-next-20250618 #1 PREEMPT(voluntary) 
[   11.438450] Tainted: [B]=BAD_PAGE, [N]=TEST
[   11.438462] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   11.438481] Call Trace:
[   11.438493]  <TASK>
[   11.438507]  dump_stack_lvl+0x73/0xb0
[   11.438535]  print_report+0xd1/0x650
[   11.438565]  ? __virt_addr_valid+0x1db/0x2d0
[   11.438587]  ? kmalloc_uaf2+0x4a8/0x520
[   11.438605]  ? kasan_complete_mode_report_info+0x64/0x200
[   11.438700]  ? kmalloc_uaf2+0x4a8/0x520
[   11.438736]  kasan_report+0x141/0x180
[   11.438765]  ? kmalloc_uaf2+0x4a8/0x520
[   11.438788]  __asan_report_load1_noabort+0x18/0x20
[   11.438810]  kmalloc_uaf2+0x4a8/0x520
[   11.438839]  ? __pfx_kmalloc_uaf2+0x10/0x10
[   11.438857]  ? finish_task_switch.isra.0+0x153/0x700
[   11.438878]  ? __switch_to+0x47/0xf50
[   11.438903]  ? __schedule+0x10cc/0x2b60
[   11.438924]  ? __pfx_read_tsc+0x10/0x10
[   11.438944]  ? ktime_get_ts64+0x86/0x230
[   11.438968]  kunit_try_run_case+0x1a5/0x480
[   11.438990]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.439011]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   11.439033]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   11.439053]  ? __kthread_parkme+0x82/0x180
[   11.439072]  ? preempt_count_sub+0x50/0x80
[   11.439093]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.439124]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.439145]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   11.439166]  kthread+0x337/0x6f0
[   11.439194]  ? trace_preempt_on+0x20/0xc0
[   11.439232]  ? __pfx_kthread+0x10/0x10
[   11.439252]  ? _raw_spin_unlock_irq+0x47/0x80
[   11.439271]  ? calculate_sigpending+0x7b/0xa0
[   11.439304]  ? __pfx_kthread+0x10/0x10
[   11.439324]  ret_from_fork+0x116/0x1d0
[   11.439341]  ? __pfx_kthread+0x10/0x10
[   11.439368]  ret_from_fork_asm+0x1a/0x30
[   11.439396]  </TASK>
[   11.439407] 
[   11.447199] Allocated by task 214:
[   11.447382]  kasan_save_stack+0x45/0x70
[   11.447730]  kasan_save_track+0x18/0x40
[   11.447942]  kasan_save_alloc_info+0x3b/0x50
[   11.448111]  __kasan_kmalloc+0xb7/0xc0
[   11.448245]  __kmalloc_cache_noprof+0x189/0x420
[   11.448409]  kmalloc_uaf2+0xc6/0x520
[   11.448579]  kunit_try_run_case+0x1a5/0x480
[   11.448991]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.449300]  kthread+0x337/0x6f0
[   11.449463]  ret_from_fork+0x116/0x1d0
[   11.449696]  ret_from_fork_asm+0x1a/0x30
[   11.449898] 
[   11.449962] Freed by task 214:
[   11.450063]  kasan_save_stack+0x45/0x70
[   11.450292]  kasan_save_track+0x18/0x40
[   11.450666]  kasan_save_free_info+0x3f/0x60
[   11.450873]  __kasan_slab_free+0x56/0x70
[   11.451086]  kfree+0x222/0x3f0
[   11.451243]  kmalloc_uaf2+0x14c/0x520
[   11.451414]  kunit_try_run_case+0x1a5/0x480
[   11.451677]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.451945]  kthread+0x337/0x6f0
[   11.452104]  ret_from_fork+0x116/0x1d0
[   11.452285]  ret_from_fork_asm+0x1a/0x30
[   11.452697] 
[   11.452795] The buggy address belongs to the object at ffff88810387b480
[   11.452795]  which belongs to the cache kmalloc-64 of size 64
[   11.453335] The buggy address is located 40 bytes inside of
[   11.453335]  freed 64-byte region [ffff88810387b480, ffff88810387b4c0)
[   11.453923] 
[   11.453994] The buggy address belongs to the physical page:
[   11.454161] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10387b
[   11.454406] flags: 0x200000000000000(node=0|zone=2)
[   11.454584] page_type: f5(slab)
[   11.454818] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   11.455146] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   11.455597] page dumped because: kasan: bad access detected
[   11.455758] 
[   11.455818] Memory state around the buggy address:
[   11.455963]  ffff88810387b380: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   11.456350]  ffff88810387b400: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   11.456669] >ffff88810387b480: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   11.457143]                                   ^
[   11.457464]  ffff88810387b500: 00 00 00 00 00 03 fc fc fc fc fc fc fc fc fc fc
[   11.457915]  ffff88810387b580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.458237] ==================================================================