Hay
Date
Nov. 28, 2024, 2:36 a.m.

Environment
qemu-arm64
qemu-x86_64

[   30.830888] ==================================================================
[   30.832014] BUG: KASAN: slab-out-of-bounds in kmalloc_memmove_invalid_size+0x154/0x2e8
[   30.832869] Read of size 64 at addr fff00000c6352a04 by task kunit_try_catch/170
[   30.834496] 
[   30.834972] CPU: 0 UID: 0 PID: 170 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241128 #1
[   30.835875] Tainted: [B]=BAD_PAGE, [N]=TEST
[   30.836152] Hardware name: linux,dummy-virt (DT)
[   30.836668] Call trace:
[   30.837183]  show_stack+0x20/0x38 (C)
[   30.838300]  dump_stack_lvl+0x8c/0xd0
[   30.838921]  print_report+0x118/0x5e0
[   30.839496]  kasan_report+0xc8/0x118
[   30.840174]  kasan_check_range+0x100/0x1a8
[   30.840764]  __asan_memmove+0x3c/0x98
[   30.841863]  kmalloc_memmove_invalid_size+0x154/0x2e8
[   30.842670]  kunit_try_run_case+0x14c/0x3d0
[   30.843387]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   30.844173]  kthread+0x24c/0x2d0
[   30.844826]  ret_from_fork+0x10/0x20
[   30.845647] 
[   30.846506] Allocated by task 170:
[   30.846916]  kasan_save_stack+0x3c/0x68
[   30.847464]  kasan_save_track+0x20/0x40
[   30.847974]  kasan_save_alloc_info+0x40/0x58
[   30.848625]  __kasan_kmalloc+0xd4/0xd8
[   30.849313]  __kmalloc_cache_noprof+0x15c/0x3c0
[   30.849813]  kmalloc_memmove_invalid_size+0xb0/0x2e8
[   30.850555]  kunit_try_run_case+0x14c/0x3d0
[   30.851236]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   30.851972]  kthread+0x24c/0x2d0
[   30.852449]  ret_from_fork+0x10/0x20
[   30.853004] 
[   30.853887] The buggy address belongs to the object at fff00000c6352a00
[   30.853887]  which belongs to the cache kmalloc-64 of size 64
[   30.855860] The buggy address is located 4 bytes inside of
[   30.855860]  allocated 64-byte region [fff00000c6352a00, fff00000c6352a40)
[   30.857757] 
[   30.858032] The buggy address belongs to the physical page:
[   30.858727] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106352
[   30.859582] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   30.860448] page_type: f5(slab)
[   30.861062] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   30.862018] raw: 0000000000000000 0000000080200020 00000001f5000000 0000000000000000
[   30.862707] page dumped because: kasan: bad access detected
[   30.863447] 
[   30.863884] Memory state around the buggy address:
[   30.864561]  fff00000c6352900: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   30.865471]  fff00000c6352980: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   30.866836] >fff00000c6352a00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
[   30.867388]                                            ^
[   30.867698]  fff00000c6352a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   30.868043]  fff00000c6352b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   30.868989] ==================================================================

[   21.757852] ==================================================================
[   21.758839] BUG: KASAN: slab-out-of-bounds in kmalloc_memmove_invalid_size+0x170/0x330
[   21.759700] Read of size 64 at addr ffff888101b59084 by task kunit_try_catch/190
[   21.760446] 
[   21.760689] CPU: 1 UID: 0 PID: 190 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241128 #1
[   21.761780] Tainted: [B]=BAD_PAGE, [N]=TEST
[   21.762148] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   21.763206] Call Trace:
[   21.764322]  <TASK>
[   21.764812]  dump_stack_lvl+0x73/0xb0
[   21.765202]  print_report+0xd1/0x640
[   21.765713]  ? __virt_addr_valid+0x1db/0x2d0
[   21.766537]  ? kasan_complete_mode_report_info+0x2a/0x200
[   21.767251]  kasan_report+0x102/0x140
[   21.767822]  ? kmalloc_memmove_invalid_size+0x170/0x330
[   21.768367]  ? kmalloc_memmove_invalid_size+0x170/0x330
[   21.768866]  kasan_check_range+0x10c/0x1c0
[   21.769493]  __asan_memmove+0x27/0x70
[   21.769916]  kmalloc_memmove_invalid_size+0x170/0x330
[   21.770615]  ? __pfx_kmalloc_memmove_invalid_size+0x10/0x10
[   21.771508]  ? __schedule+0xc3e/0x2790
[   21.771829]  ? __pfx_read_tsc+0x10/0x10
[   21.772119]  ? ktime_get_ts64+0x84/0x230
[   21.772717]  kunit_try_run_case+0x1b3/0x490
[   21.773578]  ? __pfx_kunit_try_run_case+0x10/0x10
[   21.774110]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   21.774776]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   21.775532]  ? __kthread_parkme+0x82/0x160
[   21.776024]  ? preempt_count_sub+0x50/0x80
[   21.776542]  ? __pfx_kunit_try_run_case+0x10/0x10
[   21.777001]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   21.777603]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   21.777993]  kthread+0x257/0x310
[   21.778788]  ? __pfx_kthread+0x10/0x10
[   21.779308]  ret_from_fork+0x41/0x80
[   21.779631]  ? __pfx_kthread+0x10/0x10
[   21.780061]  ret_from_fork_asm+0x1a/0x30
[   21.780612]  </TASK>
[   21.780922] 
[   21.781296] Allocated by task 190:
[   21.781654]  kasan_save_stack+0x3d/0x60
[   21.782134]  kasan_save_track+0x18/0x40
[   21.782588]  kasan_save_alloc_info+0x3b/0x50
[   21.783086]  __kasan_kmalloc+0xb7/0xc0
[   21.783522]  __kmalloc_cache_noprof+0x184/0x410
[   21.784054]  kmalloc_memmove_invalid_size+0xad/0x330
[   21.785052]  kunit_try_run_case+0x1b3/0x490
[   21.785676]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   21.786315]  kthread+0x257/0x310
[   21.786713]  ret_from_fork+0x41/0x80
[   21.787059]  ret_from_fork_asm+0x1a/0x30
[   21.787705] 
[   21.787923] The buggy address belongs to the object at ffff888101b59080
[   21.787923]  which belongs to the cache kmalloc-64 of size 64
[   21.788851] The buggy address is located 4 bytes inside of
[   21.788851]  allocated 64-byte region [ffff888101b59080, ffff888101b590c0)
[   21.789815] 
[   21.790019] The buggy address belongs to the physical page:
[   21.790559] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101b59
[   21.791783] flags: 0x200000000000000(node=0|zone=2)
[   21.792400] page_type: f5(slab)
[   21.792805] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   21.793623] raw: 0000000000000000 0000000080200020 00000001f5000000 0000000000000000
[   21.794404] page dumped because: kasan: bad access detected
[   21.794765] 
[   21.795039] Memory state around the buggy address:
[   21.795520]  ffff888101b58f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   21.796042]  ffff888101b59000: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   21.796902] >ffff888101b59080: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
[   21.797576]                                            ^
[   21.797984]  ffff888101b59100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   21.799222]  ffff888101b59180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   21.799967] ==================================================================