Skip to content

Commit

Permalink
x86: Prepare asm files for straight-line-speculation
Browse files Browse the repository at this point in the history
Replace all ret/retq instructions with RET in preparation of making
RET a macro. Since AS is case insensitive it's a big no-op without
RET defined.

  find arch/x86/ -name \*.S | while read file
  do
	sed -i 's/\<ret[q]*\>/RET/' $file
  done

Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Signed-off-by: Borislav Petkov <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
Peter Zijlstra authored and suryasaimadhu committed Dec 8, 2021
1 parent 22da5a0 commit f94909c
Show file tree
Hide file tree
Showing 106 changed files with 349 additions and 349 deletions.
2 changes: 1 addition & 1 deletion arch/x86/boot/compressed/efi_thunk_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ SYM_FUNC_START(__efi64_thunk)

pop %rbx
pop %rbp
ret
RET
SYM_FUNC_END(__efi64_thunk)

.code32
Expand Down
8 changes: 4 additions & 4 deletions arch/x86/boot/compressed/head_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ SYM_FUNC_START(efi32_pe_entry)
2: popl %edi // restore callee-save registers
popl %ebx
leave
ret
RET
SYM_FUNC_END(efi32_pe_entry)

.section ".rodata"
Expand Down Expand Up @@ -868,7 +868,7 @@ SYM_FUNC_START(startup32_set_idt_entry)

pop %ecx
pop %ebx
ret
RET
SYM_FUNC_END(startup32_set_idt_entry)
#endif

Expand All @@ -884,7 +884,7 @@ SYM_FUNC_START(startup32_load_idt)
movl %eax, rva(boot32_idt_desc+2)(%ebp)
lidt rva(boot32_idt_desc)(%ebp)
#endif
ret
RET
SYM_FUNC_END(startup32_load_idt)

/*
Expand Down Expand Up @@ -954,7 +954,7 @@ SYM_FUNC_START(startup32_check_sev_cbit)
popl %ebx
popl %eax
#endif
ret
RET
SYM_FUNC_END(startup32_check_sev_cbit)

/*
Expand Down
6 changes: 3 additions & 3 deletions arch/x86/boot/compressed/mem_encrypt.S
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ SYM_FUNC_START(get_sev_encryption_bit)

#endif /* CONFIG_AMD_MEM_ENCRYPT */

ret
RET
SYM_FUNC_END(get_sev_encryption_bit)

/**
Expand Down Expand Up @@ -92,7 +92,7 @@ SYM_CODE_START_LOCAL(sev_es_req_cpuid)
/* All good - return success */
xorl %eax, %eax
1:
ret
RET
2:
movl $-1, %eax
jmp 1b
Expand Down Expand Up @@ -221,7 +221,7 @@ SYM_FUNC_START(set_sev_encryption_mask)
#endif

xor %rax, %rax
ret
RET
SYM_FUNC_END(set_sev_encryption_mask)

.data
Expand Down
48 changes: 24 additions & 24 deletions arch/x86/crypto/aegis128-aesni-asm.S
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ SYM_FUNC_START_LOCAL(__load_partial)
pxor T0, MSG

.Lld_partial_8:
ret
RET
SYM_FUNC_END(__load_partial)

/*
Expand Down Expand Up @@ -180,7 +180,7 @@ SYM_FUNC_START_LOCAL(__store_partial)
mov %r10b, (%r9)

.Lst_partial_1:
ret
RET
SYM_FUNC_END(__store_partial)

/*
Expand Down Expand Up @@ -225,7 +225,7 @@ SYM_FUNC_START(crypto_aegis128_aesni_init)
movdqu STATE4, 0x40(STATEP)

FRAME_END
ret
RET
SYM_FUNC_END(crypto_aegis128_aesni_init)

/*
Expand Down Expand Up @@ -337,7 +337,7 @@ SYM_FUNC_START(crypto_aegis128_aesni_ad)
movdqu STATE3, 0x30(STATEP)
movdqu STATE4, 0x40(STATEP)
FRAME_END
ret
RET

.Lad_out_1:
movdqu STATE4, 0x00(STATEP)
Expand All @@ -346,7 +346,7 @@ SYM_FUNC_START(crypto_aegis128_aesni_ad)
movdqu STATE2, 0x30(STATEP)
movdqu STATE3, 0x40(STATEP)
FRAME_END
ret
RET

.Lad_out_2:
movdqu STATE3, 0x00(STATEP)
Expand All @@ -355,7 +355,7 @@ SYM_FUNC_START(crypto_aegis128_aesni_ad)
movdqu STATE1, 0x30(STATEP)
movdqu STATE2, 0x40(STATEP)
FRAME_END
ret
RET

.Lad_out_3:
movdqu STATE2, 0x00(STATEP)
Expand All @@ -364,7 +364,7 @@ SYM_FUNC_START(crypto_aegis128_aesni_ad)
movdqu STATE0, 0x30(STATEP)
movdqu STATE1, 0x40(STATEP)
FRAME_END
ret
RET

.Lad_out_4:
movdqu STATE1, 0x00(STATEP)
Expand All @@ -373,11 +373,11 @@ SYM_FUNC_START(crypto_aegis128_aesni_ad)
movdqu STATE4, 0x30(STATEP)
movdqu STATE0, 0x40(STATEP)
FRAME_END
ret
RET

.Lad_out:
FRAME_END
ret
RET
SYM_FUNC_END(crypto_aegis128_aesni_ad)

.macro encrypt_block a s0 s1 s2 s3 s4 i
Expand Down Expand Up @@ -452,7 +452,7 @@ SYM_FUNC_START(crypto_aegis128_aesni_enc)
movdqu STATE2, 0x30(STATEP)
movdqu STATE3, 0x40(STATEP)
FRAME_END
ret
RET

.Lenc_out_1:
movdqu STATE3, 0x00(STATEP)
Expand All @@ -461,7 +461,7 @@ SYM_FUNC_START(crypto_aegis128_aesni_enc)
movdqu STATE1, 0x30(STATEP)
movdqu STATE2, 0x40(STATEP)
FRAME_END
ret
RET

.Lenc_out_2:
movdqu STATE2, 0x00(STATEP)
Expand All @@ -470,7 +470,7 @@ SYM_FUNC_START(crypto_aegis128_aesni_enc)
movdqu STATE0, 0x30(STATEP)
movdqu STATE1, 0x40(STATEP)
FRAME_END
ret
RET

.Lenc_out_3:
movdqu STATE1, 0x00(STATEP)
Expand All @@ -479,7 +479,7 @@ SYM_FUNC_START(crypto_aegis128_aesni_enc)
movdqu STATE4, 0x30(STATEP)
movdqu STATE0, 0x40(STATEP)
FRAME_END
ret
RET

.Lenc_out_4:
movdqu STATE0, 0x00(STATEP)
Expand All @@ -488,11 +488,11 @@ SYM_FUNC_START(crypto_aegis128_aesni_enc)
movdqu STATE3, 0x30(STATEP)
movdqu STATE4, 0x40(STATEP)
FRAME_END
ret
RET

.Lenc_out:
FRAME_END
ret
RET
SYM_FUNC_END(crypto_aegis128_aesni_enc)

/*
Expand Down Expand Up @@ -532,7 +532,7 @@ SYM_FUNC_START(crypto_aegis128_aesni_enc_tail)
movdqu STATE3, 0x40(STATEP)

FRAME_END
ret
RET
SYM_FUNC_END(crypto_aegis128_aesni_enc_tail)

.macro decrypt_block a s0 s1 s2 s3 s4 i
Expand Down Expand Up @@ -606,7 +606,7 @@ SYM_FUNC_START(crypto_aegis128_aesni_dec)
movdqu STATE2, 0x30(STATEP)
movdqu STATE3, 0x40(STATEP)
FRAME_END
ret
RET

.Ldec_out_1:
movdqu STATE3, 0x00(STATEP)
Expand All @@ -615,7 +615,7 @@ SYM_FUNC_START(crypto_aegis128_aesni_dec)
movdqu STATE1, 0x30(STATEP)
movdqu STATE2, 0x40(STATEP)
FRAME_END
ret
RET

.Ldec_out_2:
movdqu STATE2, 0x00(STATEP)
Expand All @@ -624,7 +624,7 @@ SYM_FUNC_START(crypto_aegis128_aesni_dec)
movdqu STATE0, 0x30(STATEP)
movdqu STATE1, 0x40(STATEP)
FRAME_END
ret
RET

.Ldec_out_3:
movdqu STATE1, 0x00(STATEP)
Expand All @@ -633,7 +633,7 @@ SYM_FUNC_START(crypto_aegis128_aesni_dec)
movdqu STATE4, 0x30(STATEP)
movdqu STATE0, 0x40(STATEP)
FRAME_END
ret
RET

.Ldec_out_4:
movdqu STATE0, 0x00(STATEP)
Expand All @@ -642,11 +642,11 @@ SYM_FUNC_START(crypto_aegis128_aesni_dec)
movdqu STATE3, 0x30(STATEP)
movdqu STATE4, 0x40(STATEP)
FRAME_END
ret
RET

.Ldec_out:
FRAME_END
ret
RET
SYM_FUNC_END(crypto_aegis128_aesni_dec)

/*
Expand Down Expand Up @@ -696,7 +696,7 @@ SYM_FUNC_START(crypto_aegis128_aesni_dec_tail)
movdqu STATE3, 0x40(STATEP)

FRAME_END
ret
RET
SYM_FUNC_END(crypto_aegis128_aesni_dec_tail)

/*
Expand Down Expand Up @@ -743,5 +743,5 @@ SYM_FUNC_START(crypto_aegis128_aesni_final)
movdqu MSG, (%rsi)

FRAME_END
ret
RET
SYM_FUNC_END(crypto_aegis128_aesni_final)
2 changes: 1 addition & 1 deletion arch/x86/crypto/aes_ctrby8_avx-x86_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ ddq_add_8:
/* return updated IV */
vpshufb xbyteswap, xcounter, xcounter
vmovdqu xcounter, (p_iv)
ret
RET
.endm

/*
Expand Down
Loading

0 comments on commit f94909c

Please sign in to comment.