From: Hengyu Liang <hengyul@cs.unc.edu>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: "Jason Wang" <jasowangio@gmail.com>,
"Eugenio Pérez" <eperezma@redhat.com>,
"Paolo Abeni" <pabeni@redhat.com>,
kvm@vger.kernel.org, virtualization@lists.linux.dev,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] vhost/net: bound the count of VHOST_SET_FEATURES_ARRAY
Date: Sun, 22 Nov 2026 09:38:29 -0500 [thread overview]
Message-ID: <20261122143829.2674252-1-hengyul@cs.unc.edu> (raw)
In-Reply-To: <20261122092235-mutt-send-email-mst@kernel.org>
On Sun, Nov 22, 2026 at 09:25:37AM -0500, Michael S. Tsirkin wrote:
> this is followed by:
>
> virtio_features_zero(all_features);
> argp += sizeof(u64);
> copied = min(count, (u64)VIRTIO_FEATURES_U64S);
> if (copy_from_user(all_features, argp, copied * sizeof(u64)))
> return -EFAULT;
>
> copies at most 8 bytes.
>
>
> did you test that this patch actually helps anything?
That first copy is bounded, yes. The unbounded part is the loop right
after it, which is outside the diff context:
for (i = copied; i < count; ++i) {
if (copy_from_user(&features, featurep + 1 + i,
sizeof(features)))
return -EFAULT;
if (features)
return -EOPNOTSUPP;
}
It reads one u64 per iteration up to the count from user space. With
count = U64_MAX and a large zero-filled mapping, it only stops at the
first unreadable address.
Yes, I tested it, on the vhost tree at 44293796526f (KASAN + lockdep),
count = U64_MAX:
1 GiB zero-filled mapping:
without the patch: EFAULT after 27.4 s
with the patch: E2BIG at once
2 GiB mapping, SIGKILL sent 1 s into the ioctl:
without the patch: the process is reaped 46.7 s after the kill
with the patch: the ioctl has already returned
I have a small reproducer (a few lines of C). Since I found this with
the help of an LLM, Documentation/process/security-bugs.rst asks me to
treat it as public and not post the reproducer to a public list, so I
have not included it here. I am happy to send it to you off-list if it
would help.
Thanks,
Hengyu
next prev parent reply other threads:[~2026-11-22 14:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 12:09 Hengyu Liang
2026-11-22 14:25 ` Michael S. Tsirkin
2026-11-22 14:38 ` Hengyu Liang [this message]
2026-11-22 19:14 ` 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=20261122143829.2674252-1-hengyul@cs.unc.edu \
--to=hengyul@cs.unc.edu \
--cc=eperezma@redhat.com \
--cc=jasowangio@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=virtualization@lists.linux.dev \
/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®