Hay
Date
Dec. 4, 2024, 3:07 p.m.

Environment
qemu-arm64
qemu-x86_64

[   32.312678] ==================================================================
[   32.313990] BUG: KASAN: slab-out-of-bounds in kmalloc_memmove_invalid_size+0x154/0x2e8
[   32.315238] Read of size 64 at addr fff00000c66e4e04 by task kunit_try_catch/170
[   32.316816] 
[   32.317352] CPU: 0 UID: 0 PID: 170 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241204 #1
[   32.318951] Tainted: [B]=BAD_PAGE, [N]=TEST
[   32.320087] Hardware name: linux,dummy-virt (DT)
[   32.320843] Call trace:
[   32.321318]  show_stack+0x20/0x38 (C)
[   32.322960]  dump_stack_lvl+0x8c/0xd0
[   32.323772]  print_report+0x118/0x5e0
[   32.324276]  kasan_report+0xc8/0x118
[   32.325163]  kasan_check_range+0x100/0x1a8
[   32.326195]  __asan_memmove+0x3c/0x98
[   32.327315]  kmalloc_memmove_invalid_size+0x154/0x2e8
[   32.328106]  kunit_try_run_case+0x14c/0x3d0
[   32.328859]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   32.329680]  kthread+0x24c/0x2d0
[   32.331217]  ret_from_fork+0x10/0x20
[   32.331777] 
[   32.332093] Allocated by task 170:
[   32.332544]  kasan_save_stack+0x3c/0x68
[   32.333232]  kasan_save_track+0x20/0x40
[   32.334122]  kasan_save_alloc_info+0x40/0x58
[   32.335294]  __kasan_kmalloc+0xd4/0xd8
[   32.336069]  __kmalloc_cache_noprof+0x15c/0x3c0
[   32.336802]  kmalloc_memmove_invalid_size+0xb0/0x2e8
[   32.337566]  kunit_try_run_case+0x14c/0x3d0
[   32.339272]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   32.340210]  kthread+0x24c/0x2d0
[   32.340973]  ret_from_fork+0x10/0x20
[   32.341503] 
[   32.342025] The buggy address belongs to the object at fff00000c66e4e00
[   32.342025]  which belongs to the cache kmalloc-64 of size 64
[   32.344192] The buggy address is located 4 bytes inside of
[   32.344192]  allocated 64-byte region [fff00000c66e4e00, fff00000c66e4e40)
[   32.346263] 
[   32.346603] The buggy address belongs to the physical page:
[   32.348384] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1066e4
[   32.349412] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   32.350813] page_type: f5(slab)
[   32.351307] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   32.352204] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   32.353110] page dumped because: kasan: bad access detected
[   32.353928] 
[   32.354202] Memory state around the buggy address:
[   32.355041]  fff00000c66e4d00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
[   32.356436]  fff00000c66e4d80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   32.357761] >fff00000c66e4e00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
[   32.359515]                                            ^
[   32.360111]  fff00000c66e4e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.361319]  fff00000c66e4f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.362451] ==================================================================

[   23.135739] ==================================================================
[   23.137318] BUG: KASAN: slab-out-of-bounds in kmalloc_memmove_invalid_size+0x170/0x330
[   23.138573] Read of size 64 at addr ffff888101aec004 by task kunit_try_catch/190
[   23.139918] 
[   23.140448] CPU: 0 UID: 0 PID: 190 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241204 #1
[   23.141246] Tainted: [B]=BAD_PAGE, [N]=TEST
[   23.142090] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   23.142943] Call Trace:
[   23.143526]  <TASK>
[   23.143978]  dump_stack_lvl+0x73/0xb0
[   23.144651]  print_report+0xd1/0x640
[   23.145242]  ? __virt_addr_valid+0x1db/0x2d0
[   23.146105]  ? kasan_complete_mode_report_info+0x2a/0x200
[   23.146941]  kasan_report+0x102/0x140
[   23.147265]  ? kmalloc_memmove_invalid_size+0x170/0x330
[   23.148229]  ? kmalloc_memmove_invalid_size+0x170/0x330
[   23.148862]  kasan_check_range+0x10c/0x1c0
[   23.149321]  __asan_memmove+0x27/0x70
[   23.149941]  kmalloc_memmove_invalid_size+0x170/0x330
[   23.150835]  ? __pfx_kmalloc_memmove_invalid_size+0x10/0x10
[   23.151354]  ? __schedule+0xc3e/0x2790
[   23.152074]  ? __pfx_read_tsc+0x10/0x10
[   23.152477]  ? ktime_get_ts64+0x86/0x230
[   23.152866]  kunit_try_run_case+0x1b3/0x490
[   23.153311]  ? __pfx_kunit_try_run_case+0x10/0x10
[   23.154236]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   23.154663]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   23.155845]  ? __kthread_parkme+0x82/0x160
[   23.156260]  ? preempt_count_sub+0x50/0x80
[   23.156960]  ? __pfx_kunit_try_run_case+0x10/0x10
[   23.158022]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   23.158761]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   23.159213]  kthread+0x257/0x310
[   23.159592]  ? __pfx_kthread+0x10/0x10
[   23.160542]  ret_from_fork+0x41/0x80
[   23.161113]  ? __pfx_kthread+0x10/0x10
[   23.161700]  ret_from_fork_asm+0x1a/0x30
[   23.162086]  </TASK>
[   23.162313] 
[   23.162965] Allocated by task 190:
[   23.163250]  kasan_save_stack+0x3d/0x60
[   23.164068]  kasan_save_track+0x18/0x40
[   23.164353]  kasan_save_alloc_info+0x3b/0x50
[   23.165318]  __kasan_kmalloc+0xb7/0xc0
[   23.166092]  __kmalloc_cache_noprof+0x184/0x410
[   23.166776]  kmalloc_memmove_invalid_size+0xad/0x330
[   23.167087]  kunit_try_run_case+0x1b3/0x490
[   23.167988]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   23.168798]  kthread+0x257/0x310
[   23.169168]  ret_from_fork+0x41/0x80
[   23.169719]  ret_from_fork_asm+0x1a/0x30
[   23.170329] 
[   23.170877] The buggy address belongs to the object at ffff888101aec000
[   23.170877]  which belongs to the cache kmalloc-64 of size 64
[   23.172140] The buggy address is located 4 bytes inside of
[   23.172140]  allocated 64-byte region [ffff888101aec000, ffff888101aec040)
[   23.173681] 
[   23.174223] The buggy address belongs to the physical page:
[   23.175792] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101aec
[   23.176441] flags: 0x200000000000000(node=0|zone=2)
[   23.177014] page_type: f5(slab)
[   23.177957] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   23.178585] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   23.179320] page dumped because: kasan: bad access detected
[   23.180041] 
[   23.180140] Memory state around the buggy address:
[   23.180362]  ffff888101aebf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.181638]  ffff888101aebf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.182408] >ffff888101aec000: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
[   23.183076]                                            ^
[   23.183585]  ffff888101aec080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.184896]  ffff888101aec100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.185571] ==================================================================