Hay
Date
Dec. 6, 2024, 3:11 p.m.

Environment
qemu-arm64
qemu-x86_64

[   31.425348] ==================================================================
[   31.426634] BUG: KASAN: slab-out-of-bounds in kmalloc_memmove_invalid_size+0x154/0x2e8
[   31.428712] Read of size 64 at addr fff00000c66d2104 by task kunit_try_catch/171
[   31.429648] 
[   31.430023] CPU: 0 UID: 0 PID: 171 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241206 #1
[   31.431626] Tainted: [B]=BAD_PAGE, [N]=TEST
[   31.432132] Hardware name: linux,dummy-virt (DT)
[   31.432806] Call trace:
[   31.433178]  show_stack+0x20/0x38 (C)
[   31.433853]  dump_stack_lvl+0x8c/0xd0
[   31.434762]  print_report+0x118/0x5e0
[   31.435372]  kasan_report+0xc8/0x118
[   31.435951]  kasan_check_range+0x100/0x1a8
[   31.436601]  __asan_memmove+0x3c/0x98
[   31.437171]  kmalloc_memmove_invalid_size+0x154/0x2e8
[   31.437911]  kunit_try_run_case+0x14c/0x3d0
[   31.438869]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.440081]  kthread+0x24c/0x2d0
[   31.440649]  ret_from_fork+0x10/0x20
[   31.441257] 
[   31.441620] Allocated by task 171:
[   31.442045]  kasan_save_stack+0x3c/0x68
[   31.443614]  kasan_save_track+0x20/0x40
[   31.444131]  kasan_save_alloc_info+0x40/0x58
[   31.444784]  __kasan_kmalloc+0xd4/0xd8
[   31.445398]  __kmalloc_cache_noprof+0x15c/0x3c0
[   31.446058]  kmalloc_memmove_invalid_size+0xb0/0x2e8
[   31.447004]  kunit_try_run_case+0x14c/0x3d0
[   31.447671]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.448433]  kthread+0x24c/0x2d0
[   31.449016]  ret_from_fork+0x10/0x20
[   31.449571] 
[   31.449948] The buggy address belongs to the object at fff00000c66d2100
[   31.449948]  which belongs to the cache kmalloc-64 of size 64
[   31.451443] The buggy address is located 4 bytes inside of
[   31.451443]  allocated 64-byte region [fff00000c66d2100, fff00000c66d2140)
[   31.452679] 
[   31.453053] The buggy address belongs to the physical page:
[   31.453791] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1066d2
[   31.454990] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   31.455872] page_type: f5(slab)
[   31.456359] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   31.457367] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   31.458501] page dumped because: kasan: bad access detected
[   31.459277] 
[   31.459657] Memory state around the buggy address:
[   31.460208]  fff00000c66d2000: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
[   31.461111]  fff00000c66d2080: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   31.461900] >fff00000c66d2100: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
[   31.463640]                                            ^
[   31.464217]  fff00000c66d2180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.465134]  fff00000c66d2200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.465936] ==================================================================

[   24.001021] ==================================================================
[   24.002662] BUG: KASAN: slab-out-of-bounds in kmalloc_memmove_invalid_size+0x170/0x330
[   24.004233] Read of size 64 at addr ffff888102919b04 by task kunit_try_catch/190
[   24.005044] 
[   24.005245] CPU: 0 UID: 0 PID: 190 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241206 #1
[   24.006516] Tainted: [B]=BAD_PAGE, [N]=TEST
[   24.007501] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   24.008880] Call Trace:
[   24.009365]  <TASK>
[   24.009769]  dump_stack_lvl+0x73/0xb0
[   24.010461]  print_report+0xd1/0x640
[   24.011673]  ? __virt_addr_valid+0x1db/0x2d0
[   24.012373]  ? kasan_complete_mode_report_info+0x2a/0x200
[   24.012662]  kasan_report+0x102/0x140
[   24.012890]  ? kmalloc_memmove_invalid_size+0x170/0x330
[   24.013213]  ? kmalloc_memmove_invalid_size+0x170/0x330
[   24.015008]  kasan_check_range+0x10c/0x1c0
[   24.015519]  __asan_memmove+0x27/0x70
[   24.016475]  kmalloc_memmove_invalid_size+0x170/0x330
[   24.017258]  ? __pfx_kmalloc_memmove_invalid_size+0x10/0x10
[   24.018130]  ? __schedule+0xc70/0x27e0
[   24.019097]  ? __pfx_read_tsc+0x10/0x10
[   24.019599]  ? ktime_get_ts64+0x86/0x230
[   24.020046]  kunit_try_run_case+0x1b3/0x490
[   24.021496]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.022381]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   24.023366]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   24.024505]  ? __kthread_parkme+0x82/0x160
[   24.025249]  ? preempt_count_sub+0x50/0x80
[   24.025737]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.027586]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   24.028192]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.028713]  kthread+0x257/0x310
[   24.029083]  ? __pfx_kthread+0x10/0x10
[   24.030429]  ret_from_fork+0x41/0x80
[   24.031173]  ? __pfx_kthread+0x10/0x10
[   24.031475]  ret_from_fork_asm+0x1a/0x30
[   24.032348]  </TASK>
[   24.032582] 
[   24.033005] Allocated by task 190:
[   24.034090]  kasan_save_stack+0x3d/0x60
[   24.035280]  kasan_save_track+0x18/0x40
[   24.035653]  kasan_save_alloc_info+0x3b/0x50
[   24.036701]  __kasan_kmalloc+0xb7/0xc0
[   24.037451]  __kmalloc_cache_noprof+0x184/0x410
[   24.037817]  kmalloc_memmove_invalid_size+0xad/0x330
[   24.039162]  kunit_try_run_case+0x1b3/0x490
[   24.039522]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.040300]  kthread+0x257/0x310
[   24.040817]  ret_from_fork+0x41/0x80
[   24.041671]  ret_from_fork_asm+0x1a/0x30
[   24.041994] 
[   24.042205] The buggy address belongs to the object at ffff888102919b00
[   24.042205]  which belongs to the cache kmalloc-64 of size 64
[   24.044003] The buggy address is located 4 bytes inside of
[   24.044003]  allocated 64-byte region [ffff888102919b00, ffff888102919b40)
[   24.045703] 
[   24.045922] The buggy address belongs to the physical page:
[   24.046811] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102919
[   24.048816] flags: 0x200000000000000(node=0|zone=2)
[   24.049349] page_type: f5(slab)
[   24.050106] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   24.050971] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   24.052454] page dumped because: kasan: bad access detected
[   24.053060] 
[   24.053802] Memory state around the buggy address:
[   24.054263]  ffff888102919a00: 00 00 00 00 00 01 fc fc fc fc fc fc fc fc fc fc
[   24.054876]  ffff888102919a80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   24.056456] >ffff888102919b00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
[   24.057181]                                            ^
[   24.057646]  ffff888102919b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.058989]  ffff888102919c00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.059585] ==================================================================