Hay
Date
Nov. 27, 2024, 3:37 a.m.

Environment
qemu-x86_64

[   32.781089] ==================================================================
[   32.781683] BUG: KASAN: slab-out-of-bounds in _copy_to_user+0x4a/0x70
[   32.782263] Read of size 121 at addr ffff888102a58900 by task kunit_try_catch/293
[   32.783019] 
[   32.783393] CPU: 0 UID: 0 PID: 293 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241127 #1
[   32.784285] Tainted: [B]=BAD_PAGE, [N]=TEST
[   32.784645] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   32.785616] Call Trace:
[   32.786272]  <TASK>
[   32.786751]  dump_stack_lvl+0x73/0xb0
[   32.787468]  print_report+0xd1/0x640
[   32.787963]  ? __virt_addr_valid+0x1db/0x2d0
[   32.788776]  ? kasan_complete_mode_report_info+0x2a/0x200
[   32.789499]  kasan_report+0x102/0x140
[   32.789913]  ? _copy_to_user+0x4a/0x70
[   32.790654]  ? _copy_to_user+0x4a/0x70
[   32.791417]  kasan_check_range+0x10c/0x1c0
[   32.792197]  __kasan_check_read+0x15/0x20
[   32.792600]  _copy_to_user+0x4a/0x70
[   32.792928]  copy_user_test_oob+0x365/0x10f0
[   32.793489]  ? __pfx_copy_user_test_oob+0x10/0x10
[   32.794246]  ? finish_task_switch.isra.0+0x153/0x700
[   32.794786]  ? __switch_to+0x5d9/0xf60
[   32.795629]  ? __schedule+0xc3e/0x2790
[   32.796539]  ? __pfx_read_tsc+0x10/0x10
[   32.797030]  ? ktime_get_ts64+0x84/0x230
[   32.797422]  kunit_try_run_case+0x1b3/0x490
[   32.797900]  ? __pfx_kunit_try_run_case+0x10/0x10
[   32.798706]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   32.799367]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   32.799732]  ? __kthread_parkme+0x82/0x160
[   32.800326]  ? preempt_count_sub+0x50/0x80
[   32.800893]  ? __pfx_kunit_try_run_case+0x10/0x10
[   32.801416]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   32.802021]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   32.802602]  kthread+0x257/0x310
[   32.803062]  ? __pfx_kthread+0x10/0x10
[   32.803469]  ret_from_fork+0x41/0x80
[   32.803972]  ? __pfx_kthread+0x10/0x10
[   32.804482]  ret_from_fork_asm+0x1a/0x30
[   32.804937]  </TASK>
[   32.805320] 
[   32.805545] Allocated by task 293:
[   32.806012]  kasan_save_stack+0x3d/0x60
[   32.806388]  kasan_save_track+0x18/0x40
[   32.806881]  kasan_save_alloc_info+0x3b/0x50
[   32.807592]  __kasan_kmalloc+0xb7/0xc0
[   32.808055]  __kmalloc_noprof+0x1c4/0x500
[   32.808445]  kunit_kmalloc_array+0x25/0x60
[   32.809071]  copy_user_test_oob+0xac/0x10f0
[   32.809444]  kunit_try_run_case+0x1b3/0x490
[   32.809890]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   32.810641]  kthread+0x257/0x310
[   32.811276]  ret_from_fork+0x41/0x80
[   32.811562]  ret_from_fork_asm+0x1a/0x30
[   32.812081] 
[   32.812350] The buggy address belongs to the object at ffff888102a58900
[   32.812350]  which belongs to the cache kmalloc-128 of size 128
[   32.813263] The buggy address is located 0 bytes inside of
[   32.813263]  allocated 120-byte region [ffff888102a58900, ffff888102a58978)
[   32.814459] 
[   32.814812] The buggy address belongs to the physical page:
[   32.815278] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a58
[   32.816213] flags: 0x200000000000000(node=0|zone=2)
[   32.816548] page_type: f5(slab)
[   32.816795] raw: 0200000000000000 ffff888100041a00 dead000000000122 0000000000000000
[   32.817754] raw: 0000000000000000 0000000080100010 00000001f5000000 0000000000000000
[   32.818619] page dumped because: kasan: bad access detected
[   32.819132] 
[   32.819512] Memory state around the buggy address:
[   32.820137]  ffff888102a58800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   32.820863]  ffff888102a58880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.821349] >ffff888102a58900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
[   32.822219]                                                                 ^
[   32.822917]  ffff888102a58980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.823629]  ffff888102a58a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.824401] ==================================================================