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

Environment
qemu-x86_64

[   32.557913] ==================================================================
[   32.558420] BUG: KASAN: slab-out-of-bounds in _copy_to_user+0x4a/0x70
[   32.558882] Read of size 121 at addr ffff888102a99200 by task kunit_try_catch/294
[   32.559543] 
[   32.559796] CPU: 1 UID: 0 PID: 294 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241203 #1
[   32.560348] Tainted: [B]=BAD_PAGE, [N]=TEST
[   32.560756] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   32.561346] Call Trace:
[   32.561703]  <TASK>
[   32.561976]  dump_stack_lvl+0x73/0xb0
[   32.562395]  print_report+0xd1/0x640
[   32.562702]  ? __virt_addr_valid+0x1db/0x2d0
[   32.563001]  ? kasan_complete_mode_report_info+0x2a/0x200
[   32.563570]  kasan_report+0x102/0x140
[   32.563972]  ? _copy_to_user+0x4a/0x70
[   32.564385]  ? _copy_to_user+0x4a/0x70
[   32.564726]  kasan_check_range+0x10c/0x1c0
[   32.565013]  __kasan_check_read+0x15/0x20
[   32.565532]  _copy_to_user+0x4a/0x70
[   32.565908]  copy_user_test_oob+0x365/0x10f0
[   32.566368]  ? __pfx_copy_user_test_oob+0x10/0x10
[   32.566846]  ? sysvec_apic_timer_interrupt+0x50/0x90
[   32.567344]  ? __pfx_copy_user_test_oob+0x10/0x10
[   32.568049]  kunit_try_run_case+0x1b3/0x490
[   32.568367]  ? __pfx_kunit_try_run_case+0x10/0x10
[   32.568843]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   32.569175]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   32.569491]  ? __kthread_parkme+0x82/0x160
[   32.569937]  ? preempt_count_sub+0x50/0x80
[   32.570388]  ? __pfx_kunit_try_run_case+0x10/0x10
[   32.570850]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   32.571216]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   32.571792]  kthread+0x257/0x310
[   32.572180]  ? __pfx_kthread+0x10/0x10
[   32.572626]  ret_from_fork+0x41/0x80
[   32.572946]  ? __pfx_kthread+0x10/0x10
[   32.573360]  ret_from_fork_asm+0x1a/0x30
[   32.573696]  </TASK>
[   32.573983] 
[   32.574204] Allocated by task 294:
[   32.574561]  kasan_save_stack+0x3d/0x60
[   32.574914]  kasan_save_track+0x18/0x40
[   32.575233]  kasan_save_alloc_info+0x3b/0x50
[   32.575747]  __kasan_kmalloc+0xb7/0xc0
[   32.576007]  __kmalloc_noprof+0x1c4/0x500
[   32.576421]  kunit_kmalloc_array+0x25/0x60
[   32.576798]  copy_user_test_oob+0xac/0x10f0
[   32.577166]  kunit_try_run_case+0x1b3/0x490
[   32.577503]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   32.578193]  kthread+0x257/0x310
[   32.578482]  ret_from_fork+0x41/0x80
[   32.578836]  ret_from_fork_asm+0x1a/0x30
[   32.579125] 
[   32.579337] The buggy address belongs to the object at ffff888102a99200
[   32.579337]  which belongs to the cache kmalloc-128 of size 128
[   32.580363] The buggy address is located 0 bytes inside of
[   32.580363]  allocated 120-byte region [ffff888102a99200, ffff888102a99278)
[   32.580922] 
[   32.581093] The buggy address belongs to the physical page:
[   32.581585] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a99
[   32.582289] flags: 0x200000000000000(node=0|zone=2)
[   32.582913] page_type: f5(slab)
[   32.583276] raw: 0200000000000000 ffff888100041a00 dead000000000122 0000000000000000
[   32.584182] raw: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
[   32.584939] page dumped because: kasan: bad access detected
[   32.585262] 
[   32.585410] Memory state around the buggy address:
[   32.585679]  ffff888102a99100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc
[   32.586299]  ffff888102a99180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.586994] >ffff888102a99200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
[   32.587683]                                                                 ^
[   32.588153]  ffff888102a99280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.588798]  ffff888102a99300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.589277] ==================================================================