Hay
Date
Dec. 9, 2024, 6:35 a.m.

Environment
qemu-arm64
qemu-x86_64

[   24.206563] ==================================================================
[   24.207779] BUG: KASAN: slab-out-of-bounds in kmalloc_oob_in_memset+0x144/0x2d0
[   24.208548] Write of size 128 at addr fff00000c639f600 by task kunit_try_catch/158
[   24.210220] 
[   24.210649] CPU: 0 UID: 0 PID: 158 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc2-next-20241209 #1
[   24.212092] Tainted: [B]=BAD_PAGE, [N]=TEST
[   24.212740] Hardware name: linux,dummy-virt (DT)
[   24.213408] Call trace:
[   24.213841]  show_stack+0x20/0x38 (C)
[   24.214431]  dump_stack_lvl+0x8c/0xd0
[   24.215140]  print_report+0x118/0x5e0
[   24.215664]  kasan_report+0xc8/0x118
[   24.216198]  kasan_check_range+0x100/0x1a8
[   24.216780]  __asan_memset+0x34/0x78
[   24.217487]  kmalloc_oob_in_memset+0x144/0x2d0
[   24.218238]  kunit_try_run_case+0x14c/0x3d0
[   24.219018]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   24.219767]  kthread+0x24c/0x2d0
[   24.220262]  ret_from_fork+0x10/0x20
[   24.220822] 
[   24.221129] Allocated by task 158:
[   24.221612]  kasan_save_stack+0x3c/0x68
[   24.222129]  kasan_save_track+0x20/0x40
[   24.222693]  kasan_save_alloc_info+0x40/0x58
[   24.223327]  __kasan_kmalloc+0xd4/0xd8
[   24.224254]  __kmalloc_cache_noprof+0x15c/0x3c0
[   24.224825]  kmalloc_oob_in_memset+0xb0/0x2d0
[   24.225399]  kunit_try_run_case+0x14c/0x3d0
[   24.225986]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   24.226585]  kthread+0x24c/0x2d0
[   24.227369]  ret_from_fork+0x10/0x20
[   24.227834] 
[   24.228164] The buggy address belongs to the object at fff00000c639f600
[   24.228164]  which belongs to the cache kmalloc-128 of size 128
[   24.229509] The buggy address is located 0 bytes inside of
[   24.229509]  allocated 120-byte region [fff00000c639f600, fff00000c639f678)
[   24.230782] 
[   24.231456] The buggy address belongs to the physical page:
[   24.232099] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10639f
[   24.233030] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   24.233764] page_type: f5(slab)
[   24.234222] raw: 0bfffe0000000000 fff00000c0001a00 dead000000000122 0000000000000000
[   24.235308] raw: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
[   24.236148] page dumped because: kasan: bad access detected
[   24.236829] 
[   24.237125] Memory state around the buggy address:
[   24.237760]  fff00000c639f500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc
[   24.238479]  fff00000c639f580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.239724] >fff00000c639f600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
[   24.240515]                                                                 ^
[   24.241303]  fff00000c639f680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.242117]  fff00000c639f700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.242891] ==================================================================

[   24.107601] ==================================================================
[   24.108794] BUG: KASAN: slab-out-of-bounds in kmalloc_oob_in_memset+0x160/0x320
[   24.109442] Write of size 128 at addr ffff888102954f00 by task kunit_try_catch/177
[   24.110424] 
[   24.110559] CPU: 0 UID: 0 PID: 177 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc2-next-20241209 #1
[   24.111812] Tainted: [B]=BAD_PAGE, [N]=TEST
[   24.112527] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   24.113410] Call Trace:
[   24.113669]  <TASK>
[   24.114012]  dump_stack_lvl+0x73/0xb0
[   24.114562]  print_report+0xd1/0x640
[   24.115075]  ? __virt_addr_valid+0x1db/0x2d0
[   24.115545]  ? kasan_complete_mode_report_info+0x2a/0x200
[   24.116332]  kasan_report+0x102/0x140
[   24.116726]  ? kmalloc_oob_in_memset+0x160/0x320
[   24.117387]  ? kmalloc_oob_in_memset+0x160/0x320
[   24.117847]  kasan_check_range+0x10c/0x1c0
[   24.118414]  __asan_memset+0x27/0x50
[   24.118927]  kmalloc_oob_in_memset+0x160/0x320
[   24.119419]  ? __pfx_kmalloc_oob_in_memset+0x10/0x10
[   24.120108]  ? __pfx_kmalloc_oob_in_memset+0x10/0x10
[   24.120558]  kunit_try_run_case+0x1b3/0x490
[   24.121104]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.121519]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   24.121903]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   24.122335]  ? __kthread_parkme+0x82/0x160
[   24.122925]  ? preempt_count_sub+0x50/0x80
[   24.123457]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.123892]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   24.124441]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.124952]  kthread+0x257/0x310
[   24.125283]  ? __pfx_kthread+0x10/0x10
[   24.125713]  ret_from_fork+0x41/0x80
[   24.126122]  ? __pfx_kthread+0x10/0x10
[   24.126481]  ret_from_fork_asm+0x1a/0x30
[   24.127079]  </TASK>
[   24.127495] 
[   24.128396] Allocated by task 177:
[   24.128667]  kasan_save_stack+0x3d/0x60
[   24.129266]  kasan_save_track+0x18/0x40
[   24.129888]  kasan_save_alloc_info+0x3b/0x50
[   24.130358]  __kasan_kmalloc+0xb7/0xc0
[   24.130893]  __kmalloc_cache_noprof+0x184/0x410
[   24.131433]  kmalloc_oob_in_memset+0xad/0x320
[   24.131978]  kunit_try_run_case+0x1b3/0x490
[   24.132453]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.133150]  kthread+0x257/0x310
[   24.133621]  ret_from_fork+0x41/0x80
[   24.133927]  ret_from_fork_asm+0x1a/0x30
[   24.134504] 
[   24.134871] The buggy address belongs to the object at ffff888102954f00
[   24.134871]  which belongs to the cache kmalloc-128 of size 128
[   24.135952] The buggy address is located 0 bytes inside of
[   24.135952]  allocated 120-byte region [ffff888102954f00, ffff888102954f78)
[   24.137115] 
[   24.137403] The buggy address belongs to the physical page:
[   24.137953] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102954
[   24.138703] flags: 0x200000000000000(node=0|zone=2)
[   24.139204] page_type: f5(slab)
[   24.139697] raw: 0200000000000000 ffff888100041a00 dead000000000122 0000000000000000
[   24.140555] raw: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
[   24.141284] page dumped because: kasan: bad access detected
[   24.142005] 
[   24.142192] Memory state around the buggy address:
[   24.142652]  ffff888102954e00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   24.143416]  ffff888102954e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.144175] >ffff888102954f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc
[   24.144835]                                                                 ^
[   24.145497]  ffff888102954f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.146097]  ffff888102955000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   24.146910] ==================================================================