Hay
Date
Nov. 28, 2024, 2:36 a.m.

Environment
qemu-arm64
qemu-x86_64

[   33.611457] ==================================================================
[   33.612751] BUG: KASAN: slab-use-after-free in strcmp+0xc0/0xc8
[   33.613678] Read of size 1 at addr fff00000c4081c10 by task kunit_try_catch/247
[   33.615461] 
[   33.615837] CPU: 1 UID: 0 PID: 247 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241128 #1
[   33.617432] Tainted: [B]=BAD_PAGE, [N]=TEST
[   33.617951] Hardware name: linux,dummy-virt (DT)
[   33.618592] Call trace:
[   33.619009]  show_stack+0x20/0x38 (C)
[   33.619609]  dump_stack_lvl+0x8c/0xd0
[   33.620260]  print_report+0x118/0x5e0
[   33.620861]  kasan_report+0xc8/0x118
[   33.621723]  __asan_report_load1_noabort+0x20/0x30
[   33.622239]  strcmp+0xc0/0xc8
[   33.622829]  kasan_strings+0x248/0x8f8
[   33.623403]  kunit_try_run_case+0x14c/0x3d0
[   33.624099]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.624853]  kthread+0x24c/0x2d0
[   33.625459]  ret_from_fork+0x10/0x20
[   33.626241] 
[   33.626630] Allocated by task 247:
[   33.627159]  kasan_save_stack+0x3c/0x68
[   33.627809]  kasan_save_track+0x20/0x40
[   33.628458]  kasan_save_alloc_info+0x40/0x58
[   33.629093]  __kasan_kmalloc+0xd4/0xd8
[   33.629891]  __kmalloc_cache_noprof+0x15c/0x3c0
[   33.630520]  kasan_strings+0xb4/0x8f8
[   33.631090]  kunit_try_run_case+0x14c/0x3d0
[   33.631735]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.632466]  kthread+0x24c/0x2d0
[   33.633295]  ret_from_fork+0x10/0x20
[   33.633854] 
[   33.634171] Freed by task 247:
[   33.634664]  kasan_save_stack+0x3c/0x68
[   33.635750]  kasan_save_track+0x20/0x40
[   33.636406]  kasan_save_free_info+0x4c/0x78
[   33.636924]  __kasan_slab_free+0x6c/0x98
[   33.637509]  kfree+0x114/0x3c8
[   33.637908]  kasan_strings+0x128/0x8f8
[   33.638676]  kunit_try_run_case+0x14c/0x3d0
[   33.639438]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.640083]  kthread+0x24c/0x2d0
[   33.640542]  ret_from_fork+0x10/0x20
[   33.641343] 
[   33.641714] The buggy address belongs to the object at fff00000c4081c00
[   33.641714]  which belongs to the cache kmalloc-32 of size 32
[   33.642873] The buggy address is located 16 bytes inside of
[   33.642873]  freed 32-byte region [fff00000c4081c00, fff00000c4081c20)
[   33.643997] 
[   33.644436] The buggy address belongs to the physical page:
[   33.645447] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x104081
[   33.646309] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   33.647087] page_type: f5(slab)
[   33.647600] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   33.648536] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   33.649510] page dumped because: kasan: bad access detected
[   33.650180] 
[   33.650559] Memory state around the buggy address:
[   33.651110]  fff00000c4081b00: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   33.651940]  fff00000c4081b80: 00 00 00 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   33.652745] >fff00000c4081c00: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   33.654272]                          ^
[   33.654866]  fff00000c4081c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   33.655660]  fff00000c4081d00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   33.656447] ==================================================================

[   24.549502] ==================================================================
[   24.549978] BUG: KASAN: slab-use-after-free in strcmp+0xb0/0xc0
[   24.551121] Read of size 1 at addr ffff888102a34190 by task kunit_try_catch/267
[   24.551909] 
[   24.552240] CPU: 0 UID: 0 PID: 267 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241128 #1
[   24.553260] Tainted: [B]=BAD_PAGE, [N]=TEST
[   24.553733] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   24.554306] Call Trace:
[   24.554647]  <TASK>
[   24.554938]  dump_stack_lvl+0x73/0xb0
[   24.555440]  print_report+0xd1/0x640
[   24.555880]  ? __virt_addr_valid+0x1db/0x2d0
[   24.556271]  ? kasan_complete_mode_report_info+0x64/0x200
[   24.556652]  kasan_report+0x102/0x140
[   24.557127]  ? strcmp+0xb0/0xc0
[   24.557566]  ? strcmp+0xb0/0xc0
[   24.558065]  __asan_report_load1_noabort+0x18/0x20
[   24.558703]  strcmp+0xb0/0xc0
[   24.559187]  kasan_strings+0x2e9/0xb60
[   24.559690]  ? __pfx_kasan_strings+0x10/0x10
[   24.559998]  ? __schedule+0xc3e/0x2790
[   24.560531]  ? __pfx_read_tsc+0x10/0x10
[   24.561028]  ? ktime_get_ts64+0x84/0x230
[   24.561411]  kunit_try_run_case+0x1b3/0x490
[   24.561741]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.562201]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   24.562760]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   24.563422]  ? __kthread_parkme+0x82/0x160
[   24.563954]  ? preempt_count_sub+0x50/0x80
[   24.564554]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.564959]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   24.565498]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.566191]  kthread+0x257/0x310
[   24.566561]  ? __pfx_kthread+0x10/0x10
[   24.566955]  ret_from_fork+0x41/0x80
[   24.567292]  ? __pfx_kthread+0x10/0x10
[   24.567744]  ret_from_fork_asm+0x1a/0x30
[   24.568304]  </TASK>
[   24.568626] 
[   24.568872] Allocated by task 267:
[   24.569316]  kasan_save_stack+0x3d/0x60
[   24.569763]  kasan_save_track+0x18/0x40
[   24.570177]  kasan_save_alloc_info+0x3b/0x50
[   24.570517]  __kasan_kmalloc+0xb7/0xc0
[   24.570917]  __kmalloc_cache_noprof+0x184/0x410
[   24.571270]  kasan_strings+0xb3/0xb60
[   24.571551]  kunit_try_run_case+0x1b3/0x490
[   24.571846]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.572271]  kthread+0x257/0x310
[   24.572751]  ret_from_fork+0x41/0x80
[   24.573297]  ret_from_fork_asm+0x1a/0x30
[   24.573828] 
[   24.573997] Freed by task 267:
[   24.574321]  kasan_save_stack+0x3d/0x60
[   24.574783]  kasan_save_track+0x18/0x40
[   24.575389]  kasan_save_free_info+0x3f/0x60
[   24.575800]  __kasan_slab_free+0x56/0x70
[   24.576211]  kfree+0x123/0x3f0
[   24.576602]  kasan_strings+0x13a/0xb60
[   24.576938]  kunit_try_run_case+0x1b3/0x490
[   24.577470]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.577960]  kthread+0x257/0x310
[   24.578349]  ret_from_fork+0x41/0x80
[   24.578738]  ret_from_fork_asm+0x1a/0x30
[   24.579214] 
[   24.579411] The buggy address belongs to the object at ffff888102a34180
[   24.579411]  which belongs to the cache kmalloc-32 of size 32
[   24.580722] The buggy address is located 16 bytes inside of
[   24.580722]  freed 32-byte region [ffff888102a34180, ffff888102a341a0)
[   24.581845] 
[   24.582199] The buggy address belongs to the physical page:
[   24.583039] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a34
[   24.584240] flags: 0x200000000000000(node=0|zone=2)
[   24.585011] page_type: f5(slab)
[   24.585638] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   24.586535] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   24.587111] page dumped because: kasan: bad access detected
[   24.587704] 
[   24.587856] Memory state around the buggy address:
[   24.588324]  ffff888102a34080: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   24.588991]  ffff888102a34100: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   24.589645] >ffff888102a34180: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   24.590419]                          ^
[   24.590780]  ffff888102a34200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.591481]  ffff888102a34280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.592030] ==================================================================