aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2015-01-30 21:22:20 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-01-30 21:22:20 +0000
commitca1c60be1f4fcb6904691522918e8ebdf271f553 (patch)
tree1e5337bc3ddbd9dc3403a0867ad4aecab1ca2858
parent9f360dc836a27d1f2da22042cb2511d237e99fcd (diff)
parentf35165a9fe623290659a755598925a833b284e22 (diff)
downloadopenssl-ca1c60be1f4fcb6904691522918e8ebdf271f553.tar.gz
am f35165a9: Merge "Work-around for bionic sigsetjmp bug"android-wear-5.1.1_r1android-wear-5.1.0_r1android-m-previewmaster-soong
* commit 'f35165a9fe623290659a755598925a833b284e22': Work-around for bionic sigsetjmp bug
-rw-r--r--crypto/armcap.c8
-rw-r--r--patches/0018-bionic-armcap.patch42
2 files changed, 50 insertions, 0 deletions
diff --git a/crypto/armcap.c b/crypto/armcap.c
index 7e46d07a32..59b7494831 100644
--- a/crypto/armcap.c
+++ b/crypto/armcap.c
@@ -68,6 +68,14 @@ static unsigned long (*getauxval)(unsigned long) = NULL;
# define HWCAP_CE_SHA256 (1 << 6)
#endif
+#ifdef ANDROID
+// Works around a bug where Android versions up to and including L don't
+// properly restore the signal mask when asked.
+#define sigsetjmp(env,savesigs) \
+ (sigprocmask(SIG_SETMASK,&ill_act.sa_mask,NULL), \
+ sigsetjmp(env,savesigs))
+#endif
+
void OPENSSL_cpuid_setup(void)
{
char *e;
diff --git a/patches/0018-bionic-armcap.patch b/patches/0018-bionic-armcap.patch
new file mode 100644
index 0000000000..cc371d247c
--- /dev/null
+++ b/patches/0018-bionic-armcap.patch
@@ -0,0 +1,42 @@
+From ad36797d76d658cee72057a50473eb98152a3fbe Mon Sep 17 00:00:00 2001
+From: Kenny Root <kroot@google.com>
+Date: Fri, 30 Jan 2015 09:16:43 -0800
+Subject: [PATCH] Work-around for bionic sigsetjmp bug
+
+In versions of bionic libc up to and including Android L, the sigsetjmp
+didn't properly restore the signal mask when returning from a nonlocal
+goto. Add a small wrapper to make sure we call sigprocmask each time we
+call sigsetjmp which ensures the SIGILL is masked.
+
+The symptoms of this problem include receiving a SIGILL with a stack
+trace or simply receiving the text "Illegal instruction" when running an
+application from the command line.
+
+Bug: 15732256
+Change-Id: Ic792583da5ccf601afc10828b1a666d24b903a19
+---
+ crypto/armcap.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/crypto/armcap.c b/crypto/armcap.c
+index 7e46d07..59b7494 100644
+--- a/crypto/armcap.c
++++ b/crypto/armcap.c
+@@ -68,6 +68,14 @@ static unsigned long (*getauxval)(unsigned long) = NULL;
+ # define HWCAP_CE_SHA256 (1 << 6)
+ #endif
+
++#ifdef ANDROID
++// Works around a bug where Android versions up to and including L don't
++// properly restore the signal mask when asked.
++#define sigsetjmp(env,savesigs) \
++ (sigprocmask(SIG_SETMASK,&ill_act.sa_mask,NULL), \
++ sigsetjmp(env,savesigs))
++#endif
++
+ void OPENSSL_cpuid_setup(void)
+ {
+ char *e;
+--
+2.2.0.rc0.207.ga3a616c
+