Hay
Date
Nov. 26, 2024, 6:09 a.m.

Environment
qemu-x86_64

[   32.704475] ==================================================================
[   32.705122] BUG: KASAN: slab-out-of-bounds in _copy_to_user+0x4a/0x70
[   32.705136] Read of size 121 at addr ffff8881028f6c00 by task kunit_try_catch/294
[   32.705136] 
[   32.705136] CPU: 0 UID: 0 PID: 294 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241126 #1
[   32.705136] Tainted: [B]=BAD_PAGE, [N]=TEST
[   32.705136] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   32.705136] Call Trace:
[   32.705136]  <TASK>
[   32.705136]  dump_stack_lvl+0x73/0xb0
[   32.705136]  print_report+0xd1/0x640
[   32.705136]  ? __virt_addr_valid+0x1db/0x2d0
[   32.705136]  ? kasan_complete_mode_report_info+0x2a/0x200
[   32.705136]  kasan_report+0x102/0x140
[   32.705136]  ? _copy_to_user+0x4a/0x70
[   32.705136]  ? _copy_to_user+0x4a/0x70
[   32.705136]  kasan_check_range+0x10c/0x1c0
[   32.705136]  __kasan_check_read+0x15/0x20
[   32.705136]  _copy_to_user+0x4a/0x70
[   32.705136]  copy_user_test_oob+0x365/0x10f0
[   32.705136]  ? __pfx_copy_user_test_oob+0x10/0x10
[   32.705136]  ? __switch_to+0x5d9/0xf60
[   32.705136]  ? __schedule+0xc3e/0x2790
[   32.705136]  ? ktime_get_ts64+0x84/0x230
[   32.705136]  kunit_try_run_case+0x1b3/0x490
[   32.705136]  ? __pfx_kunit_try_run_case+0x10/0x10
[   32.705136]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   32.705136]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   32.705136]  ? __kthread_parkme+0x82/0x160
[   32.705136]  ? preempt_count_sub+0x50/0x80
[   32.705136]  ? __pfx_kunit_try_run_case+0x10/0x10
[   32.705136]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   32.705136]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   32.705136]  kthread+0x257/0x310
[   32.705136]  ? __pfx_kthread+0x10/0x10
[   32.705136]  ret_from_fork+0x41/0x80
[   32.705136]  ? __pfx_kthread+0x10/0x10
[   32.705136]  ret_from_fork_asm+0x1a/0x30
[   32.705136]  </TASK>
[   32.705136] 
[   32.705136] Allocated by task 294:
[   32.705136]  kasan_save_stack+0x3d/0x60
[   32.705136]  kasan_save_track+0x18/0x40
[   32.705136]  kasan_save_alloc_info+0x3b/0x50
[   32.705136]  __kasan_kmalloc+0xb7/0xc0
[   32.705136]  __kmalloc_noprof+0x1c4/0x500
[   32.705136]  kunit_kmalloc_array+0x25/0x60
[   32.705136]  copy_user_test_oob+0xac/0x10f0
[   32.705136]  kunit_try_run_case+0x1b3/0x490
[   32.705136]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   32.705136]  kthread+0x257/0x310
[   32.705136]  ret_from_fork+0x41/0x80
[   32.705136]  ret_from_fork_asm+0x1a/0x30
[   32.705136] 
[   32.705136] The buggy address belongs to the object at ffff8881028f6c00
[   32.705136]  which belongs to the cache kmalloc-128 of size 128
[   32.705136] The buggy address is located 0 bytes inside of
[   32.705136]  allocated 120-byte region [ffff8881028f6c00, ffff8881028f6c78)
[   32.705136] 
[   32.705136] The buggy address belongs to the physical page:
[   32.705136] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1028f6
[   32.705136] flags: 0x200000000000000(node=0|zone=2)
[   32.705136] page_type: f5(slab)
[   32.705136] raw: 0200000000000000 ffff888100041a00 dead000000000122 0000000000000000
[   32.705136] raw: 0000000000000000 0000000080100010 00000001f5000000 0000000000000000
[   32.705136] page dumped because: kasan: bad access detected
[   32.705136] 
[   32.705136] Memory state around the buggy address:
[   32.705136]  ffff8881028f6b00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   32.705136]  ffff8881028f6b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.705136] >ffff8881028f6c00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
[   32.705136]                                                                 ^
[   32.705136]  ffff8881028f6c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.705136]  ffff8881028f6d00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.705136] ==================================================================

[   27.430357] ==================================================================
[   27.431173] BUG: KASAN: slab-out-of-bounds in _copy_to_user+0x4a/0x70
[   27.431768] Read of size 121 at addr ffff8881028cc000 by task kunit_try_catch/292
[   27.432338] 
[   27.432577] CPU: 0 UID: 0 PID: 292 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241126 #1
[   27.434158] Tainted: [B]=BAD_PAGE, [N]=TEST
[   27.434850] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   27.435692] Call Trace:
[   27.435892]  <TASK>
[   27.436457]  dump_stack_lvl+0x73/0xb0
[   27.436967]  print_report+0xd1/0x640
[   27.437386]  ? __virt_addr_valid+0x1db/0x2d0
[   27.437961]  ? kasan_complete_mode_report_info+0x2a/0x200
[   27.438355]  kasan_report+0x102/0x140
[   27.438925]  ? _copy_to_user+0x4a/0x70
[   27.439374]  ? _copy_to_user+0x4a/0x70
[   27.439782]  kasan_check_range+0x10c/0x1c0
[   27.440202]  __kasan_check_read+0x15/0x20
[   27.440746]  _copy_to_user+0x4a/0x70
[   27.441174]  copy_user_test_oob+0x365/0x10f0
[   27.441699]  ? __pfx_copy_user_test_oob+0x10/0x10
[   27.442111]  ? finish_task_switch.isra.0+0x153/0x700
[   27.442712]  ? __switch_to+0x5d9/0xf60
[   27.443194]  ? __schedule+0xc3e/0x2790
[   27.443526]  ? __pfx_read_tsc+0x10/0x10
[   27.444044]  ? ktime_get_ts64+0x84/0x230
[   27.444535]  kunit_try_run_case+0x1b3/0x490
[   27.444957]  ? __pfx_kunit_try_run_case+0x10/0x10
[   27.445326]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   27.445800]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   27.446249]  ? __kthread_parkme+0x82/0x160
[   27.447773]  ? preempt_count_sub+0x50/0x80
[   27.448064]  ? __pfx_kunit_try_run_case+0x10/0x10
[   27.448875]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   27.449622]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   27.450294]  kthread+0x257/0x310
[   27.451011]  ? __pfx_kthread+0x10/0x10
[   27.451601]  ret_from_fork+0x41/0x80
[   27.451941]  ? __pfx_kthread+0x10/0x10
[   27.452365]  ret_from_fork_asm+0x1a/0x30
[   27.452728]  </TASK>
[   27.453019] 
[   27.453246] Allocated by task 292:
[   27.453687]  kasan_save_stack+0x3d/0x60
[   27.453975]  kasan_save_track+0x18/0x40
[   27.454424]  kasan_save_alloc_info+0x3b/0x50
[   27.455006]  __kasan_kmalloc+0xb7/0xc0
[   27.455531]  __kmalloc_noprof+0x1c4/0x500
[   27.456015]  kunit_kmalloc_array+0x25/0x60
[   27.456327]  copy_user_test_oob+0xac/0x10f0
[   27.456865]  kunit_try_run_case+0x1b3/0x490
[   27.457366]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   27.457774]  kthread+0x257/0x310
[   27.458178]  ret_from_fork+0x41/0x80
[   27.458696]  ret_from_fork_asm+0x1a/0x30
[   27.459157] 
[   27.459416] The buggy address belongs to the object at ffff8881028cc000
[   27.459416]  which belongs to the cache kmalloc-128 of size 128
[   27.460125] The buggy address is located 0 bytes inside of
[   27.460125]  allocated 120-byte region [ffff8881028cc000, ffff8881028cc078)
[   27.461232] 
[   27.461504] The buggy address belongs to the physical page:
[   27.462106] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1028cc
[   27.462669] flags: 0x200000000000000(node=0|zone=2)
[   27.463149] page_type: f5(slab)
[   27.463618] raw: 0200000000000000 ffff888100041a00 dead000000000122 0000000000000000
[   27.464035] raw: 0000000000000000 0000000080100010 00000001f5000000 0000000000000000
[   27.464801] page dumped because: kasan: bad access detected
[   27.465167] 
[   27.465478] Memory state around the buggy address:
[   27.466051]  ffff8881028cbf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   27.466536]  ffff8881028cbf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   27.467144] >ffff8881028cc000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
[   27.467543]                                                                 ^
[   27.467971]  ffff8881028cc080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   27.468719]  ffff8881028cc100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   27.469363] ==================================================================