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

Environment
qemu-arm64
qemu-x86_64

[   31.295112] ==================================================================
[   31.295489] BUG: KASAN: slab-use-after-free in kmalloc_uaf2+0x3f4/0x468
[   31.295807] Read of size 1 at addr fff00000c9acb728 by task kunit_try_catch/219
[   31.295860] 
[   31.295899] CPU: 0 UID: 0 PID: 219 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5-next-20250708 #1 PREEMPT 
[   31.295988] Tainted: [B]=BAD_PAGE, [N]=TEST
[   31.296022] Hardware name: linux,dummy-virt (DT)
[   31.296159] Call trace:
[   31.296371]  show_stack+0x20/0x38 (C)
[   31.296711]  dump_stack_lvl+0x8c/0xd0
[   31.297104]  print_report+0x118/0x5d0
[   31.297164]  kasan_report+0xdc/0x128
[   31.297226]  __asan_report_load1_noabort+0x20/0x30
[   31.297277]  kmalloc_uaf2+0x3f4/0x468
[   31.297383]  kunit_try_run_case+0x170/0x3f0
[   31.297916]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.297998]  kthread+0x328/0x630
[   31.298315]  ret_from_fork+0x10/0x20
[   31.298549] 
[   31.298720] Allocated by task 219:
[   31.298775]  kasan_save_stack+0x3c/0x68
[   31.298839]  kasan_save_track+0x20/0x40
[   31.298902]  kasan_save_alloc_info+0x40/0x58
[   31.298940]  __kasan_kmalloc+0xd4/0xd8
[   31.298976]  __kmalloc_cache_noprof+0x16c/0x3c0
[   31.299017]  kmalloc_uaf2+0xc4/0x468
[   31.299054]  kunit_try_run_case+0x170/0x3f0
[   31.299390]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.299607]  kthread+0x328/0x630
[   31.299701]  ret_from_fork+0x10/0x20
[   31.299751] 
[   31.299811] Freed by task 219:
[   31.299838]  kasan_save_stack+0x3c/0x68
[   31.299907]  kasan_save_track+0x20/0x40
[   31.300047]  kasan_save_free_info+0x4c/0x78
[   31.300084]  __kasan_slab_free+0x6c/0x98
[   31.300123]  kfree+0x214/0x3c8
[   31.300198]  kmalloc_uaf2+0x134/0x468
[   31.300251]  kunit_try_run_case+0x170/0x3f0
[   31.300290]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.300388]  kthread+0x328/0x630
[   31.300842]  ret_from_fork+0x10/0x20
[   31.300962] 
[   31.300992] The buggy address belongs to the object at fff00000c9acb700
[   31.300992]  which belongs to the cache kmalloc-64 of size 64
[   31.301071] The buggy address is located 40 bytes inside of
[   31.301071]  freed 64-byte region [fff00000c9acb700, fff00000c9acb740)
[   31.301524] 
[   31.301553] The buggy address belongs to the physical page:
[   31.301584] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x109acb
[   31.301655] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   31.301709] page_type: f5(slab)
[   31.302086] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   31.302147] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   31.302231] page dumped because: kasan: bad access detected
[   31.302264] 
[   31.302284] Memory state around the buggy address:
[   31.302480]  fff00000c9acb600: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   31.302758]  fff00000c9acb680: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   31.302803] >fff00000c9acb700: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   31.302841]                                   ^
[   31.302874]  fff00000c9acb780: 00 00 00 00 00 03 fc fc fc fc fc fc fc fc fc fc
[   31.303004]  fff00000c9acb800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.303266] ==================================================================

[   23.655210] ==================================================================
[   23.655734] BUG: KASAN: slab-use-after-free in kmalloc_uaf2+0x4a8/0x520
[   23.656402] Read of size 1 at addr ffff8881062ac028 by task kunit_try_catch/236
[   23.656738] 
[   23.656837] CPU: 1 UID: 0 PID: 236 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5-next-20250708 #1 PREEMPT(voluntary) 
[   23.656894] Tainted: [B]=BAD_PAGE, [N]=TEST
[   23.657252] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   23.657283] Call Trace:
[   23.657297]  <TASK>
[   23.657319]  dump_stack_lvl+0x73/0xb0
[   23.657357]  print_report+0xd1/0x610
[   23.657382]  ? __virt_addr_valid+0x1db/0x2d0
[   23.657410]  ? kmalloc_uaf2+0x4a8/0x520
[   23.657430]  ? kasan_complete_mode_report_info+0x64/0x200
[   23.657458]  ? kmalloc_uaf2+0x4a8/0x520
[   23.657479]  kasan_report+0x141/0x180
[   23.657501]  ? kmalloc_uaf2+0x4a8/0x520
[   23.657526]  __asan_report_load1_noabort+0x18/0x20
[   23.657552]  kmalloc_uaf2+0x4a8/0x520
[   23.657573]  ? __pfx_kmalloc_uaf2+0x10/0x10
[   23.657593]  ? finish_task_switch.isra.0+0x153/0x700
[   23.657617]  ? __switch_to+0x47/0xf50
[   23.657647]  ? __schedule+0x10cc/0x2b60
[   23.657677]  ? __pfx_read_tsc+0x10/0x10
[   23.657702]  ? ktime_get_ts64+0x86/0x230
[   23.657731]  kunit_try_run_case+0x1a5/0x480
[   23.657829]  ? __pfx_kunit_try_run_case+0x10/0x10
[   23.657857]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   23.657880]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   23.657909]  ? __kthread_parkme+0x82/0x180
[   23.657931]  ? preempt_count_sub+0x50/0x80
[   23.657954]  ? __pfx_kunit_try_run_case+0x10/0x10
[   23.657976]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   23.658004]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   23.658031]  kthread+0x337/0x6f0
[   23.658053]  ? trace_preempt_on+0x20/0xc0
[   23.658080]  ? __pfx_kthread+0x10/0x10
[   23.658104]  ? _raw_spin_unlock_irq+0x47/0x80
[   23.658131]  ? calculate_sigpending+0x7b/0xa0
[   23.658159]  ? __pfx_kthread+0x10/0x10
[   23.658183]  ret_from_fork+0x116/0x1d0
[   23.658202]  ? __pfx_kthread+0x10/0x10
[   23.658225]  ret_from_fork_asm+0x1a/0x30
[   23.658272]  </TASK>
[   23.658285] 
[   23.665653] Allocated by task 236:
[   23.665800]  kasan_save_stack+0x45/0x70
[   23.665989]  kasan_save_track+0x18/0x40
[   23.666162]  kasan_save_alloc_info+0x3b/0x50
[   23.666317]  __kasan_kmalloc+0xb7/0xc0
[   23.666442]  __kmalloc_cache_noprof+0x189/0x420
[   23.666609]  kmalloc_uaf2+0xc6/0x520
[   23.666777]  kunit_try_run_case+0x1a5/0x480
[   23.666971]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   23.667320]  kthread+0x337/0x6f0
[   23.667488]  ret_from_fork+0x116/0x1d0
[   23.667614]  ret_from_fork_asm+0x1a/0x30
[   23.667748] 
[   23.667811] Freed by task 236:
[   23.667914]  kasan_save_stack+0x45/0x70
[   23.668085]  kasan_save_track+0x18/0x40
[   23.668276]  kasan_save_free_info+0x3f/0x60
[   23.668610]  __kasan_slab_free+0x56/0x70
[   23.668816]  kfree+0x222/0x3f0
[   23.669313]  kmalloc_uaf2+0x14c/0x520
[   23.669478]  kunit_try_run_case+0x1a5/0x480
[   23.669646]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   23.670000]  kthread+0x337/0x6f0
[   23.670124]  ret_from_fork+0x116/0x1d0
[   23.670263]  ret_from_fork_asm+0x1a/0x30
[   23.670397] 
[   23.670463] The buggy address belongs to the object at ffff8881062ac000
[   23.670463]  which belongs to the cache kmalloc-64 of size 64
[   23.671312] The buggy address is located 40 bytes inside of
[   23.671312]  freed 64-byte region [ffff8881062ac000, ffff8881062ac040)
[   23.671832] 
[   23.671923] The buggy address belongs to the physical page:
[   23.672093] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1062ac
[   23.672477] flags: 0x200000000000000(node=0|zone=2)
[   23.672719] page_type: f5(slab)
[   23.673035] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   23.673277] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   23.673856] page dumped because: kasan: bad access detected
[   23.674130] 
[   23.674219] Memory state around the buggy address:
[   23.674453]  ffff8881062abf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.674730]  ffff8881062abf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.675112] >ffff8881062ac000: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   23.675359]                                   ^
[   23.675503]  ffff8881062ac080: 00 00 00 00 00 03 fc fc fc fc fc fc fc fc fc fc
[   23.675878]  ffff8881062ac100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.676193] ==================================================================