git: e16b709e2dcc - main - bhyve: Report an error for invalid UUIDs.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 16 Jun 2022 20:18:44 UTC
The branch main has been updated by jhb:

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

commit e16b709e2dcc45f01cf96b5e7f6d48474feff8d7
Author:     James Mintram <me@jamesrm.com>
AuthorDate: 2022-06-16 20:17:44 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-06-16 20:18:01 +0000

    bhyve: Report an error for invalid UUIDs.
    
    Reviewed by:    rgrimes, grehan, jhb
    Differential Revision:  https://reviews.freebsd.org/D30050
---
 usr.sbin/bhyve/bhyverun.c  | 3 ++-
 usr.sbin/bhyve/smbiostbl.c | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c
index a412785f5a01..4f9fc4a2b050 100644
--- a/usr.sbin/bhyve/bhyverun.c
+++ b/usr.sbin/bhyve/bhyverun.c
@@ -1536,7 +1536,8 @@ main(int argc, char *argv[])
 	}
 
 	error = smbios_build(ctx);
-	assert(error == 0);
+	if (error != 0)
+		exit(4);
 
 	if (get_config_bool("acpi_tables")) {
 		error = acpi_build(ctx, guest_ncpus);
diff --git a/usr.sbin/bhyve/smbiostbl.c b/usr.sbin/bhyve/smbiostbl.c
index 97f5a563c6c5..bc85bb6c97af 100644
--- a/usr.sbin/bhyve/smbiostbl.c
+++ b/usr.sbin/bhyve/smbiostbl.c
@@ -666,8 +666,10 @@ smbios_type1_initializer(struct smbios_structure *template_entry,
 		uint32_t	status;
 
 		uuid_from_string(guest_uuid_str, &uuid, &status);
-		if (status != uuid_s_ok)
+		if (status != uuid_s_ok) {
+			EPRINTLN("Invalid UUID");
 			return (-1);
+		}
 
 		uuid_enc_le(&type1->uuid, &uuid);
 	} else {