Hay
Date
Nov. 22, 2024, 6:35 a.m.

Environment
qemu-x86_64

[   32.200328] ==================================================================
[   32.200930] BUG: KASAN: slab-out-of-bounds in _copy_to_user+0x4a/0x70
[   32.201590] Read of size 121 at addr ffff888101ac2800 by task kunit_try_catch/293
[   32.202198] 
[   32.202485] CPU: 0 UID: 0 PID: 293 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241122 #1
[   32.203218] Tainted: [B]=BAD_PAGE, [N]=TEST
[   32.203708] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   32.204294] Call Trace:
[   32.204698]  <TASK>
[   32.205073]  dump_stack_lvl+0x73/0xb0
[   32.205464]  print_report+0xd1/0x640
[   32.205862]  ? __virt_addr_valid+0x1db/0x2d0
[   32.206536]  ? kasan_complete_mode_report_info+0x2a/0x200
[   32.207103]  kasan_report+0x102/0x140
[   32.207616]  ? _copy_to_user+0x4a/0x70
[   32.208050]  ? _copy_to_user+0x4a/0x70
[   32.208454]  kasan_check_range+0x10c/0x1c0
[   32.209034]  __kasan_check_read+0x15/0x20
[   32.209484]  _copy_to_user+0x4a/0x70
[   32.210000]  copy_user_test_oob+0x365/0x10f0
[   32.210615]  ? __pfx_copy_user_test_oob+0x10/0x10
[   32.211079]  ? finish_task_switch.isra.0+0x153/0x700
[   32.211704]  ? __switch_to+0x5d9/0xf60
[   32.212249]  ? irqentry_exit+0x2a/0x60
[   32.212670]  ? sysvec_apic_timer_interrupt+0x50/0x90
[   32.213259]  ? trace_hardirqs_on+0x37/0xe0
[   32.213974]  ? __pfx_read_tsc+0x10/0x10
[   32.214286]  ? ktime_get_ts64+0x84/0x230
[   32.214862]  kunit_try_run_case+0x1b3/0x490
[   32.215347]  ? __pfx_kunit_try_run_case+0x10/0x10
[   32.215753]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   32.216372]  ? _raw_spin_unlock_irqrestore+0x49/0x90
[   32.216848]  ? _raw_spin_unlock_irqrestore+0x49/0x90
[   32.217317]  ? __pfx_kunit_try_run_case+0x10/0x10
[   32.217877]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   32.218255]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   32.218595]  kthread+0x257/0x310
[   32.218973]  ? __pfx_kthread+0x10/0x10
[   32.219464]  ret_from_fork+0x41/0x80
[   32.219902]  ? __pfx_kthread+0x10/0x10
[   32.220333]  ret_from_fork_asm+0x1a/0x30
[   32.220800]  </TASK>
[   32.221099] 
[   32.221334] Allocated by task 293:
[   32.221760]  kasan_save_stack+0x3d/0x60
[   32.222268]  kasan_save_track+0x18/0x40
[   32.222644]  kasan_save_alloc_info+0x3b/0x50
[   32.223149]  __kasan_kmalloc+0xb7/0xc0
[   32.223521]  __kmalloc_noprof+0x1c4/0x500
[   32.223794]  kunit_kmalloc_array+0x25/0x60
[   32.224251]  copy_user_test_oob+0xac/0x10f0
[   32.224932]  kunit_try_run_case+0x1b3/0x490
[   32.225415]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   32.225951]  kthread+0x257/0x310
[   32.226408]  ret_from_fork+0x41/0x80
[   32.226882]  ret_from_fork_asm+0x1a/0x30
[   32.227252] 
[   32.227507] The buggy address belongs to the object at ffff888101ac2800
[   32.227507]  which belongs to the cache kmalloc-128 of size 128
[   32.228614] The buggy address is located 0 bytes inside of
[   32.228614]  allocated 120-byte region [ffff888101ac2800, ffff888101ac2878)
[   32.229413] 
[   32.229637] The buggy address belongs to the physical page:
[   32.230171] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101ac2
[   32.231141] flags: 0x200000000000000(node=0|zone=2)
[   32.231737] page_type: f5(slab)
[   32.232132] raw: 0200000000000000 ffff888100041a00 dead000000000122 0000000000000000
[   32.233021] raw: 0000000000000000 0000000080100010 00000001f5000000 0000000000000000
[   32.233564] page dumped because: kasan: bad access detected
[   32.234129] 
[   32.234439] Memory state around the buggy address:
[   32.235044]  ffff888101ac2700: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   32.235410]  ffff888101ac2780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.236407] >ffff888101ac2800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
[   32.237003]                                                                 ^
[   32.237769]  ffff888101ac2880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.238545]  ffff888101ac2900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.239127] ==================================================================