Hay
Date
Dec. 5, 2024, 2:07 p.m.

Environment
qemu-arm64
qemu-x86_64

[   33.183185] ==================================================================
[   33.184120] BUG: KASAN: slab-use-after-free in strlen+0xa8/0xb0
[   33.185033] Read of size 1 at addr fff00000c63d1e50 by task kunit_try_catch/248
[   33.186097] 
[   33.186499] CPU: 0 UID: 0 PID: 248 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241205 #1
[   33.188021] Tainted: [B]=BAD_PAGE, [N]=TEST
[   33.188733] Hardware name: linux,dummy-virt (DT)
[   33.189424] Call trace:
[   33.189892]  show_stack+0x20/0x38 (C)
[   33.190634]  dump_stack_lvl+0x8c/0xd0
[   33.191281]  print_report+0x118/0x5e0
[   33.191922]  kasan_report+0xc8/0x118
[   33.192549]  __asan_report_load1_noabort+0x20/0x30
[   33.193314]  strlen+0xa8/0xb0
[   33.193901]  kasan_strings+0x304/0x8d8
[   33.194518]  kunit_try_run_case+0x14c/0x3d0
[   33.195230]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.196134]  kthread+0x24c/0x2d0
[   33.196736]  ret_from_fork+0x10/0x20
[   33.197506] 
[   33.197822] Allocated by task 248:
[   33.198345]  kasan_save_stack+0x3c/0x68
[   33.199345]  kasan_save_track+0x20/0x40
[   33.199803]  kasan_save_alloc_info+0x40/0x58
[   33.200626]  __kasan_kmalloc+0xd4/0xd8
[   33.201363]  __kmalloc_cache_noprof+0x15c/0x3c0
[   33.202176]  kasan_strings+0xb0/0x8d8
[   33.202928]  kunit_try_run_case+0x14c/0x3d0
[   33.203588]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.204464]  kthread+0x24c/0x2d0
[   33.204988]  ret_from_fork+0x10/0x20
[   33.205511] 
[   33.205817] Freed by task 248:
[   33.206774]  kasan_save_stack+0x3c/0x68
[   33.207531]  kasan_save_track+0x20/0x40
[   33.208226]  kasan_save_free_info+0x4c/0x78
[   33.209016]  __kasan_slab_free+0x6c/0x98
[   33.209750]  kfree+0x114/0x3c8
[   33.210437]  kasan_strings+0x124/0x8d8
[   33.211203]  kunit_try_run_case+0x14c/0x3d0
[   33.211798]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.212606]  kthread+0x24c/0x2d0
[   33.213301]  ret_from_fork+0x10/0x20
[   33.213800] 
[   33.214214] The buggy address belongs to the object at fff00000c63d1e40
[   33.214214]  which belongs to the cache kmalloc-32 of size 32
[   33.215527] The buggy address is located 16 bytes inside of
[   33.215527]  freed 32-byte region [fff00000c63d1e40, fff00000c63d1e60)
[   33.216938] 
[   33.217228] The buggy address belongs to the physical page:
[   33.218066] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1063d1
[   33.218978] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   33.219814] page_type: f5(slab)
[   33.220414] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   33.221382] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   33.222291] page dumped because: kasan: bad access detected
[   33.222983] 
[   33.223344] Memory state around the buggy address:
[   33.224082]  fff00000c63d1d00: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   33.224943]  fff00000c63d1d80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   33.225829] >fff00000c63d1e00: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   33.226689]                                                  ^
[   33.227351]  fff00000c63d1e80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   33.228351]  fff00000c63d1f00: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   33.229177] ==================================================================

[   31.030634] ==================================================================
[   31.031501] BUG: KASAN: slab-use-after-free in strlen+0x8f/0xb0
[   31.032324] Read of size 1 at addr ffff888102a07ed0 by task kunit_try_catch/266
[   31.033542] 
[   31.033890] CPU: 1 UID: 0 PID: 266 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241205 #1
[   31.035195] Tainted: [B]=BAD_PAGE, [N]=TEST
[   31.035612] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   31.036572] Call Trace:
[   31.037082]  <TASK>
[   31.037810]  dump_stack_lvl+0x73/0xb0
[   31.038327]  print_report+0xd1/0x640
[   31.038834]  ? __virt_addr_valid+0x1db/0x2d0
[   31.039495]  ? kasan_complete_mode_report_info+0x64/0x200
[   31.040259]  kasan_report+0x102/0x140
[   31.040733]  ? strlen+0x8f/0xb0
[   31.041435]  ? strlen+0x8f/0xb0
[   31.041844]  __asan_report_load1_noabort+0x18/0x20
[   31.042425]  strlen+0x8f/0xb0
[   31.043265]  kasan_strings+0x425/0xb60
[   31.043833]  ? __pfx_kasan_strings+0x10/0x10
[   31.044242]  ? __schedule+0xc70/0x27e0
[   31.044657]  ? __pfx_read_tsc+0x10/0x10
[   31.045488]  ? ktime_get_ts64+0x86/0x230
[   31.046139]  kunit_try_run_case+0x1b3/0x490
[   31.046536]  ? __pfx_kunit_try_run_case+0x10/0x10
[   31.047284]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   31.047867]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   31.048488]  ? __kthread_parkme+0x82/0x160
[   31.049291]  ? preempt_count_sub+0x50/0x80
[   31.049674]  ? __pfx_kunit_try_run_case+0x10/0x10
[   31.050248]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   31.050821]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   31.051315]  kthread+0x257/0x310
[   31.051747]  ? __pfx_kthread+0x10/0x10
[   31.052085]  ret_from_fork+0x41/0x80
[   31.052536]  ? __pfx_kthread+0x10/0x10
[   31.053418]  ret_from_fork_asm+0x1a/0x30
[   31.053917]  </TASK>
[   31.054391] 
[   31.054610] Allocated by task 266:
[   31.055151]  kasan_save_stack+0x3d/0x60
[   31.055477]  kasan_save_track+0x18/0x40
[   31.056115]  kasan_save_alloc_info+0x3b/0x50
[   31.056493]  __kasan_kmalloc+0xb7/0xc0
[   31.057290]  __kmalloc_cache_noprof+0x184/0x410
[   31.057742]  kasan_strings+0xb9/0xb60
[   31.058349]  kunit_try_run_case+0x1b3/0x490
[   31.058733]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   31.059329]  kthread+0x257/0x310
[   31.059624]  ret_from_fork+0x41/0x80
[   31.060132]  ret_from_fork_asm+0x1a/0x30
[   31.060654] 
[   31.060927] Freed by task 266:
[   31.061518]  kasan_save_stack+0x3d/0x60
[   31.061909]  kasan_save_track+0x18/0x40
[   31.062510]  kasan_save_free_info+0x3f/0x60
[   31.063179]  __kasan_slab_free+0x56/0x70
[   31.063601]  kfree+0x123/0x3f0
[   31.064043]  kasan_strings+0x13c/0xb60
[   31.064531]  kunit_try_run_case+0x1b3/0x490
[   31.064905]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   31.065502]  kthread+0x257/0x310
[   31.066233]  ret_from_fork+0x41/0x80
[   31.066705]  ret_from_fork_asm+0x1a/0x30
[   31.067193] 
[   31.067447] The buggy address belongs to the object at ffff888102a07ec0
[   31.067447]  which belongs to the cache kmalloc-32 of size 32
[   31.068671] The buggy address is located 16 bytes inside of
[   31.068671]  freed 32-byte region [ffff888102a07ec0, ffff888102a07ee0)
[   31.070191] 
[   31.070432] The buggy address belongs to the physical page:
[   31.071034] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a07
[   31.071552] flags: 0x200000000000000(node=0|zone=2)
[   31.072363] page_type: f5(slab)
[   31.072940] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   31.074137] raw: 0000000000000000 0000000000400040 00000000f5000000 0000000000000000
[   31.074902] page dumped because: kasan: bad access detected
[   31.075548] 
[   31.075811] Memory state around the buggy address:
[   31.076512]  ffff888102a07d80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   31.077592]  ffff888102a07e00: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   31.078456] >ffff888102a07e80: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   31.079462]                                                  ^
[   31.080058]  ffff888102a07f00: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   31.081288]  ffff888102a07f80: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   31.082555] ==================================================================