Hay
Date
May 26, 2025, 9:10 a.m.

Environment
qemu-arm64
qemu-x86_64

[   20.342880] ==================================================================
[   20.342995] BUG: KASAN: slab-use-after-free in strnlen+0x80/0x88
[   20.343103] Read of size 1 at addr fff00000c7896b90 by task kunit_try_catch/259
[   20.343215] 
[   20.343287] CPU: 0 UID: 0 PID: 259 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc7-next-20250526 #1 PREEMPT 
[   20.343493] Tainted: [B]=BAD_PAGE, [N]=TEST
[   20.343558] Hardware name: linux,dummy-virt (DT)
[   20.343628] Call trace:
[   20.343680]  show_stack+0x20/0x38 (C)
[   20.343791]  dump_stack_lvl+0x8c/0xd0
[   20.343895]  print_report+0x118/0x608
[   20.344002]  kasan_report+0xdc/0x128
[   20.344106]  __asan_report_load1_noabort+0x20/0x30
[   20.344222]  strnlen+0x80/0x88
[   20.344802]  kasan_strings+0x478/0xb00
[   20.344972]  kunit_try_run_case+0x170/0x3f0
[   20.345096]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   20.345358]  kthread+0x328/0x630
[   20.345513]  ret_from_fork+0x10/0x20
[   20.345778] 
[   20.345825] Allocated by task 259:
[   20.345890]  kasan_save_stack+0x3c/0x68
[   20.345993]  kasan_save_track+0x20/0x40
[   20.346094]  kasan_save_alloc_info+0x40/0x58
[   20.346170]  __kasan_kmalloc+0xd4/0xd8
[   20.346228]  __kmalloc_cache_noprof+0x15c/0x3c0
[   20.346294]  kasan_strings+0xc8/0xb00
[   20.346377]  kunit_try_run_case+0x170/0x3f0
[   20.346485]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   20.346618]  kthread+0x328/0x630
[   20.346693]  ret_from_fork+0x10/0x20
[   20.346776] 
[   20.346814] Freed by task 259:
[   20.346875]  kasan_save_stack+0x3c/0x68
[   20.347233]  kasan_save_track+0x20/0x40
[   20.347405]  kasan_save_free_info+0x4c/0x78
[   20.347497]  __kasan_slab_free+0x6c/0x98
[   20.347579]  kfree+0x214/0x3c8
[   20.347649]  kasan_strings+0x24c/0xb00
[   20.347716]  kunit_try_run_case+0x170/0x3f0
[   20.347779]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   20.347865]  kthread+0x328/0x630
[   20.347932]  ret_from_fork+0x10/0x20
[   20.348012] 
[   20.348058] The buggy address belongs to the object at fff00000c7896b80
[   20.348058]  which belongs to the cache kmalloc-32 of size 32
[   20.348186] The buggy address is located 16 bytes inside of
[   20.348186]  freed 32-byte region [fff00000c7896b80, fff00000c7896ba0)
[   20.348336] 
[   20.348378] The buggy address belongs to the physical page:
[   20.348446] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x107896
[   20.348883] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   20.349007] page_type: f5(slab)
[   20.349133] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   20.349247] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   20.349347] page dumped because: kasan: bad access detected
[   20.349432] 
[   20.349495] Memory state around the buggy address:
[   20.349594]  fff00000c7896a80: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   20.349729]  fff00000c7896b00: 00 00 07 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   20.349831] >fff00000c7896b80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   20.349935]                          ^
[   20.350005]  fff00000c7896c00: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   20.350100]  fff00000c7896c80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   20.350188] ==================================================================


[   13.025438] ==================================================================
[   13.025809] BUG: KASAN: slab-use-after-free in strnlen+0x73/0x80
[   13.026261] Read of size 1 at addr ffff8881039b9850 by task kunit_try_catch/277
[   13.026580] 
[   13.026666] CPU: 1 UID: 0 PID: 277 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc7-next-20250526 #1 PREEMPT(voluntary) 
[   13.026711] Tainted: [B]=BAD_PAGE, [N]=TEST
[   13.026774] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   13.026798] Call Trace:
[   13.026815]  <TASK>
[   13.026831]  dump_stack_lvl+0x73/0xb0
[   13.026859]  print_report+0xd1/0x650
[   13.026882]  ? __virt_addr_valid+0x1db/0x2d0
[   13.026905]  ? strnlen+0x73/0x80
[   13.026924]  ? kasan_complete_mode_report_info+0x64/0x200
[   13.026948]  ? strnlen+0x73/0x80
[   13.026969]  kasan_report+0x141/0x180
[   13.026993]  ? strnlen+0x73/0x80
[   13.027017]  __asan_report_load1_noabort+0x18/0x20
[   13.027038]  strnlen+0x73/0x80
[   13.027059]  kasan_strings+0x615/0xe80
[   13.027080]  ? trace_hardirqs_on+0x37/0xe0
[   13.027103]  ? __pfx_kasan_strings+0x10/0x10
[   13.027124]  ? finish_task_switch.isra.0+0x153/0x700
[   13.027146]  ? __switch_to+0x47/0xf50
[   13.027171]  ? __schedule+0x10cc/0x2b60
[   13.027195]  ? __pfx_read_tsc+0x10/0x10
[   13.027216]  ? ktime_get_ts64+0x86/0x230
[   13.027241]  kunit_try_run_case+0x1a5/0x480
[   13.027263]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.027282]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   13.027474]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   13.027504]  ? __kthread_parkme+0x82/0x180
[   13.027525]  ? preempt_count_sub+0x50/0x80
[   13.027548]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.027569]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.027594]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   13.027618]  kthread+0x337/0x6f0
[   13.027637]  ? trace_preempt_on+0x20/0xc0
[   13.027660]  ? __pfx_kthread+0x10/0x10
[   13.027680]  ? _raw_spin_unlock_irq+0x47/0x80
[   13.027704]  ? calculate_sigpending+0x7b/0xa0
[   13.027728]  ? __pfx_kthread+0x10/0x10
[   13.027750]  ret_from_fork+0x116/0x1d0
[   13.027776]  ? __pfx_kthread+0x10/0x10
[   13.027797]  ret_from_fork_asm+0x1a/0x30
[   13.027827]  </TASK>
[   13.027839] 
[   13.036225] Allocated by task 277:
[   13.036428]  kasan_save_stack+0x45/0x70
[   13.036634]  kasan_save_track+0x18/0x40
[   13.036839]  kasan_save_alloc_info+0x3b/0x50
[   13.037075]  __kasan_kmalloc+0xb7/0xc0
[   13.037233]  __kmalloc_cache_noprof+0x189/0x420
[   13.037471]  kasan_strings+0xc0/0xe80
[   13.037621]  kunit_try_run_case+0x1a5/0x480
[   13.037764]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.038010]  kthread+0x337/0x6f0
[   13.038188]  ret_from_fork+0x116/0x1d0
[   13.038388]  ret_from_fork_asm+0x1a/0x30
[   13.038594] 
[   13.038689] Freed by task 277:
[   13.038854]  kasan_save_stack+0x45/0x70
[   13.039032]  kasan_save_track+0x18/0x40
[   13.039329]  kasan_save_free_info+0x3f/0x60
[   13.039494]  __kasan_slab_free+0x56/0x70
[   13.039690]  kfree+0x222/0x3f0
[   13.039859]  kasan_strings+0x2aa/0xe80
[   13.040130]  kunit_try_run_case+0x1a5/0x480
[   13.040419]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.040648]  kthread+0x337/0x6f0
[   13.040873]  ret_from_fork+0x116/0x1d0
[   13.041028]  ret_from_fork_asm+0x1a/0x30
[   13.041285] 
[   13.041357] The buggy address belongs to the object at ffff8881039b9840
[   13.041357]  which belongs to the cache kmalloc-32 of size 32
[   13.041953] The buggy address is located 16 bytes inside of
[   13.041953]  freed 32-byte region [ffff8881039b9840, ffff8881039b9860)
[   13.042321] 
[   13.042411] The buggy address belongs to the physical page:
[   13.042670] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1039b9
[   13.043483] flags: 0x200000000000000(node=0|zone=2)
[   13.043704] page_type: f5(slab)
[   13.043885] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   13.044224] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   13.044653] page dumped because: kasan: bad access detected
[   13.044931] 
[   13.045066] Memory state around the buggy address:
[   13.045235]  ffff8881039b9700: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   13.045466]  ffff8881039b9780: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   13.045899] >ffff8881039b9800: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   13.046285]                                                  ^
[   13.046477]  ffff8881039b9880: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   13.046777]  ffff8881039b9900: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   13.047198] ==================================================================