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

Environment
qemu-arm64
qemu-x86_64

[   39.731603] ==================================================================
[   39.732366] BUG: KASAN: slab-use-after-free in strrchr+0x6c/0x78
[   39.733187] Read of size 1 at addr fff00000c65a90d0 by task kunit_try_catch/248
[   39.734816] 
[   39.735139] CPU: 0 UID: 0 PID: 248 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241120 #1
[   39.736352] Tainted: [B]=BAD_PAGE, [N]=TEST
[   39.736885] Hardware name: linux,dummy-virt (DT)
[   39.737166] Call trace:
[   39.738191]  show_stack+0x20/0x38 (C)
[   39.738991]  dump_stack_lvl+0x8c/0xd0
[   39.739687]  print_report+0x118/0x5e0
[   39.740395]  kasan_report+0xc8/0x118
[   39.741130]  __asan_report_load1_noabort+0x20/0x30
[   39.742136]  strrchr+0x6c/0x78
[   39.742561]  kasan_strings+0x1e0/0x8f8
[   39.743100]  kunit_try_run_case+0x14c/0x3d0
[   39.744359]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   39.745070]  kthread+0x24c/0x2d0
[   39.745610]  ret_from_fork+0x10/0x20
[   39.746662] 
[   39.746974] Allocated by task 248:
[   39.747433]  kasan_save_stack+0x3c/0x68
[   39.747948]  kasan_save_track+0x20/0x40
[   39.748502]  kasan_save_alloc_info+0x40/0x58
[   39.749023]  __kasan_kmalloc+0xd4/0xd8
[   39.749675]  __kmalloc_cache_noprof+0x15c/0x3c8
[   39.751163]  kasan_strings+0xb4/0x8f8
[   39.751861]  kunit_try_run_case+0x14c/0x3d0
[   39.752591]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   39.753555]  kthread+0x24c/0x2d0
[   39.754182]  ret_from_fork+0x10/0x20
[   39.754689] 
[   39.755068] Freed by task 248:
[   39.755535]  kasan_save_stack+0x3c/0x68
[   39.756180]  kasan_save_track+0x20/0x40
[   39.756745]  kasan_save_free_info+0x4c/0x78
[   39.757518]  __kasan_slab_free+0x6c/0x98
[   39.758342]  kfree+0x114/0x3d0
[   39.758877]  kasan_strings+0x128/0x8f8
[   39.759473]  kunit_try_run_case+0x14c/0x3d0
[   39.760142]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   39.760864]  kthread+0x24c/0x2d0
[   39.761643]  ret_from_fork+0x10/0x20
[   39.762396] 
[   39.762904] The buggy address belongs to the object at fff00000c65a90c0
[   39.762904]  which belongs to the cache kmalloc-32 of size 32
[   39.764318] The buggy address is located 16 bytes inside of
[   39.764318]  freed 32-byte region [fff00000c65a90c0, fff00000c65a90e0)
[   39.766151] 
[   39.766505] The buggy address belongs to the physical page:
[   39.767111] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1065a9
[   39.768290] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   39.769156] page_type: f5(slab)
[   39.769681] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   39.770259] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   39.771014] page dumped because: kasan: bad access detected
[   39.771721] 
[   39.772068] Memory state around the buggy address:
[   39.772771]  fff00000c65a8f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   39.773851]  fff00000c65a9000: fa fb fb fb fc fc fc fc 00 00 07 fc fc fc fc fc
[   39.774946] >fff00000c65a9080: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   39.775840]                                                  ^
[   39.776625]  fff00000c65a9100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   39.777817]  fff00000c65a9180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   39.778761] ==================================================================

[   31.354685] ==================================================================
[   31.356255] BUG: KASAN: slab-use-after-free in strrchr+0x64/0x70
[   31.357540] Read of size 1 at addr ffff8881029f3d50 by task kunit_try_catch/266
[   31.358907] 
[   31.359394] CPU: 1 UID: 0 PID: 266 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241120 #1
[   31.361590] Tainted: [B]=BAD_PAGE, [N]=TEST
[   31.361865] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   31.362212] Call Trace:
[   31.362433]  <TASK>
[   31.363732]  dump_stack_lvl+0x73/0xb0
[   31.364172]  print_report+0xd1/0x640
[   31.365126]  ? __virt_addr_valid+0x1db/0x2d0
[   31.365829]  ? kasan_complete_mode_report_info+0x64/0x200
[   31.366670]  kasan_report+0x102/0x140
[   31.367161]  ? strrchr+0x64/0x70
[   31.367967]  ? strrchr+0x64/0x70
[   31.368518]  __asan_report_load1_noabort+0x18/0x20
[   31.369093]  strrchr+0x64/0x70
[   31.370130]  kasan_strings+0x24c/0xb60
[   31.370929]  ? __pfx_kasan_strings+0x10/0x10
[   31.371461]  ? __schedule+0xc3e/0x2790
[   31.372437]  ? __pfx_read_tsc+0x10/0x10
[   31.373269]  ? ktime_get_ts64+0x84/0x230
[   31.373640]  kunit_try_run_case+0x1b3/0x490
[   31.374772]  ? __pfx_kunit_try_run_case+0x10/0x10
[   31.375237]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   31.375948]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   31.376814]  ? __kthread_parkme+0x82/0x160
[   31.377251]  ? preempt_count_sub+0x50/0x80
[   31.378197]  ? __pfx_kunit_try_run_case+0x10/0x10
[   31.378619]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   31.379800]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   31.380507]  kthread+0x257/0x310
[   31.381127]  ? __pfx_kthread+0x10/0x10
[   31.381874]  ret_from_fork+0x41/0x80
[   31.382911]  ? __pfx_kthread+0x10/0x10
[   31.383571]  ret_from_fork_asm+0x1a/0x30
[   31.384425]  </TASK>
[   31.384602] 
[   31.384887] Allocated by task 266:
[   31.385765]  kasan_save_stack+0x3d/0x60
[   31.386746]  kasan_save_track+0x18/0x40
[   31.387132]  kasan_save_alloc_info+0x3b/0x50
[   31.387965]  __kasan_kmalloc+0xb7/0xc0
[   31.388470]  __kmalloc_cache_noprof+0x184/0x410
[   31.388921]  kasan_strings+0xb3/0xb60
[   31.389564]  kunit_try_run_case+0x1b3/0x490
[   31.390033]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   31.390892]  kthread+0x257/0x310
[   31.391347]  ret_from_fork+0x41/0x80
[   31.391884]  ret_from_fork_asm+0x1a/0x30
[   31.392741] 
[   31.393051] Freed by task 266:
[   31.393769]  kasan_save_stack+0x3d/0x60
[   31.394031]  kasan_save_track+0x18/0x40
[   31.394306]  kasan_save_free_info+0x3f/0x60
[   31.394582]  __kasan_slab_free+0x56/0x70
[   31.395232]  kfree+0x123/0x3f0
[   31.395825]  kasan_strings+0x13a/0xb60
[   31.396922]  kunit_try_run_case+0x1b3/0x490
[   31.397775]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   31.398810]  kthread+0x257/0x310
[   31.399357]  ret_from_fork+0x41/0x80
[   31.400145]  ret_from_fork_asm+0x1a/0x30
[   31.401159] 
[   31.401502] The buggy address belongs to the object at ffff8881029f3d40
[   31.401502]  which belongs to the cache kmalloc-32 of size 32
[   31.403233] The buggy address is located 16 bytes inside of
[   31.403233]  freed 32-byte region [ffff8881029f3d40, ffff8881029f3d60)
[   31.404282] 
[   31.404742] The buggy address belongs to the physical page:
[   31.405363] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1029f3
[   31.406453] flags: 0x200000000000000(node=0|zone=2)
[   31.407191] page_type: f5(slab)
[   31.407819] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   31.408672] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   31.409599] page dumped because: kasan: bad access detected
[   31.410605] 
[   31.410853] Memory state around the buggy address:
[   31.411612]  ffff8881029f3c00: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   31.412534]  ffff8881029f3c80: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   31.413312] >ffff8881029f3d00: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   31.414097]                                                  ^
[   31.414851]  ffff8881029f3d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.417089]  ffff8881029f3e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.417443] ==================================================================