[Bug 300843] bhyve: e1000 RDLEN=0 causes SIGFPE in receive path

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

            Bug ID: 300843
           Summary: bhyve: e1000 RDLEN=0 causes SIGFPE in receive path
           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 277396
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=277396&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.
- e1000 attached as -s 6:0,e1000,tap1.

The e1000 register handler accepts RDLEN=0. Once receive is enabled, the first
delivered frame executes:

    size = esc_RDLEN / 16;
    left = (size + esc_RDT - esc_RDH) % size;

This causes a host integer-divide fault and terminates bhyve.

Steps to reproduce:
1. Boot the guest with the supplied ROM.
2. The ROM enables PCI MEMEN, writes RDLEN=0, RDBAL=0x100000, and RCTL=0x2.
3. Save normally with bhyvectl --suspend.
4. Restore the unmodified snapshot.
5. Bring up tap1 and send one frame.

Expected: reject the zero ring length or drop the frame safely.
Actual: bhyve terminates with SIGFPE, exit status 136.

The bad snapshot records RDLEN=0, RCTL=2, and rx_enabled=1. A control with
RDLEN=0x1000 survives the same flow.

Impact: denial of service and loss of the affected VM. The same arithmetic is
on the ordinary receive path, so this is not claimed as restore-exclusive.

Suggested fix: reject RDLEN=0, treat size==0 as no descriptors before modulo,
and validate the restored RX-enabled state.

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