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

Environment
qemu-arm64
qemu-x86_64

[   31.108198] ==================================================================
[   31.109323] BUG: KASAN: slab-out-of-bounds in kmalloc_oob_in_memset+0x144/0x2d0
[   31.110285] Write of size 128 at addr fff00000c6728900 by task kunit_try_catch/159
[   31.111830] 
[   31.112254] CPU: 1 UID: 0 PID: 159 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241206 #1
[   31.113663] Tainted: [B]=BAD_PAGE, [N]=TEST
[   31.114328] Hardware name: linux,dummy-virt (DT)
[   31.115277] Call trace:
[   31.115688]  show_stack+0x20/0x38 (C)
[   31.116581]  dump_stack_lvl+0x8c/0xd0
[   31.117336]  print_report+0x118/0x5e0
[   31.118086]  kasan_report+0xc8/0x118
[   31.118917]  kasan_check_range+0x100/0x1a8
[   31.119732]  __asan_memset+0x34/0x78
[   31.120405]  kmalloc_oob_in_memset+0x144/0x2d0
[   31.121162]  kunit_try_run_case+0x14c/0x3d0
[   31.121860]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.122915]  kthread+0x24c/0x2d0
[   31.123481]  ret_from_fork+0x10/0x20
[   31.124096] 
[   31.124459] Allocated by task 159:
[   31.125014]  kasan_save_stack+0x3c/0x68
[   31.125603]  kasan_save_track+0x20/0x40
[   31.126258]  kasan_save_alloc_info+0x40/0x58
[   31.126818]  __kasan_kmalloc+0xd4/0xd8
[   31.127427]  __kmalloc_cache_noprof+0x15c/0x3c0
[   31.128123]  kmalloc_oob_in_memset+0xb0/0x2d0
[   31.129155]  kunit_try_run_case+0x14c/0x3d0
[   31.129724]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.130869]  kthread+0x24c/0x2d0
[   31.131386]  ret_from_fork+0x10/0x20
[   31.131995] 
[   31.132363] The buggy address belongs to the object at fff00000c6728900
[   31.132363]  which belongs to the cache kmalloc-128 of size 128
[   31.133403] The buggy address is located 0 bytes inside of
[   31.133403]  allocated 120-byte region [fff00000c6728900, fff00000c6728978)
[   31.134803] 
[   31.135126] The buggy address belongs to the physical page:
[   31.136615] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106728
[   31.137482] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   31.138274] page_type: f5(slab)
[   31.138843] raw: 0bfffe0000000000 fff00000c0001a00 dead000000000122 0000000000000000
[   31.139742] raw: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
[   31.140941] page dumped because: kasan: bad access detected
[   31.141712] 
[   31.142039] Memory state around the buggy address:
[   31.142943]  fff00000c6728800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc
[   31.143716]  fff00000c6728880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.144839] >fff00000c6728900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
[   31.145693]                                                                 ^
[   31.146577]  fff00000c6728980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.147449]  fff00000c6728a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.148165] ==================================================================

[   23.632300] ==================================================================
[   23.634329] BUG: KASAN: slab-out-of-bounds in kmalloc_oob_in_memset+0x160/0x320
[   23.635334] Write of size 128 at addr ffff888102472700 by task kunit_try_catch/178
[   23.636542] 
[   23.636760] CPU: 1 UID: 0 PID: 178 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241206 #1
[   23.639102] Tainted: [B]=BAD_PAGE, [N]=TEST
[   23.639535] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   23.640394] Call Trace:
[   23.640687]  <TASK>
[   23.642105]  dump_stack_lvl+0x73/0xb0
[   23.643178]  print_report+0xd1/0x640
[   23.644193]  ? __virt_addr_valid+0x1db/0x2d0
[   23.644638]  ? kasan_complete_mode_report_info+0x2a/0x200
[   23.645607]  kasan_report+0x102/0x140
[   23.646377]  ? kmalloc_oob_in_memset+0x160/0x320
[   23.647313]  ? kmalloc_oob_in_memset+0x160/0x320
[   23.648531]  kasan_check_range+0x10c/0x1c0
[   23.648880]  __asan_memset+0x27/0x50
[   23.649627]  kmalloc_oob_in_memset+0x160/0x320
[   23.650402]  ? __pfx_kmalloc_oob_in_memset+0x10/0x10
[   23.651113]  ? __schedule+0xc70/0x27e0
[   23.652515]  ? __pfx_read_tsc+0x10/0x10
[   23.653086]  ? ktime_get_ts64+0x86/0x230
[   23.653569]  kunit_try_run_case+0x1b3/0x490
[   23.654987]  ? __pfx_kunit_try_run_case+0x10/0x10
[   23.655659]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   23.656124]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   23.656555]  ? __kthread_parkme+0x82/0x160
[   23.656989]  ? preempt_count_sub+0x50/0x80
[   23.657506]  ? __pfx_kunit_try_run_case+0x10/0x10
[   23.658277]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   23.659226]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   23.660325]  kthread+0x257/0x310
[   23.660877]  ? __pfx_kthread+0x10/0x10
[   23.661466]  ret_from_fork+0x41/0x80
[   23.663160]  ? __pfx_kthread+0x10/0x10
[   23.664033]  ret_from_fork_asm+0x1a/0x30
[   23.664524]  </TASK>
[   23.665236] 
[   23.665427] Allocated by task 178:
[   23.665853]  kasan_save_stack+0x3d/0x60
[   23.667207]  kasan_save_track+0x18/0x40
[   23.667691]  kasan_save_alloc_info+0x3b/0x50
[   23.668091]  __kasan_kmalloc+0xb7/0xc0
[   23.669072]  __kmalloc_cache_noprof+0x184/0x410
[   23.669980]  kmalloc_oob_in_memset+0xad/0x320
[   23.670278]  kunit_try_run_case+0x1b3/0x490
[   23.670542]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   23.670868]  kthread+0x257/0x310
[   23.671131]  ret_from_fork+0x41/0x80
[   23.671369]  ret_from_fork_asm+0x1a/0x30
[   23.672253] 
[   23.672444] The buggy address belongs to the object at ffff888102472700
[   23.672444]  which belongs to the cache kmalloc-128 of size 128
[   23.674698] The buggy address is located 0 bytes inside of
[   23.674698]  allocated 120-byte region [ffff888102472700, ffff888102472778)
[   23.675342] 
[   23.675508] The buggy address belongs to the physical page:
[   23.675826] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102472
[   23.676298] flags: 0x200000000000000(node=0|zone=2)
[   23.676622] page_type: f5(slab)
[   23.677410] raw: 0200000000000000 ffff888100041a00 dead000000000122 0000000000000000
[   23.679267] raw: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
[   23.679911] page dumped because: kasan: bad access detected
[   23.680483] 
[   23.680744] Memory state around the buggy address:
[   23.682493]  ffff888102472600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   23.683152]  ffff888102472680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.683769] >ffff888102472700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
[   23.685354]                                                                 ^
[   23.686393]  ffff888102472780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.687552]  ffff888102472800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.688324] ==================================================================