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

Environment
qemu-arm64
qemu-x86_64

[   39.780969] ==================================================================
[   39.781874] BUG: KASAN: slab-use-after-free in strcmp+0xc0/0xc8
[   39.782925] Read of size 1 at addr fff00000c65a90d0 by task kunit_try_catch/248
[   39.784557] 
[   39.784935] CPU: 0 UID: 0 PID: 248 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241120 #1
[   39.786137] Tainted: [B]=BAD_PAGE, [N]=TEST
[   39.786690] Hardware name: linux,dummy-virt (DT)
[   39.787340] Call trace:
[   39.787935]  show_stack+0x20/0x38 (C)
[   39.788467]  dump_stack_lvl+0x8c/0xd0
[   39.789121]  print_report+0x118/0x5e0
[   39.790078]  kasan_report+0xc8/0x118
[   39.790684]  __asan_report_load1_noabort+0x20/0x30
[   39.791398]  strcmp+0xc0/0xc8
[   39.791891]  kasan_strings+0x248/0x8f8
[   39.792537]  kunit_try_run_case+0x14c/0x3d0
[   39.793169]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   39.794204]  kthread+0x24c/0x2d0
[   39.794789]  ret_from_fork+0x10/0x20
[   39.795313] 
[   39.795713] Allocated by task 248:
[   39.796290]  kasan_save_stack+0x3c/0x68
[   39.796889]  kasan_save_track+0x20/0x40
[   39.797867]  kasan_save_alloc_info+0x40/0x58
[   39.798435]  __kasan_kmalloc+0xd4/0xd8
[   39.799066]  __kmalloc_cache_noprof+0x15c/0x3c8
[   39.799677]  kasan_strings+0xb4/0x8f8
[   39.800286]  kunit_try_run_case+0x14c/0x3d0
[   39.800898]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   39.801899]  kthread+0x24c/0x2d0
[   39.802277]  ret_from_fork+0x10/0x20
[   39.802689] 
[   39.803068] Freed by task 248:
[   39.803924]  kasan_save_stack+0x3c/0x68
[   39.804499]  kasan_save_track+0x20/0x40
[   39.805895]  kasan_save_free_info+0x4c/0x78
[   39.806533]  __kasan_slab_free+0x6c/0x98
[   39.807106]  kfree+0x114/0x3d0
[   39.807641]  kasan_strings+0x128/0x8f8
[   39.808221]  kunit_try_run_case+0x14c/0x3d0
[   39.808904]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   39.809882]  kthread+0x24c/0x2d0
[   39.810230]  ret_from_fork+0x10/0x20
[   39.810851] 
[   39.811245] The buggy address belongs to the object at fff00000c65a90c0
[   39.811245]  which belongs to the cache kmalloc-32 of size 32
[   39.812489] The buggy address is located 16 bytes inside of
[   39.812489]  freed 32-byte region [fff00000c65a90c0, fff00000c65a90e0)
[   39.813828] 
[   39.814167] The buggy address belongs to the physical page:
[   39.814852] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1065a9
[   39.815863] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   39.816538] page_type: f5(slab)
[   39.817070] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   39.818299] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   39.819102] page dumped because: kasan: bad access detected
[   39.819921] 
[   39.820286] Memory state around the buggy address:
[   39.820875]  fff00000c65a8f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   39.822194]  fff00000c65a9000: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   39.823368] >fff00000c65a9080: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   39.823784]                                                  ^
[   39.824088]  fff00000c65a9100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   39.824464]  fff00000c65a9180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   39.825165] ==================================================================

[   31.419893] ==================================================================
[   31.422675] BUG: KASAN: slab-use-after-free in strcmp+0xb0/0xc0
[   31.423849] Read of size 1 at addr ffff8881029f3d50 by task kunit_try_catch/266
[   31.424220] 
[   31.424380] CPU: 1 UID: 0 PID: 266 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241120 #1
[   31.425746] Tainted: [B]=BAD_PAGE, [N]=TEST
[   31.427345] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   31.427945] Call Trace:
[   31.428383]  <TASK>
[   31.429484]  dump_stack_lvl+0x73/0xb0
[   31.431223]  print_report+0xd1/0x640
[   31.432040]  ? __virt_addr_valid+0x1db/0x2d0
[   31.432559]  ? kasan_complete_mode_report_info+0x64/0x200
[   31.433420]  kasan_report+0x102/0x140
[   31.434308]  ? strcmp+0xb0/0xc0
[   31.434908]  ? strcmp+0xb0/0xc0
[   31.435786]  __asan_report_load1_noabort+0x18/0x20
[   31.436357]  strcmp+0xb0/0xc0
[   31.436961]  kasan_strings+0x2e9/0xb60
[   31.437465]  ? __pfx_kasan_strings+0x10/0x10
[   31.438063]  ? __schedule+0xc3e/0x2790
[   31.438519]  ? __pfx_read_tsc+0x10/0x10
[   31.439062]  ? ktime_get_ts64+0x84/0x230
[   31.439472]  kunit_try_run_case+0x1b3/0x490
[   31.440418]  ? __pfx_kunit_try_run_case+0x10/0x10
[   31.440904]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   31.441395]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   31.442528]  ? __kthread_parkme+0x82/0x160
[   31.443066]  ? preempt_count_sub+0x50/0x80
[   31.444087]  ? __pfx_kunit_try_run_case+0x10/0x10
[   31.444966]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   31.446099]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   31.446781]  kthread+0x257/0x310
[   31.447292]  ? __pfx_kthread+0x10/0x10
[   31.447978]  ret_from_fork+0x41/0x80
[   31.448455]  ? __pfx_kthread+0x10/0x10
[   31.448977]  ret_from_fork_asm+0x1a/0x30
[   31.449557]  </TASK>
[   31.449899] 
[   31.450080] Allocated by task 266:
[   31.450497]  kasan_save_stack+0x3d/0x60
[   31.450898]  kasan_save_track+0x18/0x40
[   31.451280]  kasan_save_alloc_info+0x3b/0x50
[   31.452172]  __kasan_kmalloc+0xb7/0xc0
[   31.452521]  __kmalloc_cache_noprof+0x184/0x410
[   31.453055]  kasan_strings+0xb3/0xb60
[   31.453516]  kunit_try_run_case+0x1b3/0x490
[   31.454017]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   31.454797]  kthread+0x257/0x310
[   31.455356]  ret_from_fork+0x41/0x80
[   31.455678]  ret_from_fork_asm+0x1a/0x30
[   31.456532] 
[   31.456788] Freed by task 266:
[   31.457341]  kasan_save_stack+0x3d/0x60
[   31.457745]  kasan_save_track+0x18/0x40
[   31.458328]  kasan_save_free_info+0x3f/0x60
[   31.458760]  __kasan_slab_free+0x56/0x70
[   31.459405]  kfree+0x123/0x3f0
[   31.459723]  kasan_strings+0x13a/0xb60
[   31.460401]  kunit_try_run_case+0x1b3/0x490
[   31.461037]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   31.461893]  kthread+0x257/0x310
[   31.462381]  ret_from_fork+0x41/0x80
[   31.462893]  ret_from_fork_asm+0x1a/0x30
[   31.463415] 
[   31.463771] The buggy address belongs to the object at ffff8881029f3d40
[   31.463771]  which belongs to the cache kmalloc-32 of size 32
[   31.464916] The buggy address is located 16 bytes inside of
[   31.464916]  freed 32-byte region [ffff8881029f3d40, ffff8881029f3d60)
[   31.466297] 
[   31.466532] The buggy address belongs to the physical page:
[   31.467026] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1029f3
[   31.468207] flags: 0x200000000000000(node=0|zone=2)
[   31.469103] page_type: f5(slab)
[   31.469502] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   31.470206] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   31.471187] page dumped because: kasan: bad access detected
[   31.472295] 
[   31.472719] Memory state around the buggy address:
[   31.473625]  ffff8881029f3c00: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   31.474760]  ffff8881029f3c80: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   31.475469] >ffff8881029f3d00: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   31.476880]                                                  ^
[   31.477237]  ffff8881029f3d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.478353]  ffff8881029f3e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.480031] ==================================================================