[Bug 300845] bhyve: virtio-net RX chain over VTNET_MAXSEGS aborts bhyve

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 17 Nov 2026 16:08:05 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300845

            Bug ID: 300845
           Summary: bhyve: virtio-net RX chain over VTNET_MAXSEGS aborts
                    bhyve
           Product: Base System
           Version: 15.1-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bhyve
          Assignee: virtualization@FreeBSD.org
          Reporter: 1350430676@qq.com

Created attachment 277398
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=277398&action=edit
Reproduction bundle: PoC source, test script, runtime logs, crash output, and
SHA-256 manifest.

Environment:
- FreeBSD 15.1-RELEASE-p3 with snapshot-enabled bhyve/bhyvectl.
- Source releng/15.1 commit 88e7371d9.
- Device: virtio-net at 0:2:0.

pci_vtnet_rx() passes VTNET_MAXSEGS-riov_len as the iov capacity to
vq_getchain(), but a guest-controlled descriptor chain may return a larger
count n. The only guard is:

    assert(n >= 1 && riov_len + n <= VTNET_MAXSEGS);

The guest published a 300-descriptor RX chain. Save succeeded; restore
re-enabled the RX backend; the first tap frame reached the oversized chain.

Steps to reproduce:
1. Publish a 300-entry NEXT chain in a 1024-entry RX queue.
2. Do not ring QUEUE_NOTIFY.
3. Save normally and restore the unmodified snapshot.
4. Send one frame to the tap interface.

Expected: reject the oversized chain and drop/return it.
Actual: SIGABRT, exit 134, at pci_vtnet_rx.

A one-descriptor control with the same save/restore/frame flow remains alive.

Current status: the assertion remains in main c8e73127e and releng/15.1
95719d8a8 (15.1-RELEASE-p6).

Impact: denial of service and loss of the VM. The same guard is on the ordinary
RX path; this is not presented as restore-exclusive.

Suggested fix: enforce the caller's iov capacity inside the chain walk, return
an error instead of asserting, and validate restored queue state before
enabling RX.

-- 
You are receiving this mail because:
You are the assignee for the bug.