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

Environment
qemu-arm64
qemu-x86_64

[   37.303542] ==================================================================
[   37.304382] BUG: KASAN: slab-use-after-free in strcmp+0xc0/0xc8
[   37.305200] Read of size 1 at addr fff00000c6a4c550 by task kunit_try_catch/248
[   37.306056] 
[   37.307724] CPU: 1 UID: 0 PID: 248 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241122 #1
[   37.309117] Tainted: [B]=BAD_PAGE, [N]=TEST
[   37.309755] Hardware name: linux,dummy-virt (DT)
[   37.310455] Call trace:
[   37.310870]  show_stack+0x20/0x38 (C)
[   37.311962]  dump_stack_lvl+0x8c/0xd0
[   37.312550]  print_report+0x118/0x5e0
[   37.313245]  kasan_report+0xc8/0x118
[   37.313869]  __asan_report_load1_noabort+0x20/0x30
[   37.314672]  strcmp+0xc0/0xc8
[   37.315137]  kasan_strings+0x248/0x8f8
[   37.315883]  kunit_try_run_case+0x14c/0x3d0
[   37.317186]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   37.318650]  kthread+0x24c/0x2d0
[   37.319792]  ret_from_fork+0x10/0x20
[   37.320135] 
[   37.320304] Allocated by task 248:
[   37.320667]  kasan_save_stack+0x3c/0x68
[   37.322294]  kasan_save_track+0x20/0x40
[   37.323574]  kasan_save_alloc_info+0x40/0x58
[   37.324511]  __kasan_kmalloc+0xd4/0xd8
[   37.325469]  __kmalloc_cache_noprof+0x15c/0x3c8
[   37.326284]  kasan_strings+0xb4/0x8f8
[   37.326898]  kunit_try_run_case+0x14c/0x3d0
[   37.327583]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   37.328269]  kthread+0x24c/0x2d0
[   37.329108]  ret_from_fork+0x10/0x20
[   37.329996] 
[   37.330419] Freed by task 248:
[   37.330872]  kasan_save_stack+0x3c/0x68
[   37.331403]  kasan_save_track+0x20/0x40
[   37.333018]  kasan_save_free_info+0x4c/0x78
[   37.333733]  __kasan_slab_free+0x6c/0x98
[   37.334317]  kfree+0x114/0x3d0
[   37.335220]  kasan_strings+0x128/0x8f8
[   37.336130]  kunit_try_run_case+0x14c/0x3d0
[   37.337020]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   37.338204]  kthread+0x24c/0x2d0
[   37.338661]  ret_from_fork+0x10/0x20
[   37.339478] 
[   37.339930] The buggy address belongs to the object at fff00000c6a4c540
[   37.339930]  which belongs to the cache kmalloc-32 of size 32
[   37.342209] The buggy address is located 16 bytes inside of
[   37.342209]  freed 32-byte region [fff00000c6a4c540, fff00000c6a4c560)
[   37.343728] 
[   37.344216] The buggy address belongs to the physical page:
[   37.345291] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106a4c
[   37.346316] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   37.347930] page_type: f5(slab)
[   37.348421] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   37.349891] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   37.350848] page dumped because: kasan: bad access detected
[   37.351623] 
[   37.351956] Memory state around the buggy address:
[   37.353825]  fff00000c6a4c400: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   37.354645]  fff00000c6a4c480: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   37.355614] >fff00000c6a4c500: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   37.358150]                                                  ^
[   37.358768]  fff00000c6a4c580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   37.359351]  fff00000c6a4c600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   37.359942] ==================================================================

[   28.206896] ==================================================================
[   28.207710] BUG: KASAN: slab-use-after-free in strcmp+0xb0/0xc0
[   28.208117] Read of size 1 at addr ffff888102a18a90 by task kunit_try_catch/267
[   28.208925] 
[   28.209167] CPU: 1 UID: 0 PID: 267 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241122 #1
[   28.209957] Tainted: [B]=BAD_PAGE, [N]=TEST
[   28.210328] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   28.211014] Call Trace:
[   28.211323]  <TASK>
[   28.211553]  dump_stack_lvl+0x73/0xb0
[   28.211894]  print_report+0xd1/0x640
[   28.212331]  ? __virt_addr_valid+0x1db/0x2d0
[   28.212787]  ? kasan_complete_mode_report_info+0x64/0x200
[   28.213293]  kasan_report+0x102/0x140
[   28.213921]  ? strcmp+0xb0/0xc0
[   28.214189]  ? strcmp+0xb0/0xc0
[   28.214452]  __asan_report_load1_noabort+0x18/0x20
[   28.215165]  strcmp+0xb0/0xc0
[   28.215569]  kasan_strings+0x2e9/0xb60
[   28.216161]  ? __pfx_kasan_strings+0x10/0x10
[   28.216743]  ? __schedule+0xc3e/0x2790
[   28.217561]  ? __pfx_read_tsc+0x10/0x10
[   28.218022]  ? ktime_get_ts64+0x84/0x230
[   28.218460]  kunit_try_run_case+0x1b3/0x490
[   28.219078]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.219429]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   28.219738]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   28.220303]  ? __kthread_parkme+0x82/0x160
[   28.221001]  ? preempt_count_sub+0x50/0x80
[   28.221531]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.222106]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   28.224140]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.225540]  kthread+0x257/0x310
[   28.225852]  ? __pfx_kthread+0x10/0x10
[   28.226157]  ret_from_fork+0x41/0x80
[   28.226574]  ? __pfx_kthread+0x10/0x10
[   28.227137]  ret_from_fork_asm+0x1a/0x30
[   28.227485]  </TASK>
[   28.227668] 
[   28.227812] Allocated by task 267:
[   28.228214]  kasan_save_stack+0x3d/0x60
[   28.228654]  kasan_save_track+0x18/0x40
[   28.229127]  kasan_save_alloc_info+0x3b/0x50
[   28.229851]  __kasan_kmalloc+0xb7/0xc0
[   28.230272]  __kmalloc_cache_noprof+0x184/0x410
[   28.230671]  kasan_strings+0xb3/0xb60
[   28.230956]  kunit_try_run_case+0x1b3/0x490
[   28.231231]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.231548]  kthread+0x257/0x310
[   28.232050]  ret_from_fork+0x41/0x80
[   28.232534]  ret_from_fork_asm+0x1a/0x30
[   28.232958] 
[   28.233176] Freed by task 267:
[   28.233713]  kasan_save_stack+0x3d/0x60
[   28.234741]  kasan_save_track+0x18/0x40
[   28.235318]  kasan_save_free_info+0x3f/0x60
[   28.235634]  __kasan_slab_free+0x56/0x70
[   28.236071]  kfree+0x123/0x3f0
[   28.236313]  kasan_strings+0x13a/0xb60
[   28.236977]  kunit_try_run_case+0x1b3/0x490
[   28.237318]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.237882]  kthread+0x257/0x310
[   28.238134]  ret_from_fork+0x41/0x80
[   28.238738]  ret_from_fork_asm+0x1a/0x30
[   28.239227] 
[   28.239477] The buggy address belongs to the object at ffff888102a18a80
[   28.239477]  which belongs to the cache kmalloc-32 of size 32
[   28.240168] The buggy address is located 16 bytes inside of
[   28.240168]  freed 32-byte region [ffff888102a18a80, ffff888102a18aa0)
[   28.240959] 
[   28.241171] The buggy address belongs to the physical page:
[   28.241769] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a18
[   28.242707] flags: 0x200000000000000(node=0|zone=2)
[   28.243037] page_type: f5(slab)
[   28.244007] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   28.244846] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   28.245344] page dumped because: kasan: bad access detected
[   28.246175] 
[   28.246356] Memory state around the buggy address:
[   28.246637]  ffff888102a18980: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   28.247031]  ffff888102a18a00: 00 00 00 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   28.247411] >ffff888102a18a80: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   28.248157]                          ^
[   28.248561]  ffff888102a18b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.249286]  ffff888102a18b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.250394] ==================================================================