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: 119324 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4395828qgn; Mon, 20 Nov 2017 13:28:06 -0800 (PST) X-Google-Smtp-Source: AGs4zMaW7aLp0c62UZYbp7woJLr/utzQba+210ubdQZxlas72mfDv/5q9H4E6GDQufeaDpjcYyB9 X-Received: by 10.37.208.88 with SMTP id h85mr9557540ybg.363.1511213286492; Mon, 20 Nov 2017 13:28:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511213286; cv=none; d=google.com; s=arc-20160816; b=YQPYMSepoKsjM5q3lmgrgsjJvVyaS0LL3M/jjMYZVq3Utp+J5ouqfEsSZc7IbroW4o 3cKIBzpZ5FkIC1Oka9eHrJKHTAfkZ+EJ4blWp3vBEZQvAM5V14fe4F43GRcYTu8NiLGM nhEvXV3D+38RdVPkL8ssrhw45/5QlwlRE5V19oLzFPLsg5hanXRn/KUf/0Q62HIeCJPT C8gTa56ukuQv9vmHI/EOy7UutWYgYH8rnKoKmvFURVj4dwW4jU0LjKhtP7XuZVnxoAiJ ghp/Ac0Vuylh4ZVeY05sEBSx4HUM4Ccm0Q70djWvWgV6enYKNeUTedT8OrZbSYbW9PUu LDYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=vsOs+oYYn+PCPaX4vVkt5j6zcyxWA0dA3DU3czrhMNA=; b=PoX/bknl90u2do6ahTexzDic9LuOgUWb+YmSjl5refnwUHV1b7AijnKY7Df4nUK+gq DKJBphkvjAbxw2u52f2Hv8RkGn2BWaWiKQJ1Fq2gSopwP70ypWEo4hiW1Ryc9Mz7Wye1 BQsQ8ZI3p8pZUJBGdsRyQRRrfyA5I1ZFPR49/kVID7//PFI4L9my4a4a6ZUWp1CimXDU YdJi/Gb6VqO5RybGPvVcWSkn9POmTuLOfE0dQmyf2WfVHi/OUq4w/FLMsJRWBYBvA0K5 6u2x2hgeFo6S8M+poRcrK+IcIJHzbhgpbx4DX9d6c50mCoyF7wQQPY17gafklvByL6DH Y+MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Ds2aCKyU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id l124si740785ywe.718.2017.11.20.13.28.06 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 20 Nov 2017 13:28:06 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Ds2aCKyU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59828 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGtbp-0001Ny-TD for patch@linaro.org; Mon, 20 Nov 2017 16:28:05 -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-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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(-) -- 2.14.2 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;