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

Environment
qemu-x86_64

[   32.150173] ==================================================================
[   32.151069] BUG: KASAN: slab-out-of-bounds in _copy_from_user+0x33/0xa0
[   32.151804] Write of size 121 at addr ffff888101ac2800 by task kunit_try_catch/293
[   32.152243] 
[   32.152495] CPU: 0 UID: 0 PID: 293 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241122 #1
[   32.153287] Tainted: [B]=BAD_PAGE, [N]=TEST
[   32.153734] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   32.154256] Call Trace:
[   32.154473]  <TASK>
[   32.154673]  dump_stack_lvl+0x73/0xb0
[   32.155142]  print_report+0xd1/0x640
[   32.155617]  ? __virt_addr_valid+0x1db/0x2d0
[   32.156114]  ? kasan_complete_mode_report_info+0x2a/0x200
[   32.156668]  kasan_report+0x102/0x140
[   32.157448]  ? _copy_from_user+0x33/0xa0
[   32.159037]  ? _copy_from_user+0x33/0xa0
[   32.159561]  kasan_check_range+0x10c/0x1c0
[   32.160049]  __kasan_check_write+0x18/0x20
[   32.160961]  _copy_from_user+0x33/0xa0
[   32.161974]  copy_user_test_oob+0x2bf/0x10f0
[   32.162740]  ? __pfx_copy_user_test_oob+0x10/0x10
[   32.163165]  ? finish_task_switch.isra.0+0x153/0x700
[   32.163929]  ? __switch_to+0x5d9/0xf60
[   32.164191]  ? irqentry_exit+0x2a/0x60
[   32.164904]  ? sysvec_apic_timer_interrupt+0x50/0x90
[   32.165437]  ? trace_hardirqs_on+0x37/0xe0
[   32.165910]  ? __pfx_read_tsc+0x10/0x10
[   32.166496]  ? ktime_get_ts64+0x84/0x230
[   32.166905]  kunit_try_run_case+0x1b3/0x490
[   32.167906]  ? __pfx_kunit_try_run_case+0x10/0x10
[   32.168499]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   32.169040]  ? _raw_spin_unlock_irqrestore+0x49/0x90
[   32.169623]  ? _raw_spin_unlock_irqrestore+0x49/0x90
[   32.170124]  ? __pfx_kunit_try_run_case+0x10/0x10
[   32.170653]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   32.171293]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   32.171923]  kthread+0x257/0x310
[   32.172208]  ? __pfx_kthread+0x10/0x10
[   32.172520]  ret_from_fork+0x41/0x80
[   32.173028]  ? __pfx_kthread+0x10/0x10
[   32.173441]  ret_from_fork_asm+0x1a/0x30
[   32.174075]  </TASK>
[   32.174321] 
[   32.174555] Allocated by task 293:
[   32.175089]  kasan_save_stack+0x3d/0x60
[   32.175530]  kasan_save_track+0x18/0x40
[   32.176024]  kasan_save_alloc_info+0x3b/0x50
[   32.176317]  __kasan_kmalloc+0xb7/0xc0
[   32.177041]  __kmalloc_noprof+0x1c4/0x500
[   32.177590]  kunit_kmalloc_array+0x25/0x60
[   32.178183]  copy_user_test_oob+0xac/0x10f0
[   32.178628]  kunit_try_run_case+0x1b3/0x490
[   32.179076]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   32.179595]  kthread+0x257/0x310
[   32.180020]  ret_from_fork+0x41/0x80
[   32.180539]  ret_from_fork_asm+0x1a/0x30
[   32.181065] 
[   32.181330] The buggy address belongs to the object at ffff888101ac2800
[   32.181330]  which belongs to the cache kmalloc-128 of size 128
[   32.182426] The buggy address is located 0 bytes inside of
[   32.182426]  allocated 120-byte region [ffff888101ac2800, ffff888101ac2878)
[   32.183379] 
[   32.183552] The buggy address belongs to the physical page:
[   32.183999] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101ac2
[   32.184846] flags: 0x200000000000000(node=0|zone=2)
[   32.185428] page_type: f5(slab)
[   32.185871] raw: 0200000000000000 ffff888100041a00 dead000000000122 0000000000000000
[   32.186503] raw: 0000000000000000 0000000080100010 00000001f5000000 0000000000000000
[   32.187161] page dumped because: kasan: bad access detected
[   32.187798] 
[   32.188113] Memory state around the buggy address:
[   32.188571]  ffff888101ac2700: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   32.189234]  ffff888101ac2780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.189849] >ffff888101ac2800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
[   32.190623]                                                                 ^
[   32.191197]  ffff888101ac2880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.191797]  ffff888101ac2900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   32.192613] ==================================================================