git: 11df1d931657 - stable/15 - bhyve: fix byte order for manually set NVMe eui64

From: Roman Bogorodskiy <novel_at_FreeBSD.org>
Date: Sat, 19 Sep 2026 07:27:32 UTC
The branch stable/15 has been updated by novel:

URL: https://cgit.FreeBSD.org/src/commit/?id=11df1d931657e3eeee85b267d50ffea401cfc845

commit 11df1d931657e3eeee85b267d50ffea401cfc845
Author:     Roman Bogorodskiy <novel@FreeBSD.org>
AuthorDate: 2026-08-21 13:27:56 +0000
Commit:     Roman Bogorodskiy <novel@FreeBSD.org>
CommitDate: 2026-09-19 07:23:51 +0000

    bhyve: fix byte order for manually set NVMe eui64
    
    Manually specified eui64 value gets converted to big endian twice:
    first using htobe64() and then using be64enc(). On little-endian hosts
    that results in a little-endian value instead of a big-endian.
    
    Fix by removing htobe64() for a user submitted value.
    
    Fixes:          409a80e5a434 ("bhyve: Create EUI64 for NVMe namespaces")
    Reviewed by:    chuck
    Relnotes:       yes
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 weeks
    Differential Revision:  https://reviews.freebsd.org/D59080
    
    (cherry picked from commit 8bd30a72e7012126a1c8d52b3ba32f844a88f8dc)
---
 UPDATING                  | 10 ++++++++++
 usr.sbin/bhyve/pci_nvme.c |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/UPDATING b/UPDATING
index e8d93352d78e..7fcdaaebae2f 100644
--- a/UPDATING
+++ b/UPDATING
@@ -12,6 +12,16 @@ Items affecting the ports and packages system can be found in
 /usr/ports/UPDATING.  Please read that file before updating system packages
 and/or ports.
 
+20260919:
+	bhyve(8) users who explicitly set the eui64 option for an NVMe
+	device may need to update their configuration.  Due to an incorrect
+	byte-order conversion, bhyve previously presented manually
+	configured EUI-64 values to the guest with their bytes reversed.
+	To preserve the identifier previously visible to the guest,
+	byte-reverse the value in the eui64 option.  Automatically
+	generated EUI-64 values, used when the option is omitted,
+	are unaffected.
+
 20260727:
 	The wait_for_pids() function in rc.subr, used by rc scripts
 	when stopping or restarting a service, has been modified to
diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c
index 7e6c8bc9d719..f5ea2d5749c1 100644
--- a/usr.sbin/bhyve/pci_nvme.c
+++ b/usr.sbin/bhyve/pci_nvme.c
@@ -3213,7 +3213,7 @@ pci_nvme_parse_config(struct pci_nvme_softc *sc, nvlist_t *nvl)
 	}
 	value = get_config_value_node(nvl, "eui64");
 	if (value != NULL)
-		sc->nvstore.eui64 = htobe64(strtoull(value, NULL, 0));
+		sc->nvstore.eui64 = strtoull(value, NULL, 0);
 	value = get_config_value_node(nvl, "dsm");
 	if (value != NULL) {
 		if (strcmp(value, "auto") == 0)