Re: [PATCH v2 00/13] objtool: Detect and warn about indirect calls in __nocfi functions
From: Peter Zijlstra <peterz@infradead.org>
Date: 2025-05-03 09:50:37
Also in:
kvm, linux-efi, lkml
On Fri, May 02, 2025 at 12:53:36PM -0700, Sean Christopherson wrote:
quoted
So the FRED NMI code is significantly different from the IDT NMI code and I really didn't want to go mixing those. If we get a nested NMI I don't think it'll behave well.Ah, because FRED hardwware doesn't have the crazy NMI unblocking behavior, and the FRED NMI entry code relies on that.
Just so.
But I don't see why we need to care about NMIs from KVM, while they do bounce through assembly to create a stack frame, the actual CALL is direct to asm_exc_nmi_kvm_vmx(). If it's just the unwind hint that's needed, that
That part is all fine.
quoted hunk ↗ jump to hunk
arch/x86/entry/entry_64_fred.S | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)diff --git a/arch/x86/entry/entry_64_fred.S b/arch/x86/entry/entry_64_fred.S index 29c5c32c16c3..7aff2f0a285f 100644 --- a/arch/x86/entry/entry_64_fred.S +++ b/arch/x86/entry/entry_64_fred.S@@ -116,7 +116,8 @@ SYM_FUNC_START(asm_fred_entry_from_kvm) movq %rsp, %rdi /* %rdi -> pt_regs */ call __fred_entry_from_kvm /* Call the C entry point */ POP_REGS - ERETS + + ALTERNATIVE "", __stringify(ERETS), X86_FEATURE_FRED 1: /* * Objtool doesn't understand what ERETS does, this hint tells it that@@ -124,7 +125,7 @@ SYM_FUNC_START(asm_fred_entry_from_kvm) * isn't strictly needed, but it's the simplest form. */ UNWIND_HINT_RESTORE - pop %rbp + leave RET
So this, while clever, might be a problem with ORC unwinding. Because now the stack is different depending on the alternative, and we can't deal with that. Anyway, I'll go have a poke on Monday (or Tuesday if Monday turns out to be a bank holiday :-).