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

Environment
qemu-arm64
qemu-x86_64

[   33.600393] ==================================================================
[   33.601788] BUG: KASAN: slab-out-of-bounds in kmalloc_oob_in_memset+0x144/0x2d0
[   33.602996] Write of size 128 at addr fff00000c6305b00 by task kunit_try_catch/159
[   33.604181] 
[   33.604612] CPU: 0 UID: 0 PID: 159 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241122 #1
[   33.606373] Tainted: [B]=BAD_PAGE, [N]=TEST
[   33.607776] Hardware name: linux,dummy-virt (DT)
[   33.608409] Call trace:
[   33.609516]  show_stack+0x20/0x38 (C)
[   33.610033]  dump_stack_lvl+0x8c/0xd0
[   33.610505]  print_report+0x118/0x5e0
[   33.611633]  kasan_report+0xc8/0x118
[   33.612769]  kasan_check_range+0x100/0x1a8
[   33.614042]  __asan_memset+0x34/0x78
[   33.614998]  kmalloc_oob_in_memset+0x144/0x2d0
[   33.615947]  kunit_try_run_case+0x14c/0x3d0
[   33.616340]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.619171]  kthread+0x24c/0x2d0
[   33.620374]  ret_from_fork+0x10/0x20
[   33.621080] 
[   33.621334] Allocated by task 159:
[   33.624069]  kasan_save_stack+0x3c/0x68
[   33.625800]  kasan_save_track+0x20/0x40
[   33.628827]  kasan_save_alloc_info+0x40/0x58
[   33.629348]  __kasan_kmalloc+0xd4/0xd8
[   33.631066]  __kmalloc_cache_noprof+0x15c/0x3c8
[   33.633289]  kmalloc_oob_in_memset+0xb0/0x2d0
[   33.635064]  kunit_try_run_case+0x14c/0x3d0
[   33.637428]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.638085]  kthread+0x24c/0x2d0
[   33.640553]  ret_from_fork+0x10/0x20
[   33.641931] 
[   33.643516] The buggy address belongs to the object at fff00000c6305b00
[   33.643516]  which belongs to the cache kmalloc-128 of size 128
[   33.646880] The buggy address is located 0 bytes inside of
[   33.646880]  allocated 120-byte region [fff00000c6305b00, fff00000c6305b78)
[   33.649609] 
[   33.650277] The buggy address belongs to the physical page:
[   33.651140] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106305
[   33.651860] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   33.652267] page_type: f5(slab)
[   33.653156] raw: 0bfffe0000000000 fff00000c0001a00 dead000000000122 0000000000000000
[   33.654867] raw: 0000000000000000 0000000080100010 00000001f5000000 0000000000000000
[   33.655536] page dumped because: kasan: bad access detected
[   33.656538] 
[   33.657686] Memory state around the buggy address:
[   33.658586]  fff00000c6305a00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc
[   33.659676]  fff00000c6305a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   33.661392] >fff00000c6305b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
[   33.663478]                                                                 ^
[   33.664533]  fff00000c6305b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   33.665422]  fff00000c6305c00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   33.667525] ==================================================================

[   25.081416] ==================================================================
[   25.082652] BUG: KASAN: slab-out-of-bounds in kmalloc_oob_in_memset+0x160/0x320
[   25.084238] Write of size 128 at addr ffff888102a09400 by task kunit_try_catch/178
[   25.084965] 
[   25.085765] CPU: 1 UID: 0 PID: 178 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241122 #1
[   25.086543] Tainted: [B]=BAD_PAGE, [N]=TEST
[   25.086956] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   25.087617] Call Trace:
[   25.088561]  <TASK>
[   25.088752]  dump_stack_lvl+0x73/0xb0
[   25.089319]  print_report+0xd1/0x640
[   25.089770]  ? __virt_addr_valid+0x1db/0x2d0
[   25.090559]  ? kasan_complete_mode_report_info+0x2a/0x200
[   25.091357]  kasan_report+0x102/0x140
[   25.091770]  ? kmalloc_oob_in_memset+0x160/0x320
[   25.092664]  ? kmalloc_oob_in_memset+0x160/0x320
[   25.093565]  kasan_check_range+0x10c/0x1c0
[   25.094208]  __asan_memset+0x27/0x50
[   25.094473]  kmalloc_oob_in_memset+0x160/0x320
[   25.095018]  ? __pfx_kmalloc_oob_in_memset+0x10/0x10
[   25.095423]  ? __schedule+0xc3e/0x2790
[   25.095979]  ? __pfx_read_tsc+0x10/0x10
[   25.096309]  ? ktime_get_ts64+0x84/0x230
[   25.097107]  kunit_try_run_case+0x1b3/0x490
[   25.097428]  ? __pfx_kunit_try_run_case+0x10/0x10
[   25.098025]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   25.098634]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   25.099353]  ? __kthread_parkme+0x82/0x160
[   25.099672]  ? preempt_count_sub+0x50/0x80
[   25.100003]  ? __pfx_kunit_try_run_case+0x10/0x10
[   25.100710]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   25.101454]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.102112]  kthread+0x257/0x310
[   25.102468]  ? __pfx_kthread+0x10/0x10
[   25.103002]  ret_from_fork+0x41/0x80
[   25.103468]  ? __pfx_kthread+0x10/0x10
[   25.103787]  ret_from_fork_asm+0x1a/0x30
[   25.104125]  </TASK>
[   25.104403] 
[   25.104632] Allocated by task 178:
[   25.105333]  kasan_save_stack+0x3d/0x60
[   25.105757]  kasan_save_track+0x18/0x40
[   25.106469]  kasan_save_alloc_info+0x3b/0x50
[   25.106873]  __kasan_kmalloc+0xb7/0xc0
[   25.107176]  __kmalloc_cache_noprof+0x184/0x410
[   25.107698]  kmalloc_oob_in_memset+0xad/0x320
[   25.108464]  kunit_try_run_case+0x1b3/0x490
[   25.109055]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.109735]  kthread+0x257/0x310
[   25.110255]  ret_from_fork+0x41/0x80
[   25.111930]  ret_from_fork_asm+0x1a/0x30
[   25.112257] 
[   25.112409] The buggy address belongs to the object at ffff888102a09400
[   25.112409]  which belongs to the cache kmalloc-128 of size 128
[   25.114611] The buggy address is located 0 bytes inside of
[   25.114611]  allocated 120-byte region [ffff888102a09400, ffff888102a09478)
[   25.115762] 
[   25.116149] The buggy address belongs to the physical page:
[   25.116596] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a09
[   25.117206] flags: 0x200000000000000(node=0|zone=2)
[   25.117771] page_type: f5(slab)
[   25.118360] raw: 0200000000000000 ffff888100041a00 dead000000000122 0000000000000000
[   25.118758] raw: 0000000000000000 0000000080100010 00000001f5000000 0000000000000000
[   25.119653] page dumped because: kasan: bad access detected
[   25.120180] 
[   25.120423] Memory state around the buggy address:
[   25.120805]  ffff888102a09300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc
[   25.121177]  ffff888102a09380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.121923] >ffff888102a09400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
[   25.122275]                                                                 ^
[   25.122743]  ffff888102a09480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.123221]  ffff888102a09500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.123787] ==================================================================