From: "Michael S. Tsirkin" <mst@redhat.com>
To: 김승중 <seungjung0711@gmail.com>
Cc: qemu-devel@nongnu.org, "Stefano Garzarella" <sgarzare@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Mauro Matteo Cascella" <mcascell@redhat.com>
Subject: Re: [PATCH] vhost: Reject oversized inflight migration buffers
Date: Mon, 27 Jul 2026 08:48:56 -0400 [thread overview]
Message-ID: <20260727084637-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CAHntc+O1jaJhj1_k6kTHDp7u_1DdPUCKZNA_AxWYh+SKraXS8A@mail.gmail.com>
On Mon, Jul 27, 2026 at 05:45:47AM -0700, 김승중 wrote:
> The inflight buffer size is migrated as a uint64_t, but vmstate_size()
> reads VMS_VBUFFER sizes as int32_t. Values above INT32_MAX therefore
> become negative and are converted to a very large size_t while loading
> the buffer, allowing writes beyond the smaller memfd-backed mapping.
>
> Reject sizes that cannot be represented by vmstate_size() before
> allocating the destination buffer.
>
> Fixes: CVE-2026-6426
This CVE really shouldn't be there.
> Reported-by: Seungjung Kim <seungjung0711@gmail.com>
> Signed-off-by: Seungjung Kim <seungjung0711@gmail.com>
This doen't fix it properly, it only fixes values 2g to 4g, but above 4g
is still wrong.
A better fix here:
https://lore.kernel.org/all/9e2d0b03a60642236e6df8edde7b3562f5f9849f.1785101237.git.mst@redhat.com/
>
> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> index af41841b52..82eb9407ae 100644
> --- a/hw/virtio/vhost.c
> +++ b/hw/virtio/vhost.c
> @@ -2022,11 +2022,18 @@ void vhost_get_features_ex(struct vhost_dev *hdev,
> static bool vhost_inflight_buffer_pre_load(void *opaque, Error **errp)
> {
> struct vhost_inflight *inflight = opaque;
> -
> int fd = -1;
pls don't make unrelated changes like this.
> - void *addr = qemu_memfd_alloc("vhost-inflight", inflight->size,
> - F_SEAL_GROW | F_SEAL_SHRINK | F_SEAL_SEAL,
> - &fd, errp);
> + void *addr;
> +
> + if (inflight->size > INT32_MAX) {
> + error_setg(errp, "inflight buffer size %" PRIu64
> + " exceeds maximum %d", inflight->size, INT32_MAX);
> + return false;
> + }
> +
> + addr = qemu_memfd_alloc("vhost-inflight", inflight->size,
> + F_SEAL_GROW | F_SEAL_SHRINK | F_SEAL_SEAL,
> + &fd, errp);
> if (!addr) {
> return false;
> }
> --
> 2.50.1 (Apple Git-155)
next prev parent reply other threads:[~2026-07-27 12:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-27 12:45 [PATCH] vhost: Reject oversized inflight migration buffers 김승중
2026-07-27 12:48 ` Michael S. Tsirkin [this message]
2026-07-27 13:02 ` 김승중
2026-07-27 13:16 ` Michael S. Tsirkin
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=20260727084637-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=berrange@redhat.com \
--cc=mcascell@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=seungjung0711@gmail.com \
--cc=sgarzare@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.