KVM: SVM: Create stack frames in VMRUN wrappers to make objtool happy
Sean Christopherson
maintainerPATCH 1/1 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
--- arch/x86/kvm/svm/vmenter.S | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/kvm/svm/vmenter.S +2 -0
@@ -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
Signature · 1 line
2.34.1.448.ga2b2bfdf31-goog