mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Sean Christopherson <seanjc@google.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] KVM: SVM: Create stack frames in VMRUN wrappers to make objtool happy
Date: Thu, 30 Dec 2021 21:32:03 +0000	[thread overview]
Message-ID: <20211230213203.2316921-1-seanjc@google.com> (raw)

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@intel.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 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


                 reply	other threads:[~2021-12-30 21:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211230213203.2316921-1-seanjc@google.com \
    --to=seanjc@google.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®