From: Jan Kiszka <[email protected]>
We must not touch the cr4 shadow if initialization or shutdown failed or
it gets out of sync and blocks re-enabling or even reboots.
Fixes: 67e4de38a3f8 ("driver: Adjust to kernel 5.8 and 5.9")
Signed-off-by: Jan Kiszka <[email protected]>
---
driver/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/driver/main.c b/driver/main.c
index 78af8e97..64e2b9a4 100644
--- a/driver/main.c
+++ b/driver/main.c
@@ -257,7 +257,7 @@ static void enter_hypervisor(void *info)
#if defined(CONFIG_X86) && LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
/* on Intel, VMXE is now on - update the shadow */
- if (boot_cpu_has(X86_FEATURE_VMX)) {
+ if (boot_cpu_has(X86_FEATURE_VMX) && !err) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0)
cr4_set_bits_irqsoff(X86_CR4_VMXE);
#else
@@ -666,7 +666,7 @@ static void leave_hypervisor(void *info)
#if defined(CONFIG_X86) && LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
/* on Intel, VMXE is now off - update the shadow */
- if (boot_cpu_has(X86_FEATURE_VMX)) {
+ if (boot_cpu_has(X86_FEATURE_VMX) && !err) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0)
cr4_clear_bits_irqsoff(X86_CR4_VMXE);
#else
--
2.26.2
--
You received this message because you are subscribed to the Google Groups
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jailhouse-dev/8f9713e2-a99c-5bc2-e75d-46cbad177c93%40web.de.