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

Environment
qemu-x86_64

[   28.628515] ==================================================================
[   28.629158] BUG: KASAN: slab-out-of-bounds in _copy_to_user+0x4a/0x70
[   28.629760] Read of size 121 at addr ffff888101b6b500 by task kunit_try_catch/293
[   28.630458] 
[   28.630768] CPU: 1 UID: 0 PID: 293 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241128 #1
[   28.631727] Tainted: [B]=BAD_PAGE, [N]=TEST
[   28.632037] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   28.633048] Call Trace:
[   28.633489]  <TASK>
[   28.633885]  dump_stack_lvl+0x73/0xb0
[   28.634476]  print_report+0xd1/0x640
[   28.634793]  ? __virt_addr_valid+0x1db/0x2d0
[   28.635397]  ? kasan_complete_mode_report_info+0x2a/0x200
[   28.635775]  kasan_report+0x102/0x140
[   28.636306]  ? _copy_to_user+0x4a/0x70
[   28.636922]  ? _copy_to_user+0x4a/0x70
[   28.637808]  kasan_check_range+0x10c/0x1c0
[   28.638181]  __kasan_check_read+0x15/0x20
[   28.638590]  _copy_to_user+0x4a/0x70
[   28.638957]  copy_user_test_oob+0x365/0x10f0
[   28.639991]  ? __pfx_copy_user_test_oob+0x10/0x10
[   28.640730]  ? finish_task_switch.isra.0+0x153/0x700
[   28.641436]  ? __switch_to+0x5d9/0xf60
[   28.641815]  ? __schedule+0xc3e/0x2790
[   28.642300]  ? __pfx_read_tsc+0x10/0x10
[   28.642771]  ? ktime_get_ts64+0x84/0x230
[   28.643150]  kunit_try_run_case+0x1b3/0x490
[   28.643653]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.644008]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   28.644585]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   28.645034]  ? __kthread_parkme+0x82/0x160
[   28.645518]  ? preempt_count_sub+0x50/0x80
[   28.645904]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.646494]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   28.646928]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.647566]  kthread+0x257/0x310
[   28.647829]  ? __pfx_kthread+0x10/0x10
[   28.648356]  ret_from_fork+0x41/0x80
[   28.648819]  ? __pfx_kthread+0x10/0x10
[   28.649234]  ret_from_fork_asm+0x1a/0x30
[   28.649620]  </TASK>
[   28.649875] 
[   28.650176] Allocated by task 293:
[   28.650675]  kasan_save_stack+0x3d/0x60
[   28.651057]  kasan_save_track+0x18/0x40
[   28.651449]  kasan_save_alloc_info+0x3b/0x50
[   28.651970]  __kasan_kmalloc+0xb7/0xc0
[   28.652314]  __kmalloc_noprof+0x1c4/0x500
[   28.652813]  kunit_kmalloc_array+0x25/0x60
[   28.653246]  copy_user_test_oob+0xac/0x10f0
[   28.653693]  kunit_try_run_case+0x1b3/0x490
[   28.654196]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.654580]  kthread+0x257/0x310
[   28.654970]  ret_from_fork+0x41/0x80
[   28.655504]  ret_from_fork_asm+0x1a/0x30
[   28.655812] 
[   28.655969] The buggy address belongs to the object at ffff888101b6b500
[   28.655969]  which belongs to the cache kmalloc-128 of size 128
[   28.657206] The buggy address is located 0 bytes inside of
[   28.657206]  allocated 120-byte region [ffff888101b6b500, ffff888101b6b578)
[   28.658459] 
[   28.658647] The buggy address belongs to the physical page:
[   28.659017] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101b6b
[   28.659866] flags: 0x200000000000000(node=0|zone=2)
[   28.660311] page_type: f5(slab)
[   28.660635] raw: 0200000000000000 ffff888100041a00 dead000000000122 0000000000000000
[   28.661254] raw: 0000000000000000 0000000080100010 00000001f5000000 0000000000000000
[   28.661975] page dumped because: kasan: bad access detected
[   28.662506] 
[   28.662657] Memory state around the buggy address:
[   28.663249]  ffff888101b6b400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   28.663935]  ffff888101b6b480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.664655] >ffff888101b6b500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
[   28.665225]                                                                 ^
[   28.665877]  ffff888101b6b580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.666509]  ffff888101b6b600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.666964] ==================================================================