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

Environment
qemu-arm64
qemu-x86_64

[   39.872415] ==================================================================
[   39.873201] BUG: KASAN: slab-use-after-free in strlen+0xa8/0xb0
[   39.873935] Read of size 1 at addr fff00000c65a90d0 by task kunit_try_catch/248
[   39.874626] 
[   39.874959] CPU: 0 UID: 0 PID: 248 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241120 #1
[   39.876020] Tainted: [B]=BAD_PAGE, [N]=TEST
[   39.876493] Hardware name: linux,dummy-virt (DT)
[   39.877106] Call trace:
[   39.877491]  show_stack+0x20/0x38 (C)
[   39.878087]  dump_stack_lvl+0x8c/0xd0
[   39.878678]  print_report+0x118/0x5e0
[   39.879295]  kasan_report+0xc8/0x118
[   39.879826]  __asan_report_load1_noabort+0x20/0x30
[   39.880505]  strlen+0xa8/0xb0
[   39.881029]  kasan_strings+0x320/0x8f8
[   39.881808]  kunit_try_run_case+0x14c/0x3d0
[   39.882463]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   39.883201]  kthread+0x24c/0x2d0
[   39.883781]  ret_from_fork+0x10/0x20
[   39.884380] 
[   39.884708] Allocated by task 248:
[   39.885146]  kasan_save_stack+0x3c/0x68
[   39.885757]  kasan_save_track+0x20/0x40
[   39.886253]  kasan_save_alloc_info+0x40/0x58
[   39.886848]  __kasan_kmalloc+0xd4/0xd8
[   39.887413]  __kmalloc_cache_noprof+0x15c/0x3c8
[   39.888323]  kasan_strings+0xb4/0x8f8
[   39.888900]  kunit_try_run_case+0x14c/0x3d0
[   39.889792]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   39.890525]  kthread+0x24c/0x2d0
[   39.891019]  ret_from_fork+0x10/0x20
[   39.891462] 
[   39.891803] Freed by task 248:
[   39.892289]  kasan_save_stack+0x3c/0x68
[   39.892829]  kasan_save_track+0x20/0x40
[   39.894280]  kasan_save_free_info+0x4c/0x78
[   39.895383]  __kasan_slab_free+0x6c/0x98
[   39.895976]  kfree+0x114/0x3d0
[   39.896516]  kasan_strings+0x128/0x8f8
[   39.897047]  kunit_try_run_case+0x14c/0x3d0
[   39.897620]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   39.898330]  kthread+0x24c/0x2d0
[   39.899063]  ret_from_fork+0x10/0x20
[   39.899658] 
[   39.899974] The buggy address belongs to the object at fff00000c65a90c0
[   39.899974]  which belongs to the cache kmalloc-32 of size 32
[   39.901213] The buggy address is located 16 bytes inside of
[   39.901213]  freed 32-byte region [fff00000c65a90c0, fff00000c65a90e0)
[   39.902746] 
[   39.903127] The buggy address belongs to the physical page:
[   39.903715] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1065a9
[   39.904688] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   39.905505] page_type: f5(slab)
[   39.905912] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   39.906934] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   39.907717] page dumped because: kasan: bad access detected
[   39.908327] 
[   39.908717] Memory state around the buggy address:
[   39.909390]  fff00000c65a8f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   39.910489]  fff00000c65a9000: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   39.911479] >fff00000c65a9080: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   39.912356]                                                  ^
[   39.913136]  fff00000c65a9100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   39.914630]  fff00000c65a9180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   39.915741] ==================================================================

[   31.535026] ==================================================================
[   31.535907] BUG: KASAN: slab-use-after-free in strlen+0x8f/0xb0
[   31.536277] Read of size 1 at addr ffff8881029f3d50 by task kunit_try_catch/266
[   31.537084] 
[   31.537256] CPU: 1 UID: 0 PID: 266 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241120 #1
[   31.539426] Tainted: [B]=BAD_PAGE, [N]=TEST
[   31.539960] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   31.541405] Call Trace:
[   31.541883]  <TASK>
[   31.542366]  dump_stack_lvl+0x73/0xb0
[   31.542872]  print_report+0xd1/0x640
[   31.543319]  ? __virt_addr_valid+0x1db/0x2d0
[   31.543880]  ? kasan_complete_mode_report_info+0x64/0x200
[   31.544511]  kasan_report+0x102/0x140
[   31.544919]  ? strlen+0x8f/0xb0
[   31.545343]  ? strlen+0x8f/0xb0
[   31.545860]  __asan_report_load1_noabort+0x18/0x20
[   31.546560]  strlen+0x8f/0xb0
[   31.546900]  kasan_strings+0x432/0xb60
[   31.547582]  ? __pfx_kasan_strings+0x10/0x10
[   31.548022]  ? __schedule+0xc3e/0x2790
[   31.548618]  ? __pfx_read_tsc+0x10/0x10
[   31.549286]  ? ktime_get_ts64+0x84/0x230
[   31.549825]  kunit_try_run_case+0x1b3/0x490
[   31.550316]  ? __pfx_kunit_try_run_case+0x10/0x10
[   31.550870]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   31.551440]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   31.551997]  ? __kthread_parkme+0x82/0x160
[   31.552362]  ? preempt_count_sub+0x50/0x80
[   31.552814]  ? __pfx_kunit_try_run_case+0x10/0x10
[   31.553353]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   31.554368]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   31.555044]  kthread+0x257/0x310
[   31.555444]  ? __pfx_kthread+0x10/0x10
[   31.555969]  ret_from_fork+0x41/0x80
[   31.556506]  ? __pfx_kthread+0x10/0x10
[   31.556962]  ret_from_fork_asm+0x1a/0x30
[   31.557586]  </TASK>
[   31.557905] 
[   31.558523] Allocated by task 266:
[   31.558961]  kasan_save_stack+0x3d/0x60
[   31.559505]  kasan_save_track+0x18/0x40
[   31.560056]  kasan_save_alloc_info+0x3b/0x50
[   31.560513]  __kasan_kmalloc+0xb7/0xc0
[   31.561005]  __kmalloc_cache_noprof+0x184/0x410
[   31.561707]  kasan_strings+0xb3/0xb60
[   31.562316]  kunit_try_run_case+0x1b3/0x490
[   31.562652]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   31.563544]  kthread+0x257/0x310
[   31.563969]  ret_from_fork+0x41/0x80
[   31.564265]  ret_from_fork_asm+0x1a/0x30
[   31.564773] 
[   31.565023] Freed by task 266:
[   31.565275]  kasan_save_stack+0x3d/0x60
[   31.565690]  kasan_save_track+0x18/0x40
[   31.566287]  kasan_save_free_info+0x3f/0x60
[   31.566634]  __kasan_slab_free+0x56/0x70
[   31.567225]  kfree+0x123/0x3f0
[   31.567659]  kasan_strings+0x13a/0xb60
[   31.568568]  kunit_try_run_case+0x1b3/0x490
[   31.569556]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   31.570028]  kthread+0x257/0x310
[   31.570732]  ret_from_fork+0x41/0x80
[   31.571220]  ret_from_fork_asm+0x1a/0x30
[   31.571606] 
[   31.571894] The buggy address belongs to the object at ffff8881029f3d40
[   31.571894]  which belongs to the cache kmalloc-32 of size 32
[   31.573066] The buggy address is located 16 bytes inside of
[   31.573066]  freed 32-byte region [ffff8881029f3d40, ffff8881029f3d60)
[   31.574306] 
[   31.574502] The buggy address belongs to the physical page:
[   31.575011] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1029f3
[   31.575991] flags: 0x200000000000000(node=0|zone=2)
[   31.576589] page_type: f5(slab)
[   31.576926] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   31.577764] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   31.578389] page dumped because: kasan: bad access detected
[   31.578976] 
[   31.579320] Memory state around the buggy address:
[   31.579791]  ffff8881029f3c00: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   31.580911]  ffff8881029f3c80: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   31.581720] >ffff8881029f3d00: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   31.582505]                                                  ^
[   31.583222]  ffff8881029f3d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.583852]  ffff8881029f3e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.584546] ==================================================================