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

Environment
qemu-arm64
qemu-x86_64

[   24.441590] ==================================================================
[   24.442578] BUG: KASAN: out-of-bounds in kmalloc_memmove_negative_size+0x154/0x2e0
[   24.444277] Read of size 18446744073709551614 at addr fff00000c125ad04 by task kunit_try_catch/168
[   24.445239] 
[   24.445602] CPU: 1 UID: 0 PID: 168 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc2-next-20241209 #1
[   24.447580] Tainted: [B]=BAD_PAGE, [N]=TEST
[   24.447970] Hardware name: linux,dummy-virt (DT)
[   24.448481] Call trace:
[   24.448910]  show_stack+0x20/0x38 (C)
[   24.449479]  dump_stack_lvl+0x8c/0xd0
[   24.450277]  print_report+0x118/0x5e0
[   24.451014]  kasan_report+0xc8/0x118
[   24.451603]  kasan_check_range+0x100/0x1a8
[   24.452216]  __asan_memmove+0x3c/0x98
[   24.452468]  kmalloc_memmove_negative_size+0x154/0x2e0
[   24.452868]  kunit_try_run_case+0x14c/0x3d0
[   24.453683]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   24.454455]  kthread+0x24c/0x2d0
[   24.455015]  ret_from_fork+0x10/0x20
[   24.455625] 
[   24.456029] Allocated by task 168:
[   24.456534]  kasan_save_stack+0x3c/0x68
[   24.457155]  kasan_save_track+0x20/0x40
[   24.457788]  kasan_save_alloc_info+0x40/0x58
[   24.458442]  __kasan_kmalloc+0xd4/0xd8
[   24.459221]  __kmalloc_cache_noprof+0x15c/0x3c0
[   24.459864]  kmalloc_memmove_negative_size+0xb0/0x2e0
[   24.460485]  kunit_try_run_case+0x14c/0x3d0
[   24.461127]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   24.461781]  kthread+0x24c/0x2d0
[   24.462371]  ret_from_fork+0x10/0x20
[   24.462963] 
[   24.463477] The buggy address belongs to the object at fff00000c125ad00
[   24.463477]  which belongs to the cache kmalloc-64 of size 64
[   24.464810] The buggy address is located 4 bytes inside of
[   24.464810]  64-byte region [fff00000c125ad00, fff00000c125ad40)
[   24.466013] 
[   24.466412] The buggy address belongs to the physical page:
[   24.467385] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10125a
[   24.468338] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   24.469180] page_type: f5(slab)
[   24.469773] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   24.470613] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   24.471719] page dumped because: kasan: bad access detected
[   24.472389] 
[   24.472798] Memory state around the buggy address:
[   24.473406]  fff00000c125ac00: 00 00 00 00 01 fc fc fc fc fc fc fc fc fc fc fc
[   24.474197]  fff00000c125ac80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   24.475181] >fff00000c125ad00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
[   24.476534]                    ^
[   24.476930]  fff00000c125ad80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.477488]  fff00000c125ae00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.478188] ==================================================================

[   24.400829] ==================================================================
[   24.401931] BUG: KASAN: out-of-bounds in kmalloc_memmove_negative_size+0x172/0x330
[   24.402652] Read of size 18446744073709551614 at addr ffff888102402a04 by task kunit_try_catch/187
[   24.404153] 
[   24.404892] CPU: 1 UID: 0 PID: 187 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc2-next-20241209 #1
[   24.405955] Tainted: [B]=BAD_PAGE, [N]=TEST
[   24.406620] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   24.407426] Call Trace:
[   24.407722]  <TASK>
[   24.407997]  dump_stack_lvl+0x73/0xb0
[   24.408700]  print_report+0xd1/0x640
[   24.409044]  ? __virt_addr_valid+0x1db/0x2d0
[   24.409405]  ? kasan_complete_mode_report_info+0x2a/0x200
[   24.410361]  kasan_report+0x102/0x140
[   24.410755]  ? kmalloc_memmove_negative_size+0x172/0x330
[   24.411886]  ? kmalloc_memmove_negative_size+0x172/0x330
[   24.412673]  kasan_check_range+0x10c/0x1c0
[   24.413446]  __asan_memmove+0x27/0x70
[   24.414030]  kmalloc_memmove_negative_size+0x172/0x330
[   24.414862]  ? __pfx_kmalloc_memmove_negative_size+0x10/0x10
[   24.415804]  ? __pfx_kmalloc_memmove_negative_size+0x10/0x10
[   24.417027]  kunit_try_run_case+0x1b3/0x490
[   24.417704]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.418137]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   24.419064]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   24.419797]  ? __kthread_parkme+0x82/0x160
[   24.420834]  ? preempt_count_sub+0x50/0x80
[   24.421480]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.422325]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   24.423100]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.423641]  kthread+0x257/0x310
[   24.424103]  ? __pfx_kthread+0x10/0x10
[   24.424639]  ret_from_fork+0x41/0x80
[   24.425384]  ? __pfx_kthread+0x10/0x10
[   24.425752]  ret_from_fork_asm+0x1a/0x30
[   24.426243]  </TASK>
[   24.426673] 
[   24.426832] Allocated by task 187:
[   24.427717]  kasan_save_stack+0x3d/0x60
[   24.428078]  kasan_save_track+0x18/0x40
[   24.429006]  kasan_save_alloc_info+0x3b/0x50
[   24.429575]  __kasan_kmalloc+0xb7/0xc0
[   24.430066]  __kmalloc_cache_noprof+0x184/0x410
[   24.430961]  kmalloc_memmove_negative_size+0xad/0x330
[   24.431543]  kunit_try_run_case+0x1b3/0x490
[   24.432266]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.432923]  kthread+0x257/0x310
[   24.433564]  ret_from_fork+0x41/0x80
[   24.434004]  ret_from_fork_asm+0x1a/0x30
[   24.434675] 
[   24.435202] The buggy address belongs to the object at ffff888102402a00
[   24.435202]  which belongs to the cache kmalloc-64 of size 64
[   24.436317] The buggy address is located 4 bytes inside of
[   24.436317]  64-byte region [ffff888102402a00, ffff888102402a40)
[   24.437925] 
[   24.438542] The buggy address belongs to the physical page:
[   24.439067] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102402
[   24.440126] flags: 0x200000000000000(node=0|zone=2)
[   24.441000] page_type: f5(slab)
[   24.441280] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   24.442425] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   24.443111] page dumped because: kasan: bad access detected
[   24.443910] 
[   24.444095] Memory state around the buggy address:
[   24.445101]  ffff888102402900: 00 00 00 00 01 fc fc fc fc fc fc fc fc fc fc fc
[   24.445965]  ffff888102402980: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   24.446696] >ffff888102402a00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
[   24.447622]                    ^
[   24.448115]  ffff888102402a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.449445]  ffff888102402b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.450191] ==================================================================