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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <pbbfdqgd7vu6xknmrlg6ezrbhprnw42ngbkp7f55thxanqgnuf@7l4fkbrk7v76>
Date: Tue, 6 Jan 2026 23:31:53 +0000
From: Yosry Ahmed <yosry.ahmed@...ux.dev>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Kevin Cheng <chengkev@...gle.com>, pbonzini@...hat.com, 
	kvm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] KVM: SVM: Raise #UD if VMMCALL instruction is not
 intercepted

On Tue, Jan 06, 2026 at 10:29:59AM -0800, Sean Christopherson wrote:
> On Tue, Jan 06, 2026, Kevin Cheng wrote:
> > The AMD APM states that if VMMCALL instruction is not intercepted, the
> > instruction raises a #UD exception.
> > 
> > Create a vmmcall exit handler that generates a #UD if a VMMCALL exit
> > from L2 is being handled by L0, which means that L1 did not intercept
> > the VMMCALL instruction.
> > 
> > Co-developed-by: Sean Christopherson <seanjc@...gle.com>
> > Co-developed-by: Yosry Ahmed <yosry.ahmed@...ux.dev>
> 
> Co-developed-by requires a SoB.  As Yosry noted off-list, he only provided the
> comment, and I have feedback on that :-)  Unless Yosry objects, just drop his.
> Co-developed-by.

Yup, no objections.

> 
> Ditt for me, just give me
> 
>   Suggested-by: Sean Christopherson <seanjc@...gle.com>
> 
> I don't need a Co-developed-by for a tossing a code snippet your way. though I
> appreciate the offer. :-)
> 
> > Signed-off-by: Kevin Cheng <chengkev@...gle.com>
> > ---
> >  arch/x86/kvm/svm/svm.c | 16 +++++++++++++++-
> >  1 file changed, 15 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> > index fc1b8707bb00c..482495ad72d22 100644
> > --- a/arch/x86/kvm/svm/svm.c
> > +++ b/arch/x86/kvm/svm/svm.c
> > @@ -3179,6 +3179,20 @@ static int bus_lock_exit(struct kvm_vcpu *vcpu)
> >  	return 0;
> >  }
> >  
> > +static int vmmcall_interception(struct kvm_vcpu *vcpu)
> > +{
> > +	/*
> > +	 * If VMMCALL from L2 is not intercepted by L1, the instruction raises a
> > +	 * #UD exception
> > +	 */
> 
> Mentioning L2 and L1 is confusing.  It reads like arbitrary KVM behavior.  And
> IMO the most notable thing is what's missing: an intercept check.  _That_ is
> worth commenting, e.g.
> 
> 	/*
> 	 * VMMCALL #UDs if it's not intercepted, and KVM reaches this point if
> 	 * and only if the VMCALL intercept is not set in vmcb12.

Nit: VMMCALL

> 	 */
> 

Would it be too paranoid to WARN if the L1 intercept is set here?

WARN_ON_ONCE(vmcb12_is_intercept(&svm->nested.ctl, INTERCEPT_VMMCALL));

> > +	if (is_guest_mode(vcpu)) {
> > +		kvm_queue_exception(vcpu, UD_VECTOR);
> > +		return 1;
> > +	}
> > +
> > +	return kvm_emulate_hypercall(vcpu);
> > +}
> > +
> >  static int (*const svm_exit_handlers[])(struct kvm_vcpu *vcpu) = {
> >  	[SVM_EXIT_READ_CR0]			= cr_interception,
> >  	[SVM_EXIT_READ_CR3]			= cr_interception,
> > @@ -3229,7 +3243,7 @@ static int (*const svm_exit_handlers[])(struct kvm_vcpu *vcpu) = {
> >  	[SVM_EXIT_TASK_SWITCH]			= task_switch_interception,
> >  	[SVM_EXIT_SHUTDOWN]			= shutdown_interception,
> >  	[SVM_EXIT_VMRUN]			= vmrun_interception,
> > -	[SVM_EXIT_VMMCALL]			= kvm_emulate_hypercall,
> > +	[SVM_EXIT_VMMCALL]			= vmmcall_interception,
> >  	[SVM_EXIT_VMLOAD]			= vmload_interception,
> >  	[SVM_EXIT_VMSAVE]			= vmsave_interception,
> >  	[SVM_EXIT_STGI]				= stgi_interception,
> > -- 
> > 2.52.0.351.gbe84eed79e-goog
> > 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ