Re: [PATCH 3/6] x86/kvm/emulate: Avoid RET for fastops
From: Josh Poimboeuf
Date: Mon Apr 14 2025 - 18:37:04 EST
On Mon, Apr 14, 2025 at 01:11:43PM +0200, Peter Zijlstra wrote:
> Since there is only a single fastop() function, convert the FASTOP
> stuff from CALL_NOSPEC+RET to JMP_NOSPEC+JMP, avoiding the return
> thunks and all that jazz.
>
> Specifically FASTOPs rely on the return thunk to preserve EFLAGS,
> which not all of them can trivially do (call depth tracing suffers
> here).
>
> Objtool strenuously complains about things, therefore fix up the
> various problems:
>
> - indirect call without a .rodata, fails to determine JUMP_TABLE,
> add an annotation for this.
> - fastop functions fall through, create an exception for this case
> - unreachable instruction after fastop_return, save/restore
I think this breaks unwinding. Each of the individual fastops inherits
fastop()'s stack but the ORC doesn't reflect that.
Should they just be moved to a proper .S file?
--
Josh