Hay
Date
Dec. 9, 2024, 6:35 a.m.

Environment
qemu-arm64
qemu-x86_64

[   27.030890] ==================================================================
[   27.032777] BUG: KASAN: slab-use-after-free in strlen+0xa8/0xb0
[   27.033332] Read of size 1 at addr fff00000c1204c50 by task kunit_try_catch/247
[   27.034615] 
[   27.035048] CPU: 0 UID: 0 PID: 247 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc2-next-20241209 #1
[   27.036226] Tainted: [B]=BAD_PAGE, [N]=TEST
[   27.037123] Hardware name: linux,dummy-virt (DT)
[   27.037812] Call trace:
[   27.038170]  show_stack+0x20/0x38 (C)
[   27.038652]  dump_stack_lvl+0x8c/0xd0
[   27.039529]  print_report+0x118/0x5e0
[   27.040176]  kasan_report+0xc8/0x118
[   27.041047]  __asan_report_load1_noabort+0x20/0x30
[   27.041997]  strlen+0xa8/0xb0
[   27.042758]  kasan_strings+0x304/0x8d8
[   27.043562]  kunit_try_run_case+0x14c/0x3d0
[   27.044304]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   27.045151]  kthread+0x24c/0x2d0
[   27.045678]  ret_from_fork+0x10/0x20
[   27.046447] 
[   27.046778] Allocated by task 247:
[   27.047725]  kasan_save_stack+0x3c/0x68
[   27.048252]  kasan_save_track+0x20/0x40
[   27.048768]  kasan_save_alloc_info+0x40/0x58
[   27.049292]  __kasan_kmalloc+0xd4/0xd8
[   27.050328]  __kmalloc_cache_noprof+0x15c/0x3c0
[   27.051529]  kasan_strings+0xb0/0x8d8
[   27.052034]  kunit_try_run_case+0x14c/0x3d0
[   27.052672]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   27.053409]  kthread+0x24c/0x2d0
[   27.053954]  ret_from_fork+0x10/0x20
[   27.054433] 
[   27.054752] Freed by task 247:
[   27.055893]  kasan_save_stack+0x3c/0x68
[   27.056482]  kasan_save_track+0x20/0x40
[   27.057037]  kasan_save_free_info+0x4c/0x78
[   27.057611]  __kasan_slab_free+0x6c/0x98
[   27.058162]  kfree+0x114/0x3c8
[   27.058616]  kasan_strings+0x124/0x8d8
[   27.059196]  kunit_try_run_case+0x14c/0x3d0
[   27.060256]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   27.060982]  kthread+0x24c/0x2d0
[   27.061486]  ret_from_fork+0x10/0x20
[   27.062015] 
[   27.062392] The buggy address belongs to the object at fff00000c1204c40
[   27.062392]  which belongs to the cache kmalloc-32 of size 32
[   27.064116] The buggy address is located 16 bytes inside of
[   27.064116]  freed 32-byte region [fff00000c1204c40, fff00000c1204c60)
[   27.065177] 
[   27.065515] The buggy address belongs to the physical page:
[   27.066653] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101204
[   27.067881] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   27.068774] page_type: f5(slab)
[   27.069382] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   27.070330] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   27.071077] page dumped because: kasan: bad access detected
[   27.071692] 
[   27.072770] Memory state around the buggy address:
[   27.073453]  fff00000c1204b00: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   27.074456]  fff00000c1204b80: 00 00 00 fc fc fc fc fc 00 00 00 04 fc fc fc fc
[   27.075734] >fff00000c1204c00: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   27.076437]                                                  ^
[   27.077196]  fff00000c1204c80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   27.077976]  fff00000c1204d00: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   27.078731] ==================================================================

[   27.475131] ==================================================================
[   27.475767] BUG: KASAN: slab-use-after-free in strlen+0x8f/0xb0
[   27.476734] Read of size 1 at addr ffff888102964dd0 by task kunit_try_catch/266
[   27.477551] 
[   27.478660] CPU: 0 UID: 0 PID: 266 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc2-next-20241209 #1
[   27.479611] Tainted: [B]=BAD_PAGE, [N]=TEST
[   27.480206] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   27.481060] Call Trace:
[   27.481396]  <TASK>
[   27.481738]  dump_stack_lvl+0x73/0xb0
[   27.482192]  print_report+0xd1/0x640
[   27.482770]  ? __virt_addr_valid+0x1db/0x2d0
[   27.483228]  ? kasan_complete_mode_report_info+0x64/0x200
[   27.483740]  kasan_report+0x102/0x140
[   27.484248]  ? strlen+0x8f/0xb0
[   27.484697]  ? strlen+0x8f/0xb0
[   27.485410]  __asan_report_load1_noabort+0x18/0x20
[   27.485970]  strlen+0x8f/0xb0
[   27.486495]  kasan_strings+0x425/0xb60
[   27.487078]  ? __pfx_kasan_strings+0x10/0x10
[   27.487639]  ? __schedule+0xc70/0x27e0
[   27.487979]  ? __pfx_read_tsc+0x10/0x10
[   27.488573]  ? ktime_get_ts64+0x86/0x230
[   27.488880]  kunit_try_run_case+0x1b3/0x490
[   27.489664]  ? __pfx_kunit_try_run_case+0x10/0x10
[   27.490310]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   27.490778]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   27.491155]  ? __kthread_parkme+0x82/0x160
[   27.491907]  ? preempt_count_sub+0x50/0x80
[   27.492527]  ? __pfx_kunit_try_run_case+0x10/0x10
[   27.493113]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   27.493692]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   27.494498]  kthread+0x257/0x310
[   27.494933]  ? __pfx_kthread+0x10/0x10
[   27.495338]  ret_from_fork+0x41/0x80
[   27.495790]  ? __pfx_kthread+0x10/0x10
[   27.496504]  ret_from_fork_asm+0x1a/0x30
[   27.496842]  </TASK>
[   27.497367] 
[   27.497689] Allocated by task 266:
[   27.498122]  kasan_save_stack+0x3d/0x60
[   27.498664]  kasan_save_track+0x18/0x40
[   27.499243]  kasan_save_alloc_info+0x3b/0x50
[   27.499762]  __kasan_kmalloc+0xb7/0xc0
[   27.500264]  __kmalloc_cache_noprof+0x184/0x410
[   27.500808]  kasan_strings+0xb9/0xb60
[   27.501264]  kunit_try_run_case+0x1b3/0x490
[   27.501753]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   27.502500]  kthread+0x257/0x310
[   27.503027]  ret_from_fork+0x41/0x80
[   27.503409]  ret_from_fork_asm+0x1a/0x30
[   27.503874] 
[   27.504189] Freed by task 266:
[   27.504566]  kasan_save_stack+0x3d/0x60
[   27.504857]  kasan_save_track+0x18/0x40
[   27.505514]  kasan_save_free_info+0x3f/0x60
[   27.506128]  __kasan_slab_free+0x56/0x70
[   27.506570]  kfree+0x123/0x3f0
[   27.507151]  kasan_strings+0x13c/0xb60
[   27.507717]  kunit_try_run_case+0x1b3/0x490
[   27.508216]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   27.508829]  kthread+0x257/0x310
[   27.509323]  ret_from_fork+0x41/0x80
[   27.509693]  ret_from_fork_asm+0x1a/0x30
[   27.510246] 
[   27.510462] The buggy address belongs to the object at ffff888102964dc0
[   27.510462]  which belongs to the cache kmalloc-32 of size 32
[   27.511491] The buggy address is located 16 bytes inside of
[   27.511491]  freed 32-byte region [ffff888102964dc0, ffff888102964de0)
[   27.513030] 
[   27.513196] The buggy address belongs to the physical page:
[   27.514075] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102964
[   27.515110] flags: 0x200000000000000(node=0|zone=2)
[   27.515550] page_type: f5(slab)
[   27.516182] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   27.516941] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   27.517771] page dumped because: kasan: bad access detected
[   27.518616] 
[   27.518893] Memory state around the buggy address:
[   27.519384]  ffff888102964c80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   27.520171]  ffff888102964d00: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   27.520855] >ffff888102964d80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   27.521807]                                                  ^
[   27.522716]  ffff888102964e00: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   27.523514]  ffff888102964e80: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   27.524327] ==================================================================