Hay
Date
Nov. 28, 2024, 2:36 a.m.

Environment
qemu-arm64
qemu-x86_64

[   29.646739] ==================================================================
[   29.647944] BUG: KASAN: use-after-free in kmalloc_large_uaf+0x2cc/0x2f8
[   29.648530] Read of size 1 at addr fff00000c6520000 by task kunit_try_catch/136
[   29.648881] 
[   29.649703] CPU: 0 UID: 0 PID: 136 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241128 #1
[   29.651564] Tainted: [B]=BAD_PAGE, [N]=TEST
[   29.652258] Hardware name: linux,dummy-virt (DT)
[   29.652787] Call trace:
[   29.653954]  show_stack+0x20/0x38 (C)
[   29.654563]  dump_stack_lvl+0x8c/0xd0
[   29.655156]  print_report+0x118/0x5e0
[   29.655754]  kasan_report+0xc8/0x118
[   29.656351]  __asan_report_load1_noabort+0x20/0x30
[   29.657040]  kmalloc_large_uaf+0x2cc/0x2f8
[   29.657555]  kunit_try_run_case+0x14c/0x3d0
[   29.658094]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   29.658854]  kthread+0x24c/0x2d0
[   29.660199]  ret_from_fork+0x10/0x20
[   29.660814] 
[   29.661524] The buggy address belongs to the physical page:
[   29.662189] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106520
[   29.663093] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   29.663910] raw: 0bfffe0000000000 ffffc1ffc3194908 fff00000da4e3f80 0000000000000000
[   29.664820] raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
[   29.666001] page dumped because: kasan: bad access detected
[   29.666747] 
[   29.667408] Memory state around the buggy address:
[   29.668247]  fff00000c651ff00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   29.669140]  fff00000c651ff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   29.670104] >fff00000c6520000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   29.671144]                    ^
[   29.671683]  fff00000c6520080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   29.672475]  fff00000c6520100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   29.673512] ==================================================================

[   20.391620] ==================================================================
[   20.392444] BUG: KASAN: use-after-free in kmalloc_large_uaf+0x2f3/0x340
[   20.393439] Read of size 1 at addr ffff888102368000 by task kunit_try_catch/156
[   20.394102] 
[   20.394283] CPU: 1 UID: 0 PID: 156 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241128 #1
[   20.396086] Tainted: [B]=BAD_PAGE, [N]=TEST
[   20.397405] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   20.398405] Call Trace:
[   20.398743]  <TASK>
[   20.399063]  dump_stack_lvl+0x73/0xb0
[   20.399724]  print_report+0xd1/0x640
[   20.400112]  ? __virt_addr_valid+0x1db/0x2d0
[   20.401032]  ? kasan_addr_to_slab+0x11/0xa0
[   20.402098]  kasan_report+0x102/0x140
[   20.402943]  ? kmalloc_large_uaf+0x2f3/0x340
[   20.403454]  ? kmalloc_large_uaf+0x2f3/0x340
[   20.403869]  __asan_report_load1_noabort+0x18/0x20
[   20.404440]  kmalloc_large_uaf+0x2f3/0x340
[   20.404838]  ? __pfx_kmalloc_large_uaf+0x10/0x10
[   20.405314]  ? __schedule+0xc3e/0x2790
[   20.406311]  ? __pfx_read_tsc+0x10/0x10
[   20.406823]  ? ktime_get_ts64+0x84/0x230
[   20.407600]  kunit_try_run_case+0x1b3/0x490
[   20.408070]  ? __pfx_kunit_try_run_case+0x10/0x10
[   20.408695]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   20.409269]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   20.410006]  ? __kthread_parkme+0x82/0x160
[   20.410541]  ? preempt_count_sub+0x50/0x80
[   20.411333]  ? __pfx_kunit_try_run_case+0x10/0x10
[   20.411775]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   20.412706]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   20.413450]  kthread+0x257/0x310
[   20.413965]  ? __pfx_kthread+0x10/0x10
[   20.414318]  ret_from_fork+0x41/0x80
[   20.414805]  ? __pfx_kthread+0x10/0x10
[   20.415139]  ret_from_fork_asm+0x1a/0x30
[   20.415759]  </TASK>
[   20.415981] 
[   20.416308] The buggy address belongs to the physical page:
[   20.417300] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102368
[   20.418401] flags: 0x200000000000000(node=0|zone=2)
[   20.418820] raw: 0200000000000000 ffffea000408db08 ffff88815b13f000 0000000000000000
[   20.420088] raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
[   20.420712] page dumped because: kasan: bad access detected
[   20.421521] 
[   20.421746] Memory state around the buggy address:
[   20.422553]  ffff888102367f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   20.423410]  ffff888102367f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   20.424595] >ffff888102368000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   20.425369]                    ^
[   20.425738]  ffff888102368080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   20.426997]  ffff888102368100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   20.427721] ==================================================================