[PATCH] x86/retpoline: Remove alignment directives from retpoline core

From: David Woodhouse
Date: Wed Jan 10 2018 - 07:01:20 EST


Now that the retpoline is emitted in the altinstr section, there's not a
lot of point in attempting to align it. It might be aligned there, but it
could still end up misaligned when copied into place over oldinstr.

It is also actively harmful, because the alternatives code will helpfully
spot that the first instruction of the alternative is a NOP and thus turn
*all* the rest of it into NOPs too. (A fix for which is already available,
but we just don't need to do it, so stop.)

Signed-off-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
---
arch/x86/include/asm/nospec-branch.h | 3 ---
1 file changed, 3 deletions(-)

diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h
index 6bda2c0..16329f1 100644
--- a/arch/x86/include/asm/nospec-branch.h
+++ b/arch/x86/include/asm/nospec-branch.h
@@ -15,12 +15,10 @@
* invocation below less ugly.
*/
.macro RETPOLINE_JMP reg:req
- .align 16
call .Ldo_rop_\@
.Lspec_trap_\@:
pause
jmp .Lspec_trap_\@
- .align 16
.Ldo_rop_\@:
mov \reg, (%_ASM_SP)
ret
@@ -34,7 +32,6 @@
jmp .Ldo_call_\@
.Ldo_retpoline_jmp_\@:
RETPOLINE_JMP \reg
- .align 16
.Ldo_call_\@:
call .Ldo_retpoline_jmp_\@
.endm
--
2.7.4