[Qemu-devel] [PATCH] linux-user: Fix fork() and vfork()

Tim Hentenaar posted 1 patch 8 years, 8 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20170228025157.3499-1-tim@hentenaar.com
Test checkpatch passed
Test docker passed
Test s390x passed
linux-user/syscall.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[Qemu-devel] [PATCH] linux-user: Fix fork() and vfork()
Posted by Tim Hentenaar 8 years, 8 months ago
A check was introduced in 5ea2fc84da1bffce749c9d0848f5336def2818bb which
causes fork() and vfork() to fail if TARGET_SIGCHLD != SIGCHLD.

Signed-off-by: Tim Hentenaar <tim@hentenaar.com>
---
 linux-user/syscall.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index f569f82..ac4106a 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -7680,7 +7680,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
         break;
 #ifdef TARGET_NR_fork
     case TARGET_NR_fork:
-        ret = get_errno(do_fork(cpu_env, SIGCHLD, 0, 0, 0, 0));
+        ret = get_errno(do_fork(cpu_env, TARGET_SIGCHLD, 0, 0, 0, 0));
         break;
 #endif
 #ifdef TARGET_NR_waitpid
@@ -10490,7 +10490,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
 #endif
 #ifdef TARGET_NR_vfork
     case TARGET_NR_vfork:
-        ret = get_errno(do_fork(cpu_env, CLONE_VFORK | CLONE_VM | SIGCHLD,
+        ret = get_errno(do_fork(cpu_env, CLONE_VFORK | CLONE_VM | TARGET_SIGCHLD,
                         0, 0, 0, 0));
         break;
 #endif
-- 
2.10.2


Re: [Qemu-devel] [PATCH] linux-user: Fix fork() and vfork()
Posted by Peter Maydell 8 years, 8 months ago
On 28 February 2017 at 02:51, Tim Hentenaar <tim@hentenaar.com> wrote:
> A check was introduced in 5ea2fc84da1bffce749c9d0848f5336def2818bb which
> causes fork() and vfork() to fail if TARGET_SIGCHLD != SIGCHLD.
>
> Signed-off-by: Tim Hentenaar <tim@hentenaar.com>
> ---
>  linux-user/syscall.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Thanks for this patch. In fact the equivalent bugfix has just
hit QEMU git master, as commit 7eddb5ddacb783ba.

thanks
-- PMM