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

Environment
qemu-arm64
qemu-x86_64

[   37.116551] ==================================================================
[   37.118299] BUG: KASAN: slab-out-of-bounds in memcmp+0x198/0x1d8
[   37.119067] Read of size 1 at addr fff00000c6a4c458 by task kunit_try_catch/246
[   37.120074] 
[   37.120506] CPU: 1 UID: 0 PID: 246 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241122 #1
[   37.121923] Tainted: [B]=BAD_PAGE, [N]=TEST
[   37.122635] Hardware name: linux,dummy-virt (DT)
[   37.123298] Call trace:
[   37.123677]  show_stack+0x20/0x38 (C)
[   37.124401]  dump_stack_lvl+0x8c/0xd0
[   37.125918]  print_report+0x118/0x5e0
[   37.126464]  kasan_report+0xc8/0x118
[   37.127094]  __asan_report_load1_noabort+0x20/0x30
[   37.127787]  memcmp+0x198/0x1d8
[   37.128285]  kasan_memcmp+0x16c/0x300
[   37.128986]  kunit_try_run_case+0x14c/0x3d0
[   37.129601]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   37.130992]  kthread+0x24c/0x2d0
[   37.131548]  ret_from_fork+0x10/0x20
[   37.132315] 
[   37.132766] Allocated by task 246:
[   37.133969]  kasan_save_stack+0x3c/0x68
[   37.134894]  kasan_save_track+0x20/0x40
[   37.135358]  kasan_save_alloc_info+0x40/0x58
[   37.135997]  __kasan_kmalloc+0xd4/0xd8
[   37.137107]  __kmalloc_cache_noprof+0x15c/0x3c8
[   37.137827]  kasan_memcmp+0xbc/0x300
[   37.138412]  kunit_try_run_case+0x14c/0x3d0
[   37.139151]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   37.139914]  kthread+0x24c/0x2d0
[   37.141529]  ret_from_fork+0x10/0x20
[   37.142214] 
[   37.142575] The buggy address belongs to the object at fff00000c6a4c440
[   37.142575]  which belongs to the cache kmalloc-32 of size 32
[   37.144178] The buggy address is located 0 bytes to the right of
[   37.144178]  allocated 24-byte region [fff00000c6a4c440, fff00000c6a4c458)
[   37.147202] 
[   37.147572] The buggy address belongs to the physical page:
[   37.148359] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106a4c
[   37.149606] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   37.150064] page_type: f5(slab)
[   37.150330] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   37.152037] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   37.154013] page dumped because: kasan: bad access detected
[   37.155819] 
[   37.156239] Memory state around the buggy address:
[   37.157713]  fff00000c6a4c300: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   37.159570]  fff00000c6a4c380: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   37.160250] >fff00000c6a4c400: 00 00 07 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   37.161414]                                                     ^
[   37.162612]  fff00000c6a4c480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   37.163365]  fff00000c6a4c500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   37.164398] ==================================================================

[   28.048405] ==================================================================
[   28.049534] BUG: KASAN: slab-out-of-bounds in memcmp+0x1b4/0x1d0
[   28.050634] Read of size 1 at addr ffff888102a18958 by task kunit_try_catch/265
[   28.051499] 
[   28.052043] CPU: 1 UID: 0 PID: 265 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241122 #1
[   28.053191] Tainted: [B]=BAD_PAGE, [N]=TEST
[   28.053743] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   28.054327] Call Trace:
[   28.055532]  <TASK>
[   28.055848]  dump_stack_lvl+0x73/0xb0
[   28.056357]  print_report+0xd1/0x640
[   28.057029]  ? __virt_addr_valid+0x1db/0x2d0
[   28.057521]  ? kasan_complete_mode_report_info+0x2a/0x200
[   28.058195]  kasan_report+0x102/0x140
[   28.058592]  ? memcmp+0x1b4/0x1d0
[   28.059558]  ? memcmp+0x1b4/0x1d0
[   28.060008]  __asan_report_load1_noabort+0x18/0x20
[   28.060641]  memcmp+0x1b4/0x1d0
[   28.061203]  kasan_memcmp+0x190/0x390
[   28.061760]  ? trace_hardirqs_on+0x37/0xe0
[   28.062344]  ? __pfx_kasan_memcmp+0x10/0x10
[   28.062813]  ? finish_task_switch.isra.0+0x153/0x700
[   28.063253]  ? __switch_to+0x5d9/0xf60
[   28.063699]  ? __pfx_read_tsc+0x10/0x10
[   28.064379]  ? ktime_get_ts64+0x84/0x230
[   28.064772]  kunit_try_run_case+0x1b3/0x490
[   28.065695]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.066428]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   28.067151]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   28.067628]  ? __kthread_parkme+0x82/0x160
[   28.068433]  ? preempt_count_sub+0x50/0x80
[   28.068741]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.069540]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   28.069965]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.071095]  kthread+0x257/0x310
[   28.071670]  ? __pfx_kthread+0x10/0x10
[   28.072193]  ret_from_fork+0x41/0x80
[   28.072851]  ? __pfx_kthread+0x10/0x10
[   28.073381]  ret_from_fork_asm+0x1a/0x30
[   28.073970]  </TASK>
[   28.074471] 
[   28.074644] Allocated by task 265:
[   28.074904]  kasan_save_stack+0x3d/0x60
[   28.075303]  kasan_save_track+0x18/0x40
[   28.075970]  kasan_save_alloc_info+0x3b/0x50
[   28.076906]  __kasan_kmalloc+0xb7/0xc0
[   28.077290]  __kmalloc_cache_noprof+0x184/0x410
[   28.077626]  kasan_memcmp+0xb8/0x390
[   28.077917]  kunit_try_run_case+0x1b3/0x490
[   28.078386]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.079101]  kthread+0x257/0x310
[   28.079552]  ret_from_fork+0x41/0x80
[   28.079934]  ret_from_fork_asm+0x1a/0x30
[   28.080211] 
[   28.080365] The buggy address belongs to the object at ffff888102a18940
[   28.080365]  which belongs to the cache kmalloc-32 of size 32
[   28.081621] The buggy address is located 0 bytes to the right of
[   28.081621]  allocated 24-byte region [ffff888102a18940, ffff888102a18958)
[   28.082702] 
[   28.082958] The buggy address belongs to the physical page:
[   28.083670] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a18
[   28.084907] flags: 0x200000000000000(node=0|zone=2)
[   28.085298] page_type: f5(slab)
[   28.085543] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   28.086206] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   28.087277] page dumped because: kasan: bad access detected
[   28.087788] 
[   28.088029] Memory state around the buggy address:
[   28.088465]  ffff888102a18800: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   28.090122]  ffff888102a18880: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   28.090786] >ffff888102a18900: 00 00 07 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   28.091699]                                                     ^
[   28.092297]  ffff888102a18980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.092848]  ffff888102a18a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.093480] ==================================================================