aboutsummaryrefslogtreecommitdiff
path: root/linux-user/signal.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2016-07-28 16:44:48 +0100
committerRiku Voipio <riku.voipio@linaro.org>2016-09-21 22:01:45 +0300
commit28298c912e2c379f2b7767b351beeb77f001f27f (patch)
tree57af2f2d2a1faeef64e7f0eea77f814802c21616 /linux-user/signal.c
parent09391669975a0e2882c181982d4ddee35a0080bb (diff)
linux-user: ARM: Give SIGSEGV if signal frame setup fails
The 32-bit ARM signal frame setup code was just bailing out on error returns from lock_user_struct calls, without generating the SIGSEGV that should happen here. Wire up error return codes to call force_sigsegv(). Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Diffstat (limited to 'linux-user/signal.c')
-rw-r--r--linux-user/signal.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/linux-user/signal.c b/linux-user/signal.c
index 892b527a37..43836960c1 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -512,8 +512,7 @@ void signal_init(void)
}
}
-#if !((defined(TARGET_ARM) && !defined(TARGET_AARCH64)) || \
- defined(TARGET_X86_64) || defined(TARGET_UNICORE32))
+#if !(defined(TARGET_X86_64) || defined(TARGET_UNICORE32))
/* Force a SIGSEGV if we couldn't write to memory trying to set
* up the signal frame. oldsig is the signal we were trying to handle
@@ -1789,7 +1788,7 @@ static void setup_frame_v1(int usig, struct target_sigaction *ka,
trace_user_setup_frame(regs, frame_addr);
if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) {
- return;
+ goto sigsegv;
}
setup_sigcontext(&frame->sc, regs, set->sig[0]);
@@ -1802,6 +1801,9 @@ static void setup_frame_v1(int usig, struct target_sigaction *ka,
frame_addr + offsetof(struct sigframe_v1, retcode));
unlock_user_struct(frame, frame_addr, 1);
+ return;
+sigsegv:
+ force_sigsegv(usig);
}
static void setup_frame_v2(int usig, struct target_sigaction *ka,
@@ -1812,7 +1814,7 @@ static void setup_frame_v2(int usig, struct target_sigaction *ka,
trace_user_setup_frame(regs, frame_addr);
if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) {
- return;
+ goto sigsegv;
}
setup_sigframe_v2(&frame->uc, set, regs);
@@ -1821,6 +1823,9 @@ static void setup_frame_v2(int usig, struct target_sigaction *ka,
frame_addr + offsetof(struct sigframe_v2, retcode));
unlock_user_struct(frame, frame_addr, 1);
+ return;
+sigsegv:
+ force_sigsegv(usig);
}
static void setup_frame(int usig, struct target_sigaction *ka,
@@ -1846,7 +1851,7 @@ static void setup_rt_frame_v1(int usig, struct target_sigaction *ka,
trace_user_setup_rt_frame(env, frame_addr);
if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) {
- return /* 1 */;
+ goto sigsegv;
}
info_addr = frame_addr + offsetof(struct rt_sigframe_v1, info);
@@ -1876,6 +1881,9 @@ static void setup_rt_frame_v1(int usig, struct target_sigaction *ka,
env->regs[2] = uc_addr;
unlock_user_struct(frame, frame_addr, 1);
+ return;
+sigsegv:
+ force_sigsegv(usig);
}
static void setup_rt_frame_v2(int usig, struct target_sigaction *ka,
@@ -1888,7 +1896,7 @@ static void setup_rt_frame_v2(int usig, struct target_sigaction *ka,
trace_user_setup_rt_frame(env, frame_addr);
if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) {
- return /* 1 */;
+ goto sigsegv;
}
info_addr = frame_addr + offsetof(struct rt_sigframe_v2, info);
@@ -1904,6 +1912,9 @@ static void setup_rt_frame_v2(int usig, struct target_sigaction *ka,
env->regs[2] = uc_addr;
unlock_user_struct(frame, frame_addr, 1);
+ return;
+sigsegv:
+ force_sigsegv(usig);
}
static void setup_rt_frame(int usig, struct target_sigaction *ka,