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

Environment
qemu-arm64
qemu-x86_64

[   33.563934] ==================================================================
[   33.564637] BUG: KASAN: slab-use-after-free in strrchr+0x6c/0x78
[   33.565694] Read of size 1 at addr fff00000c4081c10 by task kunit_try_catch/247
[   33.566698] 
[   33.567372] CPU: 1 UID: 0 PID: 247 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241128 #1
[   33.568764] Tainted: [B]=BAD_PAGE, [N]=TEST
[   33.569591] Hardware name: linux,dummy-virt (DT)
[   33.570306] Call trace:
[   33.570735]  show_stack+0x20/0x38 (C)
[   33.571271]  dump_stack_lvl+0x8c/0xd0
[   33.571910]  print_report+0x118/0x5e0
[   33.572506]  kasan_report+0xc8/0x118
[   33.573359]  __asan_report_load1_noabort+0x20/0x30
[   33.574029]  strrchr+0x6c/0x78
[   33.574613]  kasan_strings+0x1e0/0x8f8
[   33.575234]  kunit_try_run_case+0x14c/0x3d0
[   33.575919]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.576679]  kthread+0x24c/0x2d0
[   33.577410]  ret_from_fork+0x10/0x20
[   33.577971] 
[   33.578340] Allocated by task 247:
[   33.578870]  kasan_save_stack+0x3c/0x68
[   33.579469]  kasan_save_track+0x20/0x40
[   33.580046]  kasan_save_alloc_info+0x40/0x58
[   33.580749]  __kasan_kmalloc+0xd4/0xd8
[   33.582128]  __kmalloc_cache_noprof+0x15c/0x3c0
[   33.582749]  kasan_strings+0xb4/0x8f8
[   33.583353]  kunit_try_run_case+0x14c/0x3d0
[   33.583916]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.584694]  kthread+0x24c/0x2d0
[   33.585543]  ret_from_fork+0x10/0x20
[   33.586104] 
[   33.586463] Freed by task 247:
[   33.586909]  kasan_save_stack+0x3c/0x68
[   33.587448]  kasan_save_track+0x20/0x40
[   33.587951]  kasan_save_free_info+0x4c/0x78
[   33.588638]  __kasan_slab_free+0x6c/0x98
[   33.589267]  kfree+0x114/0x3c8
[   33.590151]  kasan_strings+0x128/0x8f8
[   33.590737]  kunit_try_run_case+0x14c/0x3d0
[   33.591367]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.592149]  kthread+0x24c/0x2d0
[   33.592646]  ret_from_fork+0x10/0x20
[   33.593530] 
[   33.593914] The buggy address belongs to the object at fff00000c4081c00
[   33.593914]  which belongs to the cache kmalloc-32 of size 32
[   33.595130] The buggy address is located 16 bytes inside of
[   33.595130]  freed 32-byte region [fff00000c4081c00, fff00000c4081c20)
[   33.596293] 
[   33.596640] The buggy address belongs to the physical page:
[   33.597696] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x104081
[   33.598556] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   33.599426] page_type: f5(slab)
[   33.599954] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   33.600831] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   33.602438] page dumped because: kasan: bad access detected
[   33.603151] 
[   33.603533] Memory state around the buggy address:
[   33.604210]  fff00000c4081b00: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   33.605015]  fff00000c4081b80: 00 00 00 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   33.605873] >fff00000c4081c00: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   33.606858]                          ^
[   33.607319]  fff00000c4081c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   33.607997]  fff00000c4081d00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   33.608846] ==================================================================

[   24.505992] ==================================================================
[   24.506734] BUG: KASAN: slab-use-after-free in strrchr+0x64/0x70
[   24.507704] Read of size 1 at addr ffff888102a34190 by task kunit_try_catch/267
[   24.508328] 
[   24.508622] CPU: 0 UID: 0 PID: 267 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241128 #1
[   24.509805] Tainted: [B]=BAD_PAGE, [N]=TEST
[   24.510404] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   24.511312] Call Trace:
[   24.511582]  <TASK>
[   24.511776]  dump_stack_lvl+0x73/0xb0
[   24.512067]  print_report+0xd1/0x640
[   24.512493]  ? __virt_addr_valid+0x1db/0x2d0
[   24.513041]  ? kasan_complete_mode_report_info+0x64/0x200
[   24.513869]  kasan_report+0x102/0x140
[   24.515015]  ? strrchr+0x64/0x70
[   24.515415]  ? strrchr+0x64/0x70
[   24.515874]  __asan_report_load1_noabort+0x18/0x20
[   24.516388]  strrchr+0x64/0x70
[   24.516733]  kasan_strings+0x24c/0xb60
[   24.517111]  ? __pfx_kasan_strings+0x10/0x10
[   24.517639]  ? __schedule+0xc3e/0x2790
[   24.518020]  ? __pfx_read_tsc+0x10/0x10
[   24.518468]  ? ktime_get_ts64+0x84/0x230
[   24.518952]  kunit_try_run_case+0x1b3/0x490
[   24.519453]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.519863]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   24.520378]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   24.520841]  ? __kthread_parkme+0x82/0x160
[   24.521392]  ? preempt_count_sub+0x50/0x80
[   24.521837]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.522275]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   24.522908]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.523331]  kthread+0x257/0x310
[   24.523785]  ? __pfx_kthread+0x10/0x10
[   24.524364]  ret_from_fork+0x41/0x80
[   24.524840]  ? __pfx_kthread+0x10/0x10
[   24.525257]  ret_from_fork_asm+0x1a/0x30
[   24.525618]  </TASK>
[   24.525937] 
[   24.526188] Allocated by task 267:
[   24.526617]  kasan_save_stack+0x3d/0x60
[   24.527097]  kasan_save_track+0x18/0x40
[   24.527530]  kasan_save_alloc_info+0x3b/0x50
[   24.527837]  __kasan_kmalloc+0xb7/0xc0
[   24.528399]  __kmalloc_cache_noprof+0x184/0x410
[   24.528931]  kasan_strings+0xb3/0xb60
[   24.529448]  kunit_try_run_case+0x1b3/0x490
[   24.529866]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.530378]  kthread+0x257/0x310
[   24.530643]  ret_from_fork+0x41/0x80
[   24.531128]  ret_from_fork_asm+0x1a/0x30
[   24.531627] 
[   24.531843] Freed by task 267:
[   24.532133]  kasan_save_stack+0x3d/0x60
[   24.532424]  kasan_save_track+0x18/0x40
[   24.532854]  kasan_save_free_info+0x3f/0x60
[   24.533457]  __kasan_slab_free+0x56/0x70
[   24.533960]  kfree+0x123/0x3f0
[   24.534363]  kasan_strings+0x13a/0xb60
[   24.534636]  kunit_try_run_case+0x1b3/0x490
[   24.534934]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.535573]  kthread+0x257/0x310
[   24.535967]  ret_from_fork+0x41/0x80
[   24.536468]  ret_from_fork_asm+0x1a/0x30
[   24.536796] 
[   24.537045] The buggy address belongs to the object at ffff888102a34180
[   24.537045]  which belongs to the cache kmalloc-32 of size 32
[   24.538037] The buggy address is located 16 bytes inside of
[   24.538037]  freed 32-byte region [ffff888102a34180, ffff888102a341a0)
[   24.538792] 
[   24.538953] The buggy address belongs to the physical page:
[   24.539555] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a34
[   24.540357] flags: 0x200000000000000(node=0|zone=2)
[   24.540678] page_type: f5(slab)
[   24.540930] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   24.541561] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   24.542437] page dumped because: kasan: bad access detected
[   24.543037] 
[   24.543299] Memory state around the buggy address:
[   24.543855]  ffff888102a34080: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   24.544657]  ffff888102a34100: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   24.545269] >ffff888102a34180: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   24.545888]                          ^
[   24.546202]  ffff888102a34200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.546625]  ffff888102a34280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.547413] ==================================================================