diff options
author | Peter Zijlstra <peterz@infradead.org> | 2021-10-26 15:01:44 +0300 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2021-10-29 00:25:28 +0300 |
commit | bbe2df3f6b6da7848398d55b1311d58a16ec21e4 (patch) | |
tree | 2abeeafd8f025733e94cf8e6a0e96bfd2ea5d004 /lib/debugobjects.c | |
parent | 2f0cbb2a8e5bbf101e9de118fc0eb168111a5e1e (diff) | |
download | linux-bbe2df3f6b6da7848398d55b1311d58a16ec21e4.tar.xz |
x86/alternative: Try inline spectre_v2=retpoline,amd
Try and replace retpoline thunk calls with:
LFENCE
CALL *%\reg
for spectre_v2=retpoline,amd.
Specifically, the sequence above is 5 bytes for the low 8 registers,
but 6 bytes for the high 8 registers. This means that unless the
compilers prefix stuff the call with higher registers this replacement
will fail.
Luckily GCC strongly favours RAX for the indirect calls and most (95%+
for defconfig-x86_64) will be converted. OTOH clang strongly favours
R11 and almost nothing gets converted.
Note: it will also generate a correct replacement for the Jcc.d32
case, except unless the compilers start to prefix stuff that, it'll
never fit. Specifically:
Jncc.d8 1f
LFENCE
JMP *%\reg
1:
is 7-8 bytes long, where the original instruction in unpadded form is
only 6 bytes.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Borislav Petkov <bp@suse.de>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Tested-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/r/20211026120310.359986601@infradead.org
Diffstat (limited to 'lib/debugobjects.c')
0 files changed, 0 insertions, 0 deletions