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: <jmacawbcdorwi2y5ulh2l2mdpeulx5sj7qvjehvnhaa5cgdcs3@2tljlprwtl27>
Date: Mon, 12 Jan 2026 20:37:53 +0000
From: Yosry Ahmed <yosry.ahmed@...ux.dev>
To: Kevin Cheng <chengkev@...gle.com>
Cc: seanjc@...gle.com, pbonzini@...hat.com, kvm@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2 1/5] KVM: SVM: Move STGI and CLGI intercept handling

On Mon, Jan 12, 2026 at 05:45:31PM +0000, Kevin Cheng wrote:
> Similar to VMLOAD/VMSAVE intercept handling, move the STGI/CLGI
> intercept handling to svm_recalc_instruction_intercepts().
> ---
>  arch/x86/kvm/svm/svm.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index 24d59ccfa40d9..6373a25d85479 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -1010,6 +1010,11 @@ static void svm_recalc_instruction_intercepts(struct kvm_vcpu *vcpu)
>  			svm_clr_intercept(svm, INTERCEPT_VMSAVE);
>  			svm->vmcb->control.virt_ext |= VIRTUAL_VMLOAD_VMSAVE_ENABLE_MASK;
>  		}
> +
> +		if (vgif) {
> +			svm_clr_intercept(svm, INTERCEPT_STGI);

Could this cause a problem with NMI window tracking?

svm_enable_nmi_window() sets INTERCEPT_STGI to detect when NMIs are
enabled, and it's later cleared by svm_set_gif(). If we recalc
intercepts in between we will clear the intercept here and miss NMI
enablement.

We could move the logic to set/clear INTERCEPT_STGI for NMI window
tracking here as well, but then we'll need to recalc intercepts in
svm_enable_nmi_window() and svm_set_gif(), which could be expensive.

The alternative is perhaps setting a flag when INTERCEPT_STGI is set in
svm_enable_nmi_window() and avoid clearing the intercept here if the
flag is set.

Not sure what's the best way forward here.

> +			svm_clr_intercept(svm, INTERCEPT_CLGI);
> +		}
>  	}
>  }
>  
> @@ -1147,11 +1152,8 @@ static void init_vmcb(struct kvm_vcpu *vcpu, bool init_event)
>  	if (vnmi)
>  		svm->vmcb->control.int_ctl |= V_NMI_ENABLE_MASK;
>  
> -	if (vgif) {
> -		svm_clr_intercept(svm, INTERCEPT_STGI);
> -		svm_clr_intercept(svm, INTERCEPT_CLGI);
> +	if (vgif)
>  		svm->vmcb->control.int_ctl |= V_GIF_ENABLE_MASK;
> -	}
>  
>  	if (vcpu->kvm->arch.bus_lock_detection_enabled)
>  		svm_set_intercept(svm, INTERCEPT_BUSLOCK);
> -- 
> 2.52.0.457.g6b5491de43-goog
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ