Hay
Date
Dec. 9, 2024, 6:35 a.m.

Environment
qemu-x86_64

[   32.014459] ==================================================================
[   32.015691] BUG: KASAN: slab-out-of-bounds in _copy_from_user+0x33/0xa0
[   32.016492] Write of size 121 at addr ffff88810296dd00 by task kunit_try_catch/292
[   32.017431] 
[   32.017842] CPU: 0 UID: 0 PID: 292 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc2-next-20241209 #1
[   32.019367] Tainted: [B]=BAD_PAGE, [N]=TEST
[   32.019885] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   32.020627] Call Trace:
[   32.020967]  <TASK>
[   32.022105]  dump_stack_lvl+0x73/0xb0
[   32.022496]  print_report+0xd1/0x640
[   32.022927]  ? __virt_addr_valid+0x1db/0x2d0
[   32.023704]  ? kasan_complete_mode_report_info+0x2a/0x200
[   32.024535]  kasan_report+0x102/0x140
[   32.025110]  ? _copy_from_user+0x33/0xa0
[   32.025540]  ? _copy_from_user+0x33/0xa0
[   32.026076]  kasan_check_range+0x10c/0x1c0
[   32.026652]  __kasan_check_write+0x18/0x20
[   32.027226]  _copy_from_user+0x33/0xa0
[   32.027620]  copy_user_test_oob+0x2bf/0x10f0
[   32.028075]  ? __pfx_copy_user_test_oob+0x10/0x10
[   32.028513]  ? finish_task_switch.isra.0+0x153/0x700
[   32.029201]  ? __switch_to+0x5d9/0xf60
[   32.029709]  ? __schedule+0xc70/0x27e0
[   32.030247]  ? __pfx_read_tsc+0x10/0x10
[   32.030649]  ? ktime_get_ts64+0x86/0x230
[   32.031192]  kunit_try_run_case+0x1b3/0x490
[   32.031650]  ? __pfx_kunit_try_run_case+0x10/0x10
[   32.032249]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   32.032661]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   32.033413]  ? __kthread_parkme+0x82/0x160
[   32.033923]  ? preempt_count_sub+0x50/0x80
[   32.034557]  ? __pfx_kunit_try_run_case+0x10/0x10
[   32.034962]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   32.035608]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   32.036611]  kthread+0x257/0x310
[   32.037029]  ? __pfx_kthread+0x10/0x10
[   32.037801]  ret_from_fork+0x41/0x80
[   32.038611]  ? __pfx_kthread+0x10/0x10
[   32.039091]  ret_from_fork_asm+0x1a/0x30
[   32.039590]  </TASK>
[   32.039834] 
[   32.040065] Allocated by task 292:
[   32.041043]  kasan_save_stack+0x3d/0x60
[   32.041453]  kasan_save_track+0x18/0x40
[   32.042575]  kasan_save_alloc_info+0x3b/0x50
[   32.043136]  __kasan_kmalloc+0xb7/0xc0
[   32.043714]  __kmalloc_noprof+0x1c4/0x500
[   32.044315]  kunit_kmalloc_array+0x25/0x60
[   32.044946]  copy_user_test_oob+0xac/0x10f0
[   32.045552]  kunit_try_run_case+0x1b3/0x490
[   32.046420]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   32.046990]  kthread+0x257/0x310
[   32.047320]  ret_from_fork+0x41/0x80
[   32.048513]  ret_from_fork_asm+0x1a/0x30
[   32.049161] 
[   32.049352] The buggy address belongs to the object at ffff88810296dd00
[   32.049352]  which belongs to the cache kmalloc-128 of size 128
[   32.050876] The buggy address is located 0 bytes inside of
[   32.050876]  allocated 120-byte region [ffff88810296dd00, ffff88810296dd78)
[   32.052284] 
[   32.052767] The buggy address belongs to the physical page:
[   32.053395] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10296d
[   32.054647] flags: 0x200000000000000(node=0|zone=2)
[   32.055194] page_type: f5(slab)
[   32.055621] raw: 0200000000000000 ffff888100041a00 dead000000000122 0000000000000000
[   32.056858] raw: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
[   32.057613] page dumped because: kasan: bad access detected
[   32.059113] 
[   32.059305] Memory state around the buggy address:
[   32.059723]  ffff88810296dc00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   32.061074]  ffff88810296dc80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.062010] >ffff88810296dd00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
[   32.062707]                                                                 ^
[   32.063680]  ffff88810296dd80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.064413]  ffff88810296de00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.065384] ==================================================================