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

Environment
qemu-arm64
qemu-x86_64

[   39.684719] ==================================================================
[   39.686405] BUG: KASAN: slab-use-after-free in strchr+0xcc/0xd8
[   39.687249] Read of size 1 at addr fff00000c65a90d0 by task kunit_try_catch/248
[   39.688288] 
[   39.688716] CPU: 0 UID: 0 PID: 248 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241120 #1
[   39.690045] Tainted: [B]=BAD_PAGE, [N]=TEST
[   39.690552] Hardware name: linux,dummy-virt (DT)
[   39.691173] Call trace:
[   39.691543]  show_stack+0x20/0x38 (C)
[   39.692161]  dump_stack_lvl+0x8c/0xd0
[   39.692740]  print_report+0x118/0x5e0
[   39.693264]  kasan_report+0xc8/0x118
[   39.693796]  __asan_report_load1_noabort+0x20/0x30
[   39.694500]  strchr+0xcc/0xd8
[   39.695038]  kasan_strings+0x180/0x8f8
[   39.695954]  kunit_try_run_case+0x14c/0x3d0
[   39.696581]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   39.697202]  kthread+0x24c/0x2d0
[   39.698023]  ret_from_fork+0x10/0x20
[   39.698605] 
[   39.698961] Allocated by task 248:
[   39.699456]  kasan_save_stack+0x3c/0x68
[   39.700048]  kasan_save_track+0x20/0x40
[   39.700565]  kasan_save_alloc_info+0x40/0x58
[   39.701186]  __kasan_kmalloc+0xd4/0xd8
[   39.702000]  __kmalloc_cache_noprof+0x15c/0x3c8
[   39.702664]  kasan_strings+0xb4/0x8f8
[   39.703178]  kunit_try_run_case+0x14c/0x3d0
[   39.703788]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   39.704401]  kthread+0x24c/0x2d0
[   39.704987]  ret_from_fork+0x10/0x20
[   39.705998] 
[   39.706311] Freed by task 248:
[   39.706760]  kasan_save_stack+0x3c/0x68
[   39.707295]  kasan_save_track+0x20/0x40
[   39.707899]  kasan_save_free_info+0x4c/0x78
[   39.708547]  __kasan_slab_free+0x6c/0x98
[   39.709075]  kfree+0x114/0x3d0
[   39.710038]  kasan_strings+0x128/0x8f8
[   39.710655]  kunit_try_run_case+0x14c/0x3d0
[   39.711224]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   39.711803]  kthread+0x24c/0x2d0
[   39.712282]  ret_from_fork+0x10/0x20
[   39.712835] 
[   39.713134] The buggy address belongs to the object at fff00000c65a90c0
[   39.713134]  which belongs to the cache kmalloc-32 of size 32
[   39.714307] The buggy address is located 16 bytes inside of
[   39.714307]  freed 32-byte region [fff00000c65a90c0, fff00000c65a90e0)
[   39.715993] 
[   39.716317] The buggy address belongs to the physical page:
[   39.717022] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1065a9
[   39.718488] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   39.719194] page_type: f5(slab)
[   39.719741] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   39.720641] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   39.721387] page dumped because: kasan: bad access detected
[   39.722276] 
[   39.722633] Memory state around the buggy address:
[   39.723210]  fff00000c65a8f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   39.724045]  fff00000c65a9000: 00 00 00 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   39.724961] >fff00000c65a9080: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   39.726373]                                                  ^
[   39.727299]  fff00000c65a9100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   39.728320]  fff00000c65a9180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   39.729019] ==================================================================

[   31.295328] ==================================================================
[   31.296966] BUG: KASAN: slab-use-after-free in strchr+0x9c/0xc0
[   31.298021] Read of size 1 at addr ffff8881029f3d50 by task kunit_try_catch/266
[   31.298553] 
[   31.299274] CPU: 1 UID: 0 PID: 266 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241120 #1
[   31.300783] Tainted: [B]=BAD_PAGE, [N]=TEST
[   31.301062] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   31.302749] Call Trace:
[   31.303567]  <TASK>
[   31.304051]  dump_stack_lvl+0x73/0xb0
[   31.304737]  print_report+0xd1/0x640
[   31.305326]  ? __virt_addr_valid+0x1db/0x2d0
[   31.305540]  ? kasan_complete_mode_report_info+0x64/0x200
[   31.306737]  kasan_report+0x102/0x140
[   31.307390]  ? strchr+0x9c/0xc0
[   31.308059]  ? strchr+0x9c/0xc0
[   31.308443]  __asan_report_load1_noabort+0x18/0x20
[   31.310123]  strchr+0x9c/0xc0
[   31.310507]  kasan_strings+0x1b1/0xb60
[   31.310980]  ? __pfx_kasan_strings+0x10/0x10
[   31.311798]  ? __schedule+0xc3e/0x2790
[   31.312210]  ? __pfx_read_tsc+0x10/0x10
[   31.313431]  ? ktime_get_ts64+0x84/0x230
[   31.313833]  kunit_try_run_case+0x1b3/0x490
[   31.314934]  ? __pfx_kunit_try_run_case+0x10/0x10
[   31.315622]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   31.316404]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   31.317159]  ? __kthread_parkme+0x82/0x160
[   31.317870]  ? preempt_count_sub+0x50/0x80
[   31.318353]  ? __pfx_kunit_try_run_case+0x10/0x10
[   31.319370]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   31.320003]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   31.320575]  kthread+0x257/0x310
[   31.321121]  ? __pfx_kthread+0x10/0x10
[   31.321903]  ret_from_fork+0x41/0x80
[   31.322336]  ? __pfx_kthread+0x10/0x10
[   31.322891]  ret_from_fork_asm+0x1a/0x30
[   31.323410]  </TASK>
[   31.323862] 
[   31.324055] Allocated by task 266:
[   31.324809]  kasan_save_stack+0x3d/0x60
[   31.325187]  kasan_save_track+0x18/0x40
[   31.325544]  kasan_save_alloc_info+0x3b/0x50
[   31.326396]  __kasan_kmalloc+0xb7/0xc0
[   31.326908]  __kmalloc_cache_noprof+0x184/0x410
[   31.327584]  kasan_strings+0xb3/0xb60
[   31.327921]  kunit_try_run_case+0x1b3/0x490
[   31.328223]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   31.328977]  kthread+0x257/0x310
[   31.329553]  ret_from_fork+0x41/0x80
[   31.330294]  ret_from_fork_asm+0x1a/0x30
[   31.330877] 
[   31.331106] Freed by task 266:
[   31.331638]  kasan_save_stack+0x3d/0x60
[   31.332183]  kasan_save_track+0x18/0x40
[   31.332716]  kasan_save_free_info+0x3f/0x60
[   31.333022]  __kasan_slab_free+0x56/0x70
[   31.333847]  kfree+0x123/0x3f0
[   31.334287]  kasan_strings+0x13a/0xb60
[   31.335073]  kunit_try_run_case+0x1b3/0x490
[   31.335610]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   31.336038]  kthread+0x257/0x310
[   31.336291]  ret_from_fork+0x41/0x80
[   31.336562]  ret_from_fork_asm+0x1a/0x30
[   31.337236] 
[   31.337491] The buggy address belongs to the object at ffff8881029f3d40
[   31.337491]  which belongs to the cache kmalloc-32 of size 32
[   31.338767] The buggy address is located 16 bytes inside of
[   31.338767]  freed 32-byte region [ffff8881029f3d40, ffff8881029f3d60)
[   31.340396] 
[   31.340834] The buggy address belongs to the physical page:
[   31.341203] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1029f3
[   31.342548] flags: 0x200000000000000(node=0|zone=2)
[   31.343187] page_type: f5(slab)
[   31.343807] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   31.344908] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   31.345389] page dumped because: kasan: bad access detected
[   31.346195] 
[   31.346459] Memory state around the buggy address:
[   31.347322]  ffff8881029f3c00: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   31.347916]  ffff8881029f3c80: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   31.349142] >ffff8881029f3d00: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   31.349958]                                                  ^
[   31.351128]  ffff8881029f3d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.351588]  ffff8881029f3e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.352586] ==================================================================