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

Environment
qemu-arm64
qemu-x86_64

[   24.489809] ==================================================================
[   24.491235] BUG: KASAN: slab-out-of-bounds in kmalloc_memmove_invalid_size+0x154/0x2e8
[   24.492285] Read of size 64 at addr fff00000c6487184 by task kunit_try_catch/170
[   24.493285] 
[   24.493615] CPU: 0 UID: 0 PID: 170 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc2-next-20241209 #1
[   24.495656] Tainted: [B]=BAD_PAGE, [N]=TEST
[   24.496207] Hardware name: linux,dummy-virt (DT)
[   24.497250] Call trace:
[   24.497828]  show_stack+0x20/0x38 (C)
[   24.498488]  dump_stack_lvl+0x8c/0xd0
[   24.499270]  print_report+0x118/0x5e0
[   24.499978]  kasan_report+0xc8/0x118
[   24.500784]  kasan_check_range+0x100/0x1a8
[   24.501334]  __asan_memmove+0x3c/0x98
[   24.501909]  kmalloc_memmove_invalid_size+0x154/0x2e8
[   24.502680]  kunit_try_run_case+0x14c/0x3d0
[   24.503669]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   24.504692]  kthread+0x24c/0x2d0
[   24.505276]  ret_from_fork+0x10/0x20
[   24.505887] 
[   24.506250] Allocated by task 170:
[   24.506797]  kasan_save_stack+0x3c/0x68
[   24.507608]  kasan_save_track+0x20/0x40
[   24.508654]  kasan_save_alloc_info+0x40/0x58
[   24.509274]  __kasan_kmalloc+0xd4/0xd8
[   24.509911]  __kmalloc_cache_noprof+0x15c/0x3c0
[   24.510621]  kmalloc_memmove_invalid_size+0xb0/0x2e8
[   24.511313]  kunit_try_run_case+0x14c/0x3d0
[   24.512218]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   24.512981]  kthread+0x24c/0x2d0
[   24.513549]  ret_from_fork+0x10/0x20
[   24.514128] 
[   24.514494] The buggy address belongs to the object at fff00000c6487180
[   24.514494]  which belongs to the cache kmalloc-64 of size 64
[   24.516029] The buggy address is located 4 bytes inside of
[   24.516029]  allocated 64-byte region [fff00000c6487180, fff00000c64871c0)
[   24.517336] 
[   24.517758] The buggy address belongs to the physical page:
[   24.518534] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106487
[   24.519503] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   24.520493] page_type: f5(slab)
[   24.521011] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   24.521612] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   24.522227] page dumped because: kasan: bad access detected
[   24.524010] 
[   24.524460] Memory state around the buggy address:
[   24.525255]  fff00000c6487080: 00 00 00 00 00 01 fc fc fc fc fc fc fc fc fc fc
[   24.526332]  fff00000c6487100: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   24.527101] >fff00000c6487180: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
[   24.527811]                                            ^
[   24.528866]  fff00000c6487200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.529951]  fff00000c6487280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.531104] ==================================================================

[   24.456672] ==================================================================
[   24.457729] BUG: KASAN: slab-out-of-bounds in kmalloc_memmove_invalid_size+0x170/0x330
[   24.458640] Read of size 64 at addr ffff888102402a84 by task kunit_try_catch/189
[   24.459967] 
[   24.460443] CPU: 1 UID: 0 PID: 189 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc2-next-20241209 #1
[   24.461953] Tainted: [B]=BAD_PAGE, [N]=TEST
[   24.462178] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   24.462924] Call Trace:
[   24.463371]  <TASK>
[   24.464179]  dump_stack_lvl+0x73/0xb0
[   24.465035]  print_report+0xd1/0x640
[   24.465575]  ? __virt_addr_valid+0x1db/0x2d0
[   24.465907]  ? kasan_complete_mode_report_info+0x2a/0x200
[   24.466906]  kasan_report+0x102/0x140
[   24.467215]  ? kmalloc_memmove_invalid_size+0x170/0x330
[   24.467883]  ? kmalloc_memmove_invalid_size+0x170/0x330
[   24.468745]  kasan_check_range+0x10c/0x1c0
[   24.469621]  __asan_memmove+0x27/0x70
[   24.470355]  kmalloc_memmove_invalid_size+0x170/0x330
[   24.470953]  ? __pfx_kmalloc_memmove_invalid_size+0x10/0x10
[   24.471561]  ? __schedule+0xc70/0x27e0
[   24.472080]  ? __pfx_read_tsc+0x10/0x10
[   24.472516]  ? ktime_get_ts64+0x86/0x230
[   24.472951]  kunit_try_run_case+0x1b3/0x490
[   24.473645]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.474039]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   24.475714]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   24.477021]  ? __kthread_parkme+0x82/0x160
[   24.477478]  ? preempt_count_sub+0x50/0x80
[   24.478399]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.479018]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   24.480026]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.480965]  kthread+0x257/0x310
[   24.481765]  ? __pfx_kthread+0x10/0x10
[   24.482511]  ret_from_fork+0x41/0x80
[   24.483053]  ? __pfx_kthread+0x10/0x10
[   24.483883]  ret_from_fork_asm+0x1a/0x30
[   24.484980]  </TASK>
[   24.485446] 
[   24.485951] Allocated by task 189:
[   24.487012]  kasan_save_stack+0x3d/0x60
[   24.488018]  kasan_save_track+0x18/0x40
[   24.488761]  kasan_save_alloc_info+0x3b/0x50
[   24.489162]  __kasan_kmalloc+0xb7/0xc0
[   24.489643]  __kmalloc_cache_noprof+0x184/0x410
[   24.490580]  kmalloc_memmove_invalid_size+0xad/0x330
[   24.491564]  kunit_try_run_case+0x1b3/0x490
[   24.491958]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.493095]  kthread+0x257/0x310
[   24.493413]  ret_from_fork+0x41/0x80
[   24.494122]  ret_from_fork_asm+0x1a/0x30
[   24.494523] 
[   24.494786] The buggy address belongs to the object at ffff888102402a80
[   24.494786]  which belongs to the cache kmalloc-64 of size 64
[   24.496490] The buggy address is located 4 bytes inside of
[   24.496490]  allocated 64-byte region [ffff888102402a80, ffff888102402ac0)
[   24.498149] 
[   24.498320] The buggy address belongs to the physical page:
[   24.500047] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102402
[   24.500974] flags: 0x200000000000000(node=0|zone=2)
[   24.501693] page_type: f5(slab)
[   24.502440] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   24.503620] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   24.504473] page dumped because: kasan: bad access detected
[   24.505726] 
[   24.505942] Memory state around the buggy address:
[   24.506474]  ffff888102402980: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   24.507828]  ffff888102402a00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   24.508582] >ffff888102402a80: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
[   24.509259]                                            ^
[   24.510666]  ffff888102402b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.511484]  ffff888102402b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.512526] ==================================================================