Nikita Zhandarovich
25460d6f39
net/9p: fix uninit-value in p9_client_rpc()
...
Syzbot with the help of KMSAN reported the following error:
BUG: KMSAN: uninit-value in trace_9p_client_res include/trace/events/9p.h:146 [inline]
BUG: KMSAN: uninit-value in p9_client_rpc+0x1314/0x1340 net/9p/client.c:754
trace_9p_client_res include/trace/events/9p.h:146 [inline]
p9_client_rpc+0x1314/0x1340 net/9p/client.c:754
p9_client_create+0x1551/0x1ff0 net/9p/client.c:1031
v9fs_session_init+0x1b9/0x28e0 fs/9p/v9fs.c:410
v9fs_mount+0xe2/0x12b0 fs/9p/vfs_super.c:122
legacy_get_tree+0x114/0x290 fs/fs_context.c:662
vfs_get_tree+0xa7/0x570 fs/super.c:1797
do_new_mount+0x71f/0x15e0 fs/namespace.c:3352
path_mount+0x742/0x1f20 fs/namespace.c:3679
do_mount fs/namespace.c:3692 [inline]
__do_sys_mount fs/namespace.c:3898 [inline]
__se_sys_mount+0x725/0x810 fs/namespace.c:3875
__x64_sys_mount+0xe4/0x150 fs/namespace.c:3875
do_syscall_64+0xd5/0x1f0
entry_SYSCALL_64_after_hwframe+0x6d/0x75
Uninit was created at:
__alloc_pages+0x9d6/0xe70 mm/page_alloc.c:4598
__alloc_pages_node include/linux/gfp.h:238 [inline]
alloc_pages_node include/linux/gfp.h:261 [inline]
alloc_slab_page mm/slub.c:2175 [inline]
allocate_slab mm/slub.c:2338 [inline]
new_slab+0x2de/0x1400 mm/slub.c:2391
___slab_alloc+0x1184/0x33d0 mm/slub.c:3525
__slab_alloc mm/slub.c:3610 [inline]
__slab_alloc_node mm/slub.c:3663 [inline]
slab_alloc_node mm/slub.c:3835 [inline]
kmem_cache_alloc+0x6d3/0xbe0 mm/slub.c:3852
p9_tag_alloc net/9p/client.c:278 [inline]
p9_client_prepare_req+0x20a/0x1770 net/9p/client.c:641
p9_client_rpc+0x27e/0x1340 net/9p/client.c:688
p9_client_create+0x1551/0x1ff0 net/9p/client.c:1031
v9fs_session_init+0x1b9/0x28e0 fs/9p/v9fs.c:410
v9fs_mount+0xe2/0x12b0 fs/9p/vfs_super.c:122
legacy_get_tree+0x114/0x290 fs/fs_context.c:662
vfs_get_tree+0xa7/0x570 fs/super.c:1797
do_new_mount+0x71f/0x15e0 fs/namespace.c:3352
path_mount+0x742/0x1f20 fs/namespace.c:3679
do_mount fs/namespace.c:3692 [inline]
__do_sys_mount fs/namespace.c:3898 [inline]
__se_sys_mount+0x725/0x810 fs/namespace.c:3875
__x64_sys_mount+0xe4/0x150 fs/namespace.c:3875
do_syscall_64+0xd5/0x1f0
entry_SYSCALL_64_after_hwframe+0x6d/0x75
If p9_check_errors() fails early in p9_client_rpc(), req->rc.tag
will not be properly initialized. However, trace_9p_client_res()
ends up trying to print it out anyway before p9_client_rpc()
finishes.
Fix this issue by assigning default values to p9_fcall fields
such as 'tag' and (just in case KMSAN unearths something new) 'id'
during the tag allocation stage.
Reported-and-tested-by: syzbot+ff14db38f56329ef68df@syzkaller.appspotmail.com
Fixes: 348b59012e5c ("net/9p: Convert net/9p protocol dumps to tracepoints")
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Reviewed-by: Christian Schoenebeck <linux_oss@crudebyte.com>
Cc: stable@vger.kernel.org
Message-ID: <20240408141039.30428-1-n.zhandarovich@fintech.ru>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
2024-05-21 21:27:28 +09:00
..
2024-02-09 14:12:01 -08:00
2024-05-21 21:27:28 +09:00
2024-05-02 11:02:48 +02:00
2024-05-08 12:17:19 +01:00
2024-02-09 14:12:01 -08:00
2024-04-23 11:35:52 +02:00
2024-03-29 20:18:43 +01:00
2024-05-03 13:05:54 -04:00
2024-03-11 18:06:04 -07:00
2024-05-08 10:37:57 +01:00
2024-01-05 08:06:35 -08:00
2024-02-20 15:32:45 +01:00
2024-03-06 12:43:01 +01:00
2024-05-06 13:38:14 +02:00
2024-03-21 14:41:00 -07:00
2024-03-19 19:37:57 -07:00
2024-01-11 10:07:29 -08:00
2024-03-07 20:37:13 -08:00
2024-04-25 08:20:54 -07:00
2024-03-06 20:40:20 -08:00
2024-02-08 18:32:29 -08:00
2024-05-08 18:56:30 -07:00
2024-03-08 20:35:33 -08:00
2024-05-03 15:56:15 -07:00
2024-05-08 18:57:12 -07:00
2024-03-19 11:38:27 -07:00
2024-03-11 09:53:22 +00:00
2024-02-09 14:12:01 -08:00
2024-04-26 13:48:24 +02:00
2024-01-30 13:49:09 +01:00
2024-04-19 10:02:27 +02:00
2024-03-06 21:01:26 +01:00
2024-02-29 14:24:56 -08:00
2024-03-14 18:03:09 -07:00
2024-05-07 17:23:35 -07:00
2024-04-25 10:42:57 +02:00
2024-02-28 19:37:34 -08:00
2024-03-11 15:48:34 -07:00
2024-03-07 10:36:58 +01:00
2024-05-07 16:40:06 -07:00
2024-04-26 12:20:01 +02:00
2024-04-24 17:14:24 -07:00
2024-03-18 12:29:53 +00:00
2024-05-06 18:30:00 -07:00
2023-12-29 08:43:59 +00:00
2024-01-01 18:41:29 +00:00
2024-03-29 12:04:09 -07:00
2024-05-08 08:05:03 -07:00
2024-04-17 18:22:52 -07:00
2024-03-07 21:12:43 -08:00
2024-05-09 10:03:43 +02:00
2024-04-29 12:07:37 -07:00
2024-02-16 09:36:37 +00:00
2024-05-01 18:39:44 -07:00
2024-04-25 08:32:37 -07:00
2024-04-25 08:37:02 -07:00
2024-04-02 18:00:24 -07:00
2024-04-19 10:02:17 +02:00
2024-03-11 09:53:22 +00:00
2024-04-05 22:47:22 -07:00
2024-04-26 06:44:33 +02:00
2024-02-18 10:19:21 +00:00
2024-01-31 16:41:16 -08:00
2024-03-14 16:48:53 -07:00