Hay
Date
March 19, 2025, 10:35 a.m.

Environment
qemu-arm64
qemu-x86_64

[   34.499710] ==================================================================
[   34.499870] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   34.500025] Write of size 33 at addr fff00000c5d89c00 by task kunit_try_catch/188
[   34.501976] 
[   34.503044] CPU: 1 UID: 0 PID: 188 Comm: kunit_try_catch Tainted: G    B            N  6.14.0-rc7-next-20250319 #1 PREEMPT 
[   34.504820] Tainted: [B]=BAD_PAGE, [N]=TEST
[   34.505477] Hardware name: linux,dummy-virt (DT)
[   34.505779] Call trace:
[   34.506046]  show_stack+0x20/0x38 (C)
[   34.506834]  dump_stack_lvl+0x8c/0xd0
[   34.507563]  print_report+0x118/0x5f0
[   34.508272]  kasan_report+0xc8/0x118
[   34.509550]  kasan_check_range+0x100/0x1a8
[   34.509819]  __asan_memset+0x34/0x78
[   34.509967]  kmalloc_uaf_memset+0x170/0x310
[   34.510145]  kunit_try_run_case+0x14c/0x3d0
[   34.510785]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   34.511886]  kthread+0x318/0x618
[   34.512583]  ret_from_fork+0x10/0x20
[   34.513281] 
[   34.513605] Allocated by task 188:
[   34.513701]  kasan_save_stack+0x3c/0x68
[   34.514558]  kasan_save_track+0x20/0x40
[   34.514693]  kasan_save_alloc_info+0x40/0x58
[   34.515425]  __kasan_kmalloc+0xd4/0xd8
[   34.515869]  __kmalloc_cache_noprof+0x15c/0x3c0
[   34.516832]  kmalloc_uaf_memset+0xb8/0x310
[   34.516985]  kunit_try_run_case+0x14c/0x3d0
[   34.517860]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   34.518398]  kthread+0x318/0x618
[   34.518547]  ret_from_fork+0x10/0x20
[   34.518668] 
[   34.518729] Freed by task 188:
[   34.519415]  kasan_save_stack+0x3c/0x68
[   34.519784]  kasan_save_track+0x20/0x40
[   34.520648]  kasan_save_free_info+0x4c/0x78
[   34.521617]  __kasan_slab_free+0x6c/0x98
[   34.521831]  kfree+0x214/0x3c8
[   34.522208]  kmalloc_uaf_memset+0x11c/0x310
[   34.522686]  kunit_try_run_case+0x14c/0x3d0
[   34.522990]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   34.523757]  kthread+0x318/0x618
[   34.524689]  ret_from_fork+0x10/0x20
[   34.525314] 
[   34.525590] The buggy address belongs to the object at fff00000c5d89c00
[   34.525590]  which belongs to the cache kmalloc-64 of size 64
[   34.526081] The buggy address is located 0 bytes inside of
[   34.526081]  freed 64-byte region [fff00000c5d89c00, fff00000c5d89c40)
[   34.526299] 
[   34.526373] The buggy address belongs to the physical page:
[   34.527396] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105d89
[   34.528268] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   34.528459] page_type: f5(slab)
[   34.528583] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   34.528746] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   34.529506] page dumped because: kasan: bad access detected
[   34.529867] 
[   34.530163] Memory state around the buggy address:
[   34.530320]  fff00000c5d89b00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   34.530464]  fff00000c5d89b80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   34.530606] >fff00000c5d89c00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   34.530728]                    ^
[   34.530815]  fff00000c5d89c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   34.531032]  fff00000c5d89d00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   34.531230] ==================================================================

[   22.197388] ==================================================================
[   22.198426] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   22.199386] Write of size 33 at addr ffff88810305ca80 by task kunit_try_catch/207
[   22.200379] 
[   22.200600] CPU: 0 UID: 0 PID: 207 Comm: kunit_try_catch Tainted: G    B            N  6.14.0-rc7-next-20250319 #1 PREEMPT(voluntary) 
[   22.200769] Tainted: [B]=BAD_PAGE, [N]=TEST
[   22.200809] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   22.200867] Call Trace:
[   22.200956]  <TASK>
[   22.201023]  dump_stack_lvl+0x73/0xb0
[   22.201132]  print_report+0xd1/0x660
[   22.201204]  ? __virt_addr_valid+0x1db/0x2d0
[   22.201324]  ? kasan_complete_mode_report_info+0x64/0x200
[   22.201397]  kasan_report+0x104/0x140
[   22.201638]  ? kmalloc_uaf_memset+0x1a3/0x360
[   22.201916]  ? kmalloc_uaf_memset+0x1a3/0x360
[   22.202062]  kasan_check_range+0x10c/0x1c0
[   22.202188]  __asan_memset+0x27/0x50
[   22.202256]  kmalloc_uaf_memset+0x1a3/0x360
[   22.202314]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   22.202354]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   22.202394]  kunit_try_run_case+0x1b2/0x490
[   22.202434]  ? __pfx_kunit_try_run_case+0x10/0x10
[   22.202465]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   22.202497]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   22.202529]  ? __kthread_parkme+0x82/0x160
[   22.202561]  ? preempt_count_sub+0x50/0x80
[   22.202597]  ? __pfx_kunit_try_run_case+0x10/0x10
[   22.202631]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   22.202664]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   22.202773]  kthread+0x323/0x710
[   22.202864]  ? trace_preempt_on+0x20/0xc0
[   22.202908]  ? __pfx_kthread+0x10/0x10
[   22.202940]  ? _raw_spin_unlock_irq+0x47/0x80
[   22.202971]  ? calculate_sigpending+0x7b/0xa0
[   22.203003]  ? __pfx_kthread+0x10/0x10
[   22.203036]  ret_from_fork+0x41/0x80
[   22.203068]  ? __pfx_kthread+0x10/0x10
[   22.203099]  ret_from_fork_asm+0x1a/0x30
[   22.203172]  </TASK>
[   22.203189] 
[   22.218927] Allocated by task 207:
[   22.219407]  kasan_save_stack+0x3d/0x60
[   22.219830]  kasan_save_track+0x18/0x40
[   22.220291]  kasan_save_alloc_info+0x3b/0x50
[   22.220689]  __kasan_kmalloc+0xb7/0xc0
[   22.220963]  __kmalloc_cache_noprof+0x183/0x410
[   22.221651]  kmalloc_uaf_memset+0xa9/0x360
[   22.222293]  kunit_try_run_case+0x1b2/0x490
[   22.223004]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   22.223645]  kthread+0x323/0x710
[   22.224242]  ret_from_fork+0x41/0x80
[   22.224909]  ret_from_fork_asm+0x1a/0x30
[   22.225423] 
[   22.225892] Freed by task 207:
[   22.226268]  kasan_save_stack+0x3d/0x60
[   22.226632]  kasan_save_track+0x18/0x40
[   22.227170]  kasan_save_free_info+0x3f/0x60
[   22.227861]  __kasan_slab_free+0x56/0x70
[   22.228360]  kfree+0x222/0x3f0
[   22.228939]  kmalloc_uaf_memset+0x12b/0x360
[   22.229411]  kunit_try_run_case+0x1b2/0x490
[   22.230100]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   22.231014]  kthread+0x323/0x710
[   22.231380]  ret_from_fork+0x41/0x80
[   22.232128]  ret_from_fork_asm+0x1a/0x30
[   22.232532] 
[   22.233038] The buggy address belongs to the object at ffff88810305ca80
[   22.233038]  which belongs to the cache kmalloc-64 of size 64
[   22.234196] The buggy address is located 0 bytes inside of
[   22.234196]  freed 64-byte region [ffff88810305ca80, ffff88810305cac0)
[   22.235312] 
[   22.235538] The buggy address belongs to the physical page:
[   22.236358] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10305c
[   22.237304] flags: 0x200000000000000(node=0|zone=2)
[   22.237959] page_type: f5(slab)
[   22.238392] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   22.239335] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   22.240303] page dumped because: kasan: bad access detected
[   22.241063] 
[   22.241314] Memory state around the buggy address:
[   22.241670]  ffff88810305c980: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   22.242072]  ffff88810305ca00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   22.242724] >ffff88810305ca80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   22.243878]                    ^
[   22.244352]  ffff88810305cb00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.245263]  ffff88810305cb80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.246194] ==================================================================