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

Environment
qemu-x86_64

[   35.790631] ==================================================================
[   35.791936] BUG: KASAN: slab-out-of-bounds in _copy_from_user+0x33/0xa0
[   35.792566] Write of size 121 at addr ffff888101adc700 by task kunit_try_catch/292
[   35.793406] 
[   35.793694] CPU: 0 UID: 0 PID: 292 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241120 #1
[   35.794796] Tainted: [B]=BAD_PAGE, [N]=TEST
[   35.795313] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   35.796345] Call Trace:
[   35.796657]  <TASK>
[   35.797050]  dump_stack_lvl+0x73/0xb0
[   35.797682]  print_report+0xd1/0x640
[   35.798102]  ? __virt_addr_valid+0x1db/0x2d0
[   35.798810]  ? kasan_complete_mode_report_info+0x2a/0x200
[   35.799289]  kasan_report+0x102/0x140
[   35.799675]  ? _copy_from_user+0x33/0xa0
[   35.800605]  ? _copy_from_user+0x33/0xa0
[   35.801004]  kasan_check_range+0x10c/0x1c0
[   35.801363]  __kasan_check_write+0x18/0x20
[   35.801977]  _copy_from_user+0x33/0xa0
[   35.802430]  copy_user_test_oob+0x2bf/0x10f0
[   35.803149]  ? __pfx_copy_user_test_oob+0x10/0x10
[   35.803501]  ? finish_task_switch.isra.0+0x153/0x700
[   35.804363]  ? __switch_to+0x5d9/0xf60
[   35.804873]  ? __schedule+0xc3e/0x2790
[   35.805317]  ? __pfx_read_tsc+0x10/0x10
[   35.805811]  ? ktime_get_ts64+0x84/0x230
[   35.806291]  kunit_try_run_case+0x1b3/0x490
[   35.807056]  ? __pfx_kunit_try_run_case+0x10/0x10
[   35.807475]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   35.808363]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   35.808872]  ? __kthread_parkme+0x82/0x160
[   35.809396]  ? preempt_count_sub+0x50/0x80
[   35.810178]  ? __pfx_kunit_try_run_case+0x10/0x10
[   35.811065]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   35.811572]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   35.812432]  kthread+0x257/0x310
[   35.812932]  ? __pfx_kthread+0x10/0x10
[   35.813283]  ret_from_fork+0x41/0x80
[   35.813677]  ? __pfx_kthread+0x10/0x10
[   35.814971]  ret_from_fork_asm+0x1a/0x30
[   35.815371]  </TASK>
[   35.815866] 
[   35.816050] Allocated by task 292:
[   35.816837]  kasan_save_stack+0x3d/0x60
[   35.817119]  kasan_save_track+0x18/0x40
[   35.818370]  kasan_save_alloc_info+0x3b/0x50
[   35.818798]  __kasan_kmalloc+0xb7/0xc0
[   35.818985]  __kmalloc_noprof+0x1c4/0x500
[   35.819172]  kunit_kmalloc_array+0x25/0x60
[   35.819360]  copy_user_test_oob+0xac/0x10f0
[   35.819553]  kunit_try_run_case+0x1b3/0x490
[   35.819917]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   35.820264]  kthread+0x257/0x310
[   35.821407]  ret_from_fork+0x41/0x80
[   35.822064]  ret_from_fork_asm+0x1a/0x30
[   35.822721] 
[   35.823202] The buggy address belongs to the object at ffff888101adc700
[   35.823202]  which belongs to the cache kmalloc-128 of size 128
[   35.824590] The buggy address is located 0 bytes inside of
[   35.824590]  allocated 120-byte region [ffff888101adc700, ffff888101adc778)
[   35.825858] 
[   35.826246] The buggy address belongs to the physical page:
[   35.826659] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101adc
[   35.827407] flags: 0x200000000000000(node=0|zone=2)
[   35.827919] page_type: f5(slab)
[   35.828862] raw: 0200000000000000 ffff888100041a00 dead000000000122 0000000000000000
[   35.829624] raw: 0000000000000000 0000000080100010 00000001f5000000 0000000000000000
[   35.830655] page dumped because: kasan: bad access detected
[   35.831491] 
[   35.831661] Memory state around the buggy address:
[   35.832494]  ffff888101adc600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   35.833676]  ffff888101adc680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   35.834416] >ffff888101adc700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
[   35.835141]                                                                 ^
[   35.835701]  ffff888101adc780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   35.836694]  ffff888101adc800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   35.837430] ==================================================================