Hay
Date
Dec. 3, 2024, 11:38 p.m.

Environment
qemu-x86_64

[   32.512591] ==================================================================
[   32.513552] BUG: KASAN: slab-out-of-bounds in _copy_from_user+0x33/0xa0
[   32.514247] Write of size 121 at addr ffff888102a99200 by task kunit_try_catch/294
[   32.514731] 
[   32.515278] CPU: 1 UID: 0 PID: 294 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241203 #1
[   32.516022] Tainted: [B]=BAD_PAGE, [N]=TEST
[   32.516498] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   32.517094] Call Trace:
[   32.517390]  <TASK>
[   32.517753]  dump_stack_lvl+0x73/0xb0
[   32.518176]  print_report+0xd1/0x640
[   32.518652]  ? __virt_addr_valid+0x1db/0x2d0
[   32.518992]  ? kasan_complete_mode_report_info+0x2a/0x200
[   32.519473]  kasan_report+0x102/0x140
[   32.519932]  ? _copy_from_user+0x33/0xa0
[   32.520311]  ? _copy_from_user+0x33/0xa0
[   32.520777]  kasan_check_range+0x10c/0x1c0
[   32.521223]  __kasan_check_write+0x18/0x20
[   32.521677]  _copy_from_user+0x33/0xa0
[   32.521953]  copy_user_test_oob+0x2bf/0x10f0
[   32.522530]  ? __pfx_copy_user_test_oob+0x10/0x10
[   32.522994]  ? sysvec_apic_timer_interrupt+0x50/0x90
[   32.523563]  ? __pfx_copy_user_test_oob+0x10/0x10
[   32.523942]  kunit_try_run_case+0x1b3/0x490
[   32.524259]  ? __pfx_kunit_try_run_case+0x10/0x10
[   32.524767]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   32.525510]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   32.526004]  ? __kthread_parkme+0x82/0x160
[   32.526451]  ? preempt_count_sub+0x50/0x80
[   32.526780]  ? __pfx_kunit_try_run_case+0x10/0x10
[   32.527139]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   32.528920]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   32.529379]  kthread+0x257/0x310
[   32.530191]  ? __pfx_kthread+0x10/0x10
[   32.530574]  ret_from_fork+0x41/0x80
[   32.530819]  ? __pfx_kthread+0x10/0x10
[   32.531413]  ret_from_fork_asm+0x1a/0x30
[   32.531861]  </TASK>
[   32.532140] 
[   32.532344] Allocated by task 294:
[   32.532648]  kasan_save_stack+0x3d/0x60
[   32.534088]  kasan_save_track+0x18/0x40
[   32.534396]  kasan_save_alloc_info+0x3b/0x50
[   32.534707]  __kasan_kmalloc+0xb7/0xc0
[   32.535647]  __kmalloc_noprof+0x1c4/0x500
[   32.535934]  kunit_kmalloc_array+0x25/0x60
[   32.536350]  copy_user_test_oob+0xac/0x10f0
[   32.537253]  kunit_try_run_case+0x1b3/0x490
[   32.537601]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   32.538280]  kthread+0x257/0x310
[   32.538846]  ret_from_fork+0x41/0x80
[   32.539401]  ret_from_fork_asm+0x1a/0x30
[   32.539925] 
[   32.540112] The buggy address belongs to the object at ffff888102a99200
[   32.540112]  which belongs to the cache kmalloc-128 of size 128
[   32.541240] The buggy address is located 0 bytes inside of
[   32.541240]  allocated 120-byte region [ffff888102a99200, ffff888102a99278)
[   32.542105] 
[   32.542820] The buggy address belongs to the physical page:
[   32.543446] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a99
[   32.543931] flags: 0x200000000000000(node=0|zone=2)
[   32.544664] page_type: f5(slab)
[   32.545015] raw: 0200000000000000 ffff888100041a00 dead000000000122 0000000000000000
[   32.546074] raw: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
[   32.546639] page dumped because: kasan: bad access detected
[   32.547039] 
[   32.547234] Memory state around the buggy address:
[   32.547616]  ffff888102a99100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc
[   32.548148]  ffff888102a99180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.549398] >ffff888102a99200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
[   32.549886]                                                                 ^
[   32.550800]  ffff888102a99280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.551273]  ffff888102a99300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.552075] ==================================================================