lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z2MXKkNb-aSLK2z7@google.com>
Date: Wed, 18 Dec 2024 10:40:42 -0800
From: Sean Christopherson <seanjc@...gle.com>
To: Ivan Orlov <iorlov@...zon.com>
Cc: bp@...en8.de, dave.hansen@...ux.intel.com, mingo@...hat.com, 
	pbonzini@...hat.com, shuah@...nel.org, tglx@...utronix.de, hpa@...or.com, 
	kvm@...r.kernel.org, linux-kernel@...r.kernel.org, 
	linux-kselftest@...r.kernel.org, x86@...nel.org, dwmw@...zon.co.uk, 
	pdurrant@...zon.co.uk, jalliste@...zon.co.uk
Subject: Re: [PATCH v3 5/7] KVM: SVM: Handle vectoring error in check_emulate_instruction

On Tue, Dec 17, 2024, Ivan Orlov wrote:
> Detect unhandleable vectoring in check_emulate_instruction to prevent
> infinite loop on SVM and eliminate the difference in how intercepted #PF
> during vectoring is handled on SVM and VMX.
> 
> Signed-off-by: Ivan Orlov <iorlov@...zon.com>
> ---
> V1 -> V2:
> - Detect the unhandleable vectoring error in svm_check_emulate_instruction
> instead of handling it in the common MMU code (which is specific for
> cached MMIO)
> V2 -> V3:
> - Use more generic function to check if emulation is allowed when
> vectoring
> 
>  arch/x86/kvm/svm/svm.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index dd15cc635655..e89c6fc2c4e6 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -4802,6 +4802,12 @@ static int svm_check_emulate_instruction(struct kvm_vcpu *vcpu, int emul_type,
>  	bool smep, smap, is_user;
>  	u64 error_code;
>  
> +	/* Check that emulation is possible during event vectoring */
> +	if ((to_svm(vcpu)->vmcb->control.exit_int_info &
> +	    SVM_EXITINTINFO_TYPE_MASK) &&

Let this poke out.  Alternatively, and probably preferably, capture "svm" locally
and it fits nicely on one line (there's an existing user of to_svm() in this
helper).  My objection to a local variable was specifically about a local
"is_event_vectoring", not about local variables in general.

> +	    !kvm_can_emulate_event_vectoring(emul_type))
> +		return X86EMUL_UNHANDLEABLE_VECTORING;
> +
>  	/* Emulation is always possible when KVM has access to all guest state. */
>  	if (!sev_guest(vcpu->kvm))
>  		return X86EMUL_CONTINUE;
> -- 
> 2.43.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ