aboutsummaryrefslogtreecommitdiff
path: root/linux-user/sparc
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-05-04 09:25:12 +0100
committerPeter Maydell <peter.maydell@linaro.org>2018-05-04 09:25:12 +0100
commitf0c889522255b8fee2fe3a6cc8157dfa80abac2a (patch)
tree4303e6870bc957055892b0c474c14376b0301a10 /linux-user/sparc
parente2f557f9889fea29fbb7bafae7719e38821df8fb (diff)
parent7f254c5cb80bc478794a4c3d7fe5d503b033be13 (diff)
downloadqemu-f0c889522255b8fee2fe3a6cc8157dfa80abac2a.zip
qemu-f0c889522255b8fee2fe3a6cc8157dfa80abac2a.tar.gz
qemu-f0c889522255b8fee2fe3a6cc8157dfa80abac2a.tar.bz2
Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-2.13-pull-request' into staging
# gpg: Signature made Thu 03 May 2018 22:38:35 BST # gpg: using RSA key F30C38BD3F2FBE3C # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" # gpg: aka "Laurent Vivier <laurent@vivier.eu>" # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * remotes/vivier2/tags/linux-user-for-2.13-pull-request: linux-user: remove useless padding in flock64 structure linux-user: introduce target_sigsp() and target_save_altstack() linux-user: ARM-FDPIC: Add support for signals for FDPIC targets linux-user: ARM-FDPIC: Add support of FDPIC for ARM. linux-user: ARM-FDPIC: Identify ARM FDPIC binaries Remove CONFIG_USE_FDPIC. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'linux-user/sparc')
-rw-r--r--linux-user/sparc/signal.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c
index c823e61..45e922f 100644
--- a/linux-user/sparc/signal.c
+++ b/linux-user/sparc/signal.c
@@ -123,18 +123,28 @@ static inline abi_ulong get_sigframe(struct target_sigaction *sa,
CPUSPARCState *env,
unsigned long framesize)
{
- abi_ulong sp;
+ abi_ulong sp = get_sp_from_cpustate(env);
- sp = env->regwptr[UREG_FP];
+ /*
+ * If we are on the alternate signal stack and would overflow it, don't.
+ * Return an always-bogus address instead so we will die with SIGSEGV.
+ */
+ if (on_sig_stack(sp) && !likely(on_sig_stack(sp - framesize))) {
+ return -1;
+ }
/* This is the X/Open sanctioned signal stack switching. */
- if (sa->sa_flags & TARGET_SA_ONSTACK) {
- if (!on_sig_stack(sp)
- && !((target_sigaltstack_used.ss_sp + target_sigaltstack_used.ss_size) & 7)) {
- sp = target_sigaltstack_used.ss_sp + target_sigaltstack_used.ss_size;
- }
- }
- return sp - framesize;
+ sp = target_sigsp(sp, sa) - framesize;
+
+ /* Always align the stack frame. This handles two cases. First,
+ * sigaltstack need not be mindful of platform specific stack
+ * alignment. Second, if we took this signal because the stack
+ * is not aligned properly, we'd like to take the signal cleanly
+ * and report that.
+ */
+ sp &= ~15UL;
+
+ return sp;
}
static int