diff options
author | Tom Cosgrove <tom.cosgrove@arm.com> | 2022-02-14 11:23:57 +0000 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2022-03-01 09:52:25 +1100 |
commit | f5ec705d4ad15767204f301d96d9bfd447b66c24 (patch) | |
tree | b768a3e7070d1c1995471d5c56b36c265889d112 /crypto/async | |
parent | f609d9464e198e4cd93bc15e47a073b478bdd42e (diff) |
aarch64: Fix async_fibre_swapcontext() on clang BTI builds
Reverting to using swapcontext() when compiling with clang on BTI-enabled
builds fixes the BTI setjmp() failure seen when running asynctest.
The issue with setjmp/longjmp is a known clang bug: see
https://github.com/llvm/llvm-project/issues/48888
Change-Id: I6eeaaa2e15f402789f1b3e742038f84bef846e29
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17698)
(cherry picked from commit d2d2401aed7ff45f4c013201944e1218dce12da7)
Diffstat (limited to 'crypto/async')
-rw-r--r-- | crypto/async/arch/async_posix.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crypto/async/arch/async_posix.h b/crypto/async/arch/async_posix.h index eeb7774512..57da6e211f 100644 --- a/crypto/async/arch/async_posix.h +++ b/crypto/async/arch/async_posix.h @@ -36,6 +36,18 @@ */ # define USE_SWAPCONTEXT # endif +# if defined(__aarch64__) && defined(__clang__) \ + && defined(__ARM_FEATURE_BTI_DEFAULT) && __ARM_FEATURE_BTI_DEFAULT == 1 +/* + * setjmp/longjmp don't currently work with BTI on all libc implementations + * when compiled by clang. This is because clang doesn't put a BTI after the + * call to setjmp where it returns the second time. This then fails on libc + * implementations - notably glibc - which use an indirect jump to there. + * So use the swapcontext implementation, which does work. + * See https://github.com/llvm/llvm-project/issues/48888. + */ +# define USE_SWAPCONTEXT +# endif # include <ucontext.h> # ifndef USE_SWAPCONTEXT # include <setjmp.h> |