diff options
author | H.J. Lu <hongjiu.lu@intel.com> | 2020-01-31 05:07:01 -0800 |
---|---|---|
committer | Pauli <paul.dale@oracle.com> | 2020-02-05 11:51:50 +1000 |
commit | e558ae49213c1b7e58addc322675757ec93c2829 (patch) | |
tree | 7efca8b3427408098bbb75d21cb66b1a8d9fcd64 /crypto/perlasm | |
parent | 34b167625af50a13b8414e11814a795457cb17b0 (diff) | |
download | openssl-new-e558ae49213c1b7e58addc322675757ec93c2829.tar.gz |
x86: Add endbranch to indirect branch targets for Intel CET
To support Intel CET, all indirect branch targets must start with
endbranch. Here is a patch to add endbranch to all function entries
in x86 assembly codes which are indirect branch targets as discovered
by running openssl testsuite on Intel CET machine and visual inspection.
Since x86 cbc.pl uses indirect branch with a jump table, we also need
to add endbranch to all jump targets.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10984)
Diffstat (limited to 'crypto/perlasm')
-rw-r--r-- | crypto/perlasm/cbc.pl | 7 | ||||
-rw-r--r-- | crypto/perlasm/x86gas.pl | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/crypto/perlasm/cbc.pl b/crypto/perlasm/cbc.pl index 8aefefb696..44a60eb762 100644 --- a/crypto/perlasm/cbc.pl +++ b/crypto/perlasm/cbc.pl @@ -165,21 +165,28 @@ sub cbc &jmp_ptr($count); &set_label("ej7"); + &endbranch() &movb(&HB("edx"), &BP(6,$in,"",0)); &shl("edx",8); &set_label("ej6"); + &endbranch() &movb(&HB("edx"), &BP(5,$in,"",0)); &set_label("ej5"); + &endbranch() &movb(&LB("edx"), &BP(4,$in,"",0)); &set_label("ej4"); + &endbranch() &mov("ecx", &DWP(0,$in,"",0)); &jmp(&label("ejend")); &set_label("ej3"); + &endbranch() &movb(&HB("ecx"), &BP(2,$in,"",0)); &shl("ecx",8); &set_label("ej2"); + &endbranch() &movb(&HB("ecx"), &BP(1,$in,"",0)); &set_label("ej1"); + &endbranch() &movb(&LB("ecx"), &BP(0,$in,"",0)); &set_label("ejend"); diff --git a/crypto/perlasm/x86gas.pl b/crypto/perlasm/x86gas.pl index 728c1a6da5..25d1c16aac 100644 --- a/crypto/perlasm/x86gas.pl +++ b/crypto/perlasm/x86gas.pl @@ -124,6 +124,7 @@ sub ::function_begin_B push(@out,".align\t$align\n"); push(@out,"$func:\n"); push(@out,"$begin:\n") if ($global); + &::endbranch(); $::stack=4; } |