From nobody Thu May 9 00:58:33 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1619132669; cv=none; d=zohomail.com; s=zohoarc; b=jdP2f3z2KhnIlabOs0ya1V3N6M4+DDxa5WIluxIeFlZwpqVzx1juCDrFmI05hFfRZEbZwT5AALf7kRrKCxySmLHz4R8v2a1TA8iu7JLBfLOHJ6g3uSkpNSka3kQOqnxe7F9XlkSateC2QK6CoSfaYEAIXdJQdMuRrV/0BlM+t7g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619132669; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=i2qHlCiJ2ypvQTREB0mNHsQoQ+IiJSRCvrbrqzPax/E=; b=fJzTEmjzCNt7wN1pcqrTHJisJH29xxO39WftYhG2LF/hy8N1Q2miysHqjAt0Vx2+yKS4sj+Mt9ustN0ZS+NPdKudMORr8hzFGL4SaOY9QiJxDO02U9v12dgZWuv3dzhY1VXv1rieX/JfnztfbkzttD0puVPfkyKK9Uz/TRny0xk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1619132669675884.2455998468795; Thu, 22 Apr 2021 16:04:29 -0700 (PDT) Received: from localhost ([::1]:58170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lZiN1-0006jB-1t for importer@patchew.org; Thu, 22 Apr 2021 19:04:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39980) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lZiLC-0005A8-4X for qemu-devel@nongnu.org; Thu, 22 Apr 2021 19:02:34 -0400 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]:44831) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lZiL9-0007ov-VW for qemu-devel@nongnu.org; Thu, 22 Apr 2021 19:02:33 -0400 Received: by mail-pg1-x529.google.com with SMTP id y32so33906663pga.11 for ; Thu, 22 Apr 2021 16:02:31 -0700 (PDT) Received: from localhost.localdomain ([71.212.131.83]) by smtp.gmail.com with ESMTPSA id z12sm2930605pfn.195.2021.04.22.16.02.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Apr 2021 16:02:29 -0700 (PDT) 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=i2qHlCiJ2ypvQTREB0mNHsQoQ+IiJSRCvrbrqzPax/E=; b=Dic/n7O6ICQOz1iGkTB5aoOiLwB53NZ1EwzjoR3OW+9JkKZ4MhYorNDWx4wpOqANae 0jyQ1LDF7QU2zCg1rmU4rwVmQCF3zdpHIalgpSJQ2eXlBmnvJadvy2WQNOUnyP9vFfPk FuLyj0MxSLmIcTx1PmCSaNyjCuMhlhBIJST2031JSnjePD/xAiblbWzU2FU42aGjVc71 CaL8UVFreGQzktIFRdXJgtiEg1F2GU/2f+Q+GZYAXHMt2/TcTnULY1V/GJLLpcDl8J57 eRVza+8RR5r7K8StrHuyCjPXSJ6u//rHat+jyUNJ6VVHcuiSckx5wMUYVe+CO68udEbS KCYA== 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=i2qHlCiJ2ypvQTREB0mNHsQoQ+IiJSRCvrbrqzPax/E=; b=p6bhkNBEJcI/KigyQM8Q1GclQip/lRvDwWykRcu0KLAN1FWkSV6f8mtsm6gaq04NSD nMPYuQX0kiAH8AZSQpX/nPX6DarhS4k9ObvTqYUmPpE5eVLmbZWHdQV/OehJV2xf++oc JFRzpObn5C5kx1DNPQGhV309ApBV42zeDKFCEZEkjsXAkxnqANQdK4l4e54OLX5l7Bi6 Fy5TAtt0RVnXfatJv/6YOL69R7nigP5PKIYlSvWmLHPSWn42EneK9I5IRExDWzrovOVa lBkWjptQQuDXtvCJnSZdfj/G5wOoegWCyKk9atm7UlGFa7AVY6R1P4LPX6oi3KnM/7e0 JwAw== X-Gm-Message-State: AOAM531r5mLpXgc17vva3Z9qG3xE+E/eQUxzKClL8eTVdIgBX+JRu0n5 Qsv2WQ9bGsD8bRtXRKcLYJYQRa/KTopwgg== X-Google-Smtp-Source: ABdhPJy8kl/NznFQAWjxFnvmR3JbFGBPTPvlWvx2Bwo/FvikwmjnCmjy3KDaiI4Q5Mj7LKDhiUvV9A== X-Received: by 2002:a63:3c59:: with SMTP id i25mr943724pgn.366.1619132550121; Thu, 22 Apr 2021 16:02:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 1/7] linux-user/alpha: Fix rt sigframe return Date: Thu, 22 Apr 2021 16:02:21 -0700 Message-Id: <20210422230227.314751-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210422230227.314751-1-richard.henderson@linaro.org> References: <20210422230227.314751-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x529.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) We incorrectly used the offset of the non-rt sigframe. Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- linux-user/alpha/signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/alpha/signal.c b/linux-user/alpha/signal.c index c5c27ce084..86f5d2276d 100644 --- a/linux-user/alpha/signal.c +++ b/linux-user/alpha/signal.c @@ -200,7 +200,7 @@ void setup_rt_frame(int sig, struct target_sigaction *k= a, &frame->retcode[1]); __put_user(INSN_CALLSYS, &frame->retcode[2]); /* imb(); */ - r26 =3D frame_addr + offsetof(struct target_sigframe, retcode); + r26 =3D frame_addr + offsetof(struct target_rt_sigframe, retcode); } =20 if (err) { --=20 2.25.1 From nobody Thu May 9 00:58:33 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1619132794; cv=none; d=zohomail.com; s=zohoarc; b=bRFxknyOZbQw/gjJ+dRxJiGItD5K6KHh4FMugcJaN6C38n9fbRILOD26JWULc7jdyIXXRyV3l68cpaCEReSR2NJtHYNt8q4FKduIqqwr65ty+v151XhK3nIz88C68HRCdQCFgEsN64xyYxX2d6chXsJdP5mliopF9R2+jwDyayE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619132794; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=E3bcQGoF5tL2SwrZa81gd5wA84VGUXSBs7q30g13W7s=; b=KPElTozY2AnrtQo3/jN+5MW4lw/5CwwhkorAwClwsudW36TOqlTMKci8NBinNFboFIcqth3qPX8muj80i3yuxaeBYJlv8/PVqY3xjshIhRk0mCH4ZSkHSTGfwXHDJXVEEczRwYLzn94r6gbVDZaUZGvBIR2gKw2FBj5bzN2GEco= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1619132794759854.858043920606; Thu, 22 Apr 2021 16:06:34 -0700 (PDT) Received: from localhost ([::1]:36596 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lZiP3-000163-P3 for importer@patchew.org; Thu, 22 Apr 2021 19:06:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40034) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lZiLD-0005AQ-OC for qemu-devel@nongnu.org; Thu, 22 Apr 2021 19:02:35 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]:43549) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lZiLA-0007p2-UH for qemu-devel@nongnu.org; Thu, 22 Apr 2021 19:02:35 -0400 Received: by mail-pl1-x62e.google.com with SMTP id u15so15754627plf.10 for ; Thu, 22 Apr 2021 16:02:32 -0700 (PDT) Received: from localhost.localdomain ([71.212.131.83]) by smtp.gmail.com with ESMTPSA id z12sm2930605pfn.195.2021.04.22.16.02.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Apr 2021 16:02:30 -0700 (PDT) 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=E3bcQGoF5tL2SwrZa81gd5wA84VGUXSBs7q30g13W7s=; b=Z8uoVgCBCKRqwEyyy1CXT+mgEXTiPQK5aDHiBM7TftnnuVidzhBNCWd5KknmnKCQ0G X1DBKTZ06hoX/atHKDcyFQSIpAEu+NcouEWH6xIDMEvLXS/dMZDDrpTLHZsmWaFUHPGY Fnrf6y1hWrIw0ZgWkVk/JCZgsI9ZCCKYynVgAMtgW18rIKYIZN/9j7TdL6jpqiaT9YqX pjr3FhMUpNwMsMa0aKa+eUJeKeNz1mRd1ewn4N8ZPBEZJs/PSwlyuZnlQxGQzdq4ZJWb c7WOO3Iqq+xpF+kGFLDqe7Ds9kG6jyo3Cllxf0nkyLvDrmHfPUa9evFn4fAA9vEtfxEW axDg== 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=E3bcQGoF5tL2SwrZa81gd5wA84VGUXSBs7q30g13W7s=; b=lsCPdh+/LgFQAAvl8Qsqc3/jValaiCtQJV1uQVZnPPxwxyEYSthQ47DOYfFB2n9xiC WHyrl6CD2Vr71/76M+jq75RVbOsf+ZQB8c7rA6kY/pqZHw4bDKRs5tE+YzbmFwehpY1A ZJzdumMfKwTbhMfUfm4TZ2eNHCI+3LV7MvC7ZU3OGkm8zDL1ZfZkrGYNTfTKlkclsV11 3eXpPDArSaLP9U0YyaqewU7wgTMFP2scVf9f3sWIyOmmfNpEJ5zHuXgNXhDr2dJ1e8Cg MK1RoKdDWs7xKPF5SZiBxC8wGcI7a+cU3quZg+IFFIOVi7cImGXqBMhJ901qivE8wjkF KMQg== X-Gm-Message-State: AOAM533xIrY46ig7m6B+sc4s6bld1JuOP4LiVqyVlsSqZyx5WjIH5B5X 0yS6D1Zab3KJPSjHTxXAjF5vybdA1NULxQ== X-Google-Smtp-Source: ABdhPJwxoWceg63ddk3cjhGTbBfZWuYlQwkYIG5b0SORKPxECErp1WFVRpuslUPimmHPjMU3Q+KtCA== X-Received: by 2002:a17:90a:4a8f:: with SMTP id f15mr1136828pjh.19.1619132550891; Thu, 22 Apr 2021 16:02:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 2/7] linux-user/alpha: Rename the sigaction restorer field Date: Thu, 22 Apr 2021 16:02:22 -0700 Message-Id: <20210422230227.314751-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210422230227.314751-1-richard.henderson@linaro.org> References: <20210422230227.314751-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Use ka_restorer, in line with TARGET_ARCH_HAS_KA_RESTORER vs TARGET_ARCH_HAS_SA_RESTORER, since Alpha passes this field as a syscall argument. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- linux-user/syscall_defs.h | 2 +- linux-user/alpha/signal.c | 8 ++++---- linux-user/syscall.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 25be414727..693d4f3788 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -519,7 +519,7 @@ struct target_sigaction { abi_ulong _sa_handler; abi_ulong sa_flags; target_sigset_t sa_mask; - abi_ulong sa_restorer; + abi_ulong ka_restorer; }; #elif defined(TARGET_MIPS) struct target_sigaction { diff --git a/linux-user/alpha/signal.c b/linux-user/alpha/signal.c index 86f5d2276d..3aa4b339a4 100644 --- a/linux-user/alpha/signal.c +++ b/linux-user/alpha/signal.c @@ -138,8 +138,8 @@ void setup_frame(int sig, struct target_sigaction *ka, =20 setup_sigcontext(&frame->sc, env, frame_addr, set); =20 - if (ka->sa_restorer) { - r26 =3D ka->sa_restorer; + if (ka->ka_restorer) { + r26 =3D ka->ka_restorer; } else { __put_user(INSN_MOV_R30_R16, &frame->retcode[0]); __put_user(INSN_LDI_R0 + TARGET_NR_sigreturn, @@ -192,8 +192,8 @@ void setup_rt_frame(int sig, struct target_sigaction *k= a, __put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]); } =20 - if (ka->sa_restorer) { - r26 =3D ka->sa_restorer; + if (ka->ka_restorer) { + r26 =3D ka->ka_restorer; } else { __put_user(INSN_MOV_R30_R16, &frame->retcode[0]); __put_user(INSN_LDI_R0 + TARGET_NR_rt_sigreturn, diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 95d79ddc43..ee21eb5e6f 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8989,7 +8989,7 @@ static abi_long do_syscall1(void *cpu_env, int num, a= bi_long arg1, act._sa_handler =3D old_act->_sa_handler; target_siginitset(&act.sa_mask, old_act->sa_mask); act.sa_flags =3D old_act->sa_flags; - act.sa_restorer =3D 0; + act.ka_restorer =3D 0; unlock_user_struct(old_act, arg2, 0); pact =3D &act; } @@ -9085,7 +9085,7 @@ static abi_long do_syscall1(void *cpu_env, int num, a= bi_long arg1, act._sa_handler =3D rt_act->_sa_handler; act.sa_mask =3D rt_act->sa_mask; act.sa_flags =3D rt_act->sa_flags; - act.sa_restorer =3D arg5; + act.ka_restorer =3D arg5; unlock_user_struct(rt_act, arg2, 0); pact =3D &act; } --=20 2.25.1 From nobody Thu May 9 00:58:33 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1619132797; cv=none; d=zohomail.com; s=zohoarc; b=YS347hITU+UDu7If7FNVQtGxm+FfLuCCkePf4kBLAd63RjablRy2gZDnBicOy2D0R6tOe819/Rkhtrched2H8XMA6uBW/HMBtKVrbxrvDH+vndQEvI5iQUZ66wX6kDBAJ01bButmBKPGZqAGW5Vl0MDsbKdaWDWN9xMQFuY/HD0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619132797; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OcPohUJWUFK5d9fBWTi1civihLvFybtJees054KN698=; b=cWCICBGczxeLPcL9j4AMtNp8WeZf3tViwAWgRvyD+gH+qTu7JWw33FKAhhcOVeVqqku/13QenqHdHpddA6UUI3geuPjl14SVKwkyhbm2uIuGXD0JoxdyzT6o3xBziNZioF2lhdY8/U4vAwGGw4xH9Jy/96WoAw8YojSvVyS8CN0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1619132797927882.2318191178981; Thu, 22 Apr 2021 16:06:37 -0700 (PDT) Received: from localhost ([::1]:36794 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lZiP6-0001An-V4 for importer@patchew.org; Thu, 22 Apr 2021 19:06:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40064) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lZiLG-0005Ee-0t for qemu-devel@nongnu.org; Thu, 22 Apr 2021 19:02:38 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:37722) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lZiLB-0007p6-4f for qemu-devel@nongnu.org; Thu, 22 Apr 2021 19:02:37 -0400 Received: by mail-pl1-x635.google.com with SMTP id h20so24313504plr.4 for ; Thu, 22 Apr 2021 16:02:32 -0700 (PDT) Received: from localhost.localdomain ([71.212.131.83]) by smtp.gmail.com with ESMTPSA id z12sm2930605pfn.195.2021.04.22.16.02.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Apr 2021 16:02:31 -0700 (PDT) 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=OcPohUJWUFK5d9fBWTi1civihLvFybtJees054KN698=; b=nK+8iNGgiElRkLPhvH2RntlROcVQ0UaIVOTu5rAW+MEVw6hMb8bKJzhyMD15Tq1Wxy hq08ZcBuEpAfNujI5yFJ11mA5BK3TdO0Gprx6R8hVq6Plb19krvuF+dkTaA2ZqdKICLR sY/4/vsOFg/XilXqx3Ef/ii2VBqg5sqfQ4YQ4nMlQ7SiJePNz5ii/rXof+U9F4swOh8C zcwIIQjvS+xiaBqzaVvR8KfhnssKcBXG5K1Qqu0cBT7dYE64yVaZ+SUP/4TMp6BYWdsN ag7envE1QPNxln8hEJXdZyJyk/Kq9L27iAfiL5tW9W5YcUW6/9YtfexxZgHNYIBTXsQB 6eHA== 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=OcPohUJWUFK5d9fBWTi1civihLvFybtJees054KN698=; b=P1SkwIPeBLTkHu1GuCPmIa48H0FKdL91/s5/7sVY0eeGZynLtwC7j1z3RDnVxmenFj elCc90ms5t64oJq6KmcXg3/APeo4Thcby6D6lqZIzBAeuQEUaEHV5twgnjEGLRy3TKtp 9uH1Gx6eIcDII4iwNdz3d09MpMXdqIknJtf+kBQw8I9mDTgcMkf3XGvvmJ4YHKQmPCX3 RCGERH5iNPJyZKR2HJo5Gk0jOgcvkA0dpI6wO/HwnbVMb/nQA5HZf4Fio+/62vJ9xbwB AR9QFMxqgRZ0yRKslsDVB4UMVyDQ2DbQigDie9ZC36tdTDC95YYwwt6+QxZB7pMK4SGm 8Kdw== X-Gm-Message-State: AOAM532Jsv9XI+dULAcsUtp322t4UeNpsmS4XrF9sZ8YUZyyj6dy7stQ MIzUbqDjjPPSNkxI3TQC9cC5ybELFbj9KQ== X-Google-Smtp-Source: ABdhPJwIiElIq1Cipf1p9U13WPbfbhfOXXqPnNgSSadOTjRWM+VJxZAlm87A1+BPYsZUhPkbt22gZQ== X-Received: by 2002:a17:90a:fb89:: with SMTP id cp9mr1089993pjb.47.1619132551466; Thu, 22 Apr 2021 16:02:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 3/7] linux-user: Pass ka_restorer to do_sigaction Date: Thu, 22 Apr 2021 16:02:23 -0700 Message-Id: <20210422230227.314751-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210422230227.314751-1-richard.henderson@linaro.org> References: <20210422230227.314751-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" The value of ka_restorer needs to be saved in sigact_table. At the moment, the attempt to save it in do_syscall is improperly clobbering user memory. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- linux-user/syscall_defs.h | 2 +- linux-user/signal.c | 5 ++++- linux-user/syscall.c | 19 ++++++------------- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 693d4f3788..e4aaf8412f 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -492,7 +492,7 @@ void target_to_host_old_sigset(sigset_t *sigset, const abi_ulong *old_sigset); struct target_sigaction; int do_sigaction(int sig, const struct target_sigaction *act, - struct target_sigaction *oact); + struct target_sigaction *oact, abi_ulong ka_restorer); =20 #include "target_signal.h" =20 diff --git a/linux-user/signal.c b/linux-user/signal.c index 7eecec46c4..44a5012930 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -830,7 +830,7 @@ out: =20 /* do_sigaction() return target values and host errnos */ int do_sigaction(int sig, const struct target_sigaction *act, - struct target_sigaction *oact) + struct target_sigaction *oact, abi_ulong ka_restorer) { struct target_sigaction *k; struct sigaction act1; @@ -863,6 +863,9 @@ int do_sigaction(int sig, const struct target_sigaction= *act, __get_user(k->sa_flags, &act->sa_flags); #ifdef TARGET_ARCH_HAS_SA_RESTORER __get_user(k->sa_restorer, &act->sa_restorer); +#endif +#ifdef TARGET_ARCH_HAS_KA_RESTORER + k->ka_restorer =3D ka_restorer; #endif /* To be swapped in target_to_host_sigset. */ k->sa_mask =3D act->sa_mask; diff --git a/linux-user/syscall.c b/linux-user/syscall.c index ee21eb5e6f..36169a0ded 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8989,11 +8989,10 @@ static abi_long do_syscall1(void *cpu_env, int num,= abi_long arg1, act._sa_handler =3D old_act->_sa_handler; target_siginitset(&act.sa_mask, old_act->sa_mask); act.sa_flags =3D old_act->sa_flags; - act.ka_restorer =3D 0; unlock_user_struct(old_act, arg2, 0); pact =3D &act; } - ret =3D get_errno(do_sigaction(arg1, pact, &oact)); + ret =3D get_errno(do_sigaction(arg1, pact, &oact, 0)); if (!is_error(ret) && arg3) { if (!lock_user_struct(VERIFY_WRITE, old_act, arg3, 0)) return -TARGET_EFAULT; @@ -9017,7 +9016,7 @@ static abi_long do_syscall1(void *cpu_env, int num, a= bi_long arg1, pact =3D NULL; } =20 - ret =3D get_errno(do_sigaction(arg1, pact, &oact)); + ret =3D get_errno(do_sigaction(arg1, pact, &oact, 0)); =20 if (!is_error(ret) && arg3) { if (!lock_user_struct(VERIFY_WRITE, old_act, arg3, 0)) @@ -9040,15 +9039,12 @@ static abi_long do_syscall1(void *cpu_env, int num,= abi_long arg1, target_siginitset(&act.sa_mask, old_act->sa_mask); act.sa_flags =3D old_act->sa_flags; act.sa_restorer =3D old_act->sa_restorer; -#ifdef TARGET_ARCH_HAS_KA_RESTORER - act.ka_restorer =3D 0; -#endif unlock_user_struct(old_act, arg2, 0); pact =3D &act; } else { pact =3D NULL; } - ret =3D get_errno(do_sigaction(arg1, pact, &oact)); + ret =3D get_errno(do_sigaction(arg1, pact, &oact, 0)); if (!is_error(ret) && arg3) { if (!lock_user_struct(VERIFY_WRITE, old_act, arg3, 0)) return -TARGET_EFAULT; @@ -9085,11 +9081,10 @@ static abi_long do_syscall1(void *cpu_env, int num,= abi_long arg1, act._sa_handler =3D rt_act->_sa_handler; act.sa_mask =3D rt_act->sa_mask; act.sa_flags =3D rt_act->sa_flags; - act.ka_restorer =3D arg5; unlock_user_struct(rt_act, arg2, 0); pact =3D &act; } - ret =3D get_errno(do_sigaction(arg1, pact, &oact)); + ret =3D get_errno(do_sigaction(arg1, pact, &oact, arg5)); if (!is_error(ret) && arg3) { if (!lock_user_struct(VERIFY_WRITE, rt_act, arg3, 0)) return -TARGET_EFAULT; @@ -9104,6 +9099,7 @@ static abi_long do_syscall1(void *cpu_env, int num, a= bi_long arg1, target_ulong sigsetsize =3D arg5; #else target_ulong sigsetsize =3D arg4; + target_ulong restorer =3D 0; #endif struct target_sigaction *act; struct target_sigaction *oact; @@ -9115,9 +9111,6 @@ static abi_long do_syscall1(void *cpu_env, int num, a= bi_long arg1, if (!lock_user_struct(VERIFY_READ, act, arg2, 1)) { return -TARGET_EFAULT; } -#ifdef TARGET_ARCH_HAS_KA_RESTORER - act->ka_restorer =3D restorer; -#endif } else { act =3D NULL; } @@ -9128,7 +9121,7 @@ static abi_long do_syscall1(void *cpu_env, int num, a= bi_long arg1, } } else oact =3D NULL; - ret =3D get_errno(do_sigaction(arg1, act, oact)); + ret =3D get_errno(do_sigaction(arg1, act, oact, restorer)); rt_sigaction_fail: if (act) unlock_user_struct(act, arg2, 0); --=20 2.25.1 From nobody Thu May 9 00:58:33 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1619132869; cv=none; d=zohomail.com; s=zohoarc; b=A9L/kb6N10YU3Y5Cij55fo/fZOs8VyFHFju3WIAx8angA1guJZ1hCuIo2irNvkMxXOpgySuJ2yfnT6PIA+HrB9N1Bi0XHjX21A401ocnGS1VYgY+4m+1dczB9hCANAI/Cq8NBQQs1shQk9a8p8Oe7lJ5SFwvPtRvSa//NDVwQbg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619132869; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=lssDGPyfuni9CuU6IOfi+DPva4cgyenF8vOgPbXMLPk=; b=Q87xAKbVjSY/1q+1AXKxebhWLEE547y0YmyO+xwuSG9V1KzD+KCKA+W7MlhNgRVE4ORxi4F2mj4WQShXpdssUeVGA8B2MVdVZiSdNngjA8LMLGCLQ/iF44Zz6M/kj1uTnCUBKMQzVTeRr7zruusj94J7ZNFT0sav/pRd0hk8p8w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1619132869901192.18614656562283; Thu, 22 Apr 2021 16:07:49 -0700 (PDT) Received: from localhost ([::1]:40648 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lZiQG-0002il-Uz for importer@patchew.org; Thu, 22 Apr 2021 19:07:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40044) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lZiLE-0005Ak-2A for qemu-devel@nongnu.org; Thu, 22 Apr 2021 19:02:36 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:45730) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lZiLC-0007p9-5F for qemu-devel@nongnu.org; Thu, 22 Apr 2021 19:02:35 -0400 Received: by mail-pl1-x62f.google.com with SMTP id p16so20353559plf.12 for ; Thu, 22 Apr 2021 16:02:33 -0700 (PDT) Received: from localhost.localdomain ([71.212.131.83]) by smtp.gmail.com with ESMTPSA id z12sm2930605pfn.195.2021.04.22.16.02.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Apr 2021 16:02:31 -0700 (PDT) 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=lssDGPyfuni9CuU6IOfi+DPva4cgyenF8vOgPbXMLPk=; b=MXesaNbFzhW2/ZKO+ltPv8YM0ZD4L5WpCZBG94oPSWNzcZvxw2f42Q5xannurG2ZLg xCe27Xo7OWDg5Gkj5h3ylt9uhl7AzzFMal7JE6gq1l+cKzjFNZuHT1MSwe6unFWKDX3a DvlreW+WLHZq9ojN//Xl/GcXHpn5dJ0t/qZRKMns81VWoxp/pcY10lns6yudzU4vhdj5 fOsgzJJCVebeBLGgkUOCuJUpuMng9+eCqT4gINgHL2o3w4jkVgJFQ+I0/ALW3d6+eASQ 03pGgbeLy0mTEWg1ffhMD3CDW+ZKXy0a+Xy3zuJHzrP5HWwJw1ZpkajMzwHjuYhdytPD KSCQ== 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=lssDGPyfuni9CuU6IOfi+DPva4cgyenF8vOgPbXMLPk=; b=Sj6uWqshXRJbuHgsD5h3aVZ8wMvQqeZi+CEvQYDiNuBzi6bVkGfT8Yf2bgDVBNUiOL ty/HL8nxYuLNPXPVHMqsQ7RNxTQUR+N0aXB4xoWWWWnwp2MGamPXCm0BHRZH3Ukkfesw k31nul0EAZkA0OvnfEdK3GyuF9pJ8x6+/Fkk5YCw0mxZIdB5mTQNOfG9DrEHdnj36Lnt nizrgEn6pnMAGKDQ/F3v4I4/C7YP6tTm+DAhcnz6tZMcps5Q3WKIiRVojflQjOwuSQak v/7E0dIu99b7kJ1QcwWln/CTq3bpx0O4zTXl0E5/GcH85OV8FL8V3FIRGTgYiF1LAleP jzDA== X-Gm-Message-State: AOAM531IZGjWa2RIgW0ai0Br4lBVqiPH4cjpyPKgWPMLBnVUeGi7nSP5 qPxIiIqj0N8OIqhGjWEVvD6xH+bq9SyvIg== X-Google-Smtp-Source: ABdhPJw4xowupFCslN6Eo7JLHn4xXwiGp03xy0w35dI1jn1zoUxK6MX0dRHuupGCOiwwIVVUClNSJg== X-Received: by 2002:a17:902:d706:b029:e6:90aa:24e0 with SMTP id w6-20020a170902d706b02900e690aa24e0mr851040ply.42.1619132552090; Thu, 22 Apr 2021 16:02:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 4/7] linux-user: Honor TARGET_ARCH_HAS_SA_RESTORER in do_syscall Date: Thu, 22 Apr 2021 16:02:24 -0700 Message-Id: <20210422230227.314751-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210422230227.314751-1-richard.henderson@linaro.org> References: <20210422230227.314751-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Do not access a field that may not be present. This will become an issue when sharing more code in the next patch. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- linux-user/syscall.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 36169a0ded..89d641856c 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -9038,7 +9038,9 @@ static abi_long do_syscall1(void *cpu_env, int num, a= bi_long arg1, act._sa_handler =3D old_act->_sa_handler; target_siginitset(&act.sa_mask, old_act->sa_mask); act.sa_flags =3D old_act->sa_flags; +#ifdef TARGET_ARCH_HAS_SA_RESTORER act.sa_restorer =3D old_act->sa_restorer; +#endif unlock_user_struct(old_act, arg2, 0); pact =3D &act; } else { @@ -9051,7 +9053,9 @@ static abi_long do_syscall1(void *cpu_env, int num, a= bi_long arg1, old_act->_sa_handler =3D oact._sa_handler; old_act->sa_mask =3D oact.sa_mask.sig[0]; old_act->sa_flags =3D oact.sa_flags; +#ifdef TARGET_ARCH_HAS_SA_RESTORER old_act->sa_restorer =3D oact.sa_restorer; +#endif unlock_user_struct(old_act, arg3, 1); } #endif --=20 2.25.1 From nobody Thu May 9 00:58:33 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1619132673; cv=none; d=zohomail.com; s=zohoarc; b=hlOavQlSg08+imffEK+aPBEFa1hgjbbGZMDTYg5MRwUvE+1vgimTJOcApZj/hdCDYcYKinDbA5bcoZFgdJ5aCdiHRGi0oxiABEmMyI8YErzV+B74XnhKtVKI/MVsgTIR5PWSZfdiwtOjKVd4QmOhw5Q7erIDhRaPoOqr5mBj9Qw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619132673; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Pq63tIitSEl/3DIHxaCuKkI+VTWbKxsaVUJWQ8jB2y0=; b=R5Ho5mg0ytaXXtn+WXkcbDhO5QmkmoISu1DotWqbHhJ/DPKywvVFrZUtkJh6kzIU2QWQ1FXqiNX6p+g5epwm8yg1Ubr9pfSXIfykaDVV6jnbrvj8fvyX5mbYjG7f92iGvn/QKljgE1mrRjau9kZA0k0jalB26T2lcSB9VBRulio= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1619132673421699.0809358466624; Thu, 22 Apr 2021 16:04:33 -0700 (PDT) Received: from localhost ([::1]:58674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lZiN6-0006x5-DI for importer@patchew.org; Thu, 22 Apr 2021 19:04:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40058) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lZiLE-0005C2-Om for qemu-devel@nongnu.org; Thu, 22 Apr 2021 19:02:36 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]:42777) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lZiLC-0007pG-Kz for qemu-devel@nongnu.org; Thu, 22 Apr 2021 19:02:36 -0400 Received: by mail-pj1-x102d.google.com with SMTP id j6-20020a17090adc86b02900cbfe6f2c96so225273pjv.1 for ; Thu, 22 Apr 2021 16:02:33 -0700 (PDT) Received: from localhost.localdomain ([71.212.131.83]) by smtp.gmail.com with ESMTPSA id z12sm2930605pfn.195.2021.04.22.16.02.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Apr 2021 16:02:32 -0700 (PDT) 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=Pq63tIitSEl/3DIHxaCuKkI+VTWbKxsaVUJWQ8jB2y0=; b=MZVtRtGh6eepo5poAaJrndcIXlcBUIMHSdqOE55GuNbzB+IjnkXv2DN88FoFWIvFWK rX8heO1anc2b4+lNYp3ikXUicBbt6mPb20I3K72A4HRjnb2jdwX8dTxU5TiQAjk3n+aY vUB2uH1rUgGsqHK6J3owYEOrPjGG50fekU8wp52vqNbmi03qSjvtr0rO1gKGPpvpv4A+ mP2PtOJyQqlTqR7uuXztejjNSFnzIFxMMQTN0VbS3GeR7Lz42DeYKnNSD/I7Mz3C4fAP X5dXDm6QxlSAGXvrXdeEAtG7PBMPAoYrzIpeBSMM2MAexjxvxD29FrzzfjxYx9NFnDE6 MhTg== 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=Pq63tIitSEl/3DIHxaCuKkI+VTWbKxsaVUJWQ8jB2y0=; b=GrXFEjB/WqqBD+D1WqKYNRFqS1PA9ETHvVR528DM5XPdrEowF/iyiC8TKbivtoB8Tm bvMB49mmh+/b2d4FVRxbd86dzrXtnn4MSYsHLmV7w768UvP89fz7ZbOm3CpOCFtgWN/5 91X1b1v+RCEWNF9nNNj9nwPqDRzywkrKUCE8UugGE5AcC/oJ78Ze8MzyOPp2J7Rvix/W dwE7mmRAnmdPghoRZx2Y7G8cbgJiBLFuoOxlvacNbI7bD56uzWfj//Qfnw+qObXiPkm/ sp4lvGFBb9xlhF3CCh389zrJju4/fCRB8mOcbXRWdlgKJW5aTIqCC28zTpQYaQa58W48 V4nw== X-Gm-Message-State: AOAM533UHnoh5HoWATfvnssk88WPzvVd2eV/Xkk5twxpiVzPCJFc97Jz FNmt1JcJXe0X489llEsYs0yrKpbaYhL+BQ== X-Google-Smtp-Source: ABdhPJxq2sCBM70ZnV0U+DvZtsUVr9Irzu7MVBse1m5B7jjnJlZIfw+8DGqaTXtqHOo2QuVR6tPyLQ== X-Received: by 2002:a17:902:b210:b029:eb:535f:852 with SMTP id t16-20020a170902b210b02900eb535f0852mr845384plr.80.1619132552721; Thu, 22 Apr 2021 16:02:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 5/7] linux-user/alpha: Define TARGET_ARCH_HAS_KA_RESTORER Date: Thu, 22 Apr 2021 16:02:25 -0700 Message-Id: <20210422230227.314751-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210422230227.314751-1-richard.henderson@linaro.org> References: <20210422230227.314751-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" This means that we can share the TARGET_NR_rt_sigaction code, and the target_rt_sigaction structure is unused. Untangling the ifdefs so that target_sigaction can be shared will wait until the next patch. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- linux-user/alpha/target_signal.h | 1 + linux-user/syscall_defs.h | 6 ------ linux-user/syscall.c | 37 ++++++-------------------------- 3 files changed, 7 insertions(+), 37 deletions(-) diff --git a/linux-user/alpha/target_signal.h b/linux-user/alpha/target_sig= nal.h index 0b90d3a897..250642913e 100644 --- a/linux-user/alpha/target_signal.h +++ b/linux-user/alpha/target_signal.h @@ -92,6 +92,7 @@ typedef struct target_sigaltstack { #define TARGET_GEN_SUBRNG7 -25 =20 #define TARGET_ARCH_HAS_SETUP_FRAME +#define TARGET_ARCH_HAS_KA_RESTORER =20 /* bit-flags */ #define TARGET_SS_AUTODISARM (1U << 31) /* disable sas during sighandling = */ diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index e4aaf8412f..7a1d3b239c 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -507,12 +507,6 @@ struct target_old_sigaction { int32_t sa_flags; }; =20 -struct target_rt_sigaction { - abi_ulong _sa_handler; - abi_ulong sa_flags; - target_sigset_t sa_mask; -}; - /* This is the struct used inside the kernel. The ka_restorer field comes from the 5th argument to sys_rt_sigaction. */ struct target_sigaction { diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 89d641856c..216ee4ca47 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -9064,41 +9064,17 @@ static abi_long do_syscall1(void *cpu_env, int num,= abi_long arg1, #endif case TARGET_NR_rt_sigaction: { -#if defined(TARGET_ALPHA) - /* For Alpha and SPARC this is a 5 argument syscall, with + /* + * 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 =3D 0; - - if (arg4 !=3D sizeof(target_sigset_t)) { - return -TARGET_EINVAL; - } - if (arg2) { - if (!lock_user_struct(VERIFY_READ, rt_act, arg2, 1)) - return -TARGET_EFAULT; - act._sa_handler =3D rt_act->_sa_handler; - act.sa_mask =3D rt_act->sa_mask; - act.sa_flags =3D rt_act->sa_flags; - unlock_user_struct(rt_act, arg2, 0); - pact =3D &act; - } - ret =3D get_errno(do_sigaction(arg1, pact, &oact, arg5)); - if (!is_error(ret) && arg3) { - if (!lock_user_struct(VERIFY_WRITE, rt_act, arg3, 0)) - return -TARGET_EFAULT; - rt_act->_sa_handler =3D oact._sa_handler; - rt_act->sa_mask =3D oact.sa_mask; - rt_act->sa_flags =3D oact.sa_flags; - unlock_user_struct(rt_act, arg3, 1); - } -#else -#ifdef TARGET_SPARC +#if defined(TARGET_ALPHA) + target_ulong sigsetsize =3D arg4; + target_ulong restorer =3D arg5; +#elif defined(TARGET_SPARC) target_ulong restorer =3D arg4; target_ulong sigsetsize =3D arg5; #else @@ -9131,7 +9107,6 @@ static abi_long do_syscall1(void *cpu_env, int num, a= bi_long arg1, unlock_user_struct(act, arg2, 0); if (oact) unlock_user_struct(oact, arg3, 1); -#endif } return ret; #ifdef TARGET_NR_sgetmask /* not on alpha */ --=20 2.25.1 From nobody Thu May 9 00:58:33 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1619132671; cv=none; d=zohomail.com; s=zohoarc; b=nwzeaQnSfG5YmppXoUk06voL+EY9/X3jv/PYdBfcztJ3qnfgu1lS62jNOQapWHM3SCZJCZy1fwpGLrS6r422PBZxTft/eJTKM62lxSnbnFkdCyqY/0pyRaGolW9ZQ8VJ1B0J90uu6/AWk74jjR+q1ClH7k9uXy3oEibjzcmRLdQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619132671; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9IBgpRlXRDcwQhpg7EYQ7Dn5EzD7vaEg5bq7L4WY5HM=; b=m6RO/olv3t1oXClBO9Na3XZUI/P1WGPpg11VBv1MEptn5dBUC5lUMcp4eCPxhSNpicrEsnanMB4U7PjLx8IMHkAhH+pTbFSRkKy37mdK8sH2z63e0jof5nHM+iHBdIeUfDp802i13tLJquxEyarKvtd+iMl1f1qhtMSndm99Dws= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1619132671892384.25321531761085; Thu, 22 Apr 2021 16:04:31 -0700 (PDT) Received: from localhost ([::1]:58466 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lZiN4-0006qr-Mj for importer@patchew.org; Thu, 22 Apr 2021 19:04:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40060) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lZiLE-0005CN-W4 for qemu-devel@nongnu.org; Thu, 22 Apr 2021 19:02:37 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:40485) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lZiLD-0007pT-2g for qemu-devel@nongnu.org; Thu, 22 Apr 2021 19:02:36 -0400 Received: by mail-pl1-x633.google.com with SMTP id 20so20356068pll.7 for ; Thu, 22 Apr 2021 16:02:34 -0700 (PDT) Received: from localhost.localdomain ([71.212.131.83]) by smtp.gmail.com with ESMTPSA id z12sm2930605pfn.195.2021.04.22.16.02.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Apr 2021 16:02:33 -0700 (PDT) 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=9IBgpRlXRDcwQhpg7EYQ7Dn5EzD7vaEg5bq7L4WY5HM=; b=avWb8ynRA7J49Tc/sUJZVMIW1LAdjHBf/5vjzQRzWX7xOKc08cIafzUFQtskoiV3B0 IScMgUuQhJaROSWth3xdwKMPX7O3L4d7sMESOi1j5tx0EtnT7Vk10UOIMmIuanaLMYNl d42DVyqFyj0wd6z8QmteiBpXOTE4olQm6hFYJdT99XkBFlLONCN/dybefuUM4DBhdUrw NwSB9TpgIQLN8aiIEjecvoGDqGW6KBw3VkhXUI6UcWF+i8/xpawayEKW5mC+OUVeG4sk BDBwluwNAiBcESviTIa0AbcXFGSnuWXpZRcnEbxV/4VhGa3dklaW3HIJAWZ9SSSdCRqY VzRg== 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=9IBgpRlXRDcwQhpg7EYQ7Dn5EzD7vaEg5bq7L4WY5HM=; b=FLjGcUIc4AIhSIZMmjTlROJblYshNC8JownBZpZFiFo8YO057LwHUNhpWnic+84WRV livBDsoXBfL8/bWn/rZ1J18kRBQCyUtsKGkxo8CBcT7N9tHk5IovCg8DrVCZ7P78XSr5 Gb2KXRF2tfDQg9I8yrUDzGoAYeRli29XT0D1crHa4jl6f8Z3ziw9B+COYSR1DTUBmXnE 14UOKLBPFGFI86VHuGpyPewKf4RNQ//1gqUfQB3WzGyG4hHy/C1we+VxY+5fDhaRmuZY /fM2LsF5z2wVDEAHeYLosZP1k92rDvo8rvA0PtO9S6R8llNHLKQYF5/1K1FINPQQCkoA fs4Q== X-Gm-Message-State: AOAM533dyc1QBCArvxW8vV5IbHjX1owz5wy3RYvptC4WSQnJ8IaEdalf 7Yux8qgOrhHg2PI/Kwl/RoeGvf/X8ABPPQ== X-Google-Smtp-Source: ABdhPJyKfKQX/W5aXPaw1CrVqCIv4VgYY+mPZMCr/0VfpIVYh+e73MxlJlG4mu7WP6j3X0IOFImGpQ== X-Received: by 2002:a17:902:a38e:b029:eb:3963:5aee with SMTP id x14-20020a170902a38eb02900eb39635aeemr1142615pla.78.1619132553313; Thu, 22 Apr 2021 16:02:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 6/7] linux-user/alpha: Share code for TARGET_NR_sigaction Date: Thu, 22 Apr 2021 16:02:26 -0700 Message-Id: <20210422230227.314751-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210422230227.314751-1-richard.henderson@linaro.org> References: <20210422230227.314751-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" There's no longer a difference between the alpha code and the generic code. There is a type difference in target_old_sigaction.sa_flags, which can be resolved with a very much smaller ifdef, which allows us to finish sharing the target_sigaction definition. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- linux-user/syscall_defs.h | 21 ++++++--------------- linux-user/syscall.c | 23 +---------------------- 2 files changed, 7 insertions(+), 37 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 7a1d3b239c..18b031a2f6 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -501,21 +501,12 @@ int do_sigaction(int sig, const struct target_sigacti= on *act, #endif =20 #if defined(TARGET_ALPHA) -struct target_old_sigaction { - abi_ulong _sa_handler; - abi_ulong sa_mask; - int32_t sa_flags; -}; +typedef int32_t target_old_sa_flags; +#else +typedef abi_ulong target_old_sa_flags; +#endif =20 -/* This is the struct used inside the kernel. The ka_restorer - field comes from the 5th argument to sys_rt_sigaction. */ -struct target_sigaction { - abi_ulong _sa_handler; - abi_ulong sa_flags; - target_sigset_t sa_mask; - abi_ulong ka_restorer; -}; -#elif defined(TARGET_MIPS) +#if defined(TARGET_MIPS) struct target_sigaction { uint32_t sa_flags; #if defined(TARGET_ABI_MIPSN32) @@ -533,7 +524,7 @@ struct target_sigaction { struct target_old_sigaction { abi_ulong _sa_handler; abi_ulong sa_mask; - abi_ulong sa_flags; + target_old_sa_flags sa_flags; #ifdef TARGET_ARCH_HAS_SA_RESTORER abi_ulong sa_restorer; #endif diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 216ee4ca47..9bcd485423 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8980,28 +8980,7 @@ static abi_long do_syscall1(void *cpu_env, int num, = abi_long arg1, #ifdef TARGET_NR_sigaction case TARGET_NR_sigaction: { -#if defined(TARGET_ALPHA) - struct target_sigaction act, oact, *pact =3D 0; - struct target_old_sigaction *old_act; - if (arg2) { - if (!lock_user_struct(VERIFY_READ, old_act, arg2, 1)) - return -TARGET_EFAULT; - act._sa_handler =3D old_act->_sa_handler; - target_siginitset(&act.sa_mask, old_act->sa_mask); - act.sa_flags =3D old_act->sa_flags; - unlock_user_struct(old_act, arg2, 0); - pact =3D &act; - } - ret =3D get_errno(do_sigaction(arg1, pact, &oact, 0)); - if (!is_error(ret) && arg3) { - if (!lock_user_struct(VERIFY_WRITE, old_act, arg3, 0)) - return -TARGET_EFAULT; - old_act->_sa_handler =3D oact._sa_handler; - old_act->sa_mask =3D oact.sa_mask.sig[0]; - old_act->sa_flags =3D oact.sa_flags; - unlock_user_struct(old_act, arg3, 1); - } -#elif defined(TARGET_MIPS) +#if defined(TARGET_MIPS) struct target_sigaction act, oact, *pact, *old_act; =20 if (arg2) { --=20 2.25.1 From nobody Thu May 9 00:58:33 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1619132929; cv=none; d=zohomail.com; s=zohoarc; b=YFJbLAa3pjsh55E/ORmrFGjfEwwYLj+vMx+K6FSmbRj7i27r2GhVKv3w2/66K2zFDm+rMAbNRess+S7hpsgDD6KtuTrRdbiiSCC3yzRylN5o97wjHXn+SpbnCFlB5/dPGwn/VZ0kqaqfyEEp14c1ADpl8/OCDJ8yz2jRfmBahCk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619132929; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LKfV1I/Csk0qYQwhR0M4lp6iP2nYp4OTkUQuJPZGosY=; b=ddImw7CZ9tysAc5hRo+A2fTfzp8W1+yRWa6gHhLUoSwy+RxN0RnZ2YX/htuNj0/Y499/FV1LaPGHxt7/obkIsPtyB2OUHmw2yNJhJwv5QWSw9gt+aLUIkol6qRhKHZhPF7iC0++QrD1l+nPnzUgSvNqBWL3Q2s5puM9CNZIYWrs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1619132929125865.046538466063; Thu, 22 Apr 2021 16:08:49 -0700 (PDT) Received: from localhost ([::1]:42780 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lZiRE-0003aW-4A for importer@patchew.org; Thu, 22 Apr 2021 19:08:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40062) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lZiLF-0005Ck-5l for qemu-devel@nongnu.org; Thu, 22 Apr 2021 19:02:37 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:39913) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lZiLD-0007pY-HA for qemu-devel@nongnu.org; Thu, 22 Apr 2021 19:02:36 -0400 Received: by mail-pl1-x633.google.com with SMTP id u7so22494823plr.6 for ; Thu, 22 Apr 2021 16:02:34 -0700 (PDT) Received: from localhost.localdomain ([71.212.131.83]) by smtp.gmail.com with ESMTPSA id z12sm2930605pfn.195.2021.04.22.16.02.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Apr 2021 16:02:33 -0700 (PDT) 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=LKfV1I/Csk0qYQwhR0M4lp6iP2nYp4OTkUQuJPZGosY=; b=C4QyKbBANIxwH1YFMbdaY3BSVgMwjkdCbJ8cZPHBoIwx1zIxj9mDEdfin8uRo/p/Pt i1qwlJPHlbRLOOnthiFVWEpdZbkTF5JQnF/8ekARH+LQ6CW/C/MvyZN17xUMrnj9wTdi j/h4AM6dKUSF+j5jiRFxmFOo79z/y9rAjPttt11qKT6WAh0s5nEF715C0LjCCfhz88a6 E25AREdKNsasDGu8rY40qKNo/mvPeiGjCUyPioguruGBzznjancd0T5J7fcW0nbz3f6b bZmCce+Cw8+9bvx7UtVL2HMJbV9XtT8wUlCoEV+ZQuixfli/ELuO+EOxYriZvViR4c8q dtIg== 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=LKfV1I/Csk0qYQwhR0M4lp6iP2nYp4OTkUQuJPZGosY=; b=bmN/8EH9Effo7A1tC4kTCwnQkNYaaRlRxMQgl0s6ZdHpzftNROukyP0dynAEHFnJkr K1twtAZ8+wBpDLzpe9/qr9aKaICMSJpIPc6LtzOtb7ZKQMpcGRenequeBMROIZkUPSwM sWDaOBRH5SXceleqCO3G9S98vXc7PpDqyDEINAu+dL7IOBtl1ujyBYsrO+TzEDsGfNhK 8SWD06Ff8JS1uwJfifvzAswx+B9B6pcW8JxG9hZxZCiClTrdlmHfxiApdIIK0apWW1/X vGZtadv6RpHKfoK26E+wQ9myuYk1bmhMJpM+GAvoI0UTkwlLDCBloZIpK9Jf48WD6NXb kYAQ== X-Gm-Message-State: AOAM5322CtnbpBsBrOkKu4FZfchM+/jesWH4/++nCj3D26XdsjbGgw5b 4bR+DnDxnVCWUcVc5bI6FwXhsffd15jrNg== X-Google-Smtp-Source: ABdhPJx5Td1YDbJzHiZ16Y8821MEwhqcD82ABQhnXZKBElIJvKnYvAAvszeJtWmup0JPCsUXHhf/gg== X-Received: by 2002:a17:903:18e:b029:ec:b394:981f with SMTP id z14-20020a170903018eb02900ecb394981fmr1161614plg.6.1619132553950; Thu, 22 Apr 2021 16:02:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 7/7] linux-user: Tidy TARGET_NR_rt_sigaction Date: Thu, 22 Apr 2021 16:02:27 -0700 Message-Id: <20210422230227.314751-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210422230227.314751-1-richard.henderson@linaro.org> References: <20210422230227.314751-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Initialize variables instead of elses. Use an else instead of a goto. Add braces. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- linux-user/syscall.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 9bcd485423..c7c3257f40 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -9060,32 +9060,26 @@ static abi_long do_syscall1(void *cpu_env, int num,= abi_long arg1, target_ulong sigsetsize =3D arg4; target_ulong restorer =3D 0; #endif - struct target_sigaction *act; - struct target_sigaction *oact; + struct target_sigaction *act =3D NULL; + struct target_sigaction *oact =3D NULL; =20 if (sigsetsize !=3D sizeof(target_sigset_t)) { return -TARGET_EINVAL; } - if (arg2) { - if (!lock_user_struct(VERIFY_READ, act, arg2, 1)) { - return -TARGET_EFAULT; - } - } else { - act =3D NULL; + if (arg2 && !lock_user_struct(VERIFY_READ, act, arg2, 1)) { + return -TARGET_EFAULT; } - if (arg3) { - if (!lock_user_struct(VERIFY_WRITE, oact, arg3, 0)) { - ret =3D -TARGET_EFAULT; - goto rt_sigaction_fail; + if (arg3 && !lock_user_struct(VERIFY_WRITE, oact, arg3, 0)) { + ret =3D -TARGET_EFAULT; + } else { + ret =3D get_errno(do_sigaction(arg1, act, oact, restorer)); + if (oact) { + unlock_user_struct(oact, arg3, 1); } - } else - oact =3D NULL; - ret =3D get_errno(do_sigaction(arg1, act, oact, restorer)); - rt_sigaction_fail: - if (act) + } + if (act) { unlock_user_struct(act, arg2, 0); - if (oact) - unlock_user_struct(oact, arg3, 1); + } } return ret; #ifdef TARGET_NR_sgetmask /* not on alpha */ --=20 2.25.1