Skip to content

Commit 4635742

Browse files
zx2c4herbertx
authored andcommitted
crypto: x86/chacha20 - satisfy stack validation 2.0
The new stack validator in objdump doesn't like directly assigning r11 to rsp, warning with something like: warning: objtool: chacha20_4block_xor_ssse3()+0xa: unsupported stack pointer realignment warning: objtool: chacha20_8block_xor_avx2()+0x6: unsupported stack pointer realignment This fixes things up to use code similar to gcc's DRAP register, so that objdump remains happy. Signed-off-by: Jason A. Donenfeld <[email protected]> Fixes: baa4146 ("objtool: Implement stack validation 2.0") Signed-off-by: Herbert Xu <[email protected]>
1 parent b61907b commit 4635742

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

arch/x86/crypto/chacha20-avx2-x86_64.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ ENTRY(chacha20_8block_xor_avx2)
4545

4646
vzeroupper
4747
# 4 * 32 byte stack, 32-byte aligned
48-
mov %rsp, %r8
48+
lea 8(%rsp),%r10
4949
and $~31, %rsp
5050
sub $0x80, %rsp
5151

@@ -443,6 +443,6 @@ ENTRY(chacha20_8block_xor_avx2)
443443
vmovdqu %ymm15,0x01e0(%rsi)
444444

445445
vzeroupper
446-
mov %r8,%rsp
446+
lea -8(%r10),%rsp
447447
ret
448448
ENDPROC(chacha20_8block_xor_avx2)

arch/x86/crypto/chacha20-ssse3-x86_64.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ ENTRY(chacha20_4block_xor_ssse3)
160160
# done with the slightly better performing SSSE3 byte shuffling,
161161
# 7/12-bit word rotation uses traditional shift+OR.
162162

163-
mov %rsp,%r11
163+
lea 8(%rsp),%r10
164164
sub $0x80,%rsp
165165
and $~63,%rsp
166166

@@ -625,6 +625,6 @@ ENTRY(chacha20_4block_xor_ssse3)
625625
pxor %xmm1,%xmm15
626626
movdqu %xmm15,0xf0(%rsi)
627627

628-
mov %r11,%rsp
628+
lea -8(%r10),%rsp
629629
ret
630630
ENDPROC(chacha20_4block_xor_ssse3)

0 commit comments

Comments
 (0)