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>] [day] [month] [year] [list]
Date:   Thu, 30 Dec 2021 21:32:03 +0000
From:   Sean Christopherson <seanjc@...gle.com>
To:     Paolo Bonzini <pbonzini@...hat.com>
Cc:     Sean Christopherson <seanjc@...gle.com>,
        Vitaly Kuznetsov <vkuznets@...hat.com>,
        Wanpeng Li <wanpengli@...cent.com>,
        Jim Mattson <jmattson@...gle.com>,
        Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH] KVM: SVM: Create stack frames in VMRUN wrappers to make
 objtool happy

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ