kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] KVM: VMX: Fix operand constraint of PUSH instructions
@ 2020-05-07  8:44 Uros Bizjak
  0 siblings, 0 replies; only message in thread
From: Uros Bizjak @ 2020-05-07  8:44 UTC (permalink / raw)
  To: kvm; +Cc: Uros Bizjak, Paolo Bonzini, Sean Christopherson

PUSH instructions can't handle 64-bit immediate operands, so "i"
operand constraint is not correct. Use "er" operand constraint
to limit the range of the immediate operand to a signed 32-bit
value and also to leave the compiler the freedom to pass the value
via the register.

Please note that memory operands are not allowed here. These
operands include stack slots, and these are not valid in this
asm block due to the clobbered %rsp register.

v2: Add casts.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
---
 arch/x86/kvm/vmx/vmx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 94f49c5ae89a..52cb150a9633 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -6390,9 +6390,9 @@ static void handle_external_interrupt_irqoff(struct kvm_vcpu *vcpu)
 		:
 		[thunk_target]"r"(entry),
 #ifdef CONFIG_X86_64
-		[ss]"i"(__KERNEL_DS),
+		[ss]"er"((unsigned long)__KERNEL_DS),
 #endif
-		[cs]"i"(__KERNEL_CS)
+		[cs]"er"((unsigned long)__KERNEL_CS)
 	);
 
 	kvm_after_interrupt(vcpu);
-- 
2.25.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-05-07  8:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-07  8:44 [PATCH v2] KVM: VMX: Fix operand constraint of PUSH instructions Uros Bizjak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).