• Sean Christopherson's avatar
    KVM: VMX: Make VMREAD error path play nice with noinstr · c20d403f
    Sean Christopherson authored
    Mark vmread_error_trampoline() as noinstr, and add a second trampoline
    for the CONFIG_CC_HAS_ASM_GOTO_OUTPUT=n case to enable instrumentation
    when handling VM-Fail on VMREAD.  VMREAD is used in various noinstr
    flows, e.g. immediately after VM-Exit, and objtool rightly complains that
    the call to the error trampoline leaves a no-instrumentation section
    without annotating that it's safe to do so.
    
      vmlinux.o: warning: objtool: vmx_vcpu_enter_exit+0xc9:
      call to vmread_error_trampoline() leaves .noinstr.text section
    
    Note, strictly speaking, enabling instrumentation in the VM-Fail path
    isn't exactly safe, but if VMREAD fails the kernel/system is likely hosed
    anyways, and logging that there is a fatal error is more important than
    *maybe* encountering slightly unsafe instrumentation.
    Reported-by: default avatarSu Hui <suhui@nfschina.com>
    Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
    Message-Id: <20230721235637.2345403-2-seanjc@google.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    c20d403f
vmx.c 246 KB