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

Environment
qemu-arm64
qemu-x86_64

[   20.308888] ==================================================================
[   20.309050] BUG: KASAN: slab-use-after-free in kmalloc_uaf_16+0x3bc/0x438
[   20.309194] Read of size 16 at addr fff00000c6058140 by task kunit_try_catch/178
[   20.309320] 
[   20.309404] CPU: 0 UID: 0 PID: 178 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc2-next-20250618 #1 PREEMPT 
[   20.309602] Tainted: [B]=BAD_PAGE, [N]=TEST
[   20.309661] Hardware name: linux,dummy-virt (DT)
[   20.309731] Call trace:
[   20.309781]  show_stack+0x20/0x38 (C)
[   20.309893]  dump_stack_lvl+0x8c/0xd0
[   20.310002]  print_report+0x118/0x608
[   20.310110]  kasan_report+0xdc/0x128
[   20.310201]  __asan_report_load16_noabort+0x20/0x30
[   20.310314]  kmalloc_uaf_16+0x3bc/0x438
[   20.310419]  kunit_try_run_case+0x170/0x3f0
[   20.310543]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   20.310645]  kthread+0x328/0x630
[   20.310735]  ret_from_fork+0x10/0x20
[   20.310844] 
[   20.310877] Allocated by task 178:
[   20.310939]  kasan_save_stack+0x3c/0x68
[   20.311043]  kasan_save_track+0x20/0x40
[   20.311138]  kasan_save_alloc_info+0x40/0x58
[   20.311261]  __kasan_kmalloc+0xd4/0xd8
[   20.311328]  __kmalloc_cache_noprof+0x16c/0x3c0
[   20.311448]  kmalloc_uaf_16+0x140/0x438
[   20.311555]  kunit_try_run_case+0x170/0x3f0
[   20.311667]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   20.311789]  kthread+0x328/0x630
[   20.311887]  ret_from_fork+0x10/0x20
[   20.311990] 
[   20.312046] Freed by task 178:
[   20.312098]  kasan_save_stack+0x3c/0x68
[   20.312165]  kasan_save_track+0x20/0x40
[   20.312226]  kasan_save_free_info+0x4c/0x78
[   20.312303]  __kasan_slab_free+0x6c/0x98
[   20.312399]  kfree+0x214/0x3c8
[   20.312503]  kmalloc_uaf_16+0x190/0x438
[   20.312631]  kunit_try_run_case+0x170/0x3f0
[   20.312757]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   20.312889]  kthread+0x328/0x630
[   20.312970]  ret_from_fork+0x10/0x20
[   20.313096] 
[   20.313159] The buggy address belongs to the object at fff00000c6058140
[   20.313159]  which belongs to the cache kmalloc-16 of size 16
[   20.313340] The buggy address is located 0 bytes inside of
[   20.313340]  freed 16-byte region [fff00000c6058140, fff00000c6058150)
[   20.313501] 
[   20.313559] The buggy address belongs to the physical page:
[   20.313658] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106058
[   20.313828] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   20.313943] page_type: f5(slab)
[   20.314322] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   20.314448] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   20.314530] page dumped because: kasan: bad access detected
[   20.314594] 
[   20.314635] Memory state around the buggy address:
[   20.314708]  fff00000c6058000: 00 00 fc fc 00 00 fc fc fa fb fc fc fa fb fc fc
[   20.314815]  fff00000c6058080: fa fb fc fc 00 04 fc fc fa fb fc fc fa fb fc fc
[   20.314950] >fff00000c6058100: fa fb fc fc 00 00 fc fc fa fb fc fc fc fc fc fc
[   20.315076]                                            ^
[   20.315188]  fff00000c6058180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   20.315269]  fff00000c6058200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   20.315337] ==================================================================

[   11.155619] ==================================================================
[   11.156092] BUG: KASAN: slab-use-after-free in kmalloc_uaf_16+0x47b/0x4c0
[   11.156593] Read of size 16 at addr ffff888101677be0 by task kunit_try_catch/194
[   11.156899] 
[   11.156997] CPU: 0 UID: 0 PID: 194 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc2-next-20250618 #1 PREEMPT(voluntary) 
[   11.157044] Tainted: [B]=BAD_PAGE, [N]=TEST
[   11.157056] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   11.157078] Call Trace:
[   11.157090]  <TASK>
[   11.157106]  dump_stack_lvl+0x73/0xb0
[   11.157136]  print_report+0xd1/0x650
[   11.157156]  ? __virt_addr_valid+0x1db/0x2d0
[   11.157179]  ? kmalloc_uaf_16+0x47b/0x4c0
[   11.157198]  ? kasan_complete_mode_report_info+0x64/0x200
[   11.157240]  ? kmalloc_uaf_16+0x47b/0x4c0
[   11.157260]  kasan_report+0x141/0x180
[   11.157280]  ? kmalloc_uaf_16+0x47b/0x4c0
[   11.157303]  __asan_report_load16_noabort+0x18/0x20
[   11.157326]  kmalloc_uaf_16+0x47b/0x4c0
[   11.157345]  ? __pfx_kmalloc_uaf_16+0x10/0x10
[   11.157365]  ? __schedule+0x10cc/0x2b60
[   11.157387]  ? __pfx_read_tsc+0x10/0x10
[   11.157407]  ? ktime_get_ts64+0x86/0x230
[   11.157433]  kunit_try_run_case+0x1a5/0x480
[   11.158081]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.158105]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   11.158130]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   11.158153]  ? __kthread_parkme+0x82/0x180
[   11.158198]  ? preempt_count_sub+0x50/0x80
[   11.158232]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.158255]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.158277]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   11.158298]  kthread+0x337/0x6f0
[   11.158316]  ? trace_preempt_on+0x20/0xc0
[   11.158340]  ? __pfx_kthread+0x10/0x10
[   11.158359]  ? _raw_spin_unlock_irq+0x47/0x80
[   11.158378]  ? calculate_sigpending+0x7b/0xa0
[   11.158402]  ? __pfx_kthread+0x10/0x10
[   11.158427]  ret_from_fork+0x116/0x1d0
[   11.158445]  ? __pfx_kthread+0x10/0x10
[   11.158464]  ret_from_fork_asm+0x1a/0x30
[   11.158493]  </TASK>
[   11.158504] 
[   11.166886] Allocated by task 194:
[   11.167062]  kasan_save_stack+0x45/0x70
[   11.167397]  kasan_save_track+0x18/0x40
[   11.167697]  kasan_save_alloc_info+0x3b/0x50
[   11.167851]  __kasan_kmalloc+0xb7/0xc0
[   11.168014]  __kmalloc_cache_noprof+0x189/0x420
[   11.168295]  kmalloc_uaf_16+0x15b/0x4c0
[   11.168571]  kunit_try_run_case+0x1a5/0x480
[   11.168780]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.169018]  kthread+0x337/0x6f0
[   11.169144]  ret_from_fork+0x116/0x1d0
[   11.169428]  ret_from_fork_asm+0x1a/0x30
[   11.169621] 
[   11.169706] Freed by task 194:
[   11.169836]  kasan_save_stack+0x45/0x70
[   11.170011]  kasan_save_track+0x18/0x40
[   11.170190]  kasan_save_free_info+0x3f/0x60
[   11.170384]  __kasan_slab_free+0x56/0x70
[   11.170571]  kfree+0x222/0x3f0
[   11.170739]  kmalloc_uaf_16+0x1d6/0x4c0
[   11.170882]  kunit_try_run_case+0x1a5/0x480
[   11.171080]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.171288]  kthread+0x337/0x6f0
[   11.171493]  ret_from_fork+0x116/0x1d0
[   11.171630]  ret_from_fork_asm+0x1a/0x30
[   11.171794] 
[   11.171887] The buggy address belongs to the object at ffff888101677be0
[   11.171887]  which belongs to the cache kmalloc-16 of size 16
[   11.172303] The buggy address is located 0 bytes inside of
[   11.172303]  freed 16-byte region [ffff888101677be0, ffff888101677bf0)
[   11.172945] 
[   11.173054] The buggy address belongs to the physical page:
[   11.173525] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101677
[   11.173815] flags: 0x200000000000000(node=0|zone=2)
[   11.174037] page_type: f5(slab)
[   11.174191] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   11.174430] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   11.174651] page dumped because: kasan: bad access detected
[   11.174813] 
[   11.174874] Memory state around the buggy address:
[   11.175128]  ffff888101677a80: 00 00 fc fc 00 04 fc fc 00 04 fc fc fa fb fc fc
[   11.175408]  ffff888101677b00: fa fb fc fc 00 05 fc fc fa fb fc fc fa fb fc fc
[   11.175981] >ffff888101677b80: fa fb fc fc fa fb fc fc 00 00 fc fc fa fb fc fc
[   11.176198]                                                        ^
[   11.176395]  ffff888101677c00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.176602]  ffff888101677c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.176811] ==================================================================