Hay
Date
March 19, 2025, 10:35 a.m.

Environment
qemu-x86_64

[   28.851725] ==================================================================
[   28.852834] BUG: KASAN: slab-out-of-bounds in _copy_from_user+0x32/0x90
[   28.853561] Write of size 121 at addr ffff88810305ae00 by task kunit_try_catch/306
[   28.854474] 
[   28.854872] CPU: 0 UID: 0 PID: 306 Comm: kunit_try_catch Tainted: G    B            N  6.14.0-rc7-next-20250319 #1 PREEMPT(voluntary) 
[   28.855056] Tainted: [B]=BAD_PAGE, [N]=TEST
[   28.855132] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   28.855202] Call Trace:
[   28.855243]  <TASK>
[   28.855285]  dump_stack_lvl+0x73/0xb0
[   28.855464]  print_report+0xd1/0x660
[   28.855598]  ? __virt_addr_valid+0x1db/0x2d0
[   28.855808]  ? kasan_complete_mode_report_info+0x2a/0x200
[   28.855922]  kasan_report+0x104/0x140
[   28.856005]  ? _copy_from_user+0x32/0x90
[   28.856062]  ? _copy_from_user+0x32/0x90
[   28.856103]  kasan_check_range+0x10c/0x1c0
[   28.856167]  __kasan_check_write+0x18/0x20
[   28.856200]  _copy_from_user+0x32/0x90
[   28.856232]  copy_user_test_oob+0x2be/0x1130
[   28.856275]  ? __pfx_copy_user_test_oob+0x10/0x10
[   28.856312]  ? finish_task_switch.isra.0+0x153/0x730
[   28.856347]  ? __switch_to+0x5d9/0xf70
[   28.856390]  ? __schedule+0xd46/0x29c0
[   28.856424]  ? __pfx_read_tsc+0x10/0x10
[   28.856455]  ? ktime_get_ts64+0x86/0x240
[   28.856496]  kunit_try_run_case+0x1b2/0x490
[   28.856532]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.856566]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   28.856601]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   28.856635]  ? __kthread_parkme+0x82/0x160
[   28.856668]  ? preempt_count_sub+0x50/0x80
[   28.856711]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.856781]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.856818]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   28.856853]  kthread+0x323/0x710
[   28.856885]  ? trace_preempt_on+0x20/0xc0
[   28.856923]  ? __pfx_kthread+0x10/0x10
[   28.856958]  ? _raw_spin_unlock_irq+0x47/0x80
[   28.856990]  ? calculate_sigpending+0x7b/0xa0
[   28.857023]  ? __pfx_kthread+0x10/0x10
[   28.857056]  ret_from_fork+0x41/0x80
[   28.857089]  ? __pfx_kthread+0x10/0x10
[   28.857143]  ret_from_fork_asm+0x1a/0x30
[   28.857194]  </TASK>
[   28.857213] 
[   28.872074] Allocated by task 306:
[   28.872469]  kasan_save_stack+0x3d/0x60
[   28.872950]  kasan_save_track+0x18/0x40
[   28.873469]  kasan_save_alloc_info+0x3b/0x50
[   28.874023]  __kasan_kmalloc+0xb7/0xc0
[   28.874431]  __kmalloc_noprof+0x1c3/0x500
[   28.874906]  kunit_kmalloc_array+0x25/0x60
[   28.875437]  copy_user_test_oob+0xab/0x1130
[   28.876025]  kunit_try_run_case+0x1b2/0x490
[   28.876371]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.876709]  kthread+0x323/0x710
[   28.877094]  ret_from_fork+0x41/0x80
[   28.877532]  ret_from_fork_asm+0x1a/0x30
[   28.877979] 
[   28.878241] The buggy address belongs to the object at ffff88810305ae00
[   28.878241]  which belongs to the cache kmalloc-128 of size 128
[   28.879023] The buggy address is located 0 bytes inside of
[   28.879023]  allocated 120-byte region [ffff88810305ae00, ffff88810305ae78)
[   28.880298] 
[   28.880649] The buggy address belongs to the physical page:
[   28.881285] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10305a
[   28.882158] flags: 0x200000000000000(node=0|zone=2)
[   28.882738] page_type: f5(slab)
[   28.883202] raw: 0200000000000000 ffff888100041a00 dead000000000122 0000000000000000
[   28.883886] raw: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
[   28.884567] page dumped because: kasan: bad access detected
[   28.885285] 
[   28.885488] Memory state around the buggy address:
[   28.886197]  ffff88810305ad00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   28.886682]  ffff88810305ad80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.887600] >ffff88810305ae00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
[   28.888421]                                                                 ^
[   28.888793]  ffff88810305ae80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.889218]  ffff88810305af00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.889993] ==================================================================