Don't install SIGILL handler until after sigsetjmp.

Previously, if SIGILL was received between the signal handler being
installed and before the sigsetjmp, the process would longjmp to a
random location.

Change-Id: I9e6143a17ff3db0e1b00ece68fce161801461010
Reviewed-on: https://boringssl-review.googlesource.com/3950
Reviewed-by: David Benjamin <davidben@chromium.org>
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
Adam Langley 2015-03-16 13:00:53 -07:00
parent 8b368412d3
commit 078abceb29

View File

@ -93,10 +93,10 @@ static int probe_for_NEON() {
sigset_t original_sigmask;
sigprocmask(SIG_SETMASK, &sigmask, &original_sigmask);
sigaction(SIGILL, &sigill_action, &sigill_original_action);
if (sigsetjmp(sigill_jmp, 1 /* save signals */) == 0) {
sigaction(SIGILL, &sigill_action, &sigill_original_action);
// This function cannot be inline asm because GCC will refuse to compile
// inline NEON instructions unless building with -mfpu=neon, which would
// defeat the point of probing for support at runtime.