Re: [PATCH v3 2/3] Fix undefined operation fault that can hang a cpu on crash or panic

From: Andy Lutomirski
Date: Sun Jul 05 2020 - 14:23:04 EST


On Sat, Jul 4, 2020 at 1:38 PM David P. Reed <dpreed@xxxxxxxxxxxx> wrote:
>
> Fix: Mask undefined operation fault during emergency VMXOFF that must be
> attempted to force cpu exit from VMX root operation.
> Explanation: When a cpu may be in VMX root operation (only possible when
> CR4.VMXE is set), crash or panic reboot tries to exit VMX root operation
> using VMXOFF. This is necessary, because any INIT will be masked while cpu
> is in VMX root operation, but that state cannot be reliably
> discerned by the state of the cpu.
> VMXOFF faults if the cpu is not actually in VMX root operation, signalling
> undefined operation.
> Discovered while debugging an out-of-tree x-visor with a race. Can happen
> due to certain kinds of bugs in KVM.

Can you re-wrap lines to 68 characters? Also, the Fix: and
Explanation: is probably unnecessary. You could say:

Ignore a potential #UD failut during emergency VMXOFF ...

When a cpu may be in VMX ...

>
> Fixes: 208067 <https://bugzilla.kernel.org/show_bug.cgi?id=208067>
> Reported-by: David P. Reed <dpreed@xxxxxxxxxxxx>

It's not really necessary to say that you, the author, reported the
problem, but I guess it's harmless.

> Suggested-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Suggested-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx>
> Suggested-by: Andy Lutomirski <luto@xxxxxxxxxx>
> Signed-off-by: David P. Reed <dpreed@xxxxxxxxxxxx>
> ---
> arch/x86/include/asm/virtext.h | 20 ++++++++++++++------
> 1 file changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/include/asm/virtext.h b/arch/x86/include/asm/virtext.h
> index 0ede8d04535a..0e0900eacb9c 100644
> --- a/arch/x86/include/asm/virtext.h
> +++ b/arch/x86/include/asm/virtext.h
> @@ -30,11 +30,11 @@ static inline int cpu_has_vmx(void)
> }
>
>
> -/* Disable VMX on the current CPU
> +/* Exit VMX root mode and isable VMX on the current CPU.

s/isable/disable/


> /* Disable VMX if it is supported and enabled on the current CPU
> --
> 2.26.2
>

Other than that:

Reviewed-by: Andy Lutomirski <luto@xxxxxxxxxx>

--Andy