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

Environment
qemu-arm64
qemu-x86_64

[   30.729667] ==================================================================
[   30.730901] BUG: KASAN: slab-out-of-bounds in kmalloc_memmove_invalid_size+0x154/0x2e8
[   30.731810] Read of size 64 at addr fff00000c590c104 by task kunit_try_catch/171
[   30.733177] 
[   30.734113] CPU: 1 UID: 0 PID: 171 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241203 #1
[   30.735752] Tainted: [B]=BAD_PAGE, [N]=TEST
[   30.736364] Hardware name: linux,dummy-virt (DT)
[   30.736958] Call trace:
[   30.737299]  show_stack+0x20/0x38 (C)
[   30.738178]  dump_stack_lvl+0x8c/0xd0
[   30.738875]  print_report+0x118/0x5e0
[   30.740175]  kasan_report+0xc8/0x118
[   30.740754]  kasan_check_range+0x100/0x1a8
[   30.741353]  __asan_memmove+0x3c/0x98
[   30.742018]  kmalloc_memmove_invalid_size+0x154/0x2e8
[   30.743251]  kunit_try_run_case+0x14c/0x3d0
[   30.743895]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   30.744655]  kthread+0x24c/0x2d0
[   30.745153]  ret_from_fork+0x10/0x20
[   30.745838] 
[   30.746123] Allocated by task 171:
[   30.746656]  kasan_save_stack+0x3c/0x68
[   30.748030]  kasan_save_track+0x20/0x40
[   30.748718]  kasan_save_alloc_info+0x40/0x58
[   30.749362]  __kasan_kmalloc+0xd4/0xd8
[   30.749998]  __kmalloc_cache_noprof+0x15c/0x3c0
[   30.750859]  kmalloc_memmove_invalid_size+0xb0/0x2e8
[   30.751842]  kunit_try_run_case+0x14c/0x3d0
[   30.752417]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   30.753278]  kthread+0x24c/0x2d0
[   30.753809]  ret_from_fork+0x10/0x20
[   30.754461] 
[   30.754806] The buggy address belongs to the object at fff00000c590c100
[   30.754806]  which belongs to the cache kmalloc-64 of size 64
[   30.756803] The buggy address is located 4 bytes inside of
[   30.756803]  allocated 64-byte region [fff00000c590c100, fff00000c590c140)
[   30.758014] 
[   30.758392] The buggy address belongs to the physical page:
[   30.759070] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10590c
[   30.760078] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   30.760890] page_type: f5(slab)
[   30.761772] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   30.762696] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   30.763795] page dumped because: kasan: bad access detected
[   30.764470] 
[   30.764763] Memory state around the buggy address:
[   30.765469]  fff00000c590c000: 00 00 00 00 00 01 fc fc fc fc fc fc fc fc fc fc
[   30.767865]  fff00000c590c080: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   30.768778] >fff00000c590c100: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
[   30.769738]                                            ^
[   30.770303]  fff00000c590c180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   30.772316]  fff00000c590c200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   30.773104] ==================================================================

[   26.306237] ==================================================================
[   26.307341] BUG: KASAN: slab-out-of-bounds in kmalloc_memmove_invalid_size+0x170/0x330
[   26.308431] Read of size 64 at addr ffff888102a12304 by task kunit_try_catch/191
[   26.309755] 
[   26.310106] CPU: 1 UID: 0 PID: 191 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241203 #1
[   26.311150] Tainted: [B]=BAD_PAGE, [N]=TEST
[   26.311506] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   26.312537] Call Trace:
[   26.313030]  <TASK>
[   26.313693]  dump_stack_lvl+0x73/0xb0
[   26.314156]  print_report+0xd1/0x640
[   26.314769]  ? __virt_addr_valid+0x1db/0x2d0
[   26.315457]  ? kasan_complete_mode_report_info+0x2a/0x200
[   26.315919]  kasan_report+0x102/0x140
[   26.316202]  ? kmalloc_memmove_invalid_size+0x170/0x330
[   26.317049]  ? kmalloc_memmove_invalid_size+0x170/0x330
[   26.317700]  kasan_check_range+0x10c/0x1c0
[   26.317892]  __asan_memmove+0x27/0x70
[   26.318034]  kmalloc_memmove_invalid_size+0x170/0x330
[   26.318330]  ? __pfx_kmalloc_memmove_invalid_size+0x10/0x10
[   26.319409]  ? __pfx_kmalloc_memmove_invalid_size+0x10/0x10
[   26.320250]  kunit_try_run_case+0x1b3/0x490
[   26.320911]  ? __pfx_kunit_try_run_case+0x10/0x10
[   26.321481]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   26.322078]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   26.322656]  ? __kthread_parkme+0x82/0x160
[   26.323019]  ? preempt_count_sub+0x50/0x80
[   26.323341]  ? __pfx_kunit_try_run_case+0x10/0x10
[   26.324271]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   26.324991]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.325716]  kthread+0x257/0x310
[   26.326270]  ? __pfx_kthread+0x10/0x10
[   26.326956]  ret_from_fork+0x41/0x80
[   26.327209]  ? __pfx_kthread+0x10/0x10
[   26.327851]  ret_from_fork_asm+0x1a/0x30
[   26.328578]  </TASK>
[   26.329123] 
[   26.329326] Allocated by task 191:
[   26.329937]  kasan_save_stack+0x3d/0x60
[   26.330292]  kasan_save_track+0x18/0x40
[   26.330617]  kasan_save_alloc_info+0x3b/0x50
[   26.331202]  __kasan_kmalloc+0xb7/0xc0
[   26.331487]  __kmalloc_cache_noprof+0x184/0x410
[   26.331846]  kmalloc_memmove_invalid_size+0xad/0x330
[   26.332473]  kunit_try_run_case+0x1b3/0x490
[   26.332989]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.333366]  kthread+0x257/0x310
[   26.333596]  ret_from_fork+0x41/0x80
[   26.334018]  ret_from_fork_asm+0x1a/0x30
[   26.334708] 
[   26.334994] The buggy address belongs to the object at ffff888102a12300
[   26.334994]  which belongs to the cache kmalloc-64 of size 64
[   26.335971] The buggy address is located 4 bytes inside of
[   26.335971]  allocated 64-byte region [ffff888102a12300, ffff888102a12340)
[   26.337014] 
[   26.337198] The buggy address belongs to the physical page:
[   26.338350] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a12
[   26.339216] flags: 0x200000000000000(node=0|zone=2)
[   26.339586] page_type: f5(slab)
[   26.340187] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   26.341017] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   26.342272] page dumped because: kasan: bad access detected
[   26.342621] 
[   26.343209] Memory state around the buggy address:
[   26.343796]  ffff888102a12200: 00 00 00 00 00 01 fc fc fc fc fc fc fc fc fc fc
[   26.344919]  ffff888102a12280: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   26.345390] >ffff888102a12300: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
[   26.345912]                                            ^
[   26.346647]  ffff888102a12380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   26.347433]  ffff888102a12400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   26.348370] ==================================================================