[PATCH] KVM: SVM: Create stack frames in VMRUN wrappers to make objtool happy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add "mov %rSP, %rBP" to the prologs of the VMRUN assembly wrappers to
create proper stack frames for the sole purpose of eliminating objtool
warnings about using rBP as a scratch register.  When the kernel is built
with CONFIG_FRAME_POINTER=y, i.e. frame pointers are used to unwind,
objtool is used to validate that assembly functions don't mess with rBP
as that can cause callers to be skipped by the unwinder.  SVM needs to
save/restore rBP across VMRUN, which triggers a false positive as objtool
thinks the PUSP+POP without creating a stack frame is indicative of using
rBP as a scratch register.

SVM's VMRUN wrappers don't truly need a stack frame as they don't make
any function calls of their own (ignoring the CALLs emitted to fill the
RSB), i.e. won't break unwinding, but the extra MOV is basically free and
eliminating objtool warning allows for a completely clean build with many
configs.

  warning: objtool: __svm_vcpu_run()+0xde: BP used as a scratch register
  warning: objtool: __svm_sev_es_vcpu_run()+0x46: BP used as a scratch register

Reported-by: kernel test robot <lkp@xxxxxxxxx>
Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
---
 arch/x86/kvm/svm/vmenter.S | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kvm/svm/vmenter.S b/arch/x86/kvm/svm/vmenter.S
index 4fa17df123cd..b62b1fd53caf 100644
--- a/arch/x86/kvm/svm/vmenter.S
+++ b/arch/x86/kvm/svm/vmenter.S
@@ -36,6 +36,7 @@
  */
 SYM_FUNC_START(__svm_vcpu_run)
 	push %_ASM_BP
+	mov  %_ASM_SP, %_ASM_BP
 #ifdef CONFIG_X86_64
 	push %r15
 	push %r14
@@ -164,6 +165,7 @@ SYM_FUNC_END(__svm_vcpu_run)
  */
 SYM_FUNC_START(__svm_sev_es_vcpu_run)
 	push %_ASM_BP
+	mov  %_ASM_SP, %_ASM_BP
 #ifdef CONFIG_X86_64
 	push %r15
 	push %r14
-- 
2.34.1.448.ga2b2bfdf31-goog




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux