From: Simon Horman <horms@kernel.org>
To: Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org,
"Willem de Bruijn" <willemdebruijn.kernel@gmail.com>,
"Jason Wang" <jasowang@redhat.com>,
"Andrew Lunn" <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
"Eugenio Pérez" <eperezma@redhat.com>,
"Yuri Benditovich" <yuri.benditovich@daynix.com>,
"Akihiko Odaki" <akihiko.odaki@daynix.com>,
"Jonathan Corbet" <corbet@lwn.net>,
kvm@vger.kernel.org
Subject: Re: [PATCH v5 net-next 4/9] vhost-net: allow configuring extended features
Date: Sun, 22 Jun 2025 17:02:21 +0100 [thread overview]
Message-ID: <20250622160221.GH71935@horms.kernel.org> (raw)
In-Reply-To: <e195567cf1f705143477f6eee7b528ee15918873.1750436464.git.pabeni@redhat.com>
On Fri, Jun 20, 2025 at 07:39:48PM +0200, Paolo Abeni wrote:
> Use the extended feature type for 'acked_features' and implement
> two new ioctls operation allowing the user-space to set/query an
> unbounded amount of features.
>
> The actual number of processed features is limited by VIRTIO_FEATURES_MAX
> and attempts to set features above such limit fail with
> EOPNOTSUPP.
>
> Note that: the legacy ioctls implicitly truncate the negotiated
> features to the lower 64 bits range and the 'acked_backend_features'
> field don't need conversion, as the only negotiated feature there
> is in the low 64 bit range.
>
> Acked-by: Jason Wang <jasowang@redhat.com>
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
...
> + case VHOST_GET_FEATURES_ARRAY:
> + if (get_user(count, featurep))
> + return -EFAULT;
> +
> + /* Copy the net features, up to the user-provided buffer size */
> + argp += sizeof(u64);
> + copied = min(count, VIRTIO_FEATURES_DWORDS);
> + if (copy_to_user(argp, vhost_net_features,
> + copied * sizeof(u64)))
> + return -EFAULT;
> +
> + /* Zero the trailing space provided by user-space, if any */
> + if (clear_user(argp, (count - copied) * sizeof(u64)))
Hi Paolo,
Smatch warns to "check for integer overflow 'count'" on the line above.
Perhaps it is wrong. Or my analyais is. But it seems to me that an overflow
could occur if count is very large, say such that (count - copied) is more
than 2^64 / 8. As then (count - copied) * sizeof(u64) would overflow 64
bits.
By the same reasoning this could overflow 32 bits on systems where an
unsigned long, type type of the 2nd parameter of clear_user, is 32 bits.
> + return -EFAULT;
> + return 0;
...
next prev parent reply other threads:[~2025-06-22 16:02 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-20 17:39 [PATCH v5 net-next 0/9] virtio: introduce GSO over UDP tunnel Paolo Abeni
2025-06-20 17:39 ` [PATCH v5 net-next 1/9] scripts/kernel_doc.py: properly handle VIRTIO_DECLARE_FEATURES Paolo Abeni
2025-06-20 17:39 ` [PATCH v5 net-next 2/9] virtio: introduce extended features Paolo Abeni
2025-06-20 17:39 ` [PATCH v5 net-next 3/9] virtio_pci_modern: allow configuring " Paolo Abeni
2025-06-20 17:39 ` [PATCH v5 net-next 4/9] vhost-net: " Paolo Abeni
2025-06-22 16:02 ` Simon Horman [this message]
2025-06-23 10:58 ` Paolo Abeni
2025-06-24 14:40 ` Dan Carpenter
2025-06-20 17:39 ` [PATCH v5 net-next 5/9] virtio_net: add supports for extended offloads Paolo Abeni
2025-06-20 17:39 ` [PATCH v5 net-next 6/9] net: implement virtio helpers to handle UDP GSO tunneling Paolo Abeni
2025-06-20 17:39 ` [PATCH v5 net-next 7/9] virtio_net: enable gso over UDP tunnel support Paolo Abeni
2025-06-20 17:39 ` [PATCH v5 net-next 8/9] tun: " Paolo Abeni
2025-06-20 17:39 ` [PATCH v5 net-next 9/9] vhost/net: " Paolo Abeni
-- strict thread matches above, loose matches on Subject: below --
2025-06-24 9:30 [PATCH v5 net-next 4/9] vhost-net: allow configuring extended features kernel test robot
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=20250622160221.GH71935@horms.kernel.org \
--to=horms@kernel.org \
--cc=akihiko.odaki@daynix.com \
--cc=andrew+netdev@lunn.ch \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=kuba@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=willemdebruijn.kernel@gmail.com \
--cc=xuanzhuo@linux.alibaba.com \
--cc=yuri.benditovich@daynix.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.