Hay
Date
May 23, 2025, 11:07 p.m.

Environment
qemu-arm64
qemu-x86_64

[   27.438418] ==================================================================
[   27.438628] BUG: KASAN: slab-use-after-free in kmalloc_uaf_16+0x3bc/0x438
[   27.438792] Read of size 16 at addr fff00000c5a2a6c0 by task kunit_try_catch/170
[   27.438938] 
[   27.439029] CPU: 0 UID: 0 PID: 170 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc7 #1 PREEMPT 
[   27.439264] Tainted: [B]=BAD_PAGE, [N]=TEST
[   27.439342] Hardware name: linux,dummy-virt (DT)
[   27.440146] Call trace:
[   27.440263]  show_stack+0x20/0x38 (C)
[   27.440903]  dump_stack_lvl+0x8c/0xd0
[   27.441328]  print_report+0x118/0x608
[   27.441960]  kasan_report+0xdc/0x128
[   27.442114]  __asan_report_load16_noabort+0x20/0x30
[   27.442263]  kmalloc_uaf_16+0x3bc/0x438
[   27.442401]  kunit_try_run_case+0x170/0x3f0
[   27.442562]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   27.443223]  kthread+0x328/0x630
[   27.443536]  ret_from_fork+0x10/0x20
[   27.443781] 
[   27.443836] Allocated by task 170:
[   27.444019]  kasan_save_stack+0x3c/0x68
[   27.444247]  kasan_save_track+0x20/0x40
[   27.444828]  kasan_save_alloc_info+0x40/0x58
[   27.445047]  __kasan_kmalloc+0xd4/0xd8
[   27.445178]  __kmalloc_cache_noprof+0x15c/0x3c0
[   27.445387]  kmalloc_uaf_16+0x140/0x438
[   27.445526]  kunit_try_run_case+0x170/0x3f0
[   27.445643]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   27.445867]  kthread+0x328/0x630
[   27.445979]  ret_from_fork+0x10/0x20
[   27.447240] 
[   27.447924] Freed by task 170:
[   27.448025]  kasan_save_stack+0x3c/0x68
[   27.448155]  kasan_save_track+0x20/0x40
[   27.448261]  kasan_save_free_info+0x4c/0x78
[   27.448372]  __kasan_slab_free+0x6c/0x98
[   27.448492]  kfree+0x214/0x3c8
[   27.448595]  kmalloc_uaf_16+0x190/0x438
[   27.448685]  kunit_try_run_case+0x170/0x3f0
[   27.448768]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   27.449235]  kthread+0x328/0x630
[   27.450047]  ret_from_fork+0x10/0x20
[   27.450434] 
[   27.450514] The buggy address belongs to the object at fff00000c5a2a6c0
[   27.450514]  which belongs to the cache kmalloc-16 of size 16
[   27.450700] The buggy address is located 0 bytes inside of
[   27.450700]  freed 16-byte region [fff00000c5a2a6c0, fff00000c5a2a6d0)
[   27.450879] 
[   27.452320] The buggy address belongs to the physical page:
[   27.452421] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105a2a
[   27.452605] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   27.452751] page_type: f5(slab)
[   27.452861] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   27.453009] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   27.453831] page dumped because: kasan: bad access detected
[   27.453993] 
[   27.454050] Memory state around the buggy address:
[   27.454211]  fff00000c5a2a580: fa fb fc fc fa fb fc fc fa fb fc fc 00 01 fc fc
[   27.454353]  fff00000c5a2a600: 00 01 fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   27.454689] >fff00000c5a2a680: fa fb fc fc 00 00 fc fc fa fb fc fc fc fc fc fc
[   27.455200]                                            ^
[   27.455364]  fff00000c5a2a700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   27.455519]  fff00000c5a2a780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   27.455635] ==================================================================

[   12.600730] ==================================================================
[   12.601327] BUG: KASAN: slab-use-after-free in kmalloc_uaf_16+0x47b/0x4c0
[   12.601632] Read of size 16 at addr ffff8881020cbe40 by task kunit_try_catch/187
[   12.602054] 
[   12.602175] CPU: 0 UID: 0 PID: 187 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc7 #1 PREEMPT(voluntary) 
[   12.602223] Tainted: [B]=BAD_PAGE, [N]=TEST
[   12.602235] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   12.602257] Call Trace:
[   12.602272]  <TASK>
[   12.602302]  dump_stack_lvl+0x73/0xb0
[   12.602331]  print_report+0xd1/0x650
[   12.602353]  ? __virt_addr_valid+0x1db/0x2d0
[   12.602375]  ? kmalloc_uaf_16+0x47b/0x4c0
[   12.602395]  ? kasan_complete_mode_report_info+0x64/0x200
[   12.602417]  ? kmalloc_uaf_16+0x47b/0x4c0
[   12.602438]  kasan_report+0x141/0x180
[   12.602460]  ? kmalloc_uaf_16+0x47b/0x4c0
[   12.602485]  __asan_report_load16_noabort+0x18/0x20
[   12.602506]  kmalloc_uaf_16+0x47b/0x4c0
[   12.602527]  ? __pfx_kmalloc_uaf_16+0x10/0x10
[   12.602548]  ? __schedule+0x2077/0x2b30
[   12.602570]  ? __pfx_read_tsc+0x10/0x10
[   12.602589]  ? ktime_get_ts64+0x86/0x230
[   12.602616]  kunit_try_run_case+0x1a5/0x480
[   12.602641]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.602667]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   12.602689]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   12.602711]  ? __kthread_parkme+0x82/0x180
[   12.602733]  ? preempt_count_sub+0x50/0x80
[   12.602758]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.602780]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.602802]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   12.602824]  kthread+0x337/0x6f0
[   12.602840]  ? trace_preempt_on+0x20/0xc0
[   12.602873]  ? __pfx_kthread+0x10/0x10
[   12.602891]  ? _raw_spin_unlock_irq+0x47/0x80
[   12.602917]  ? calculate_sigpending+0x7b/0xa0
[   12.602938]  ? __pfx_kthread+0x10/0x10
[   12.602956]  ret_from_fork+0x41/0x80
[   12.602976]  ? __pfx_kthread+0x10/0x10
[   12.602993]  ret_from_fork_asm+0x1a/0x30
[   12.603024]  </TASK>
[   12.603036] 
[   12.610346] Allocated by task 187:
[   12.610530]  kasan_save_stack+0x45/0x70
[   12.610750]  kasan_save_track+0x18/0x40
[   12.611011]  kasan_save_alloc_info+0x3b/0x50
[   12.611199]  __kasan_kmalloc+0xb7/0xc0
[   12.611346]  __kmalloc_cache_noprof+0x189/0x420
[   12.611629]  kmalloc_uaf_16+0x15b/0x4c0
[   12.611827]  kunit_try_run_case+0x1a5/0x480
[   12.612062]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.612235]  kthread+0x337/0x6f0
[   12.612443]  ret_from_fork+0x41/0x80
[   12.612865]  ret_from_fork_asm+0x1a/0x30
[   12.613234] 
[   12.613327] Freed by task 187:
[   12.613441]  kasan_save_stack+0x45/0x70
[   12.613638]  kasan_save_track+0x18/0x40
[   12.613867]  kasan_save_free_info+0x3f/0x60
[   12.614074]  __kasan_slab_free+0x56/0x70
[   12.614372]  kfree+0x222/0x3f0
[   12.614546]  kmalloc_uaf_16+0x1d6/0x4c0
[   12.614724]  kunit_try_run_case+0x1a5/0x480
[   12.614870]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.615043]  kthread+0x337/0x6f0
[   12.615161]  ret_from_fork+0x41/0x80
[   12.615358]  ret_from_fork_asm+0x1a/0x30
[   12.615554] 
[   12.615649] The buggy address belongs to the object at ffff8881020cbe40
[   12.615649]  which belongs to the cache kmalloc-16 of size 16
[   12.616210] The buggy address is located 0 bytes inside of
[   12.616210]  freed 16-byte region [ffff8881020cbe40, ffff8881020cbe50)
[   12.616573] 
[   12.616648] The buggy address belongs to the physical page:
[   12.617205] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1020cb
[   12.617782] flags: 0x200000000000000(node=0|zone=2)
[   12.618020] page_type: f5(slab)
[   12.618189] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   12.618458] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   12.618691] page dumped because: kasan: bad access detected
[   12.619107] 
[   12.619205] Memory state around the buggy address:
[   12.619440]  ffff8881020cbd00: 00 02 fc fc 00 02 fc fc 00 02 fc fc 00 02 fc fc
[   12.619716]  ffff8881020cbd80: fa fb fc fc fa fb fc fc fa fb fc fc 00 05 fc fc
[   12.620201] >ffff8881020cbe00: fa fb fc fc 00 00 fc fc fa fb fc fc fc fc fc fc
[   12.620531]                                            ^
[   12.620767]  ffff8881020cbe80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.621101]  ffff8881020cbf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.621407] ==================================================================