Hay
Date
May 26, 2025, 9:10 a.m.

Environment
qemu-x86_64

[   15.049777] ==================================================================
[   15.050482] BUG: KASAN: slab-out-of-bounds in _copy_to_user+0x3c/0x70
[   15.051114] Read of size 121 at addr ffff8881039b7800 by task kunit_try_catch/303
[   15.051789] 
[   15.051878] CPU: 1 UID: 0 PID: 303 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc7-next-20250526 #1 PREEMPT(voluntary) 
[   15.051942] Tainted: [B]=BAD_PAGE, [N]=TEST
[   15.051956] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   15.051989] Call Trace:
[   15.052002]  <TASK>
[   15.052019]  dump_stack_lvl+0x73/0xb0
[   15.052047]  print_report+0xd1/0x650
[   15.052072]  ? __virt_addr_valid+0x1db/0x2d0
[   15.052097]  ? _copy_to_user+0x3c/0x70
[   15.052118]  ? kasan_complete_mode_report_info+0x2a/0x200
[   15.052141]  ? _copy_to_user+0x3c/0x70
[   15.052163]  kasan_report+0x141/0x180
[   15.052186]  ? _copy_to_user+0x3c/0x70
[   15.052222]  kasan_check_range+0x10c/0x1c0
[   15.052247]  __kasan_check_read+0x15/0x20
[   15.052267]  _copy_to_user+0x3c/0x70
[   15.052300]  copy_user_test_oob+0x364/0x10f0
[   15.052327]  ? __pfx_copy_user_test_oob+0x10/0x10
[   15.052351]  ? finish_task_switch.isra.0+0x153/0x700
[   15.052383]  ? __switch_to+0x47/0xf50
[   15.052409]  ? __schedule+0x10cc/0x2b60
[   15.052435]  ? __pfx_read_tsc+0x10/0x10
[   15.052456]  ? ktime_get_ts64+0x86/0x230
[   15.052482]  kunit_try_run_case+0x1a5/0x480
[   15.052505]  ? __pfx_kunit_try_run_case+0x10/0x10
[   15.052525]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   15.052550]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   15.052576]  ? __kthread_parkme+0x82/0x180
[   15.052598]  ? preempt_count_sub+0x50/0x80
[   15.052622]  ? __pfx_kunit_try_run_case+0x10/0x10
[   15.052644]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   15.052668]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   15.052713]  kthread+0x337/0x6f0
[   15.052735]  ? trace_preempt_on+0x20/0xc0
[   15.052760]  ? __pfx_kthread+0x10/0x10
[   15.052781]  ? _raw_spin_unlock_irq+0x47/0x80
[   15.052805]  ? calculate_sigpending+0x7b/0xa0
[   15.052830]  ? __pfx_kthread+0x10/0x10
[   15.052853]  ret_from_fork+0x116/0x1d0
[   15.052872]  ? __pfx_kthread+0x10/0x10
[   15.052894]  ret_from_fork_asm+0x1a/0x30
[   15.052925]  </TASK>
[   15.052936] 
[   15.065837] Allocated by task 303:
[   15.066206]  kasan_save_stack+0x45/0x70
[   15.066599]  kasan_save_track+0x18/0x40
[   15.066935]  kasan_save_alloc_info+0x3b/0x50
[   15.067193]  __kasan_kmalloc+0xb7/0xc0
[   15.067330]  __kmalloc_noprof+0x1c9/0x500
[   15.067485]  kunit_kmalloc_array+0x25/0x60
[   15.067630]  copy_user_test_oob+0xab/0x10f0
[   15.067975]  kunit_try_run_case+0x1a5/0x480
[   15.068389]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   15.068901]  kthread+0x337/0x6f0
[   15.069230]  ret_from_fork+0x116/0x1d0
[   15.069599]  ret_from_fork_asm+0x1a/0x30
[   15.069997] 
[   15.070162] The buggy address belongs to the object at ffff8881039b7800
[   15.070162]  which belongs to the cache kmalloc-128 of size 128
[   15.071204] The buggy address is located 0 bytes inside of
[   15.071204]  allocated 120-byte region [ffff8881039b7800, ffff8881039b7878)
[   15.071569] 
[   15.071645] The buggy address belongs to the physical page:
[   15.072109] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1039b7
[   15.072843] flags: 0x200000000000000(node=0|zone=2)
[   15.073297] page_type: f5(slab)
[   15.073623] raw: 0200000000000000 ffff888100041a00 dead000000000122 0000000000000000
[   15.074305] raw: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
[   15.074998] page dumped because: kasan: bad access detected
[   15.075176] 
[   15.075248] Memory state around the buggy address:
[   15.075419]  ffff8881039b7700: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   15.075639]  ffff8881039b7780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   15.076245] >ffff8881039b7800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
[   15.076910]                                                                 ^
[   15.077532]  ffff8881039b7880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   15.078181]  ffff8881039b7900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   15.078826] ==================================================================