Hay
Date
Dec. 5, 2024, 2:07 p.m.

Environment
qemu-x86_64

[   35.199576] ==================================================================
[   35.200424] BUG: KASAN: slab-out-of-bounds in _copy_to_user+0x4a/0x70
[   35.201184] Read of size 121 at addr ffff888101ac8600 by task kunit_try_catch/292
[   35.203549] 
[   35.203939] CPU: 0 UID: 0 PID: 292 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241205 #1
[   35.204806] Tainted: [B]=BAD_PAGE, [N]=TEST
[   35.205144] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   35.206179] Call Trace:
[   35.206596]  <TASK>
[   35.206981]  dump_stack_lvl+0x73/0xb0
[   35.207372]  print_report+0xd1/0x640
[   35.207972]  ? __virt_addr_valid+0x1db/0x2d0
[   35.208477]  ? kasan_complete_mode_report_info+0x2a/0x200
[   35.209116]  kasan_report+0x102/0x140
[   35.209659]  ? _copy_to_user+0x4a/0x70
[   35.210089]  ? _copy_to_user+0x4a/0x70
[   35.210646]  kasan_check_range+0x10c/0x1c0
[   35.211210]  __kasan_check_read+0x15/0x20
[   35.211814]  _copy_to_user+0x4a/0x70
[   35.212171]  copy_user_test_oob+0x365/0x10f0
[   35.212708]  ? __pfx_copy_user_test_oob+0x10/0x10
[   35.213257]  ? finish_task_switch.isra.0+0x153/0x700
[   35.213746]  ? __switch_to+0x5d9/0xf60
[   35.214161]  ? irqentry_exit+0x2a/0x60
[   35.214697]  ? sysvec_apic_timer_interrupt+0x50/0x90
[   35.215276]  ? trace_hardirqs_on+0x37/0xe0
[   35.215661]  ? __pfx_read_tsc+0x10/0x10
[   35.216171]  ? ktime_get_ts64+0x86/0x230
[   35.216692]  kunit_try_run_case+0x1b3/0x490
[   35.217294]  ? __pfx_kunit_try_run_case+0x10/0x10
[   35.218151]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   35.218700]  ? __kthread_parkme+0x82/0x160
[   35.219214]  ? preempt_count_sub+0x50/0x80
[   35.219845]  ? __pfx_kunit_try_run_case+0x10/0x10
[   35.220440]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   35.221128]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   35.221757]  kthread+0x257/0x310
[   35.222263]  ? __pfx_kthread+0x10/0x10
[   35.222599]  ret_from_fork+0x41/0x80
[   35.223181]  ? __pfx_kthread+0x10/0x10
[   35.223668]  ret_from_fork_asm+0x1a/0x30
[   35.224102]  </TASK>
[   35.224499] 
[   35.224817] Allocated by task 292:
[   35.225228]  kasan_save_stack+0x3d/0x60
[   35.225726]  kasan_save_track+0x18/0x40
[   35.226182]  kasan_save_alloc_info+0x3b/0x50
[   35.226674]  __kasan_kmalloc+0xb7/0xc0
[   35.227141]  __kmalloc_noprof+0x1c4/0x500
[   35.227724]  kunit_kmalloc_array+0x25/0x60
[   35.228638]  copy_user_test_oob+0xac/0x10f0
[   35.229366]  kunit_try_run_case+0x1b3/0x490
[   35.230180]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   35.230608]  kthread+0x257/0x310
[   35.231087]  ret_from_fork+0x41/0x80
[   35.231401]  ret_from_fork_asm+0x1a/0x30
[   35.231948] 
[   35.232225] The buggy address belongs to the object at ffff888101ac8600
[   35.232225]  which belongs to the cache kmalloc-128 of size 128
[   35.233138] The buggy address is located 0 bytes inside of
[   35.233138]  allocated 120-byte region [ffff888101ac8600, ffff888101ac8678)
[   35.234739] 
[   35.234950] The buggy address belongs to the physical page:
[   35.235951] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101ac8
[   35.237135] flags: 0x200000000000000(node=0|zone=2)
[   35.237860] page_type: f5(slab)
[   35.238291] raw: 0200000000000000 ffff888100041a00 dead000000000122 0000000000000000
[   35.239038] raw: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
[   35.239614] page dumped because: kasan: bad access detected
[   35.240317] 
[   35.240495] Memory state around the buggy address:
[   35.241036]  ffff888101ac8500: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   35.241667]  ffff888101ac8580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   35.242387] >ffff888101ac8600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
[   35.243069]                                                                 ^
[   35.243865]  ffff888101ac8680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   35.244574]  ffff888101ac8700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   35.245171] ==================================================================