Discussion of the VIRTIO specification
 help / color / mirror / Atom feed
From: Amanda Liem <Amanda.Liem@amd.com>
To: <virtio-comment@lists.linux.dev>
Cc: <mvaralar@redhat.com>, <parav@nvidia.com>,
	<Nathaniel.McCallum@amd.com>, Amanda Liem <Amanda.Liem@amd.com>
Subject: Re: [PATCH v2] virtio-net: Add VIRTIO_NET_F_LABEL for a per-instance label
Date: Tue, 27 Oct 2026 10:48:14 -0500	[thread overview]
Message-ID: <20261027154814.13762-1-Amanda.Liem@amd.com> (raw)
In-Reply-To: <ar_rFCrex3b9Nz6O@mvaralar-thinkpadx1carbongen13.rmtfr.csb>

On Thu, Oct 02, 2026 at 17:34, Matias Ezequiel Vara Larsen <mvaralar@redhat.com> wrote:
> The manifest will tell the guest what are the expected virtio-nets that
> the host shall expose?

Yes. The manifest is guest-side input, shipped in the trusted image, that
lists the expected interfaces and their intended configuration. The host
builds devices to match, and the guest uses each device's label as the key
to map a discovered device back to its manifest entry. The manifest format
is out of scope for virtio - the spec defines only the label field, and the
manifest is one example consumer of it.

> Does it make sense to allow length to be zero?

I don't think it does. VIRTIO_NET_F_LABEL is negotiated per device, so a
device with no label to present simply does not offer the feature rather
than offering an empty one - an empty value carries no information and
cannot match any expected name. v3 requires label_len to be between 1 and
VIRTIO_NET_LABEL_MAX.

> What is the state of the device if label_len is bigger than
> VIRTIO_NET_LABEL_MAX? How this error shall be handled?

A compliant device always sets label_len <= VIRTIO_NET_LABEL_MAX, so the
device side carries no new requirement here - the over-length case only
arises with a non-compliant device, and the handling is entirely
driver-side defensive. v3 makes that explicit: the driver MUST NOT read
label beyond VIRTIO_NET_LABEL_MAX octets (no out-of-bounds read), MUST NOT
use the value, and SHOULD set the FAILED device status bit - the usual way
a driver signals it has given up on a device.

I used SHOULD rather than MUST for FAILED on purpose, since the label is
descriptive only: a driver that would rather treat the field as absent and
keep the device running can reasonably do so. If you think ignoring the
field is the better default I am happy to weaken it to that. FAILED seemed
the safer baseline given that the field is attacker-controlled on an
untrusted host.

I'll send a v3 with both the zero-length and over-length changes.

Thanks,
Amanda

      reply	other threads:[~2026-10-27 15:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24 15:30 [PATCH v2] virtio-net: Add VIRTIO_NET_F_LABEL for a per-instance label Amanda Liem
2026-10-02 17:34 ` Matias Ezequiel Vara Larsen
2026-10-27 15:48   ` Amanda Liem [this message]

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=20261027154814.13762-1-Amanda.Liem@amd.com \
    --to=amanda.liem@amd.com \
    --cc=Nathaniel.McCallum@amd.com \
    --cc=mvaralar@redhat.com \
    --cc=parav@nvidia.com \
    --cc=virtio-comment@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