Hay
Date
June 16, 2025, 7:07 a.m.

Environment
qemu-arm64
qemu-x86_64

[   22.289762] ==================================================================
[   22.289887] BUG: KASAN: slab-use-after-free in strnlen+0x80/0x88
[   22.290005] Read of size 1 at addr fff00000c63fb310 by task kunit_try_catch/268
[   22.290077] 
[   22.290134] CPU: 0 UID: 0 PID: 268 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc2-next-20250616 #1 PREEMPT 
[   22.290244] Tainted: [B]=BAD_PAGE, [N]=TEST
[   22.290280] Hardware name: linux,dummy-virt (DT)
[   22.290325] Call trace:
[   22.290359]  show_stack+0x20/0x38 (C)
[   22.290426]  dump_stack_lvl+0x8c/0xd0
[   22.290483]  print_report+0x118/0x608
[   22.290543]  kasan_report+0xdc/0x128
[   22.290611]  __asan_report_load1_noabort+0x20/0x30
[   22.290680]  strnlen+0x80/0x88
[   22.290736]  kasan_strings+0x478/0xb00
[   22.290795]  kunit_try_run_case+0x170/0x3f0
[   22.290866]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   22.290935]  kthread+0x328/0x630
[   22.290986]  ret_from_fork+0x10/0x20
[   22.291044] 
[   22.291073] Allocated by task 268:
[   22.291109]  kasan_save_stack+0x3c/0x68
[   22.291162]  kasan_save_track+0x20/0x40
[   22.291218]  kasan_save_alloc_info+0x40/0x58
[   22.291282]  __kasan_kmalloc+0xd4/0xd8
[   22.291332]  __kmalloc_cache_noprof+0x16c/0x3c0
[   22.291383]  kasan_strings+0xc8/0xb00
[   22.291425]  kunit_try_run_case+0x170/0x3f0
[   22.291469]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   22.291520]  kthread+0x328/0x630
[   22.291562]  ret_from_fork+0x10/0x20
[   22.291606] 
[   22.291633] Freed by task 268:
[   22.291669]  kasan_save_stack+0x3c/0x68
[   22.291715]  kasan_save_track+0x20/0x40
[   22.291771]  kasan_save_free_info+0x4c/0x78
[   22.291824]  __kasan_slab_free+0x6c/0x98
[   22.291883]  kfree+0x214/0x3c8
[   22.291926]  kasan_strings+0x24c/0xb00
[   22.291969]  kunit_try_run_case+0x170/0x3f0
[   22.292012]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   22.292060]  kthread+0x328/0x630
[   22.292097]  ret_from_fork+0x10/0x20
[   22.292139] 
[   22.292164] The buggy address belongs to the object at fff00000c63fb300
[   22.292164]  which belongs to the cache kmalloc-32 of size 32
[   22.292230] The buggy address is located 16 bytes inside of
[   22.292230]  freed 32-byte region [fff00000c63fb300, fff00000c63fb320)
[   22.292297] 
[   22.292322] The buggy address belongs to the physical page:
[   22.292361] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1063fb
[   22.292424] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   22.292481] page_type: f5(slab)
[   22.292528] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   22.292586] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   22.292633] page dumped because: kasan: bad access detected
[   22.292669] 
[   22.292692] Memory state around the buggy address:
[   22.292732]  fff00000c63fb200: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   22.292815]  fff00000c63fb280: 00 00 00 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   22.292879] >fff00000c63fb300: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   22.292928]                          ^
[   22.292965]  fff00000c63fb380: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   22.293075]  fff00000c63fb400: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   22.293129] ==================================================================

[   13.492574] ==================================================================
[   13.493175] BUG: KASAN: slab-use-after-free in strnlen+0x73/0x80
[   13.493514] Read of size 1 at addr ffff8881028dc250 by task kunit_try_catch/284
[   13.493809] 
[   13.493910] CPU: 1 UID: 0 PID: 284 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc2-next-20250616 #1 PREEMPT(voluntary) 
[   13.493968] Tainted: [B]=BAD_PAGE, [N]=TEST
[   13.493980] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   13.494000] Call Trace:
[   13.494017]  <TASK>
[   13.494034]  dump_stack_lvl+0x73/0xb0
[   13.494064]  print_report+0xd1/0x650
[   13.494086]  ? __virt_addr_valid+0x1db/0x2d0
[   13.494108]  ? strnlen+0x73/0x80
[   13.494128]  ? kasan_complete_mode_report_info+0x64/0x200
[   13.494150]  ? strnlen+0x73/0x80
[   13.494170]  kasan_report+0x141/0x180
[   13.494191]  ? strnlen+0x73/0x80
[   13.494216]  __asan_report_load1_noabort+0x18/0x20
[   13.494239]  strnlen+0x73/0x80
[   13.494260]  kasan_strings+0x615/0xe80
[   13.494279]  ? trace_hardirqs_on+0x37/0xe0
[   13.494303]  ? __pfx_kasan_strings+0x10/0x10
[   13.494322]  ? finish_task_switch.isra.0+0x153/0x700
[   13.494344]  ? __switch_to+0x47/0xf50
[   13.494369]  ? __schedule+0x10cc/0x2b60
[   13.494389]  ? __pfx_read_tsc+0x10/0x10
[   13.494409]  ? ktime_get_ts64+0x86/0x230
[   13.494434]  kunit_try_run_case+0x1a5/0x480
[   13.494457]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.494478]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   13.494499]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   13.494521]  ? __kthread_parkme+0x82/0x180
[   13.494540]  ? preempt_count_sub+0x50/0x80
[   13.494562]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.494584]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.494606]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   13.494629]  kthread+0x337/0x6f0
[   13.494719]  ? trace_preempt_on+0x20/0xc0
[   13.494746]  ? __pfx_kthread+0x10/0x10
[   13.494766]  ? _raw_spin_unlock_irq+0x47/0x80
[   13.494786]  ? calculate_sigpending+0x7b/0xa0
[   13.494810]  ? __pfx_kthread+0x10/0x10
[   13.494830]  ret_from_fork+0x116/0x1d0
[   13.494848]  ? __pfx_kthread+0x10/0x10
[   13.494868]  ret_from_fork_asm+0x1a/0x30
[   13.494897]  </TASK>
[   13.494907] 
[   13.502089] Allocated by task 284:
[   13.502276]  kasan_save_stack+0x45/0x70
[   13.502661]  kasan_save_track+0x18/0x40
[   13.502871]  kasan_save_alloc_info+0x3b/0x50
[   13.503096]  __kasan_kmalloc+0xb7/0xc0
[   13.503277]  __kmalloc_cache_noprof+0x189/0x420
[   13.503552]  kasan_strings+0xc0/0xe80
[   13.503684]  kunit_try_run_case+0x1a5/0x480
[   13.503821]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.504080]  kthread+0x337/0x6f0
[   13.504242]  ret_from_fork+0x116/0x1d0
[   13.504632]  ret_from_fork_asm+0x1a/0x30
[   13.504847] 
[   13.504948] Freed by task 284:
[   13.505077]  kasan_save_stack+0x45/0x70
[   13.505206]  kasan_save_track+0x18/0x40
[   13.505389]  kasan_save_free_info+0x3f/0x60
[   13.505606]  __kasan_slab_free+0x56/0x70
[   13.505778]  kfree+0x222/0x3f0
[   13.505921]  kasan_strings+0x2aa/0xe80
[   13.506091]  kunit_try_run_case+0x1a5/0x480
[   13.506229]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.506392]  kthread+0x337/0x6f0
[   13.506504]  ret_from_fork+0x116/0x1d0
[   13.506627]  ret_from_fork_asm+0x1a/0x30
[   13.506757] 
[   13.506822] The buggy address belongs to the object at ffff8881028dc240
[   13.506822]  which belongs to the cache kmalloc-32 of size 32
[   13.507565] The buggy address is located 16 bytes inside of
[   13.507565]  freed 32-byte region [ffff8881028dc240, ffff8881028dc260)
[   13.508087] 
[   13.508180] The buggy address belongs to the physical page:
[   13.508599] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1028dc
[   13.508964] flags: 0x200000000000000(node=0|zone=2)
[   13.509203] page_type: f5(slab)
[   13.509497] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   13.509833] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   13.510161] page dumped because: kasan: bad access detected
[   13.510506] 
[   13.510598] Memory state around the buggy address:
[   13.510809]  ffff8881028dc100: fa fb fb fb fc fc fc fc 00 00 07 fc fc fc fc fc
[   13.511025]  ffff8881028dc180: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   13.511227] >ffff8881028dc200: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   13.511515]                                                  ^
[   13.511798]  ffff8881028dc280: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   13.512124]  ffff8881028dc300: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   13.512492] ==================================================================