Hay
Date
Nov. 22, 2024, 6:35 a.m.

Environment
qemu-arm64
qemu-x86_64

[   32.410984] ==================================================================
[   32.413231] BUG: KASAN: use-after-free in kmalloc_large_uaf+0x2cc/0x2f8
[   32.414986] Read of size 1 at addr fff00000c69f0000 by task kunit_try_catch/137
[   32.416277] 
[   32.417186] CPU: 1 UID: 0 PID: 137 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241122 #1
[   32.419823] Tainted: [B]=BAD_PAGE, [N]=TEST
[   32.421039] Hardware name: linux,dummy-virt (DT)
[   32.422504] Call trace:
[   32.423170]  show_stack+0x20/0x38 (C)
[   32.423848]  dump_stack_lvl+0x8c/0xd0
[   32.424854]  print_report+0x118/0x5e0
[   32.425371]  kasan_report+0xc8/0x118
[   32.426653]  __asan_report_load1_noabort+0x20/0x30
[   32.427384]  kmalloc_large_uaf+0x2cc/0x2f8
[   32.428133]  kunit_try_run_case+0x14c/0x3d0
[   32.428834]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   32.429606]  kthread+0x24c/0x2d0
[   32.430142]  ret_from_fork+0x10/0x20
[   32.431333] 
[   32.431667] The buggy address belongs to the physical page:
[   32.433605] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1069f0
[   32.434690] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   32.435865] raw: 0bfffe0000000000 ffffc1ffc31a7d08 fff00000da505f80 0000000000000000
[   32.437857] raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
[   32.438737] page dumped because: kasan: bad access detected
[   32.439474] 
[   32.439856] Memory state around the buggy address:
[   32.440946]  fff00000c69eff00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   32.441637]  fff00000c69eff80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   32.442613] >fff00000c69f0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   32.443915]                    ^
[   32.444418]  fff00000c69f0080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   32.445353]  fff00000c69f0100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   32.445959] ==================================================================

[   24.067717] ==================================================================
[   24.068665] BUG: KASAN: use-after-free in kmalloc_large_uaf+0x2f3/0x340
[   24.069374] Read of size 1 at addr ffff8881023b0000 by task kunit_try_catch/156
[   24.070127] 
[   24.070315] CPU: 1 UID: 0 PID: 156 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241122 #1
[   24.071487] Tainted: [B]=BAD_PAGE, [N]=TEST
[   24.071977] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   24.072655] Call Trace:
[   24.073147]  <TASK>
[   24.073421]  dump_stack_lvl+0x73/0xb0
[   24.073814]  print_report+0xd1/0x640
[   24.074523]  ? __virt_addr_valid+0x1db/0x2d0
[   24.075357]  ? kasan_addr_to_slab+0x11/0xa0
[   24.075843]  kasan_report+0x102/0x140
[   24.076120]  ? kmalloc_large_uaf+0x2f3/0x340
[   24.076619]  ? kmalloc_large_uaf+0x2f3/0x340
[   24.077295]  __asan_report_load1_noabort+0x18/0x20
[   24.077802]  kmalloc_large_uaf+0x2f3/0x340
[   24.078288]  ? __pfx_kmalloc_large_uaf+0x10/0x10
[   24.078814]  ? __schedule+0xc3e/0x2790
[   24.079450]  ? __pfx_read_tsc+0x10/0x10
[   24.079795]  ? ktime_get_ts64+0x84/0x230
[   24.080318]  kunit_try_run_case+0x1b3/0x490
[   24.081430]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.081779]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   24.082428]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   24.082995]  ? __kthread_parkme+0x82/0x160
[   24.083291]  ? preempt_count_sub+0x50/0x80
[   24.084037]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.084364]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   24.084715]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.085499]  kthread+0x257/0x310
[   24.086155]  ? __pfx_kthread+0x10/0x10
[   24.086706]  ret_from_fork+0x41/0x80
[   24.087443]  ? __pfx_kthread+0x10/0x10
[   24.088124]  ret_from_fork_asm+0x1a/0x30
[   24.088580]  </TASK>
[   24.088819] 
[   24.089234] The buggy address belongs to the physical page:
[   24.089737] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1023b0
[   24.090242] flags: 0x200000000000000(node=0|zone=2)
[   24.090559] raw: 0200000000000000 ffffea000408ed08 ffff88815b13f000 0000000000000000
[   24.090962] raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
[   24.091707] page dumped because: kasan: bad access detected
[   24.092321] 
[   24.092542] Memory state around the buggy address:
[   24.093011]  ffff8881023aff00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.093775]  ffff8881023aff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.094308] >ffff8881023b0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   24.095181]                    ^
[   24.095546]  ffff8881023b0080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   24.096472]  ffff8881023b0100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   24.097099] ==================================================================