aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy E Baldwin <T.E.Baldwin99@members.leeds.ac.uk>2016-05-27 15:18:40 +0100
committerPeter Maydell <peter.maydell@linaro.org>2016-05-27 15:39:31 +0100
commit2dc5fefb0655e8d9ac443caedd22780237a466a1 (patch)
treeb74d4231c96cdfb09c5f3f5756469930440ecb1e
parentfc17f795db96fbc156a647d19f3f7ea506f7ecb9 (diff)
downloadqemu-arm-2dc5fefb0655e8d9ac443caedd22780237a466a1.tar.gz
linux-user: Restart fork() if signals pending
If there is a signal pending during fork() the signal handler will erroneously be called in both the parent and child, so handle any pending signals first. Signed-off-by: Timothy Edward Baldwin <T.E.Baldwin99@members.leeds.ac.uk> Message-id: 1441497448-32489-20-git-send-email-T.E.Baldwin99@members.leeds.ac.uk Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--linux-user/syscall.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 549f571aae..7d5f1234af 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4796,6 +4796,11 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp,
if ((flags & ~(CSIGNAL | CLONE_NPTL_FLAGS2)) != 0) {
return -TARGET_EINVAL;
}
+
+ if (block_signals()) {
+ return -TARGET_ERESTARTSYS;
+ }
+
fork_start();
ret = fork();
if (ret == 0) {