Hay
Date
Nov. 27, 2024, 3:37 a.m.

Environment
qemu-x86_64

[   32.735112] ==================================================================
[   32.736461] BUG: KASAN: slab-out-of-bounds in _copy_from_user+0x33/0xa0
[   32.737199] Write of size 121 at addr ffff888102a58900 by task kunit_try_catch/293
[   32.737829] 
[   32.738190] CPU: 0 UID: 0 PID: 293 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241127 #1
[   32.739243] Tainted: [B]=BAD_PAGE, [N]=TEST
[   32.739683] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   32.740594] Call Trace:
[   32.741072]  <TASK>
[   32.741437]  dump_stack_lvl+0x73/0xb0
[   32.741834]  print_report+0xd1/0x640
[   32.742385]  ? __virt_addr_valid+0x1db/0x2d0
[   32.742762]  ? kasan_complete_mode_report_info+0x2a/0x200
[   32.743353]  kasan_report+0x102/0x140
[   32.743658]  ? _copy_from_user+0x33/0xa0
[   32.744106]  ? _copy_from_user+0x33/0xa0
[   32.744622]  kasan_check_range+0x10c/0x1c0
[   32.745194]  __kasan_check_write+0x18/0x20
[   32.745496]  _copy_from_user+0x33/0xa0
[   32.745940]  copy_user_test_oob+0x2bf/0x10f0
[   32.746535]  ? __pfx_copy_user_test_oob+0x10/0x10
[   32.746966]  ? finish_task_switch.isra.0+0x153/0x700
[   32.747598]  ? __switch_to+0x5d9/0xf60
[   32.747931]  ? __schedule+0xc3e/0x2790
[   32.748465]  ? __pfx_read_tsc+0x10/0x10
[   32.748839]  ? ktime_get_ts64+0x84/0x230
[   32.749336]  kunit_try_run_case+0x1b3/0x490
[   32.749836]  ? __pfx_kunit_try_run_case+0x10/0x10
[   32.750408]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   32.750934]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   32.751529]  ? __kthread_parkme+0x82/0x160
[   32.751855]  ? preempt_count_sub+0x50/0x80
[   32.752394]  ? __pfx_kunit_try_run_case+0x10/0x10
[   32.752803]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   32.753522]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   32.753976]  kthread+0x257/0x310
[   32.754422]  ? __pfx_kthread+0x10/0x10
[   32.754764]  ret_from_fork+0x41/0x80
[   32.755279]  ? __pfx_kthread+0x10/0x10
[   32.755690]  ret_from_fork_asm+0x1a/0x30
[   32.756181]  </TASK>
[   32.756513] 
[   32.756761] Allocated by task 293:
[   32.757260]  kasan_save_stack+0x3d/0x60
[   32.757548]  kasan_save_track+0x18/0x40
[   32.758140]  kasan_save_alloc_info+0x3b/0x50
[   32.758506]  __kasan_kmalloc+0xb7/0xc0
[   32.758937]  __kmalloc_noprof+0x1c4/0x500
[   32.759496]  kunit_kmalloc_array+0x25/0x60
[   32.759895]  copy_user_test_oob+0xac/0x10f0
[   32.760368]  kunit_try_run_case+0x1b3/0x490
[   32.760872]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   32.761414]  kthread+0x257/0x310
[   32.761724]  ret_from_fork+0x41/0x80
[   32.762063]  ret_from_fork_asm+0x1a/0x30
[   32.762576] 
[   32.762833] The buggy address belongs to the object at ffff888102a58900
[   32.762833]  which belongs to the cache kmalloc-128 of size 128
[   32.763931] The buggy address is located 0 bytes inside of
[   32.763931]  allocated 120-byte region [ffff888102a58900, ffff888102a58978)
[   32.766090] 
[   32.766324] The buggy address belongs to the physical page:
[   32.766749] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a58
[   32.767451] flags: 0x200000000000000(node=0|zone=2)
[   32.767910] page_type: f5(slab)
[   32.768375] raw: 0200000000000000 ffff888100041a00 dead000000000122 0000000000000000
[   32.769137] raw: 0000000000000000 0000000080100010 00000001f5000000 0000000000000000
[   32.769795] page dumped because: kasan: bad access detected
[   32.770465] 
[   32.770698] Memory state around the buggy address:
[   32.771213]  ffff888102a58800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   32.771825]  ffff888102a58880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.772555] >ffff888102a58900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
[   32.773112]                                                                 ^
[   32.773854]  ffff888102a58980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.774470]  ffff888102a58a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.775233] ==================================================================