Hay
Date
Nov. 20, 2024, 6:35 a.m.

Environment
qemu-x86_64

[   35.843027] ==================================================================
[   35.844094] BUG: KASAN: slab-out-of-bounds in _copy_to_user+0x4a/0x70
[   35.844736] Read of size 121 at addr ffff888101adc700 by task kunit_try_catch/292
[   35.845157] 
[   35.845415] CPU: 0 UID: 0 PID: 292 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241120 #1
[   35.846378] Tainted: [B]=BAD_PAGE, [N]=TEST
[   35.846672] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   35.847348] Call Trace:
[   35.847686]  <TASK>
[   35.848073]  dump_stack_lvl+0x73/0xb0
[   35.848914]  print_report+0xd1/0x640
[   35.849230]  ? __virt_addr_valid+0x1db/0x2d0
[   35.849964]  ? kasan_complete_mode_report_info+0x2a/0x200
[   35.850433]  kasan_report+0x102/0x140
[   35.850751]  ? _copy_to_user+0x4a/0x70
[   35.851050]  ? _copy_to_user+0x4a/0x70
[   35.851593]  kasan_check_range+0x10c/0x1c0
[   35.852135]  __kasan_check_read+0x15/0x20
[   35.852520]  _copy_to_user+0x4a/0x70
[   35.853361]  copy_user_test_oob+0x365/0x10f0
[   35.853975]  ? __pfx_copy_user_test_oob+0x10/0x10
[   35.854984]  ? finish_task_switch.isra.0+0x153/0x700
[   35.855874]  ? __switch_to+0x5d9/0xf60
[   35.856347]  ? __schedule+0xc3e/0x2790
[   35.856905]  ? __pfx_read_tsc+0x10/0x10
[   35.857325]  ? ktime_get_ts64+0x84/0x230
[   35.857811]  kunit_try_run_case+0x1b3/0x490
[   35.858287]  ? __pfx_kunit_try_run_case+0x10/0x10
[   35.859003]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   35.859478]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   35.860185]  ? __kthread_parkme+0x82/0x160
[   35.860686]  ? preempt_count_sub+0x50/0x80
[   35.861258]  ? __pfx_kunit_try_run_case+0x10/0x10
[   35.862008]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   35.862733]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   35.863303]  kthread+0x257/0x310
[   35.863884]  ? __pfx_kthread+0x10/0x10
[   35.864363]  ret_from_fork+0x41/0x80
[   35.865005]  ? __pfx_kthread+0x10/0x10
[   35.865441]  ret_from_fork_asm+0x1a/0x30
[   35.866009]  </TASK>
[   35.866401] 
[   35.866690] Allocated by task 292:
[   35.867148]  kasan_save_stack+0x3d/0x60
[   35.867499]  kasan_save_track+0x18/0x40
[   35.868069]  kasan_save_alloc_info+0x3b/0x50
[   35.868469]  __kasan_kmalloc+0xb7/0xc0
[   35.869137]  __kmalloc_noprof+0x1c4/0x500
[   35.869503]  kunit_kmalloc_array+0x25/0x60
[   35.870238]  copy_user_test_oob+0xac/0x10f0
[   35.870691]  kunit_try_run_case+0x1b3/0x490
[   35.871206]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   35.872060]  kthread+0x257/0x310
[   35.872490]  ret_from_fork+0x41/0x80
[   35.873056]  ret_from_fork_asm+0x1a/0x30
[   35.873575] 
[   35.873854] The buggy address belongs to the object at ffff888101adc700
[   35.873854]  which belongs to the cache kmalloc-128 of size 128
[   35.875128] The buggy address is located 0 bytes inside of
[   35.875128]  allocated 120-byte region [ffff888101adc700, ffff888101adc778)
[   35.876437] 
[   35.876676] The buggy address belongs to the physical page:
[   35.877239] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101adc
[   35.878155] flags: 0x200000000000000(node=0|zone=2)
[   35.878669] page_type: f5(slab)
[   35.879009] raw: 0200000000000000 ffff888100041a00 dead000000000122 0000000000000000
[   35.880091] raw: 0000000000000000 0000000080100010 00000001f5000000 0000000000000000
[   35.880760] page dumped because: kasan: bad access detected
[   35.881533] 
[   35.881760] Memory state around the buggy address:
[   35.882478]  ffff888101adc600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   35.883733]  ffff888101adc680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   35.884519] >ffff888101adc700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
[   35.885362]                                                                 ^
[   35.886193]  ffff888101adc780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   35.886844]  ffff888101adc800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   35.887757] ==================================================================