qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL 21/44] linux-user: Restart fork() if signals pending


From: riku . voipio
Subject: [Qemu-devel] [PULL 21/44] linux-user: Restart fork() if signals pending
Date: Wed, 8 Jun 2016 16:30:02 +0300

From: Timothy E Baldwin <address@hidden>

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 <address@hidden>
Message-id: address@hidden
Reviewed-by: Peter Maydell <address@hidden>
Signed-off-by: Peter Maydell <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
---
 linux-user/syscall.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index c0d086c..a2d591e 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) {
-- 
2.1.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]