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

Environment
qemu-arm64
qemu-x86_64

[   33.230703] ==================================================================
[   33.232978] BUG: KASAN: slab-use-after-free in strnlen+0x80/0x88
[   33.233899] Read of size 1 at addr fff00000c63d1e50 by task kunit_try_catch/248
[   33.234744] 
[   33.235102] CPU: 0 UID: 0 PID: 248 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241205 #1
[   33.236572] Tainted: [B]=BAD_PAGE, [N]=TEST
[   33.237164] Hardware name: linux,dummy-virt (DT)
[   33.237680] Call trace:
[   33.238181]  show_stack+0x20/0x38 (C)
[   33.238896]  dump_stack_lvl+0x8c/0xd0
[   33.239477]  print_report+0x118/0x5e0
[   33.240122]  kasan_report+0xc8/0x118
[   33.240675]  __asan_report_load1_noabort+0x20/0x30
[   33.241339]  strnlen+0x80/0x88
[   33.241914]  kasan_strings+0x364/0x8d8
[   33.242552]  kunit_try_run_case+0x14c/0x3d0
[   33.243221]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.243973]  kthread+0x24c/0x2d0
[   33.244521]  ret_from_fork+0x10/0x20
[   33.245083] 
[   33.245416] Allocated by task 248:
[   33.245951]  kasan_save_stack+0x3c/0x68
[   33.246587]  kasan_save_track+0x20/0x40
[   33.247170]  kasan_save_alloc_info+0x40/0x58
[   33.247796]  __kasan_kmalloc+0xd4/0xd8
[   33.248373]  __kmalloc_cache_noprof+0x15c/0x3c0
[   33.248904]  kasan_strings+0xb0/0x8d8
[   33.249531]  kunit_try_run_case+0x14c/0x3d0
[   33.250081]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.250924]  kthread+0x24c/0x2d0
[   33.251526]  ret_from_fork+0x10/0x20
[   33.252110] 
[   33.252403] Freed by task 248:
[   33.252921]  kasan_save_stack+0x3c/0x68
[   33.253573]  kasan_save_track+0x20/0x40
[   33.254174]  kasan_save_free_info+0x4c/0x78
[   33.254796]  __kasan_slab_free+0x6c/0x98
[   33.255357]  kfree+0x114/0x3c8
[   33.255808]  kasan_strings+0x124/0x8d8
[   33.256489]  kunit_try_run_case+0x14c/0x3d0
[   33.257111]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   33.257673]  kthread+0x24c/0x2d0
[   33.258234]  ret_from_fork+0x10/0x20
[   33.258899] 
[   33.259194] The buggy address belongs to the object at fff00000c63d1e40
[   33.259194]  which belongs to the cache kmalloc-32 of size 32
[   33.260621] The buggy address is located 16 bytes inside of
[   33.260621]  freed 32-byte region [fff00000c63d1e40, fff00000c63d1e60)
[   33.262041] 
[   33.262391] The buggy address belongs to the physical page:
[   33.263077] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1063d1
[   33.264021] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   33.264774] page_type: f5(slab)
[   33.265349] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   33.266221] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   33.267261] page dumped because: kasan: bad access detected
[   33.267971] 
[   33.268277] Memory state around the buggy address:
[   33.268920]  fff00000c63d1d00: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   33.269843]  fff00000c63d1d80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   33.270692] >fff00000c63d1e00: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   33.271588]                                                  ^
[   33.272383]  fff00000c63d1e80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   33.273303]  fff00000c63d1f00: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   33.274117] ==================================================================

[   31.083991] ==================================================================
[   31.084744] BUG: KASAN: slab-use-after-free in strnlen+0x73/0x80
[   31.086551] Read of size 1 at addr ffff888102a07ed0 by task kunit_try_catch/266
[   31.088144] 
[   31.088334] CPU: 1 UID: 0 PID: 266 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241205 #1
[   31.089984] Tainted: [B]=BAD_PAGE, [N]=TEST
[   31.090587] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   31.092315] Call Trace:
[   31.092592]  <TASK>
[   31.093027]  dump_stack_lvl+0x73/0xb0
[   31.093648]  print_report+0xd1/0x640
[   31.094356]  ? __virt_addr_valid+0x1db/0x2d0
[   31.095401]  ? kasan_complete_mode_report_info+0x64/0x200
[   31.095979]  kasan_report+0x102/0x140
[   31.096458]  ? strnlen+0x73/0x80
[   31.097474]  ? strnlen+0x73/0x80
[   31.098252]  __asan_report_load1_noabort+0x18/0x20
[   31.099063]  strnlen+0x73/0x80
[   31.099436]  kasan_strings+0x4c3/0xb60
[   31.100598]  ? __pfx_kasan_strings+0x10/0x10
[   31.101164]  ? __schedule+0xc70/0x27e0
[   31.101660]  ? __pfx_read_tsc+0x10/0x10
[   31.102471]  ? ktime_get_ts64+0x86/0x230
[   31.103182]  kunit_try_run_case+0x1b3/0x490
[   31.103590]  ? __pfx_kunit_try_run_case+0x10/0x10
[   31.104324]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   31.105170]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   31.105665]  ? __kthread_parkme+0x82/0x160
[   31.106872]  ? preempt_count_sub+0x50/0x80
[   31.107734]  ? __pfx_kunit_try_run_case+0x10/0x10
[   31.108153]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   31.109195]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   31.110147]  kthread+0x257/0x310
[   31.110881]  ? __pfx_kthread+0x10/0x10
[   31.111454]  ret_from_fork+0x41/0x80
[   31.112381]  ? __pfx_kthread+0x10/0x10
[   31.112774]  ret_from_fork_asm+0x1a/0x30
[   31.113410]  </TASK>
[   31.114393] 
[   31.114578] Allocated by task 266:
[   31.114866]  kasan_save_stack+0x3d/0x60
[   31.115907]  kasan_save_track+0x18/0x40
[   31.116632]  kasan_save_alloc_info+0x3b/0x50
[   31.117590]  __kasan_kmalloc+0xb7/0xc0
[   31.118013]  __kmalloc_cache_noprof+0x184/0x410
[   31.118639]  kasan_strings+0xb9/0xb60
[   31.119724]  kunit_try_run_case+0x1b3/0x490
[   31.120303]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   31.121035]  kthread+0x257/0x310
[   31.121486]  ret_from_fork+0x41/0x80
[   31.121806]  ret_from_fork_asm+0x1a/0x30
[   31.122389] 
[   31.122612] Freed by task 266:
[   31.123124]  kasan_save_stack+0x3d/0x60
[   31.123878]  kasan_save_track+0x18/0x40
[   31.124296]  kasan_save_free_info+0x3f/0x60
[   31.124895]  __kasan_slab_free+0x56/0x70
[   31.125659]  kfree+0x123/0x3f0
[   31.126182]  kasan_strings+0x13c/0xb60
[   31.126860]  kunit_try_run_case+0x1b3/0x490
[   31.127518]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   31.128210]  kthread+0x257/0x310
[   31.128510]  ret_from_fork+0x41/0x80
[   31.128932]  ret_from_fork_asm+0x1a/0x30
[   31.129722] 
[   31.130110] The buggy address belongs to the object at ffff888102a07ec0
[   31.130110]  which belongs to the cache kmalloc-32 of size 32
[   31.131225] The buggy address is located 16 bytes inside of
[   31.131225]  freed 32-byte region [ffff888102a07ec0, ffff888102a07ee0)
[   31.132467] 
[   31.132635] The buggy address belongs to the physical page:
[   31.133394] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a07
[   31.134374] flags: 0x200000000000000(node=0|zone=2)
[   31.135045] page_type: f5(slab)
[   31.135350] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   31.135950] raw: 0000000000000000 0000000000400040 00000000f5000000 0000000000000000
[   31.136996] page dumped because: kasan: bad access detected
[   31.137390] 
[   31.137548] Memory state around the buggy address:
[   31.138398]  ffff888102a07d80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   31.139606]  ffff888102a07e00: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   31.140198] >ffff888102a07e80: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   31.141054]                                                  ^
[   31.141706]  ffff888102a07f00: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   31.142762]  ffff888102a07f80: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   31.143553] ==================================================================