Hay
Date
Feb. 5, 2025, 2:09 p.m.

Environment
qemu-armv7
qemu-x86_64

[  147.249659] ==================================================================
[  147.250630] BUG: KASAN: slab-use-after-free in strnlen+0x30/0x58
[  147.251122] Read of size 1 at addr c8fba210 by task kunit_try_catch/199
[  147.251734] 
[  147.252174] CPU: 1 PID: 199 Comm: kunit_try_catch Tainted: G    B            N 6.6.76-rc1 #1
[  147.253126] Hardware name: Generic DT based system
[  147.253785]  unwind_backtrace from show_stack+0x18/0x1c
[  147.254386]  show_stack from dump_stack_lvl+0x58/0x70
[  147.255144]  dump_stack_lvl from print_report+0x164/0x51c
[  147.255962]  print_report from kasan_report+0xc8/0x104
[  147.257792]  kasan_report from strnlen+0x30/0x58
[  147.258522]  strnlen from kasan_strings+0x1dc/0x4ec
[  147.259321]  kasan_strings from kunit_try_run_case+0x11c/0x2e4
[  147.260071]  kunit_try_run_case from kunit_generic_run_threadfn_adapter+0x2c/0x48
[  147.261103]  kunit_generic_run_threadfn_adapter from kthread+0x184/0x1a8
[  147.262082]  kthread from ret_from_fork+0x14/0x30
[  147.262703] Exception stack(0xfa0fbfb0 to 0xfa0fbff8)
[  147.263412] bfa0:                                     00000000 00000000 00000000 00000000
[  147.264264] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  147.265137] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000
[  147.265981] 
[  147.266481] Allocated by task 199:
[  147.266865]  kasan_set_track+0x3c/0x5c
[  147.267500]  __kasan_kmalloc+0x8c/0x94
[  147.267936]  kasan_strings+0xa0/0x4ec
[  147.268568]  kunit_try_run_case+0x11c/0x2e4
[  147.269074]  kunit_generic_run_threadfn_adapter+0x2c/0x48
[  147.269904]  kthread+0x184/0x1a8
[  147.270322]  ret_from_fork+0x14/0x30
[  147.270805] 
[  147.271155] Freed by task 199:
[  147.271629]  kasan_set_track+0x3c/0x5c
[  147.272147]  kasan_save_free_info+0x30/0x3c
[  147.272708]  __kasan_slab_free+0xdc/0x124
[  147.273434]  __kmem_cache_free+0x140/0x2a8
[  147.274107]  kasan_strings+0xbc/0x4ec
[  147.274568]  kunit_try_run_case+0x11c/0x2e4
[  147.275114]  kunit_generic_run_threadfn_adapter+0x2c/0x48
[  147.275958]  kthread+0x184/0x1a8
[  147.276772]  ret_from_fork+0x14/0x30
[  147.277286] 
[  147.277552] The buggy address belongs to the object at c8fba200
[  147.277552]  which belongs to the cache kmalloc-64 of size 64
[  147.278814] The buggy address is located 16 bytes inside of
[  147.278814]  freed 64-byte region [c8fba200, c8fba240)
[  147.279963] 
[  147.280214] The buggy address belongs to the physical page:
[  147.280820] page:3fba6f39 refcount:1 mapcount:0 mapping:00000000 index:0x0 pfn:0x48fba
[  147.281979] flags: 0x800(slab|zone=0)
[  147.282438] page_type: 0xffffffff()
[  147.282979] raw: 00000800 c4801200 00000122 00000000 00000000 80200020 ffffffff 00000001
[  147.283840] raw: 00000000
[  147.284140] page dumped because: kasan: bad access detected
[  147.284874] 
[  147.285110] Memory state around the buggy address:
[  147.285985]  c8fba100: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[  147.286673]  c8fba180: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[  147.287422] >c8fba200: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[  147.288218]                  ^
[  147.288704]  c8fba280: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc
[  147.289426]  c8fba300: 00 00 00 00 04 fc fc fc fc fc fc fc fc fc fc fc
[  147.290210] ==================================================================


[   50.543593] ==================================================================
[   50.544520] BUG: KASAN: slab-use-after-free in strnlen+0x31/0x50
[   50.545360] Read of size 1 at addr ffff8881028cedd0 by task kunit_try_catch/222
[   50.546422] 
[   50.546767] CPU: 1 PID: 222 Comm: kunit_try_catch Tainted: G    B            N 6.6.76-rc1 #1
[   50.547775] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   50.548642] Call Trace:
[   50.549547]  <TASK>
[   50.550126]  dump_stack_lvl+0x4e/0x90
[   50.550531]  print_report+0xd2/0x660
[   50.550947]  ? __virt_addr_valid+0x156/0x1e0
[   50.551709]  ? kasan_complete_mode_report_info+0x64/0x200
[   50.552460]  kasan_report+0xff/0x140
[   50.553363]  ? strnlen+0x31/0x50
[   50.553923]  ? strnlen+0x31/0x50
[   50.554614]  __asan_load1+0x66/0x70
[   50.555358]  strnlen+0x31/0x50
[   50.555763]  kasan_strings+0x21b/0x510
[   50.556158]  ? __pfx_kasan_strings+0x10/0x10
[   50.556759]  ? __schedule+0x70b/0x1190
[   50.557355]  ? ktime_get_ts64+0x118/0x140
[   50.558052]  kunit_try_run_case+0x126/0x290
[   50.558758]  ? __pfx_kunit_try_run_case+0x10/0x10
[   50.559352]  ? __kasan_check_write+0x18/0x20
[   50.560067]  ? trace_preempt_on+0x20/0xa0
[   50.560732]  ? __kthread_parkme+0x4f/0xd0
[   50.561314]  ? preempt_count_sub+0x50/0x80
[   50.562043]  ? __pfx_kunit_try_run_case+0x10/0x10
[   50.562539]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   50.563414]  kunit_generic_run_threadfn_adapter+0x33/0x50
[   50.564072]  kthread+0x19e/0x1e0
[   50.564593]  ? __pfx_kthread+0x10/0x10
[   50.565223]  ret_from_fork+0x41/0x70
[   50.565843]  ? __pfx_kthread+0x10/0x10
[   50.566481]  ret_from_fork_asm+0x1b/0x30
[   50.567152]  </TASK>
[   50.567403] 
[   50.567671] Allocated by task 222:
[   50.568263]  kasan_save_stack+0x3c/0x60
[   50.568905]  kasan_set_track+0x29/0x40
[   50.569488]  kasan_save_alloc_info+0x22/0x30
[   50.570193]  __kasan_kmalloc+0xb7/0xc0
[   50.570771]  kmalloc_trace+0x4c/0xb0
[   50.571319]  kasan_strings+0x9f/0x510
[   50.571921]  kunit_try_run_case+0x126/0x290
[   50.572519]  kunit_generic_run_threadfn_adapter+0x33/0x50
[   50.573326]  kthread+0x19e/0x1e0
[   50.573790]  ret_from_fork+0x41/0x70
[   50.574179]  ret_from_fork_asm+0x1b/0x30
[   50.574844] 
[   50.575127] Freed by task 222:
[   50.575545]  kasan_save_stack+0x3c/0x60
[   50.576177]  kasan_set_track+0x29/0x40
[   50.576777]  kasan_save_free_info+0x2f/0x50
[   50.577399]  ____kasan_slab_free+0x172/0x1d0
[   50.577967]  __kasan_slab_free+0x16/0x20
[   50.578602]  __kmem_cache_free+0x190/0x310
[   50.579379]  kfree+0x7c/0x120
[   50.579809]  kasan_strings+0xc3/0x510
[   50.580461]  kunit_try_run_case+0x126/0x290
[   50.581034]  kunit_generic_run_threadfn_adapter+0x33/0x50
[   50.581782]  kthread+0x19e/0x1e0
[   50.582300]  ret_from_fork+0x41/0x70
[   50.582938]  ret_from_fork_asm+0x1b/0x30
[   50.583561] 
[   50.583910] The buggy address belongs to the object at ffff8881028cedc0
[   50.583910]  which belongs to the cache kmalloc-32 of size 32
[   50.584776] The buggy address is located 16 bytes inside of
[   50.584776]  freed 32-byte region [ffff8881028cedc0, ffff8881028cede0)
[   50.586113] 
[   50.586424] The buggy address belongs to the physical page:
[   50.587066] page:(____ptrval____) refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1028ce
[   50.588180] flags: 0x200000000000800(slab|node=0|zone=2)
[   50.588900] page_type: 0xffffffff()
[   50.589464] raw: 0200000000000800 ffff888100041500 dead000000000122 0000000000000000
[   50.590297] raw: 0000000000000000 0000000080400040 00000001ffffffff 0000000000000000
[   50.591151] page dumped because: kasan: bad access detected
[   50.591595] 
[   50.591978] Memory state around the buggy address:
[   50.592608]  ffff8881028cec80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   50.593537]  ffff8881028ced00: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   50.594261] >ffff8881028ced80: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   50.595173]                                                  ^
[   50.595794]  ffff8881028cee00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   50.596367]  ffff8881028cee80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   50.597261] ==================================================================