Hay
Date
May 12, 2025, 11:48 a.m.

Environment
qemu-arm64
qemu-x86_64

[   19.042191] ==================================================================
[   19.042310] BUG: KASAN: slab-use-after-free in strnlen+0x80/0x88
[   19.042711] Read of size 1 at addr fff00000c78896d0 by task kunit_try_catch/259
[   19.043269] 
[   19.043638] CPU: 0 UID: 0 PID: 259 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250512 #1 PREEMPT 
[   19.043745] Tainted: [B]=BAD_PAGE, [N]=TEST
[   19.043775] Hardware name: linux,dummy-virt (DT)
[   19.043816] Call trace:
[   19.043844]  show_stack+0x20/0x38 (C)
[   19.044105]  dump_stack_lvl+0x8c/0xd0
[   19.044372]  print_report+0x118/0x608
[   19.044452]  kasan_report+0xdc/0x128
[   19.044503]  __asan_report_load1_noabort+0x20/0x30
[   19.044562]  strnlen+0x80/0x88
[   19.044818]  kasan_strings+0x478/0xb00
[   19.044902]  kunit_try_run_case+0x170/0x3f0
[   19.044955]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.045008]  kthread+0x328/0x630
[   19.045066]  ret_from_fork+0x10/0x20
[   19.045418] 
[   19.045468] Allocated by task 259:
[   19.045527]  kasan_save_stack+0x3c/0x68
[   19.045590]  kasan_save_track+0x20/0x40
[   19.045634]  kasan_save_alloc_info+0x40/0x58
[   19.045676]  __kasan_kmalloc+0xd4/0xd8
[   19.045713]  __kmalloc_cache_noprof+0x15c/0x3c0
[   19.045752]  kasan_strings+0xc8/0xb00
[   19.045788]  kunit_try_run_case+0x170/0x3f0
[   19.045824]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.045867]  kthread+0x328/0x630
[   19.046229]  ret_from_fork+0x10/0x20
[   19.046284] 
[   19.046311] Freed by task 259:
[   19.046344]  kasan_save_stack+0x3c/0x68
[   19.046384]  kasan_save_track+0x20/0x40
[   19.046877]  kasan_save_free_info+0x4c/0x78
[   19.047224]  __kasan_slab_free+0x6c/0x98
[   19.047408]  kfree+0x214/0x3c8
[   19.047476]  kasan_strings+0x24c/0xb00
[   19.047537]  kunit_try_run_case+0x170/0x3f0
[   19.047591]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.047861]  kthread+0x328/0x630
[   19.047968]  ret_from_fork+0x10/0x20
[   19.048055] 
[   19.048246] The buggy address belongs to the object at fff00000c78896c0
[   19.048246]  which belongs to the cache kmalloc-32 of size 32
[   19.048329] The buggy address is located 16 bytes inside of
[   19.048329]  freed 32-byte region [fff00000c78896c0, fff00000c78896e0)
[   19.048576] 
[   19.048607] The buggy address belongs to the physical page:
[   19.048785] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x107889
[   19.048997] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   19.049062] page_type: f5(slab)
[   19.049328] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   19.049634] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   19.049683] page dumped because: kasan: bad access detected
[   19.049815] 
[   19.049848] Memory state around the buggy address:
[   19.050017]  fff00000c7889580: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   19.050082]  fff00000c7889600: 00 00 00 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   19.050155] >fff00000c7889680: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   19.050418]                                                  ^
[   19.050539]  fff00000c7889700: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   19.050613]  fff00000c7889780: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   19.050666] ==================================================================

[   19.058207] ==================================================================
[   19.058851] BUG: KASAN: slab-use-after-free in strnlen+0x73/0x80
[   19.059407] Read of size 1 at addr ffff888102327750 by task kunit_try_catch/276
[   19.060022] 
[   19.060280] CPU: 0 UID: 0 PID: 276 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250512 #1 PREEMPT(voluntary) 
[   19.060387] Tainted: [B]=BAD_PAGE, [N]=TEST
[   19.060414] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   19.060461] Call Trace:
[   19.060511]  <TASK>
[   19.060553]  dump_stack_lvl+0x73/0xb0
[   19.060636]  print_report+0xd1/0x650
[   19.060722]  ? __virt_addr_valid+0x1db/0x2d0
[   19.060782]  ? strnlen+0x73/0x80
[   19.060844]  ? kasan_complete_mode_report_info+0x64/0x200
[   19.060893]  ? strnlen+0x73/0x80
[   19.060932]  kasan_report+0x141/0x180
[   19.060977]  ? strnlen+0x73/0x80
[   19.061028]  __asan_report_load1_noabort+0x18/0x20
[   19.061074]  strnlen+0x73/0x80
[   19.061120]  kasan_strings+0x615/0xe80
[   19.061161]  ? trace_hardirqs_on+0x37/0xe0
[   19.061213]  ? __pfx_kasan_strings+0x10/0x10
[   19.061253]  ? finish_task_switch.isra.0+0x153/0x700
[   19.061318]  ? __switch_to+0x47/0xf50
[   19.061377]  ? __schedule+0x10cc/0x2b60
[   19.061428]  ? __pfx_read_tsc+0x10/0x10
[   19.061468]  ? ktime_get_ts64+0x86/0x230
[   19.061497]  kunit_try_run_case+0x1a5/0x480
[   19.061526]  ? __pfx_kunit_try_run_case+0x10/0x10
[   19.061550]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   19.061577]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   19.061601]  ? __kthread_parkme+0x82/0x180
[   19.061624]  ? preempt_count_sub+0x50/0x80
[   19.061648]  ? __pfx_kunit_try_run_case+0x10/0x10
[   19.061733]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   19.061762]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   19.061787]  kthread+0x337/0x6f0
[   19.061809]  ? trace_preempt_on+0x20/0xc0
[   19.061833]  ? __pfx_kthread+0x10/0x10
[   19.061856]  ? _raw_spin_unlock_irq+0x47/0x80
[   19.061879]  ? calculate_sigpending+0x7b/0xa0
[   19.061906]  ? __pfx_kthread+0x10/0x10
[   19.061929]  ret_from_fork+0x116/0x1d0
[   19.061949]  ? __pfx_kthread+0x10/0x10
[   19.061971]  ret_from_fork_asm+0x1a/0x30
[   19.062004]  </TASK>
[   19.062018] 
[   19.074735] Allocated by task 276:
[   19.075085]  kasan_save_stack+0x45/0x70
[   19.075926]  kasan_save_track+0x18/0x40
[   19.076156]  kasan_save_alloc_info+0x3b/0x50
[   19.076503]  __kasan_kmalloc+0xb7/0xc0
[   19.077203]  __kmalloc_cache_noprof+0x189/0x420
[   19.077411]  kasan_strings+0xc0/0xe80
[   19.077750]  kunit_try_run_case+0x1a5/0x480
[   19.078319]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   19.078529]  kthread+0x337/0x6f0
[   19.078865]  ret_from_fork+0x116/0x1d0
[   19.079534]  ret_from_fork_asm+0x1a/0x30
[   19.079979] 
[   19.080087] Freed by task 276:
[   19.080295]  kasan_save_stack+0x45/0x70
[   19.080846]  kasan_save_track+0x18/0x40
[   19.081051]  kasan_save_free_info+0x3f/0x60
[   19.081746]  __kasan_slab_free+0x56/0x70
[   19.081952]  kfree+0x222/0x3f0
[   19.082396]  kasan_strings+0x2aa/0xe80
[   19.083020]  kunit_try_run_case+0x1a5/0x480
[   19.083442]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   19.083671]  kthread+0x337/0x6f0
[   19.084174]  ret_from_fork+0x116/0x1d0
[   19.084542]  ret_from_fork_asm+0x1a/0x30
[   19.084950] 
[   19.085090] The buggy address belongs to the object at ffff888102327740
[   19.085090]  which belongs to the cache kmalloc-32 of size 32
[   19.085774] The buggy address is located 16 bytes inside of
[   19.085774]  freed 32-byte region [ffff888102327740, ffff888102327760)
[   19.086504] 
[   19.086705] The buggy address belongs to the physical page:
[   19.087174] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102327
[   19.087606] flags: 0x200000000000000(node=0|zone=2)
[   19.088006] page_type: f5(slab)
[   19.088225] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   19.088799] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   19.089230] page dumped because: kasan: bad access detected
[   19.089643] 
[   19.089836] Memory state around the buggy address:
[   19.090102]  ffff888102327600: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   19.090531]  ffff888102327680: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   19.090972] >ffff888102327700: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   19.091437]                                                  ^
[   19.091757]  ffff888102327780: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   19.092206]  ffff888102327800: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   19.092553] ==================================================================