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

Environment
qemu-arm64
qemu-x86_64

[   33.923674] ==================================================================
[   33.925305] BUG: KASAN: out-of-bounds in kmalloc_memmove_negative_size+0x154/0x2e0
[   33.926248] Read of size 18446744073709551614 at addr fff00000c6132b84 by task kunit_try_catch/169
[   33.928183] 
[   33.929646] CPU: 0 UID: 0 PID: 169 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241122 #1
[   33.931026] Tainted: [B]=BAD_PAGE, [N]=TEST
[   33.931601] Hardware name: linux,dummy-virt (DT)
[   33.932202] Call trace:
[   33.932779]  show_stack+0x20/0x38 (C)
[   33.933804]  dump_stack_lvl+0x8c/0xd0
[   33.934488]  print_report+0x118/0x5e0
[   33.935143]  kasan_report+0xc8/0x118
[   33.935742]  kasan_check_range+0x100/0x1a8
[   33.936318]  __asan_memmove+0x3c/0x98
[   33.936927]  kmalloc_memmove_negative_size+0x154/0x2e0
[   33.937935]  kunit_try_run_case+0x14c/0x3d0
[   33.938732]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.939998]  kthread+0x24c/0x2d0
[   33.940780]  ret_from_fork+0x10/0x20
[   33.941989] 
[   33.942407] Allocated by task 169:
[   33.942983]  kasan_save_stack+0x3c/0x68
[   33.943566]  kasan_save_track+0x20/0x40
[   33.944222]  kasan_save_alloc_info+0x40/0x58
[   33.945468]  __kasan_kmalloc+0xd4/0xd8
[   33.946719]  __kmalloc_cache_noprof+0x15c/0x3c8
[   33.947334]  kmalloc_memmove_negative_size+0xb0/0x2e0
[   33.948076]  kunit_try_run_case+0x14c/0x3d0
[   33.948655]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.950384]  kthread+0x24c/0x2d0
[   33.951111]  ret_from_fork+0x10/0x20
[   33.951712] 
[   33.952040] The buggy address belongs to the object at fff00000c6132b80
[   33.952040]  which belongs to the cache kmalloc-64 of size 64
[   33.954206] The buggy address is located 4 bytes inside of
[   33.954206]  64-byte region [fff00000c6132b80, fff00000c6132bc0)
[   33.955929] 
[   33.956418] The buggy address belongs to the physical page:
[   33.957230] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106132
[   33.958874] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   33.959770] page_type: f5(slab)
[   33.960353] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   33.962421] raw: 0000000000000000 0000000080200020 00000001f5000000 0000000000000000
[   33.963764] page dumped because: kasan: bad access detected
[   33.964823] 
[   33.965710] Memory state around the buggy address:
[   33.966334]  fff00000c6132a80: 00 00 00 00 01 fc fc fc fc fc fc fc fc fc fc fc
[   33.967391]  fff00000c6132b00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   33.968798] >fff00000c6132b80: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
[   33.969701]                    ^
[   33.970284]  fff00000c6132c00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   33.971930]  fff00000c6132c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   33.972851] ==================================================================

[   25.336392] ==================================================================
[   25.338076] BUG: KASAN: out-of-bounds in kmalloc_memmove_negative_size+0x172/0x330
[   25.338674] Read of size 18446744073709551614 at addr ffff888102a03b04 by task kunit_try_catch/188
[   25.340071] 
[   25.340337] CPU: 1 UID: 0 PID: 188 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241122 #1
[   25.341762] Tainted: [B]=BAD_PAGE, [N]=TEST
[   25.342471] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   25.343047] Call Trace:
[   25.343461]  <TASK>
[   25.343746]  dump_stack_lvl+0x73/0xb0
[   25.344132]  print_report+0xd1/0x640
[   25.344555]  ? __virt_addr_valid+0x1db/0x2d0
[   25.345190]  ? kasan_complete_mode_report_info+0x2a/0x200
[   25.345665]  kasan_report+0x102/0x140
[   25.346618]  ? kmalloc_memmove_negative_size+0x172/0x330
[   25.347061]  ? kmalloc_memmove_negative_size+0x172/0x330
[   25.347726]  kasan_check_range+0x10c/0x1c0
[   25.348595]  __asan_memmove+0x27/0x70
[   25.349362]  kmalloc_memmove_negative_size+0x172/0x330
[   25.350120]  ? __pfx_kmalloc_memmove_negative_size+0x10/0x10
[   25.350643]  ? __schedule+0xc3e/0x2790
[   25.351347]  ? __pfx_read_tsc+0x10/0x10
[   25.352451]  ? ktime_get_ts64+0x84/0x230
[   25.352898]  kunit_try_run_case+0x1b3/0x490
[   25.353299]  ? __pfx_kunit_try_run_case+0x10/0x10
[   25.353739]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   25.354318]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   25.354718]  ? __kthread_parkme+0x82/0x160
[   25.355334]  ? preempt_count_sub+0x50/0x80
[   25.355840]  ? __pfx_kunit_try_run_case+0x10/0x10
[   25.356608]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   25.357124]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.357731]  kthread+0x257/0x310
[   25.358141]  ? __pfx_kthread+0x10/0x10
[   25.359227]  ret_from_fork+0x41/0x80
[   25.359876]  ? __pfx_kthread+0x10/0x10
[   25.361128]  ret_from_fork_asm+0x1a/0x30
[   25.361547]  </TASK>
[   25.361944] 
[   25.362249] Allocated by task 188:
[   25.362769]  kasan_save_stack+0x3d/0x60
[   25.363188]  kasan_save_track+0x18/0x40
[   25.364331]  kasan_save_alloc_info+0x3b/0x50
[   25.364719]  __kasan_kmalloc+0xb7/0xc0
[   25.365338]  __kmalloc_cache_noprof+0x184/0x410
[   25.365994]  kmalloc_memmove_negative_size+0xad/0x330
[   25.366659]  kunit_try_run_case+0x1b3/0x490
[   25.366986]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.367583]  kthread+0x257/0x310
[   25.368247]  ret_from_fork+0x41/0x80
[   25.368634]  ret_from_fork_asm+0x1a/0x30
[   25.369398] 
[   25.369622] The buggy address belongs to the object at ffff888102a03b00
[   25.369622]  which belongs to the cache kmalloc-64 of size 64
[   25.371428] The buggy address is located 4 bytes inside of
[   25.371428]  64-byte region [ffff888102a03b00, ffff888102a03b40)
[   25.372547] 
[   25.372857] The buggy address belongs to the physical page:
[   25.373421] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a03
[   25.374321] flags: 0x200000000000000(node=0|zone=2)
[   25.374997] page_type: f5(slab)
[   25.375297] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   25.376241] raw: 0000000000000000 0000000080200020 00000001f5000000 0000000000000000
[   25.376857] page dumped because: kasan: bad access detected
[   25.377932] 
[   25.378101] Memory state around the buggy address:
[   25.378375]  ffff888102a03a00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   25.379062]  ffff888102a03a80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   25.380138] >ffff888102a03b00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
[   25.380513]                    ^
[   25.380734]  ffff888102a03b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.381667]  ffff888102a03c00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.382759] ==================================================================