Hay
Date
Dec. 9, 2024, 6:35 a.m.

Environment
qemu-arm64
qemu-x86_64

[   23.309940] ==================================================================
[   23.311541] BUG: KASAN: use-after-free in kmalloc_large_uaf+0x2cc/0x2f8
[   23.312839] Read of size 1 at addr fff00000c6454000 by task kunit_try_catch/136
[   23.313943] 
[   23.314393] CPU: 1 UID: 0 PID: 136 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc2-next-20241209 #1
[   23.315135] Tainted: [B]=BAD_PAGE, [N]=TEST
[   23.315661] Hardware name: linux,dummy-virt (DT)
[   23.316545] Call trace:
[   23.316988]  show_stack+0x20/0x38 (C)
[   23.317579]  dump_stack_lvl+0x8c/0xd0
[   23.318202]  print_report+0x118/0x5e0
[   23.319017]  kasan_report+0xc8/0x118
[   23.319570]  __asan_report_load1_noabort+0x20/0x30
[   23.320266]  kmalloc_large_uaf+0x2cc/0x2f8
[   23.320909]  kunit_try_run_case+0x14c/0x3d0
[   23.321532]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   23.322291]  kthread+0x24c/0x2d0
[   23.322859]  ret_from_fork+0x10/0x20
[   23.323609] 
[   23.323966] The buggy address belongs to the physical page:
[   23.324681] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106454
[   23.325590] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   23.326407] raw: 0bfffe0000000000 ffffc1ffc3191608 fff00000da4ff040 0000000000000000
[   23.327308] raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
[   23.328118] page dumped because: kasan: bad access detected
[   23.329156] 
[   23.329491] Memory state around the buggy address:
[   23.330012]  fff00000c6453f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.330733]  fff00000c6453f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.332043] >fff00000c6454000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   23.332859]                    ^
[   23.333310]  fff00000c6454080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   23.334095]  fff00000c6454100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   23.334925] ==================================================================

[   22.935967] ==================================================================
[   22.937372] BUG: KASAN: use-after-free in kmalloc_large_uaf+0x2f3/0x340
[   22.938172] Read of size 1 at addr ffff888102398000 by task kunit_try_catch/155
[   22.938902] 
[   22.939176] CPU: 1 UID: 0 PID: 155 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc2-next-20241209 #1
[   22.940608] Tainted: [B]=BAD_PAGE, [N]=TEST
[   22.941459] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   22.942517] Call Trace:
[   22.943019]  <TASK>
[   22.943208]  dump_stack_lvl+0x73/0xb0
[   22.943727]  print_report+0xd1/0x640
[   22.944154]  ? __virt_addr_valid+0x1db/0x2d0
[   22.944657]  ? kasan_addr_to_slab+0x11/0xa0
[   22.945015]  kasan_report+0x102/0x140
[   22.945950]  ? kmalloc_large_uaf+0x2f3/0x340
[   22.947033]  ? kmalloc_large_uaf+0x2f3/0x340
[   22.947594]  __asan_report_load1_noabort+0x18/0x20
[   22.947980]  kmalloc_large_uaf+0x2f3/0x340
[   22.948824]  ? __pfx_kmalloc_large_uaf+0x10/0x10
[   22.949480]  ? __schedule+0xc70/0x27e0
[   22.950069]  ? __pfx_read_tsc+0x10/0x10
[   22.950616]  ? ktime_get_ts64+0x86/0x230
[   22.951422]  kunit_try_run_case+0x1b3/0x490
[   22.952436]  ? __pfx_kunit_try_run_case+0x10/0x10
[   22.953220]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   22.953964]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   22.954521]  ? __kthread_parkme+0x82/0x160
[   22.954926]  ? preempt_count_sub+0x50/0x80
[   22.955899]  ? __pfx_kunit_try_run_case+0x10/0x10
[   22.956572]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   22.957499]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   22.958179]  kthread+0x257/0x310
[   22.958874]  ? __pfx_kthread+0x10/0x10
[   22.959482]  ret_from_fork+0x41/0x80
[   22.959914]  ? __pfx_kthread+0x10/0x10
[   22.960553]  ret_from_fork_asm+0x1a/0x30
[   22.961003]  </TASK>
[   22.961512] 
[   22.961788] The buggy address belongs to the physical page:
[   22.962657] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102398
[   22.963567] flags: 0x200000000000000(node=0|zone=2)
[   22.964133] raw: 0200000000000000 ffffea000408e708 ffff88815b13f0c0 0000000000000000
[   22.964858] raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
[   22.965731] page dumped because: kasan: bad access detected
[   22.966447] 
[   22.966954] Memory state around the buggy address:
[   22.967447]  ffff888102397f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.968670]  ffff888102397f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.969334] >ffff888102398000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   22.970102]                    ^
[   22.970519]  ffff888102398080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   22.971655]  ffff888102398100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   22.972391] ==================================================================