From patchwork Mon Nov 20 21:21:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 10067333 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 23AD76038F for ; Mon, 20 Nov 2017 21:29:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1458D28BF2 for ; Mon, 20 Nov 2017 21:29:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 090A3290C5; Mon, 20 Nov 2017 21:29:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7D20528BF2 for ; Mon, 20 Nov 2017 21:29:03 +0000 (UTC) Received: from localhost ([::1]:59828 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGtck-0001Ny-ML for patchwork-qemu-devel@patchwork.kernel.org; Mon, 20 Nov 2017 16:29:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58282) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGtW5-0004vh-6b for qemu-devel@nongnu.org; Mon, 20 Nov 2017 16:22:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eGtW4-00086M-6J for qemu-devel@nongnu.org; Mon, 20 Nov 2017 16:22:09 -0500 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]:41055) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eGtW3-00083W-UF for qemu-devel@nongnu.org; Mon, 20 Nov 2017 16:22:08 -0500 Received: by mail-lf0-x244.google.com with SMTP id f134so11686961lfg.8 for ; Mon, 20 Nov 2017 13:22:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vsOs+oYYn+PCPaX4vVkt5j6zcyxWA0dA3DU3czrhMNA=; b=Ds2aCKyUtY8VKf1ip2XT6hI7enubjGCGb9C61ttzVqMkHPkpemwp/Oe01ddDjmsRg1 c0lZX/89s0adeKElUfA3zQjOnpM+O2X5df0szOeDeINJbZ4XS89JYxN1UJ/xvRABIehB U0Q9dYyPj7LmXRAZLYXMb0KNI52IQaqaxC8Ww= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vsOs+oYYn+PCPaX4vVkt5j6zcyxWA0dA3DU3czrhMNA=; b=Nm3FduZ/RvOnlzhWH4RISdLSeXnZApBrk8gyEmeNwboLj7UsFzIfAqbFTO4Qgc7ovH RymMocYLCyMrXSUNISu1YPw1CO+2pa3S/QHGX6wLCfD1PNXoparEsEjiQlcmDKtvyLya x+jRsrpd1wdDwOQoZcHnJo/qE4zpniWJbz/woMxo+Y0JZUU530qmSAMdfXSxPhiPi/vM NAC6bqS2fZGIf5aJz0fUIEVWbRYdR/F/WQW0vGUT1XFSNYZqV9KQe9e6htE3Sk0Bac66 QW7y6Pf8t/DmWKhHeyWur6VJsyrOOXvjDHdarkf5TS2VaqJsAj/cd5qQwPLpigGhq9qH Fq4Q== X-Gm-Message-State: AJaThX55Le3WTXXOM1U2iRnSdow/3cMJzGrbUbIUuys/VuC1DeZCdyRM xoOwFFwAVIVkENnTBC+tTGqEXQC5uF4= X-Google-Smtp-Source: AGs4zMZpSXsRHcTw6KTPDHCk1Kc0JPQGg+8BfGsBETtY0LM/zHW0MHAq5D9vXO4wNn9LkDc1cGDo8g== X-Received: by 10.25.228.155 with SMTP id x27mr173216lfi.231.1511212926472; Mon, 20 Nov 2017 13:22:06 -0800 (PST) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id v63sm1645409lje.39.2017.11.20.13.22.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Nov 2017 13:22:04 -0800 (PST) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Mon, 20 Nov 2017 23:21:42 +0200 Message-Id: <78bfef72fbf8705f002c5c57cf3f1d3b8e83399e.1511212753.git.riku.voipio@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::244 Subject: [Qemu-devel] [PULL 14/15] linux-user: Handle rt_sigaction correctly for SPARC 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 Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Peter Maydell SPARC is like Alpha in its handling of the rt_sigaction syscall: it takes an extra parameter 'restorer' which needs to be copied into the sa_restorer field of the sigaction struct. The order of the arguments differs slightly between SPARC and Alpha but the implementation is otherwise the same. (Compare the rt_sigaction() functions in arch/sparc/kernel/sys_sparc_64.c and arch/alpha/kernel/signal.c.) Note that this change is somewhat moot until SPARC acquires support for actually delivering RT signals. Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/syscall.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index f31b853bb7..11c9116c4a 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8579,8 +8579,16 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, case TARGET_NR_rt_sigaction: { #if defined(TARGET_ALPHA) - struct target_sigaction act, oact, *pact = 0; + /* For Alpha and SPARC this is a 5 argument syscall, with + * a 'restorer' parameter which must be copied into the + * sa_restorer field of the sigaction struct. + * For Alpha that 'restorer' is arg5; for SPARC it is arg4, + * and arg5 is the sigsetsize. + * Alpha also has a separate rt_sigaction struct that it uses + * here; SPARC uses the usual sigaction struct. + */ struct target_rt_sigaction *rt_act; + struct target_sigaction act, oact, *pact = 0; if (arg4 != sizeof(target_sigset_t)) { ret = -TARGET_EINVAL; @@ -8606,18 +8614,29 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, unlock_user_struct(rt_act, arg3, 1); } #else +#ifdef TARGET_SPARC + target_ulong restorer = arg4; + target_ulong sigsetsize = arg5; +#else + target_ulong sigsetsize = arg4; +#endif struct target_sigaction *act; struct target_sigaction *oact; - if (arg4 != sizeof(target_sigset_t)) { + if (sigsetsize != sizeof(target_sigset_t)) { ret = -TARGET_EINVAL; break; } if (arg2) { - if (!lock_user_struct(VERIFY_READ, act, arg2, 1)) + if (!lock_user_struct(VERIFY_READ, act, arg2, 1)) { goto efault; - } else + } +#ifdef TARGET_SPARC + act->sa_restorer = restorer; +#endif + } else { act = NULL; + } if (arg3) { if (!lock_user_struct(VERIFY_WRITE, oact, arg3, 0)) { ret = -TARGET_EFAULT;