git: f7a884cb017f - main - x86: gate smbios hypervisor identification behind vm_guest
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 17 Mar 2023 05:56:58 UTC
The branch main has been updated by kevans:
URL: https://cgit.FreeBSD.org/src/commit/?id=f7a884cb017f6618ae872f8d52e80a147daf3f59
commit f7a884cb017f6618ae872f8d52e80a147daf3f59
Author: Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2023-03-16 19:26:28 +0000
Commit: Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2023-03-17 05:54:32 +0000
x86: gate smbios hypervisor identification behind vm_guest
cpuid detection may have picked up a more specific guest type already,
and a follow-up check of smbios vendor/product may erroneously blow
away the previously detected type.
This reportedly fixes the boot under Hyper-V, which advertises an
smbios.system.product of "Virtual Machine."
PR: 270239
Reviewed by: imp, kib (both earlier version, same concept)
Fixes: 2fee87562948 ("abstract out the vm detection via smbios..")
Differential Revision: https://reviews.freebsd.org/D39140
---
sys/dev/smbios/smbios_subr.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/sys/dev/smbios/smbios_subr.c b/sys/dev/smbios/smbios_subr.c
index c28bf0e4983f..4e30751cd716 100644
--- a/sys/dev/smbios/smbios_subr.c
+++ b/sys/dev/smbios/smbios_subr.c
@@ -69,6 +69,14 @@ identify_hypervisor_smbios(void)
char *p;
int i;
+ /*
+ * Some platforms, e.g., amd64, have other ways of detecting what kind
+ * of hypervisor we may be running under. Make sure we don't clobber a
+ * more specific vm_guest that's been previously detected.
+ */
+ if (vm_guest != VM_GUEST_NO && vm_guest != VM_GUEST_VM)
+ return;
+
/*
* XXX: Some of these entries may not be needed since they were
* added to FreeBSD before the checks above.