Use USE_SWAPCONTEXT on IA64.
authorSebastian Andrzej Siewior <sebastian@breakpoint.cc>
Tue, 28 Dec 2021 22:05:32 +0000 (23:05 +0100)
committerTomas Mraz <tomas@openssl.org>
Tue, 4 Jan 2022 11:14:19 +0000 (12:14 +0100)
On IA64 the use of setjmp()/ longjmp() does not properly save the
state of the register stack engine (RSE) and requires extra care.
The use of it in the async interface led to a failure in the
test_async.t test since its introduction in 1.1.0 series.

Instead of properly adding the needed assembly bits here use the
swapcontext() function which properly saves the whole context.

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17370)

crypto/async/arch/async_posix.h

index ab7637f69e767608f9aaf5e547dd753dff2bb652..eeb7774512281dfa911f6572ce848dbdce54a690 100644 (file)
 #  define ASYNC_POSIX
 #  define ASYNC_ARCH
 
-#  ifdef __CET__
+#  if defined(__CET__) || defined(__ia64__)
 /*
  * When Intel CET is enabled, makecontext will create a different
  * shadow stack for each context.  async_fibre_swapcontext cannot
  * use _longjmp.  It must call swapcontext to swap shadow stack as
  * well as normal stack.
+ * On IA64 the register stack engine is not saved across setjmp/longjmp. Here
+ * swapcontext() performs correctly.
  */
 #   define USE_SWAPCONTEXT
 #  endif