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

Environment
qemu-x86_64

[   32.071659] ==================================================================
[   32.072387] BUG: KASAN: slab-out-of-bounds in _copy_to_user+0x4a/0x70
[   32.072803] Read of size 121 at addr ffff88810296dd00 by task kunit_try_catch/292
[   32.074606] 
[   32.074866] CPU: 0 UID: 0 PID: 292 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc2-next-20241209 #1
[   32.075747] Tainted: [B]=BAD_PAGE, [N]=TEST
[   32.076116] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   32.076907] Call Trace:
[   32.077763]  <TASK>
[   32.077987]  dump_stack_lvl+0x73/0xb0
[   32.079000]  print_report+0xd1/0x640
[   32.079650]  ? __virt_addr_valid+0x1db/0x2d0
[   32.080325]  ? kasan_complete_mode_report_info+0x2a/0x200
[   32.081190]  kasan_report+0x102/0x140
[   32.081483]  ? _copy_to_user+0x4a/0x70
[   32.082371]  ? _copy_to_user+0x4a/0x70
[   32.083177]  kasan_check_range+0x10c/0x1c0
[   32.083630]  __kasan_check_read+0x15/0x20
[   32.085107]  _copy_to_user+0x4a/0x70
[   32.085749]  copy_user_test_oob+0x365/0x10f0
[   32.086270]  ? __pfx_copy_user_test_oob+0x10/0x10
[   32.086699]  ? finish_task_switch.isra.0+0x153/0x700
[   32.087557]  ? __switch_to+0x5d9/0xf60
[   32.088174]  ? __schedule+0xc70/0x27e0
[   32.088602]  ? __pfx_read_tsc+0x10/0x10
[   32.089183]  ? ktime_get_ts64+0x86/0x230
[   32.089650]  kunit_try_run_case+0x1b3/0x490
[   32.090199]  ? __pfx_kunit_try_run_case+0x10/0x10
[   32.090679]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   32.091493]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   32.092356]  ? __kthread_parkme+0x82/0x160
[   32.093335]  ? preempt_count_sub+0x50/0x80
[   32.093741]  ? __pfx_kunit_try_run_case+0x10/0x10
[   32.094629]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   32.095323]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   32.096343]  kthread+0x257/0x310
[   32.096742]  ? __pfx_kthread+0x10/0x10
[   32.097405]  ret_from_fork+0x41/0x80
[   32.097802]  ? __pfx_kthread+0x10/0x10
[   32.098462]  ret_from_fork_asm+0x1a/0x30
[   32.099105]  </TASK>
[   32.099566] 
[   32.100009] Allocated by task 292:
[   32.100341]  kasan_save_stack+0x3d/0x60
[   32.101126]  kasan_save_track+0x18/0x40
[   32.101607]  kasan_save_alloc_info+0x3b/0x50
[   32.102342]  __kasan_kmalloc+0xb7/0xc0
[   32.103240]  __kmalloc_noprof+0x1c4/0x500
[   32.103652]  kunit_kmalloc_array+0x25/0x60
[   32.104244]  copy_user_test_oob+0xac/0x10f0
[   32.105083]  kunit_try_run_case+0x1b3/0x490
[   32.106014]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   32.106802]  kthread+0x257/0x310
[   32.107490]  ret_from_fork+0x41/0x80
[   32.108473]  ret_from_fork_asm+0x1a/0x30
[   32.108952] 
[   32.109139] The buggy address belongs to the object at ffff88810296dd00
[   32.109139]  which belongs to the cache kmalloc-128 of size 128
[   32.110960] The buggy address is located 0 bytes inside of
[   32.110960]  allocated 120-byte region [ffff88810296dd00, ffff88810296dd78)
[   32.112353] 
[   32.112755] The buggy address belongs to the physical page:
[   32.113081] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10296d
[   32.114171] flags: 0x200000000000000(node=0|zone=2)
[   32.114854] page_type: f5(slab)
[   32.115354] raw: 0200000000000000 ffff888100041a00 dead000000000122 0000000000000000
[   32.116394] raw: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
[   32.117373] page dumped because: kasan: bad access detected
[   32.118318] 
[   32.118623] Memory state around the buggy address:
[   32.119660]  ffff88810296dc00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   32.120557]  ffff88810296dc80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.121599] >ffff88810296dd00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
[   32.122593]                                                                 ^
[   32.123889]  ffff88810296dd80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.124411]  ffff88810296de00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.125416] ==================================================================