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

Environment
qemu-x86_64

[   30.615295] ==================================================================
[   30.615944] BUG: KASAN: slab-out-of-bounds in _copy_to_user+0x4a/0x70
[   30.616532] Read of size 121 at addr ffff8881029a4b00 by task kunit_try_catch/293
[   30.617203] 
[   30.617460] CPU: 1 UID: 0 PID: 293 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241204 #1
[   30.618370] Tainted: [B]=BAD_PAGE, [N]=TEST
[   30.618811] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   30.619597] Call Trace:
[   30.619901]  <TASK>
[   30.620214]  dump_stack_lvl+0x73/0xb0
[   30.620664]  print_report+0xd1/0x640
[   30.620948]  ? __virt_addr_valid+0x1db/0x2d0
[   30.621527]  ? kasan_complete_mode_report_info+0x2a/0x200
[   30.622122]  kasan_report+0x102/0x140
[   30.622629]  ? _copy_to_user+0x4a/0x70
[   30.623008]  ? _copy_to_user+0x4a/0x70
[   30.623309]  kasan_check_range+0x10c/0x1c0
[   30.623831]  __kasan_check_read+0x15/0x20
[   30.624341]  _copy_to_user+0x4a/0x70
[   30.624651]  copy_user_test_oob+0x365/0x10f0
[   30.625183]  ? __pfx_copy_user_test_oob+0x10/0x10
[   30.625568]  ? finish_task_switch.isra.0+0x153/0x700
[   30.626114]  ? __switch_to+0x5d9/0xf60
[   30.626606]  ? __schedule+0xc3e/0x2790
[   30.627132]  ? __pfx_read_tsc+0x10/0x10
[   30.627464]  ? ktime_get_ts64+0x86/0x230
[   30.628014]  kunit_try_run_case+0x1b3/0x490
[   30.628470]  ? __pfx_kunit_try_run_case+0x10/0x10
[   30.628954]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   30.629478]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   30.630161]  ? __kthread_parkme+0x82/0x160
[   30.630584]  ? preempt_count_sub+0x50/0x80
[   30.631061]  ? __pfx_kunit_try_run_case+0x10/0x10
[   30.631539]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   30.632037]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   30.632582]  kthread+0x257/0x310
[   30.632884]  ? __pfx_kthread+0x10/0x10
[   30.633463]  ret_from_fork+0x41/0x80
[   30.633806]  ? __pfx_kthread+0x10/0x10
[   30.634090]  ret_from_fork_asm+0x1a/0x30
[   30.634688]  </TASK>
[   30.634981] 
[   30.635198] Allocated by task 293:
[   30.635449]  kasan_save_stack+0x3d/0x60
[   30.635886]  kasan_save_track+0x18/0x40
[   30.636530]  kasan_save_alloc_info+0x3b/0x50
[   30.636912]  __kasan_kmalloc+0xb7/0xc0
[   30.637298]  __kmalloc_noprof+0x1c4/0x500
[   30.637852]  kunit_kmalloc_array+0x25/0x60
[   30.638228]  copy_user_test_oob+0xac/0x10f0
[   30.638872]  kunit_try_run_case+0x1b3/0x490
[   30.639178]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   30.639521]  kthread+0x257/0x310
[   30.640119]  ret_from_fork+0x41/0x80
[   30.640632]  ret_from_fork_asm+0x1a/0x30
[   30.641143] 
[   30.641338] The buggy address belongs to the object at ffff8881029a4b00
[   30.641338]  which belongs to the cache kmalloc-128 of size 128
[   30.642033] The buggy address is located 0 bytes inside of
[   30.642033]  allocated 120-byte region [ffff8881029a4b00, ffff8881029a4b78)
[   30.643416] 
[   30.643665] The buggy address belongs to the physical page:
[   30.644363] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1029a4
[   30.645167] flags: 0x200000000000000(node=0|zone=2)
[   30.645501] page_type: f5(slab)
[   30.645807] raw: 0200000000000000 ffff888100041a00 dead000000000122 0000000000000000
[   30.646632] raw: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
[   30.647180] page dumped because: kasan: bad access detected
[   30.647517] 
[   30.647698] Memory state around the buggy address:
[   30.648006]  ffff8881029a4a00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   30.648421]  ffff8881029a4a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   30.649519] >ffff8881029a4b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
[   30.650266]                                                                 ^
[   30.651116]  ffff8881029a4b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   30.651784]  ffff8881029a4c00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   30.652435] ==================================================================