From nobody Wed May 1 12:48:23 2024 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 1487266749680537.5514716083333; Thu, 16 Feb 2017 09:39:09 -0800 (PST) Received: from localhost ([::1]:48457 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceQ1L-0007Nh-Ad for importer@patchew.org; Thu, 16 Feb 2017 12:39:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50468) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cePzm-0006Js-3b for qemu-devel@nongnu.org; Thu, 16 Feb 2017 12:37:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cePzj-0001PQ-0x for qemu-devel@nongnu.org; Thu, 16 Feb 2017 12:37:30 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:63306) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cePzi-0001OJ-N8 for qemu-devel@nongnu.org; Thu, 16 Feb 2017 12:37:26 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.183]) with ESMTPSA (Nemesis) id 0MLfvf-1cegq43gYt-000pne; Thu, 16 Feb 2017 18:37:12 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Thu, 16 Feb 2017 18:37:07 +0100 Message-Id: <20170216173707.16209-1-laurent@vivier.eu> X-Mailer: git-send-email 2.9.3 X-Provags-ID: V03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received-From: 212.227.17.13 Subject: [Qemu-devel] [PATCH] 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: Peter Maydell , 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 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 --- 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