Hay
Date
June 7, 2025, 10:40 a.m.

Environment
qemu-arm64
qemu-x86_64

[   22.451857] ==================================================================
[   22.452046] BUG: KASAN: slab-use-after-free in kmalloc_uaf_16+0x3bc/0x438
[   22.452202] Read of size 16 at addr fff00000c5722380 by task kunit_try_catch/172
[   22.452304] 
[   22.452385] CPU: 1 UID: 0 PID: 172 Comm: kunit_try_catch Tainted: G    B            N  6.15.2-rc1 #1 PREEMPT 
[   22.452597] Tainted: [B]=BAD_PAGE, [N]=TEST
[   22.452665] Hardware name: linux,dummy-virt (DT)
[   22.452746] Call trace:
[   22.452803]  show_stack+0x20/0x38 (C)
[   22.452929]  dump_stack_lvl+0x8c/0xd0
[   22.453048]  print_report+0x118/0x608
[   22.453166]  kasan_report+0xdc/0x128
[   22.453277]  __asan_report_load16_noabort+0x20/0x30
[   22.453425]  kmalloc_uaf_16+0x3bc/0x438
[   22.453531]  kunit_try_run_case+0x170/0x3f0
[   22.453920]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   22.454109]  kthread+0x328/0x630
[   22.454271]  ret_from_fork+0x10/0x20
[   22.454442] 
[   22.454487] Allocated by task 172:
[   22.454586]  kasan_save_stack+0x3c/0x68
[   22.454733]  kasan_save_track+0x20/0x40
[   22.454854]  kasan_save_alloc_info+0x40/0x58
[   22.454983]  __kasan_kmalloc+0xd4/0xd8
[   22.455097]  __kmalloc_cache_noprof+0x16c/0x3c0
[   22.455201]  kmalloc_uaf_16+0x140/0x438
[   22.455340]  kunit_try_run_case+0x170/0x3f0
[   22.455492]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   22.455939]  kthread+0x328/0x630
[   22.456379]  ret_from_fork+0x10/0x20
[   22.456565] 
[   22.456618] Freed by task 172:
[   22.456676]  kasan_save_stack+0x3c/0x68
[   22.456748]  kasan_save_track+0x20/0x40
[   22.456816]  kasan_save_free_info+0x4c/0x78
[   22.456901]  __kasan_slab_free+0x6c/0x98
[   22.457042]  kfree+0x214/0x3c8
[   22.457181]  kmalloc_uaf_16+0x190/0x438
[   22.457275]  kunit_try_run_case+0x170/0x3f0
[   22.457371]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   22.457494]  kthread+0x328/0x630
[   22.457589]  ret_from_fork+0x10/0x20
[   22.457717] 
[   22.457788] The buggy address belongs to the object at fff00000c5722380
[   22.457788]  which belongs to the cache kmalloc-16 of size 16
[   22.457945] The buggy address is located 0 bytes inside of
[   22.457945]  freed 16-byte region [fff00000c5722380, fff00000c5722390)
[   22.458114] 
[   22.458182] The buggy address belongs to the physical page:
[   22.458264] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105722
[   22.458442] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   22.458556] page_type: f5(slab)
[   22.458650] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   22.458783] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   22.459352] page dumped because: kasan: bad access detected
[   22.459872] 
[   22.459943] Memory state around the buggy address:
[   22.460079]  fff00000c5722280: fa fb fc fc fa fb fc fc fa fb fc fc 00 04 fc fc
[   22.460350]  fff00000c5722300: fa fb fc fc fa fb fc fc fa fb fc fc 00 00 fc fc
[   22.460606] >fff00000c5722380: fa fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.460711]                    ^
[   22.460945]  fff00000c5722400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.461310]  fff00000c5722480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.461794] ==================================================================

[   13.701485] ==================================================================
[   13.701929] BUG: KASAN: slab-use-after-free in kmalloc_uaf_16+0x47b/0x4c0
[   13.702117] Read of size 16 at addr ffff888102497600 by task kunit_try_catch/188
[   13.702268] 
[   13.702355] CPU: 0 UID: 0 PID: 188 Comm: kunit_try_catch Tainted: G    B            N  6.15.2-rc1 #1 PREEMPT(voluntary) 
[   13.702418] Tainted: [B]=BAD_PAGE, [N]=TEST
[   13.702433] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   13.702457] Call Trace:
[   13.702474]  <TASK>
[   13.702496]  dump_stack_lvl+0x73/0xb0
[   13.702530]  print_report+0xd1/0x650
[   13.702575]  ? __virt_addr_valid+0x1db/0x2d0
[   13.702617]  ? kmalloc_uaf_16+0x47b/0x4c0
[   13.702653]  ? kasan_complete_mode_report_info+0x64/0x200
[   13.703173]  ? kmalloc_uaf_16+0x47b/0x4c0
[   13.703214]  kasan_report+0x141/0x180
[   13.703243]  ? kmalloc_uaf_16+0x47b/0x4c0
[   13.703295]  __asan_report_load16_noabort+0x18/0x20
[   13.703336]  kmalloc_uaf_16+0x47b/0x4c0
[   13.703382]  ? __pfx_kmalloc_uaf_16+0x10/0x10
[   13.703427]  ? __schedule+0x10cc/0x2b30
[   13.703477]  ? __pfx_read_tsc+0x10/0x10
[   13.703521]  ? ktime_get_ts64+0x86/0x230
[   13.703587]  kunit_try_run_case+0x1a5/0x480
[   13.703632]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.703664]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   13.704230]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   13.704259]  ? __kthread_parkme+0x82/0x180
[   13.704287]  ? preempt_count_sub+0x50/0x80
[   13.704317]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.704344]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.704370]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   13.704395]  kthread+0x337/0x6f0
[   13.704415]  ? trace_preempt_on+0x20/0xc0
[   13.704442]  ? __pfx_kthread+0x10/0x10
[   13.704461]  ? _raw_spin_unlock_irq+0x47/0x80
[   13.704484]  ? calculate_sigpending+0x7b/0xa0
[   13.704509]  ? __pfx_kthread+0x10/0x10
[   13.704530]  ret_from_fork+0x41/0x80
[   13.704553]  ? __pfx_kthread+0x10/0x10
[   13.704600]  ret_from_fork_asm+0x1a/0x30
[   13.704633]  </TASK>
[   13.704651] 
[   13.715781] Allocated by task 188:
[   13.716033]  kasan_save_stack+0x45/0x70
[   13.716477]  kasan_save_track+0x18/0x40
[   13.716909]  kasan_save_alloc_info+0x3b/0x50
[   13.717135]  __kasan_kmalloc+0xb7/0xc0
[   13.717518]  __kmalloc_cache_noprof+0x189/0x420
[   13.717935]  kmalloc_uaf_16+0x15b/0x4c0
[   13.718322]  kunit_try_run_case+0x1a5/0x480
[   13.718742]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.718991]  kthread+0x337/0x6f0
[   13.719177]  ret_from_fork+0x41/0x80
[   13.719374]  ret_from_fork_asm+0x1a/0x30
[   13.719584] 
[   13.719892] Freed by task 188:
[   13.720203]  kasan_save_stack+0x45/0x70
[   13.720543]  kasan_save_track+0x18/0x40
[   13.720952]  kasan_save_free_info+0x3f/0x60
[   13.721303]  __kasan_slab_free+0x56/0x70
[   13.721788]  kfree+0x222/0x3f0
[   13.722143]  kmalloc_uaf_16+0x1d6/0x4c0
[   13.722485]  kunit_try_run_case+0x1a5/0x480
[   13.722881]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.723420]  kthread+0x337/0x6f0
[   13.723752]  ret_from_fork+0x41/0x80
[   13.723954]  ret_from_fork_asm+0x1a/0x30
[   13.724148] 
[   13.724264] The buggy address belongs to the object at ffff888102497600
[   13.724264]  which belongs to the cache kmalloc-16 of size 16
[   13.725461] The buggy address is located 0 bytes inside of
[   13.725461]  freed 16-byte region [ffff888102497600, ffff888102497610)
[   13.726412] 
[   13.726707] The buggy address belongs to the physical page:
[   13.727176] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102497
[   13.727722] flags: 0x200000000000000(node=0|zone=2)
[   13.727971] page_type: f5(slab)
[   13.728273] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   13.728963] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   13.729535] page dumped because: kasan: bad access detected
[   13.730049] 
[   13.730232] Memory state around the buggy address:
[   13.730489]  ffff888102497500: 00 01 fc fc 00 01 fc fc fa fb fc fc fa fb fc fc
[   13.731119]  ffff888102497580: 00 05 fc fc fa fb fc fc fa fb fc fc 00 00 fc fc
[   13.731574] >ffff888102497600: fa fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   13.732139]                    ^
[   13.732528]  ffff888102497680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   13.733008]  ffff888102497700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   13.733458] ==================================================================