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

Environment
qemu-arm64
qemu-x86_64

[   39.919035] ==================================================================
[   39.919903] BUG: KASAN: slab-use-after-free in strnlen+0x80/0x88
[   39.920569] Read of size 1 at addr fff00000c65a90d0 by task kunit_try_catch/248
[   39.922502] 
[   39.922803] CPU: 0 UID: 0 PID: 248 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241120 #1
[   39.923916] Tainted: [B]=BAD_PAGE, [N]=TEST
[   39.924630] Hardware name: linux,dummy-virt (DT)
[   39.925301] Call trace:
[   39.925751]  show_stack+0x20/0x38 (C)
[   39.926365]  dump_stack_lvl+0x8c/0xd0
[   39.926962]  print_report+0x118/0x5e0
[   39.927565]  kasan_report+0xc8/0x118
[   39.928087]  __asan_report_load1_noabort+0x20/0x30
[   39.928820]  strnlen+0x80/0x88
[   39.929314]  kasan_strings+0x380/0x8f8
[   39.929850]  kunit_try_run_case+0x14c/0x3d0
[   39.930516]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   39.931227]  kthread+0x24c/0x2d0
[   39.931712]  ret_from_fork+0x10/0x20
[   39.932316] 
[   39.932673] Allocated by task 248:
[   39.933214]  kasan_save_stack+0x3c/0x68
[   39.933789]  kasan_save_track+0x20/0x40
[   39.934284]  kasan_save_alloc_info+0x40/0x58
[   39.934965]  __kasan_kmalloc+0xd4/0xd8
[   39.935566]  __kmalloc_cache_noprof+0x15c/0x3c8
[   39.936212]  kasan_strings+0xb4/0x8f8
[   39.936728]  kunit_try_run_case+0x14c/0x3d0
[   39.937351]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   39.938037]  kthread+0x24c/0x2d0
[   39.938584]  ret_from_fork+0x10/0x20
[   39.939132] 
[   39.939508] Freed by task 248:
[   39.939897]  kasan_save_stack+0x3c/0x68
[   39.940497]  kasan_save_track+0x20/0x40
[   39.941081]  kasan_save_free_info+0x4c/0x78
[   39.941633]  __kasan_slab_free+0x6c/0x98
[   39.942212]  kfree+0x114/0x3d0
[   39.942755]  kasan_strings+0x128/0x8f8
[   39.943320]  kunit_try_run_case+0x14c/0x3d0
[   39.943992]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   39.944856]  kthread+0x24c/0x2d0
[   39.945479]  ret_from_fork+0x10/0x20
[   39.945869] 
[   39.946233] The buggy address belongs to the object at fff00000c65a90c0
[   39.946233]  which belongs to the cache kmalloc-32 of size 32
[   39.947617] The buggy address is located 16 bytes inside of
[   39.947617]  freed 32-byte region [fff00000c65a90c0, fff00000c65a90e0)
[   39.948943] 
[   39.949376] The buggy address belongs to the physical page:
[   39.950158] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1065a9
[   39.951145] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   39.951735] page_type: f5(slab)
[   39.952273] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   39.953248] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   39.954106] page dumped because: kasan: bad access detected
[   39.954943] 
[   39.955224] Memory state around the buggy address:
[   39.955958]  fff00000c65a8f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   39.956751]  fff00000c65a9000: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   39.957480] >fff00000c65a9080: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   39.958332]                                                  ^
[   39.958956]  fff00000c65a9100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   39.959813]  fff00000c65a9180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   39.960510] ==================================================================

[   31.585412] ==================================================================
[   31.586452] BUG: KASAN: slab-use-after-free in strnlen+0x73/0x80
[   31.587016] Read of size 1 at addr ffff8881029f3d50 by task kunit_try_catch/266
[   31.587840] 
[   31.588189] CPU: 1 UID: 0 PID: 266 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241120 #1
[   31.589054] Tainted: [B]=BAD_PAGE, [N]=TEST
[   31.589713] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   31.590906] Call Trace:
[   31.591299]  <TASK>
[   31.591510]  dump_stack_lvl+0x73/0xb0
[   31.591985]  print_report+0xd1/0x640
[   31.592463]  ? __virt_addr_valid+0x1db/0x2d0
[   31.592891]  ? kasan_complete_mode_report_info+0x64/0x200
[   31.593386]  kasan_report+0x102/0x140
[   31.593685]  ? strnlen+0x73/0x80
[   31.594395]  ? strnlen+0x73/0x80
[   31.594772]  __asan_report_load1_noabort+0x18/0x20
[   31.595446]  strnlen+0x73/0x80
[   31.595825]  kasan_strings+0x4cc/0xb60
[   31.596485]  ? __pfx_kasan_strings+0x10/0x10
[   31.597211]  ? __schedule+0xc3e/0x2790
[   31.597613]  ? __pfx_read_tsc+0x10/0x10
[   31.597963]  ? ktime_get_ts64+0x84/0x230
[   31.598598]  kunit_try_run_case+0x1b3/0x490
[   31.599247]  ? __pfx_kunit_try_run_case+0x10/0x10
[   31.600368]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   31.601198]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   31.601662]  ? __kthread_parkme+0x82/0x160
[   31.602069]  ? preempt_count_sub+0x50/0x80
[   31.602475]  ? __pfx_kunit_try_run_case+0x10/0x10
[   31.603213]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   31.604333]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   31.605246]  kthread+0x257/0x310
[   31.605880]  ? __pfx_kthread+0x10/0x10
[   31.606330]  ret_from_fork+0x41/0x80
[   31.607118]  ? __pfx_kthread+0x10/0x10
[   31.608032]  ret_from_fork_asm+0x1a/0x30
[   31.608333]  </TASK>
[   31.608720] 
[   31.609537] Allocated by task 266:
[   31.610303]  kasan_save_stack+0x3d/0x60
[   31.610805]  kasan_save_track+0x18/0x40
[   31.611202]  kasan_save_alloc_info+0x3b/0x50
[   31.612057]  __kasan_kmalloc+0xb7/0xc0
[   31.612954]  __kmalloc_cache_noprof+0x184/0x410
[   31.613557]  kasan_strings+0xb3/0xb60
[   31.614625]  kunit_try_run_case+0x1b3/0x490
[   31.614956]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   31.615726]  kthread+0x257/0x310
[   31.616509]  ret_from_fork+0x41/0x80
[   31.616878]  ret_from_fork_asm+0x1a/0x30
[   31.617450] 
[   31.617714] Freed by task 266:
[   31.618109]  kasan_save_stack+0x3d/0x60
[   31.618499]  kasan_save_track+0x18/0x40
[   31.618983]  kasan_save_free_info+0x3f/0x60
[   31.619437]  __kasan_slab_free+0x56/0x70
[   31.620146]  kfree+0x123/0x3f0
[   31.620392]  kasan_strings+0x13a/0xb60
[   31.620669]  kunit_try_run_case+0x1b3/0x490
[   31.621333]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   31.622310]  kthread+0x257/0x310
[   31.622883]  ret_from_fork+0x41/0x80
[   31.623275]  ret_from_fork_asm+0x1a/0x30
[   31.623638] 
[   31.623818] The buggy address belongs to the object at ffff8881029f3d40
[   31.623818]  which belongs to the cache kmalloc-32 of size 32
[   31.625298] The buggy address is located 16 bytes inside of
[   31.625298]  freed 32-byte region [ffff8881029f3d40, ffff8881029f3d60)
[   31.626626] 
[   31.626910] The buggy address belongs to the physical page:
[   31.627308] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1029f3
[   31.628314] flags: 0x200000000000000(node=0|zone=2)
[   31.628633] page_type: f5(slab)
[   31.629093] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   31.630196] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   31.630953] page dumped because: kasan: bad access detected
[   31.631573] 
[   31.631752] Memory state around the buggy address:
[   31.632384]  ffff8881029f3c00: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   31.633494]  ffff8881029f3c80: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   31.633947] >ffff8881029f3d00: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   31.635143]                                                  ^
[   31.636240]  ffff8881029f3d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.636886]  ffff8881029f3e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.638011] ==================================================================