summaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
authorTimothy E Baldwin <T.E.Baldwin99@members.leeds.ac.uk>2016-05-27 15:51:58 +0100
committerRiku Voipio <riku.voipio@linaro.org>2016-06-07 16:39:08 +0300
commit7d92d34ee4c7988f5ef6c8a5ed23d2c3e0837253 (patch)
treecb274ac50ff93805c943c50b39d6604c53871737 /linux-user
parentbef653d92e4e1c47c60f5c020ff6de69dba83478 (diff)
downloadqemu-7d92d34ee4c7988f5ef6c8a5ed23d2c3e0837253.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> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Diffstat (limited to 'linux-user')
-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 c0d086c2fb..a2d591ed8a 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5437,6 +5437,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) {