mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wang Liang <wangliang74@huawei.com>
To: <bsdhenrymartin@gmail.com>, <huntazhang@tencent.com>,
	<jitxie@tencent.com>, <landonsun@tencent.com>,
	<stefanha@redhat.com>, <sgarzare@redhat.com>, <mst@redhat.com>,
	<jasowang@redhat.com>, <xuanzhuo@linux.alibaba.com>,
	<eperezma@redhat.com>, <davem@davemloft.net>,
	<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<horms@kernel.org>
Cc: <kvm@vger.kernel.org>, <virtualization@lists.linux.dev>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Henry Martin <bsdhenryma@tencent.com>,
	TCS Robot <tcs_robot@tencent.com>
Subject: Re: [PATCH v1] VSOCK: fix Information Leak in virtio_transport_shutdown()
Date: Tue, 5 Aug 2025 14:55:28 +0800	[thread overview]
Message-ID: <a841c987-5cd1-4105-94be-e0ea55068c5a@huawei.com> (raw)
In-Reply-To: <20250805051009.1766587-1-tcs_kernel@tencent.com>


在 2025/8/5 13:10, bsdhenrymartin@gmail.com 写道:
> From: Henry Martin <bsdhenryma@tencent.com>
>
> The `struct virtio_vsock_pkt_info` is declared on the stack but only
> partially initialized (only `op`, `flags`, and `vsk` are set)
>
> The uninitialized fields (including `pkt_len`, `remote_cid`,
> `remote_port`, etc.) contain residual kernel stack data. This structure
> is passed to `virtio_transport_send_pkt_info()`, which uses the
> uninitialized fields.
>
> Fixes: 06a8fc78367d ("VSOCK: Introduce virtio_vsock_common.ko")
> Reported-by: TCS Robot <tcs_robot@tencent.com>
> Signed-off-by: Henry Martin <bsdhenryma@tencent.com>
> ---
>   net/vmw_vsock/virtio_transport_common.c | 15 +++++++--------
>   1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
> index fe92e5fa95b4..cb391a98d025 100644
> --- a/net/vmw_vsock/virtio_transport_common.c
> +++ b/net/vmw_vsock/virtio_transport_common.c
> @@ -1073,14 +1073,14 @@ EXPORT_SYMBOL_GPL(virtio_transport_connect);
>   
>   int virtio_transport_shutdown(struct vsock_sock *vsk, int mode)
>   {
> -	struct virtio_vsock_pkt_info info = {
> -		.op = VIRTIO_VSOCK_OP_SHUTDOWN,
> -		.flags = (mode & RCV_SHUTDOWN ?
> -			  VIRTIO_VSOCK_SHUTDOWN_RCV : 0) |
> -			 (mode & SEND_SHUTDOWN ?
> -			  VIRTIO_VSOCK_SHUTDOWN_SEND : 0),
> -		.vsk = vsk,
> -	};
> +	struct virtio_vsock_pkt_info info = {0};
> +
> +	info.op = VIRTIO_VSOCK_OP_SHUTDOWN;
> +	info.flags = (mode & RCV_SHUTDOWN ?
> +			VIRTIO_VSOCK_SHUTDOWN_RCV : 0) |
> +			(mode & SEND_SHUTDOWN ?
> +			VIRTIO_VSOCK_SHUTDOWN_SEND : 0);
> +	info.vsk = vsk;
>   
>   	return virtio_transport_send_pkt_info(vsk, &info);
>   }


No. The unassigned members (including `pkt_len`, `remote_cid`,
`remote_port`, etc.) will be automatically initialized to 0?


  reply	other threads:[~2025-08-05  6:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-05  5:10 bsdhenrymartin
2025-08-05  6:55 ` Wang Liang [this message]
2025-08-05  7:00 ` Stefano Garzarella
2025-08-05  8:53   ` henry martin
2025-08-05  8:08 ` [PATCH] " Markus Elfring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a841c987-5cd1-4105-94be-e0ea55068c5a@huawei.com \
    --to=wangliang74@huawei.com \
    --cc=bsdhenryma@tencent.com \
    --cc=bsdhenrymartin@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eperezma@redhat.com \
    --cc=horms@kernel.org \
    --cc=huntazhang@tencent.com \
    --cc=jasowang@redhat.com \
    --cc=jitxie@tencent.com \
    --cc=kuba@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=landonsun@tencent.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sgarzare@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=tcs_robot@tencent.com \
    --cc=virtualization@lists.linux.dev \
    --cc=xuanzhuo@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®