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

Environment
qemu-arm64
qemu-x86_64

[   34.456239] ==================================================================
[   34.456499] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x300/0x338
[   34.456673] Read of size 1 at addr fff00000c5d8b048 by task kunit_try_catch/186
[   34.456921] 
[   34.457097] CPU: 1 UID: 0 PID: 186 Comm: kunit_try_catch Tainted: G    B            N  6.14.0-rc7-next-20250319 #1 PREEMPT 
[   34.457529] Tainted: [B]=BAD_PAGE, [N]=TEST
[   34.457679] Hardware name: linux,dummy-virt (DT)
[   34.457782] Call trace:
[   34.457852]  show_stack+0x20/0x38 (C)
[   34.458003]  dump_stack_lvl+0x8c/0xd0
[   34.458166]  print_report+0x118/0x5f0
[   34.458302]  kasan_report+0xc8/0x118
[   34.458462]  __asan_report_load1_noabort+0x20/0x30
[   34.458617]  kmalloc_uaf+0x300/0x338
[   34.458759]  kunit_try_run_case+0x14c/0x3d0
[   34.458914]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   34.459129]  kthread+0x318/0x618
[   34.459435]  ret_from_fork+0x10/0x20
[   34.459607] 
[   34.459683] Allocated by task 186:
[   34.459819]  kasan_save_stack+0x3c/0x68
[   34.459952]  kasan_save_track+0x20/0x40
[   34.460129]  kasan_save_alloc_info+0x40/0x58
[   34.460299]  __kasan_kmalloc+0xd4/0xd8
[   34.460460]  __kmalloc_cache_noprof+0x15c/0x3c0
[   34.460617]  kmalloc_uaf+0xb8/0x338
[   34.460870]  kunit_try_run_case+0x14c/0x3d0
[   34.461170]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   34.461375]  kthread+0x318/0x618
[   34.461492]  ret_from_fork+0x10/0x20
[   34.461599] 
[   34.461662] Freed by task 186:
[   34.461760]  kasan_save_stack+0x3c/0x68
[   34.461889]  kasan_save_track+0x20/0x40
[   34.462558]  kasan_save_free_info+0x4c/0x78
[   34.462719]  __kasan_slab_free+0x6c/0x98
[   34.462843]  kfree+0x214/0x3c8
[   34.463047]  kmalloc_uaf+0x11c/0x338
[   34.463746]  kunit_try_run_case+0x14c/0x3d0
[   34.463897]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   34.464152]  kthread+0x318/0x618
[   34.464521]  ret_from_fork+0x10/0x20
[   34.464792] 
[   34.464878] The buggy address belongs to the object at fff00000c5d8b040
[   34.464878]  which belongs to the cache kmalloc-16 of size 16
[   34.465078] The buggy address is located 8 bytes inside of
[   34.465078]  freed 16-byte region [fff00000c5d8b040, fff00000c5d8b050)
[   34.465849] 
[   34.465918] The buggy address belongs to the physical page:
[   34.466025] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105d8b
[   34.466215] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   34.466425] page_type: f5(slab)
[   34.466542] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   34.466706] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   34.466849] page dumped because: kasan: bad access detected
[   34.466964] 
[   34.467024] Memory state around the buggy address:
[   34.467727]  fff00000c5d8af00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   34.468015]  fff00000c5d8af80: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc
[   34.468878] >fff00000c5d8b000: fa fb fc fc fa fb fc fc fa fb fc fc fc fc fc fc
[   34.469186]                                               ^
[   34.469317]  fff00000c5d8b080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   34.469497]  fff00000c5d8b100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   34.469634] ==================================================================

[   22.138448] ==================================================================
[   22.139548] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x320/0x380
[   22.140226] Read of size 1 at addr ffff888100a7a988 by task kunit_try_catch/205
[   22.140760] 
[   22.141104] CPU: 0 UID: 0 PID: 205 Comm: kunit_try_catch Tainted: G    B            N  6.14.0-rc7-next-20250319 #1 PREEMPT(voluntary) 
[   22.141261] Tainted: [B]=BAD_PAGE, [N]=TEST
[   22.141294] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   22.141349] Call Trace:
[   22.141382]  <TASK>
[   22.141419]  dump_stack_lvl+0x73/0xb0
[   22.141496]  print_report+0xd1/0x660
[   22.141556]  ? __virt_addr_valid+0x1db/0x2d0
[   22.141680]  ? kasan_complete_mode_report_info+0x64/0x200
[   22.141885]  kasan_report+0x104/0x140
[   22.141972]  ? kmalloc_uaf+0x320/0x380
[   22.142039]  ? kmalloc_uaf+0x320/0x380
[   22.142145]  __asan_report_load1_noabort+0x18/0x20
[   22.142207]  kmalloc_uaf+0x320/0x380
[   22.142263]  ? __pfx_kmalloc_uaf+0x10/0x10
[   22.142323]  ? __schedule+0xd46/0x29c0
[   22.142383]  ? __pfx_read_tsc+0x10/0x10
[   22.142440]  ? ktime_get_ts64+0x86/0x240
[   22.142509]  kunit_try_run_case+0x1b2/0x490
[   22.142579]  ? __pfx_kunit_try_run_case+0x10/0x10
[   22.142637]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   22.142698]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   22.142758]  ? __kthread_parkme+0x82/0x160
[   22.142819]  ? preempt_count_sub+0x50/0x80
[   22.142889]  ? __pfx_kunit_try_run_case+0x10/0x10
[   22.142956]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   22.143023]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   22.143089]  kthread+0x323/0x710
[   22.143280]  ? trace_preempt_on+0x20/0xc0
[   22.143325]  ? __pfx_kthread+0x10/0x10
[   22.143358]  ? _raw_spin_unlock_irq+0x47/0x80
[   22.143389]  ? calculate_sigpending+0x7b/0xa0
[   22.143420]  ? __pfx_kthread+0x10/0x10
[   22.143452]  ret_from_fork+0x41/0x80
[   22.143483]  ? __pfx_kthread+0x10/0x10
[   22.143515]  ret_from_fork_asm+0x1a/0x30
[   22.143562]  </TASK>
[   22.143578] 
[   22.162237] Allocated by task 205:
[   22.162748]  kasan_save_stack+0x3d/0x60
[   22.163465]  kasan_save_track+0x18/0x40
[   22.164073]  kasan_save_alloc_info+0x3b/0x50
[   22.164798]  __kasan_kmalloc+0xb7/0xc0
[   22.165377]  __kmalloc_cache_noprof+0x183/0x410
[   22.166083]  kmalloc_uaf+0xaa/0x380
[   22.166465]  kunit_try_run_case+0x1b2/0x490
[   22.166930]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   22.167481]  kthread+0x323/0x710
[   22.167780]  ret_from_fork+0x41/0x80
[   22.168342]  ret_from_fork_asm+0x1a/0x30
[   22.168763] 
[   22.169434] Freed by task 205:
[   22.170087]  kasan_save_stack+0x3d/0x60
[   22.170622]  kasan_save_track+0x18/0x40
[   22.171150]  kasan_save_free_info+0x3f/0x60
[   22.171947]  __kasan_slab_free+0x56/0x70
[   22.172406]  kfree+0x222/0x3f0
[   22.172991]  kmalloc_uaf+0x12c/0x380
[   22.173471]  kunit_try_run_case+0x1b2/0x490
[   22.174349]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   22.175106]  kthread+0x323/0x710
[   22.175501]  ret_from_fork+0x41/0x80
[   22.176190]  ret_from_fork_asm+0x1a/0x30
[   22.176598] 
[   22.177071] The buggy address belongs to the object at ffff888100a7a980
[   22.177071]  which belongs to the cache kmalloc-16 of size 16
[   22.178260] The buggy address is located 8 bytes inside of
[   22.178260]  freed 16-byte region [ffff888100a7a980, ffff888100a7a990)
[   22.179545] 
[   22.179870] The buggy address belongs to the physical page:
[   22.180320] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x100a7a
[   22.181335] flags: 0x200000000000000(node=0|zone=2)
[   22.182038] page_type: f5(slab)
[   22.182511] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   22.183331] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   22.184148] page dumped because: kasan: bad access detected
[   22.184574] 
[   22.185366] Memory state around the buggy address:
[   22.186482]  ffff888100a7a880: 00 02 fc fc 00 05 fc fc 00 02 fc fc 00 02 fc fc
[   22.187152]  ffff888100a7a900: 00 02 fc fc 00 02 fc fc 00 04 fc fc fa fb fc fc
[   22.187839] >ffff888100a7a980: fa fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.188384]                       ^
[   22.188705]  ffff888100a7aa00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.189463]  ffff888100a7aa80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.190229] ==================================================================