Hay
Date
Nov. 27, 2024, 3:37 a.m.

Environment
qemu-arm64
qemu-x86_64

[   46.860364] ==================================================================
[   46.862355] BUG: KASAN: use-after-free in kmalloc_large_uaf+0x2cc/0x2f8
[   46.863344] Read of size 1 at addr fff00000c6570000 by task kunit_try_catch/137
[   46.864387] 
[   46.864941] CPU: 0 UID: 0 PID: 137 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241127 #1
[   46.866663] Tainted: [B]=BAD_PAGE, [N]=TEST
[   46.867137] Hardware name: linux,dummy-virt (DT)
[   46.867979] Call trace:
[   46.868387]  show_stack+0x20/0x38 (C)
[   46.868918]  dump_stack_lvl+0x8c/0xd0
[   46.869804]  print_report+0x118/0x5e0
[   46.870339]  kasan_report+0xc8/0x118
[   46.870918]  __asan_report_load1_noabort+0x20/0x30
[   46.871887]  kmalloc_large_uaf+0x2cc/0x2f8
[   46.872479]  kunit_try_run_case+0x14c/0x3d0
[   46.873507]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   46.874371]  kthread+0x24c/0x2d0
[   46.874910]  ret_from_fork+0x10/0x20
[   46.875469] 
[   46.875751] The buggy address belongs to the physical page:
[   46.877084] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106570
[   46.877978] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   46.878832] raw: 0bfffe0000000000 ffffc1ffc3195d08 fff00000da4e3f80 0000000000000000
[   46.880112] raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
[   46.880990] page dumped because: kasan: bad access detected
[   46.882014] 
[   46.882390] Memory state around the buggy address:
[   46.883031]  fff00000c656ff00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   46.884421]  fff00000c656ff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   46.885357] >fff00000c6570000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   46.886117]                    ^
[   46.886945]  fff00000c6570080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   46.887826]  fff00000c6570100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   46.888627] ==================================================================

[   23.945198] ==================================================================
[   23.946571] BUG: KASAN: use-after-free in kmalloc_large_uaf+0x2f3/0x340
[   23.947484] Read of size 1 at addr ffff888102c54000 by task kunit_try_catch/156
[   23.948278] 
[   23.948573] CPU: 1 UID: 0 PID: 156 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241127 #1
[   23.949710] Tainted: [B]=BAD_PAGE, [N]=TEST
[   23.950134] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   23.950901] Call Trace:
[   23.951328]  <TASK>
[   23.951708]  dump_stack_lvl+0x73/0xb0
[   23.952326]  print_report+0xd1/0x640
[   23.952786]  ? __virt_addr_valid+0x1db/0x2d0
[   23.953424]  ? kasan_addr_to_slab+0x11/0xa0
[   23.953868]  kasan_report+0x102/0x140
[   23.954538]  ? kmalloc_large_uaf+0x2f3/0x340
[   23.955277]  ? kmalloc_large_uaf+0x2f3/0x340
[   23.955842]  __asan_report_load1_noabort+0x18/0x20
[   23.956586]  kmalloc_large_uaf+0x2f3/0x340
[   23.957267]  ? __pfx_kmalloc_large_uaf+0x10/0x10
[   23.957855]  ? __schedule+0xc3e/0x2790
[   23.958641]  ? __pfx_read_tsc+0x10/0x10
[   23.959137]  ? ktime_get_ts64+0x84/0x230
[   23.959663]  kunit_try_run_case+0x1b3/0x490
[   23.960450]  ? __pfx_kunit_try_run_case+0x10/0x10
[   23.961059]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   23.961595]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   23.962194]  ? __kthread_parkme+0x82/0x160
[   23.962785]  ? preempt_count_sub+0x50/0x80
[   23.963203]  ? __pfx_kunit_try_run_case+0x10/0x10
[   23.963949]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   23.964670]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   23.965279]  kthread+0x257/0x310
[   23.965689]  ? __pfx_kthread+0x10/0x10
[   23.966304]  ret_from_fork+0x41/0x80
[   23.967075]  ? __pfx_kthread+0x10/0x10
[   23.967759]  ret_from_fork_asm+0x1a/0x30
[   23.968406]  </TASK>
[   23.968690] 
[   23.968944] The buggy address belongs to the physical page:
[   23.969590] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102c54
[   23.970367] flags: 0x200000000000000(node=0|zone=2)
[   23.971310] raw: 0200000000000000 ffffea00040b1608 ffff88815b13f000 0000000000000000
[   23.971964] raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
[   23.972696] page dumped because: kasan: bad access detected
[   23.973432] 
[   23.973837] Memory state around the buggy address:
[   23.974450]  ffff888102c53f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.975167]  ffff888102c53f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.976367] >ffff888102c54000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   23.976634]                    ^
[   23.976783]  ffff888102c54080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   23.978170]  ffff888102c54100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   23.979024] ==================================================================