From nobody Thu Nov 6 19:07:20 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1488234963008203.09666279420787; Mon, 27 Feb 2017 14:36:03 -0800 (PST) Received: from localhost ([::1]:57298 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciTth-0002b3-Bo for importer@patchew.org; Mon, 27 Feb 2017 17:36:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39758) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciTrd-0001Pp-UB for qemu-devel@nongnu.org; Mon, 27 Feb 2017 17:33:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciTrZ-0003sJ-JA for qemu-devel@nongnu.org; Mon, 27 Feb 2017 17:33:53 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:60770) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ciTrZ-0003nK-9k for qemu-devel@nongnu.org; Mon, 27 Feb 2017 17:33:49 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.183]) with ESMTPSA (Nemesis) id 0MgwGe-1cvlWW0gyW-00M6wh; Mon, 27 Feb 2017 23:33:40 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Mon, 27 Feb 2017 23:33:32 +0100 Message-Id: <20170227223337.17434-2-laurent@vivier.eu> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170227223337.17434-1-laurent@vivier.eu> References: <20170227223337.17434-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K0:lV9gJQbTCg+gApx6k+k7SlzVwUVOCiFDC2IjzCweRJc1riSKT2/ FoDWHGDzPLvvYNX3tbzBKKn6D+xiSgqUdijlKHL9Hq7Y/JzAm3L0ODaOTcyL+3bSpcrC9QU ijTpRGRF0SSOWXPKG+ECClogrgtSNtQwDJ7Oj9m2Kqflf4m8hD4UgXtycgC/IgrxypYGgv0 BeKs0hMZQMTKHUViVSczA== X-UI-Out-Filterresults: notjunk:1;V01:K0:7JSYnE1OjEc=:YOPCY0S0dTv/lLmrLa0trr 19UJMDh6hnNuDs5FrwDXcisSr/wRTsRKpFl8Cmjrz5mz0AqqfC/OP5/yYEbAK6SM/uu3KcjSH gfpuGDj9/BIDREMFqmHEe6CacZHViRWpagdPYvVXD3xdU7iAR1J2hlRVRSWmJnhgl/EVOzkt5 zAIcS04e89dwJqcN5UL4uaLxlv12e1a2d9UUQiyHRmq+8A7n6Ja5TX+iPu8mi9SytBB7772yj dyyMKtM+ORvxi3iZNl6m7tYaABPWWDP2PVvmGWrZqQ4yrvzfmBKo2sUraCCFSZG//+sGjXfWl AefBVLajgdgti1SA4OJgBKC5yyhGjMNDYFjTMiih0E/8jcocf22wAhrPmEL5ddnYk9oRpN98E t/cXUAuhn6jnzTmrrKIarPE+iesJd3FVo3EfdnNmKSRKcZICn+H+rTTWFmLs+fWjM7McCNS14 ayO5apfAX6sYXlPalntvp1MQfXOnSPC/j8SKR7XuU3EWyDVeAwy8B1CfqawgDiVye3Ln3oSQ8 uKGytzfEBulDTElkgxvaV1fupX9EhW2kSrchdzyoWz6thyFFgvZrkBvkwv+z1gaZtKa2pTnY7 tLC3P8pF2YGmyLdxEN7zGkm3q5qt9IL4Q1uumThRnoRTMFgOnphPqjWCh/Mkwk7etmq3pmIAz C6jef54a/VtCNCpZEZKWxXpeyKbfVFMGEZC/etSmM1ca6Pg3tfisAfx+k+gXYdRnzKb1q78Mk jQFr9KphFsK2p8n+ X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.72.192.73 Subject: [Qemu-devel] [PULL 1/6] linux-user: fix fork() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Since commit 5ea2fc8 ("linux-user: Sanity check clone flags"), trying to run fork() fails with old distro on some architectures. This is the case with HP-PA and Debian 5 (Lenny). It fails on: if ((flags & CSIGNAL) !=3D TARGET_SIGCHLD) { return -TARGET_EINVAL; } because flags is 17, whereas on HP-PA, SIGCHLD is 18. 17 is the SIGCHLD value of my host (x86_64). It appears that for TARGET_NR_fork and TARGET_NR_vfork, QEMU calls do_fork() with SIGCHLD instead of TARGET_SIGCHLD. Signed-off-by: Laurent Vivier Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20170216173707.16209-1-laurent@vivier.eu> --- linux-user/syscall.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index f569f82..4d85355 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 =3D get_errno(do_fork(cpu_env, SIGCHLD, 0, 0, 0, 0)); + ret =3D get_errno(do_fork(cpu_env, TARGET_SIGCHLD, 0, 0, 0, 0)); break; #endif #ifdef TARGET_NR_waitpid @@ -10490,7 +10490,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_lon= g arg1, #endif #ifdef TARGET_NR_vfork case TARGET_NR_vfork: - ret =3D get_errno(do_fork(cpu_env, CLONE_VFORK | CLONE_VM | SIGCHL= D, + ret =3D get_errno(do_fork(cpu_env, + CLONE_VFORK | CLONE_VM | TARGET_SIGCHLD, 0, 0, 0, 0)); break; #endif --=20 2.9.3