linux-user/sparc: Fix errors in target_ucontext structures
authorPeter Maydell <peter.maydell@linaro.org>
Thu, 5 Nov 2020 21:23:12 +0000 (21:23 +0000)
committerLaurent Vivier <laurent@vivier.eu>
Tue, 10 Nov 2020 06:52:55 +0000 (07:52 +0100)
commitb8ae597f0e6df9d1d80e07083fabf763fcb46013
tree13060470e8c9398d0a68e4c721f0ba4124a986a9
parent43afbbd9fea1b255cc81f5f4bfd0b6a88826c735
linux-user/sparc: Fix errors in target_ucontext structures

The various structs that make up the SPARC target_ucontext had some
errors:
 * target structures must not include fields which are host pointers,
   which might be the wrong size.  These should be abi_ulong instead
 * because we don't have the 'long double' part of the mcfpu_fregs
   union in our version of the target_mc_fpu struct, we need to
   manually force it to be 16-aligned

In particular, the lack of 16-alignment caused sparc64_get_context()
and sparc64_set_context() to read and write all the registers at the
wrong offset, which triggered a guest glibc stack check in
siglongjmp:
  *** longjmp causes uninitialized stack frame ***: terminated
when trying to run bash.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20201105212314.9628-2-peter.maydell@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
linux-user/sparc/signal.c