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

Environment
qemu-arm64
qemu-x86_64

[   48.086405] ==================================================================
[   48.087636] BUG: KASAN: out-of-bounds in kmalloc_memmove_negative_size+0x154/0x2e0
[   48.088528] Read of size 18446744073709551614 at addr fff00000c60d3304 by task kunit_try_catch/169
[   48.090953] 
[   48.091274] CPU: 1 UID: 0 PID: 169 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241127 #1
[   48.092471] Tainted: [B]=BAD_PAGE, [N]=TEST
[   48.092971] Hardware name: linux,dummy-virt (DT)
[   48.093584] Call trace:
[   48.093940]  show_stack+0x20/0x38 (C)
[   48.094570]  dump_stack_lvl+0x8c/0xd0
[   48.095503]  print_report+0x118/0x5e0
[   48.096021]  kasan_report+0xc8/0x118
[   48.096642]  kasan_check_range+0x100/0x1a8
[   48.097805]  __asan_memmove+0x3c/0x98
[   48.098372]  kmalloc_memmove_negative_size+0x154/0x2e0
[   48.098991]  kunit_try_run_case+0x14c/0x3d0
[   48.099694]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   48.100408]  kthread+0x24c/0x2d0
[   48.101021]  ret_from_fork+0x10/0x20
[   48.101888] 
[   48.102174] Allocated by task 169:
[   48.102703]  kasan_save_stack+0x3c/0x68
[   48.103342]  kasan_save_track+0x20/0x40
[   48.103873]  kasan_save_alloc_info+0x40/0x58
[   48.104439]  __kasan_kmalloc+0xd4/0xd8
[   48.105308]  __kmalloc_cache_noprof+0x15c/0x3c0
[   48.106011]  kmalloc_memmove_negative_size+0xb0/0x2e0
[   48.106677]  kunit_try_run_case+0x14c/0x3d0
[   48.107267]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   48.108075]  kthread+0x24c/0x2d0
[   48.108691]  ret_from_fork+0x10/0x20
[   48.109620] 
[   48.110275] The buggy address belongs to the object at fff00000c60d3300
[   48.110275]  which belongs to the cache kmalloc-64 of size 64
[   48.112441] The buggy address is located 4 bytes inside of
[   48.112441]  64-byte region [fff00000c60d3300, fff00000c60d3340)
[   48.113794] 
[   48.114558] The buggy address belongs to the physical page:
[   48.115247] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1060d3
[   48.116222] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   48.117207] page_type: f5(slab)
[   48.117692] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   48.118976] raw: 0000000000000000 0000000080200020 00000001f5000000 0000000000000000
[   48.120121] page dumped because: kasan: bad access detected
[   48.121385] 
[   48.121777] Memory state around the buggy address:
[   48.122566]  fff00000c60d3200: 00 00 00 00 01 fc fc fc fc fc fc fc fc fc fc fc
[   48.123658]  fff00000c60d3280: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   48.124073] >fff00000c60d3300: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
[   48.124592]                    ^
[   48.125553]  fff00000c60d3380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   48.126722]  fff00000c60d3400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   48.127817] ==================================================================

[   25.314754] ==================================================================
[   25.315967] BUG: KASAN: out-of-bounds in kmalloc_memmove_negative_size+0x172/0x330
[   25.317589] Read of size 18446744073709551614 at addr ffff888101a9ed04 by task kunit_try_catch/188
[   25.319540] 
[   25.320203] CPU: 1 UID: 0 PID: 188 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241127 #1
[   25.321240] Tainted: [B]=BAD_PAGE, [N]=TEST
[   25.321558] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   25.322580] Call Trace:
[   25.322921]  <TASK>
[   25.323240]  dump_stack_lvl+0x73/0xb0
[   25.323715]  print_report+0xd1/0x640
[   25.324392]  ? __virt_addr_valid+0x1db/0x2d0
[   25.324822]  ? kasan_complete_mode_report_info+0x2a/0x200
[   25.326329]  kasan_report+0x102/0x140
[   25.326717]  ? kmalloc_memmove_negative_size+0x172/0x330
[   25.327839]  ? kmalloc_memmove_negative_size+0x172/0x330
[   25.328539]  kasan_check_range+0x10c/0x1c0
[   25.329205]  __asan_memmove+0x27/0x70
[   25.329663]  kmalloc_memmove_negative_size+0x172/0x330
[   25.330481]  ? __pfx_kmalloc_memmove_negative_size+0x10/0x10
[   25.331671]  ? __schedule+0xc3e/0x2790
[   25.332724]  ? __pfx_read_tsc+0x10/0x10
[   25.333108]  ? ktime_get_ts64+0x84/0x230
[   25.334139]  kunit_try_run_case+0x1b3/0x490
[   25.334522]  ? __pfx_kunit_try_run_case+0x10/0x10
[   25.335017]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   25.335710]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   25.336728]  ? __kthread_parkme+0x82/0x160
[   25.337165]  ? preempt_count_sub+0x50/0x80
[   25.337597]  ? __pfx_kunit_try_run_case+0x10/0x10
[   25.338788]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   25.339493]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.340240]  kthread+0x257/0x310
[   25.340538]  ? __pfx_kthread+0x10/0x10
[   25.341071]  ret_from_fork+0x41/0x80
[   25.341620]  ? __pfx_kthread+0x10/0x10
[   25.342368]  ret_from_fork_asm+0x1a/0x30
[   25.342775]  </TASK>
[   25.343339] 
[   25.343540] Allocated by task 188:
[   25.343920]  kasan_save_stack+0x3d/0x60
[   25.344914]  kasan_save_track+0x18/0x40
[   25.345214]  kasan_save_alloc_info+0x3b/0x50
[   25.345719]  __kasan_kmalloc+0xb7/0xc0
[   25.346327]  __kmalloc_cache_noprof+0x184/0x410
[   25.346778]  kmalloc_memmove_negative_size+0xad/0x330
[   25.347244]  kunit_try_run_case+0x1b3/0x490
[   25.347832]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.348537]  kthread+0x257/0x310
[   25.348886]  ret_from_fork+0x41/0x80
[   25.349306]  ret_from_fork_asm+0x1a/0x30
[   25.349589] 
[   25.349772] The buggy address belongs to the object at ffff888101a9ed00
[   25.349772]  which belongs to the cache kmalloc-64 of size 64
[   25.351247] The buggy address is located 4 bytes inside of
[   25.351247]  64-byte region [ffff888101a9ed00, ffff888101a9ed40)
[   25.352772] 
[   25.354205] The buggy address belongs to the physical page:
[   25.354850] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101a9e
[   25.356284] flags: 0x200000000000000(node=0|zone=2)
[   25.357547] page_type: f5(slab)
[   25.357843] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   25.358592] raw: 0000000000000000 0000000080200020 00000001f5000000 0000000000000000
[   25.359977] page dumped because: kasan: bad access detected
[   25.360896] 
[   25.361191] Memory state around the buggy address:
[   25.361689]  ffff888101a9ec00: 00 00 00 00 01 fc fc fc fc fc fc fc fc fc fc fc
[   25.362651]  ffff888101a9ec80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   25.363306] >ffff888101a9ed00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
[   25.363860]                    ^
[   25.364520]  ffff888101a9ed80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.366083]  ffff888101a9ee00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.366682] ==================================================================