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

Environment
qemu-arm64
qemu-x86_64

[   27.080969] ==================================================================
[   27.081625] BUG: KASAN: slab-use-after-free in strnlen+0x80/0x88
[   27.082201] Read of size 1 at addr fff00000c1204c50 by task kunit_try_catch/247
[   27.082872] 
[   27.083213] CPU: 0 UID: 0 PID: 247 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc2-next-20241209 #1
[   27.084325] Tainted: [B]=BAD_PAGE, [N]=TEST
[   27.085083] Hardware name: linux,dummy-virt (DT)
[   27.085674] Call trace:
[   27.086158]  show_stack+0x20/0x38 (C)
[   27.086678]  dump_stack_lvl+0x8c/0xd0
[   27.088116]  print_report+0x118/0x5e0
[   27.088716]  kasan_report+0xc8/0x118
[   27.089268]  __asan_report_load1_noabort+0x20/0x30
[   27.089999]  strnlen+0x80/0x88
[   27.090560]  kasan_strings+0x364/0x8d8
[   27.091184]  kunit_try_run_case+0x14c/0x3d0
[   27.091656]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   27.092417]  kthread+0x24c/0x2d0
[   27.093165]  ret_from_fork+0x10/0x20
[   27.093713] 
[   27.094033] Allocated by task 247:
[   27.094572]  kasan_save_stack+0x3c/0x68
[   27.095194]  kasan_save_track+0x20/0x40
[   27.096489]  kasan_save_alloc_info+0x40/0x58
[   27.097083]  __kasan_kmalloc+0xd4/0xd8
[   27.097595]  __kmalloc_cache_noprof+0x15c/0x3c0
[   27.098205]  kasan_strings+0xb0/0x8d8
[   27.098771]  kunit_try_run_case+0x14c/0x3d0
[   27.099366]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   27.100233]  kthread+0x24c/0x2d0
[   27.100788]  ret_from_fork+0x10/0x20
[   27.101327] 
[   27.101687] Freed by task 247:
[   27.102160]  kasan_save_stack+0x3c/0x68
[   27.102839]  kasan_save_track+0x20/0x40
[   27.104142]  kasan_save_free_info+0x4c/0x78
[   27.104741]  __kasan_slab_free+0x6c/0x98
[   27.105296]  kfree+0x114/0x3c8
[   27.105985]  kasan_strings+0x124/0x8d8
[   27.106460]  kunit_try_run_case+0x14c/0x3d0
[   27.107106]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   27.108100]  kthread+0x24c/0x2d0
[   27.108615]  ret_from_fork+0x10/0x20
[   27.109160] 
[   27.109515] The buggy address belongs to the object at fff00000c1204c40
[   27.109515]  which belongs to the cache kmalloc-32 of size 32
[   27.110817] The buggy address is located 16 bytes inside of
[   27.110817]  freed 32-byte region [fff00000c1204c40, fff00000c1204c60)
[   27.112670] 
[   27.112988] The buggy address belongs to the physical page:
[   27.113682] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101204
[   27.114620] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   27.115793] page_type: f5(slab)
[   27.116262] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   27.117124] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   27.117958] page dumped because: kasan: bad access detected
[   27.118615] 
[   27.119646] Memory state around the buggy address:
[   27.120243]  fff00000c1204b00: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   27.121122]  fff00000c1204b80: 00 00 00 fc fc fc fc fc 00 00 00 04 fc fc fc fc
[   27.121920] >fff00000c1204c00: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   27.122718]                                                  ^
[   27.123357]  fff00000c1204c80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   27.124306]  fff00000c1204d00: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   27.125235] ==================================================================

[   27.525936] ==================================================================
[   27.526707] BUG: KASAN: slab-use-after-free in strnlen+0x73/0x80
[   27.528207] Read of size 1 at addr ffff888102964dd0 by task kunit_try_catch/266
[   27.528909] 
[   27.529330] CPU: 0 UID: 0 PID: 266 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc2-next-20241209 #1
[   27.530397] Tainted: [B]=BAD_PAGE, [N]=TEST
[   27.530901] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   27.531683] Call Trace:
[   27.532212]  <TASK>
[   27.532530]  dump_stack_lvl+0x73/0xb0
[   27.533083]  print_report+0xd1/0x640
[   27.533601]  ? __virt_addr_valid+0x1db/0x2d0
[   27.534248]  ? kasan_complete_mode_report_info+0x64/0x200
[   27.534949]  kasan_report+0x102/0x140
[   27.535521]  ? strnlen+0x73/0x80
[   27.535925]  ? strnlen+0x73/0x80
[   27.536411]  __asan_report_load1_noabort+0x18/0x20
[   27.536947]  strnlen+0x73/0x80
[   27.537446]  kasan_strings+0x4c3/0xb60
[   27.537884]  ? __pfx_kasan_strings+0x10/0x10
[   27.538737]  ? __schedule+0xc70/0x27e0
[   27.539181]  ? __pfx_read_tsc+0x10/0x10
[   27.539585]  ? ktime_get_ts64+0x86/0x230
[   27.540405]  kunit_try_run_case+0x1b3/0x490
[   27.541604]  ? __pfx_kunit_try_run_case+0x10/0x10
[   27.542672]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   27.543190]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   27.543606]  ? __kthread_parkme+0x82/0x160
[   27.544165]  ? preempt_count_sub+0x50/0x80
[   27.544563]  ? __pfx_kunit_try_run_case+0x10/0x10
[   27.544974]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   27.545488]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   27.546069]  kthread+0x257/0x310
[   27.546591]  ? __pfx_kthread+0x10/0x10
[   27.547037]  ret_from_fork+0x41/0x80
[   27.547360]  ? __pfx_kthread+0x10/0x10
[   27.547745]  ret_from_fork_asm+0x1a/0x30
[   27.548214]  </TASK>
[   27.548479] 
[   27.548708] Allocated by task 266:
[   27.549117]  kasan_save_stack+0x3d/0x60
[   27.549447]  kasan_save_track+0x18/0x40
[   27.549799]  kasan_save_alloc_info+0x3b/0x50
[   27.550359]  __kasan_kmalloc+0xb7/0xc0
[   27.550837]  __kmalloc_cache_noprof+0x184/0x410
[   27.551197]  kasan_strings+0xb9/0xb60
[   27.551640]  kunit_try_run_case+0x1b3/0x490
[   27.551998]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   27.552445]  kthread+0x257/0x310
[   27.552705]  ret_from_fork+0x41/0x80
[   27.553184]  ret_from_fork_asm+0x1a/0x30
[   27.553722] 
[   27.554099] Freed by task 266:
[   27.554366]  kasan_save_stack+0x3d/0x60
[   27.554856]  kasan_save_track+0x18/0x40
[   27.555177]  kasan_save_free_info+0x3f/0x60
[   27.555659]  __kasan_slab_free+0x56/0x70
[   27.556200]  kfree+0x123/0x3f0
[   27.556468]  kasan_strings+0x13c/0xb60
[   27.556833]  kunit_try_run_case+0x1b3/0x490
[   27.557381]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   27.558159]  kthread+0x257/0x310
[   27.558517]  ret_from_fork+0x41/0x80
[   27.559050]  ret_from_fork_asm+0x1a/0x30
[   27.559414] 
[   27.559661] The buggy address belongs to the object at ffff888102964dc0
[   27.559661]  which belongs to the cache kmalloc-32 of size 32
[   27.560356] The buggy address is located 16 bytes inside of
[   27.560356]  freed 32-byte region [ffff888102964dc0, ffff888102964de0)
[   27.561430] 
[   27.561591] The buggy address belongs to the physical page:
[   27.562531] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102964
[   27.563248] flags: 0x200000000000000(node=0|zone=2)
[   27.563683] page_type: f5(slab)
[   27.564076] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   27.564924] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   27.565415] page dumped because: kasan: bad access detected
[   27.565788] 
[   27.566050] Memory state around the buggy address:
[   27.566882]  ffff888102964c80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   27.567464]  ffff888102964d00: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   27.568075] >ffff888102964d80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   27.568898]                                                  ^
[   27.569437]  ffff888102964e00: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   27.570100]  ffff888102964e80: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   27.570655] ==================================================================