git: 0e81a14657d0 - stable/13 - bhyve: Report an error for invalid UUIDs.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 26 Jan 2023 19:47:37 UTC
The branch stable/13 has been updated by jhb:

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

commit 0e81a14657d0f9d6ae3de6b1cf5f8705a1b31993
Author:     James Mintram <me@jamesrm.com>
AuthorDate: 2022-06-16 20:17:44 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-01-26 19:28:56 +0000

    bhyve: Report an error for invalid UUIDs.
    
    Reviewed by:    rgrimes, grehan, jhb
    Differential Revision:  https://reviews.freebsd.org/D30050
    
    (cherry picked from commit e16b709e2dcc45f01cf96b5e7f6d48474feff8d7)
---
 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 70dd52c9b2b4..453c24794907 100644
--- a/usr.sbin/bhyve/bhyverun.c
+++ b/usr.sbin/bhyve/bhyverun.c
@@ -1558,7 +1558,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 ab8dfeeb532b..cafb0343519f 100644
--- a/usr.sbin/bhyve/smbiostbl.c
+++ b/usr.sbin/bhyve/smbiostbl.c
@@ -671,8 +671,10 @@ smbios_type1_initializer(const 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 {