Hay
Date
Nov. 27, 2024, 3:37 a.m.

Environment
qemu-arm64
qemu-x86_64

[   48.138541] ==================================================================
[   48.139763] BUG: KASAN: slab-out-of-bounds in kmalloc_memmove_invalid_size+0x154/0x2e8
[   48.140490] Read of size 64 at addr fff00000c60d3484 by task kunit_try_catch/171
[   48.141476] 
[   48.141835] CPU: 1 UID: 0 PID: 171 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241127 #1
[   48.143008] Tainted: [B]=BAD_PAGE, [N]=TEST
[   48.143698] Hardware name: linux,dummy-virt (DT)
[   48.144266] Call trace:
[   48.145793]  show_stack+0x20/0x38 (C)
[   48.146473]  dump_stack_lvl+0x8c/0xd0
[   48.146972]  print_report+0x118/0x5e0
[   48.147549]  kasan_report+0xc8/0x118
[   48.148153]  kasan_check_range+0x100/0x1a8
[   48.148776]  __asan_memmove+0x3c/0x98
[   48.149357]  kmalloc_memmove_invalid_size+0x154/0x2e8
[   48.150372]  kunit_try_run_case+0x14c/0x3d0
[   48.151600]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   48.152481]  kthread+0x24c/0x2d0
[   48.152906]  ret_from_fork+0x10/0x20
[   48.153528] 
[   48.153808] Allocated by task 171:
[   48.154398]  kasan_save_stack+0x3c/0x68
[   48.154925]  kasan_save_track+0x20/0x40
[   48.155591]  kasan_save_alloc_info+0x40/0x58
[   48.156665]  __kasan_kmalloc+0xd4/0xd8
[   48.157172]  __kmalloc_cache_noprof+0x15c/0x3c0
[   48.157819]  kmalloc_memmove_invalid_size+0xb0/0x2e8
[   48.158367]  kunit_try_run_case+0x14c/0x3d0
[   48.159098]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   48.160004]  kthread+0x24c/0x2d0
[   48.160603]  ret_from_fork+0x10/0x20
[   48.162062] 
[   48.162469] The buggy address belongs to the object at fff00000c60d3480
[   48.162469]  which belongs to the cache kmalloc-64 of size 64
[   48.164021] The buggy address is located 4 bytes inside of
[   48.164021]  allocated 64-byte region [fff00000c60d3480, fff00000c60d34c0)
[   48.165866] 
[   48.166151] The buggy address belongs to the physical page:
[   48.166924] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1060d3
[   48.167909] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   48.168833] page_type: f5(slab)
[   48.169277] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   48.170620] raw: 0000000000000000 0000000080200020 00000001f5000000 0000000000000000
[   48.171492] page dumped because: kasan: bad access detected
[   48.172136] 
[   48.172452] Memory state around the buggy address:
[   48.173051]  fff00000c60d3380: 00 00 00 00 00 01 fc fc fc fc fc fc fc fc fc fc
[   48.174352]  fff00000c60d3400: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   48.175194] >fff00000c60d3480: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
[   48.176166]                                            ^
[   48.176763]  fff00000c60d3500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   48.177921]  fff00000c60d3580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   48.179039] ==================================================================

[   25.373563] ==================================================================
[   25.375091] BUG: KASAN: slab-out-of-bounds in kmalloc_memmove_invalid_size+0x170/0x330
[   25.376433] Read of size 64 at addr ffff888102a49284 by task kunit_try_catch/190
[   25.377490] 
[   25.377669] CPU: 0 UID: 0 PID: 190 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241127 #1
[   25.379032] Tainted: [B]=BAD_PAGE, [N]=TEST
[   25.379738] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   25.380761] Call Trace:
[   25.381069]  <TASK>
[   25.381295]  dump_stack_lvl+0x73/0xb0
[   25.381683]  print_report+0xd1/0x640
[   25.382041]  ? __virt_addr_valid+0x1db/0x2d0
[   25.382447]  ? kasan_complete_mode_report_info+0x2a/0x200
[   25.383265]  kasan_report+0x102/0x140
[   25.383568]  ? kmalloc_memmove_invalid_size+0x170/0x330
[   25.384162]  ? kmalloc_memmove_invalid_size+0x170/0x330
[   25.384774]  kasan_check_range+0x10c/0x1c0
[   25.385337]  __asan_memmove+0x27/0x70
[   25.385846]  kmalloc_memmove_invalid_size+0x170/0x330
[   25.386376]  ? __pfx_kmalloc_memmove_invalid_size+0x10/0x10
[   25.386977]  ? __schedule+0xc3e/0x2790
[   25.387513]  ? __pfx_read_tsc+0x10/0x10
[   25.387846]  ? ktime_get_ts64+0x84/0x230
[   25.388450]  kunit_try_run_case+0x1b3/0x490
[   25.388915]  ? __pfx_kunit_try_run_case+0x10/0x10
[   25.389421]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   25.390097]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   25.390551]  ? __kthread_parkme+0x82/0x160
[   25.390850]  ? preempt_count_sub+0x50/0x80
[   25.391446]  ? __pfx_kunit_try_run_case+0x10/0x10
[   25.392221]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   25.392835]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.393447]  kthread+0x257/0x310
[   25.393708]  ? __pfx_kthread+0x10/0x10
[   25.394218]  ret_from_fork+0x41/0x80
[   25.394709]  ? __pfx_kthread+0x10/0x10
[   25.395186]  ret_from_fork_asm+0x1a/0x30
[   25.395519]  </TASK>
[   25.395710] 
[   25.396033] Allocated by task 190:
[   25.396687]  kasan_save_stack+0x3d/0x60
[   25.397248]  kasan_save_track+0x18/0x40
[   25.397552]  kasan_save_alloc_info+0x3b/0x50
[   25.397850]  __kasan_kmalloc+0xb7/0xc0
[   25.398380]  __kmalloc_cache_noprof+0x184/0x410
[   25.399126]  kmalloc_memmove_invalid_size+0xad/0x330
[   25.399452]  kunit_try_run_case+0x1b3/0x490
[   25.400108]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.400670]  kthread+0x257/0x310
[   25.400918]  ret_from_fork+0x41/0x80
[   25.401215]  ret_from_fork_asm+0x1a/0x30
[   25.401790] 
[   25.402137] The buggy address belongs to the object at ffff888102a49280
[   25.402137]  which belongs to the cache kmalloc-64 of size 64
[   25.403090] The buggy address is located 4 bytes inside of
[   25.403090]  allocated 64-byte region [ffff888102a49280, ffff888102a492c0)
[   25.404364] 
[   25.404561] The buggy address belongs to the physical page:
[   25.404885] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a49
[   25.405855] flags: 0x200000000000000(node=0|zone=2)
[   25.406367] page_type: f5(slab)
[   25.406615] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   25.407759] raw: 0000000000000000 0000000080200020 00000001f5000000 0000000000000000
[   25.408715] page dumped because: kasan: bad access detected
[   25.409650] 
[   25.409930] Memory state around the buggy address:
[   25.410463]  ffff888102a49180: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   25.412149]  ffff888102a49200: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   25.412715] >ffff888102a49280: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
[   25.413791]                                            ^
[   25.414384]  ffff888102a49300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.415544]  ffff888102a49380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.416455] ==================================================================