On 7/14/2025 3:20 AM, Peter Zijlstra wrote:
        call __fred_entry_from_kvm              /* Call the C entry point */
-       POP_REGS
-       ERETS
-1:
+
+1:     /*

The symbol "1" is misplaced; it needs to be put after the ERETS
instruction.

+        * When FRED, use ERETS to potentially clear NMIs, otherwise simply
+        * restore the stack pointer.
+        */
+       ALTERNATIVE "nop; nop; mov %rbp, %rsp", \

Why explicitly add two nops here?

ALTERNATIVE will still pad three-byte nop after the MOV instruction.

+                   __stringify(add $C_PTREGS_SIZE, %rsp; ERETS), \
+                   X86_FEATURE_FRED
+
        /*
-        * Objtool doesn't understand what ERETS does, this hint tells it that
-        * yes, we'll reach here and with what stack state. A save/restore pair
-        * isn't strictly needed, but it's the simplest form.
+        * Objtool doesn't understand ERETS, and the cfi register state is
+        * different from initial_func_cfi due to PUSH_REGS. Tell it the state
+        * is similar to where UNWIND_HINT_SAVE is.
         */
        UNWIND_HINT_RESTORE
+
        pop %rbp
        RET


Reply via email to