From patchwork Mon Oct 4 07:43:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 515156 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1148200imy; Mon, 4 Oct 2021 00:50:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpFkX+l/3c8/ESnBGDMZIuI7JOO6hayzvCs53RD5G3O8+OHu57Ik/q8A8uTg0A76bT2JbK X-Received: by 2002:a25:120a:: with SMTP id 10mr13232178ybs.24.1633333821589; Mon, 04 Oct 2021 00:50:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633333821; cv=none; d=google.com; s=arc-20160816; b=SnJt7luUPOJcDrrd6Uhoi3Jdl1zr+vj0omXo68T+2Crt3w315Nfx+xkh8SVUXNz5w5 Oeh6z6Rz1ebxghjKZ2jKNoLElUZ1qGFLBmbflYqnya4AtAsAcVE9j0qFG+ckGObzkfy5 5Fly8xnem8p6043xywpgU/ET/irOXhhGzttaMUslyXRacYMBovCRCFw2y4u6oNPr8+Lm cdZnnT1646yKAeNKqryGAAUvD7ZHtQWbfB0O4VTwgnO4uX1ueGAoD8BxJ4TJ8ZUYDiHm ynzFEN9jWppemoYu3QSCUEk3cegsQ3YakCPu8RohjawsC0AlJ8l1mXlYu+jigHQQ7nun s8aQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=wnVV8KPATxE8OynTsU6pQXvlJCFQ732sZxyfWNcUKIQ=; b=qIr6UFmO4gME5NqSk8hQ/lsfHljXa8M1LKhs53YEHdYS6kQUpjttojMjls7c5APEwg KQs2bxSHHNzz1Ll27ZXXYpkazuJD13IvEC/Sft6P9858w+NReTpbXUncwgwKlF3ppLsf 1kKzHDIVsZuqkJw7juZ9dwNPKK6LaDOI0KTfYjWU/nqVJ3V3+AfZpSty0JXydnUHz/Ej 2QPzPtk+B4ujFqCPo7gOAPfKPzB8I4r3icfUA4tjz4LQonBSddSopAwr7/cmAQUmk3rr q1pKVF0ZT7oebaOX8+6lq1RgfWfEO2DGPVaGp/HJvx42DkOypWck3T/AwFe4+7ZKVb+f YHHg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t66si13087539ybi.443.2021.10.04.00.50.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Oct 2021 00:50:21 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:45342 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXIjt-0000ab-0n for patch@linaro.org; Mon, 04 Oct 2021 03:50:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44040) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeK-00045H-Or for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:36 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:52663) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeI-0004oc-VO for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:36 -0400 Received: from quad ([82.142.3.114]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MtPzy-1mnC6Q0Zoc-00upgM; Mon, 04 Oct 2021 09:44:24 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 01/26] linux-user: Add infrastructure for a signal trampoline page Date: Mon, 4 Oct 2021 09:43:56 +0200 Message-Id: <20211004074421.3141222-2-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004074421.3141222-1-laurent@vivier.eu> References: <20211004074421.3141222-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:sbMmJtEOpzyb3l+1hVe+4VKoHMWfR4gr/+BEHgNtQw6BC98+dVM lFkCDnQAOgKv2lx2IY2LsQb5ZAHWF7HeITi5cvfmiFD6lMHZ6dpwZAMtM6e96w0Yn7GVGVt ynozdgOIAuecb9wQa+EzLkyn7462tg3cRfJfRift7p/KCCPEdsJRtpMlk7+HtHzoH1PHbKS Q2d0MsOxlyVbUqmvYMYjA== X-UI-Out-Filterresults: notjunk:1; V03:K0:xOWXO5YmaL4=:8n9JHufyYISypNDlKgbI5B xu88iX0ebeFjKmoYPbYhK4xfc3QOboyKz8Cjw9iEyn5pJhwhj6dIuTShu6l9fwWpisstZn6o2 svTPcXy/0sVMd2KjOYqLoByA8E0vxSoB5WmBK5h6iklCdr9wNJpOMdIIMLLwsIrTzjzyJqSmn 305lT1zIkD87hr0rx69yY3ASZoQNkctXFehvZfYTBhl5rKE+eAGXHDjcgTGvX/cvoZUHcc0Cf vDX+Ho0kWynbO2y8tEWiLWocppIyIwisE/ykrx5bkg/+x/ZoA8vYiQH1l2kOWzTplkUtT1CbK 7Ui+BFawSatgaq+4k3VAAqriBaMbtoaOT3D1gC8IMxYZcjStNBoPtafkGTiKHjog5nthrMVBI b/Iyzf9eas/e/vf0X40MnVQLXQiQLURVtTkr/RnXTmJgL9CQr73TIGW6zPahXysPnqZEx4aYs pfOaDJfcgtRPTSzuSOsL066A3242Pr7kWK75bDe55rudymNV7uVHGGGglk28GgHO+dkbYjW/z f/tPhq6a0DALTcse0CRRxVucuq4VadzHDJByBegqVp/3r4q7tnIzx7kvMzn+cs9HPbRaEQCry wyJijpNvaNJq0Lp7S76eJKm689p+8fEtV9CctnXHowgSUIgzKymFXnQMwrYy5Xj/ro6eqQ4dV fqUhZ7hk+Ms/a8W46FxlfPUhr2nfBiHjneZtU+RqQ1Fyk28Y6r4AKJDb1pwmdzW4abrx+h4Xk s8gqAsdkkPWsRYXzLIijFI6cTnxgghYHEqcasg== Received-SPF: none client-ip=212.227.126.187; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=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: Max Filippov , Laurent Vivier , Richard Henderson , =?utf-8?q?Philippe_?= =?utf-8?q?Mathieu-Daud=C3=A9?= , Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Allocate a page to hold the signal trampoline(s). Invoke a guest-specific hook to fill in the contents of the page before marking it read-execute again. Reviewed-by: Max Filippov Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-Id: <20210929130553.121567-2-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/elfload.c | 18 ++++++++++++++++++ linux-user/signal-common.h | 6 ++++++ linux-user/signal.c | 3 +++ 3 files changed, 27 insertions(+) -- 2.31.1 diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 5f9e2141ad1e..459a26ef1d93 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -7,6 +7,7 @@ #include "qemu.h" #include "user-internals.h" +#include "signal-common.h" #include "loader.h" #include "user-mmap.h" #include "disas/disas.h" @@ -17,6 +18,7 @@ #include "qemu/units.h" #include "qemu/selfmap.h" #include "qapi/error.h" +#include "target_signal.h" #ifdef _ARCH_PPC64 #undef ARCH_DLINFO @@ -28,6 +30,10 @@ #undef ELF_ARCH #endif +#ifndef TARGET_ARCH_HAS_SIGTRAMP_PAGE +#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 0 +#endif + #define ELF_OSABI ELFOSABI_SYSV /* from personality.h */ @@ -3249,6 +3255,18 @@ int load_elf_binary(struct linux_binprm *bprm, struct image_info *info) #endif } + /* + * TODO: load a vdso, which would also contain the signal trampolines. + * Otherwise, allocate a private page to hold them. + */ + if (TARGET_ARCH_HAS_SIGTRAMP_PAGE) { + abi_ulong tramp_page = target_mmap(0, TARGET_PAGE_SIZE, + PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANON, -1, 0); + setup_sigtramp(tramp_page); + target_mprotect(tramp_page, TARGET_PAGE_SIZE, PROT_READ | PROT_EXEC); + } + bprm->p = create_elf_tables(bprm->p, bprm->argc, bprm->envc, &elf_ex, info, (elf_interpreter ? &interp_info : NULL)); info->start_stack = bprm->p; diff --git a/linux-user/signal-common.h b/linux-user/signal-common.h index 79511becb4e7..7457f8025c47 100644 --- a/linux-user/signal-common.h +++ b/linux-user/signal-common.h @@ -20,6 +20,12 @@ #ifndef SIGNAL_COMMON_H #define SIGNAL_COMMON_H +/* Fallback addresses into sigtramp page. */ +extern abi_ulong default_sigreturn; +extern abi_ulong default_rt_sigreturn; + +void setup_sigtramp(abi_ulong tramp_page); + int on_sig_stack(unsigned long sp); int sas_ss_flags(unsigned long sp); abi_ulong target_sigsp(abi_ulong sp, struct target_sigaction *ka); diff --git a/linux-user/signal.c b/linux-user/signal.c index 203821645509..14d8fdfde152 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -35,6 +35,9 @@ static struct target_sigaction sigact_table[TARGET_NSIG]; static void host_signal_handler(int host_signum, siginfo_t *info, void *puc); +/* Fallback addresses into sigtramp page. */ +abi_ulong default_sigreturn; +abi_ulong default_rt_sigreturn; /* * System includes define _NSIG as SIGRTMAX + 1, From patchwork Mon Oct 4 07:43:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 515155 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1147225imy; Mon, 4 Oct 2021 00:47:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxY+ECy9G6wa4rwj5FscGyFd3/I4vHxQccajp/POJSJEy7rzgzYi6qW9mHme4CBcWHkPw3N X-Received: by 2002:a6b:500e:: with SMTP id e14mr8629058iob.25.1633333633198; Mon, 04 Oct 2021 00:47:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633333633; cv=none; d=google.com; s=arc-20160816; b=ZoE2wR1FISqy/HhHxg7B81YBO/1mySmhATGlGJtlaptggfzd5zU5jhRriFUUA+UQgE w3wBel00pXG7tFGuaY0mxd3alot5bXTzNXTS5bJ8Kw+v5B+9t/BGKqKPhUGMONOVL3oY SIYmFjk09aRvFZXjBDFnCscyCaR8mbXi5mTVbx9hC5tzTE4a5TrxlcpulNtON7kJNmm6 1JVK7hqpv2LSQeGwxVtpfP/St9x1SiSzBErHeiHWM76ZHA2nDRHC26YniWWBiv93b+q+ zQon/fxItwR+/BpZH6ig0oUdE/Gy/mOdUCtS6lXfcYxhB3/nEoCkVRTTXaLd3svNa/nu kacQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=zxDmvMzW+/hw9K8au6cSCaQk3ZrKWUDOvQgZDKKGytM=; b=DM80px/kjZzE+IZA4Einulb11O8190dGSPeaFMuZUxPUA0OOTO0rY1mA2tQ7y/39nl 6t8gByfXo8HtM7rc24KZlg2PjFj2b5byT7o+/pPtX78OMKmMYiqXgecuWiGpTeKgJ9sg wFHZGbW/WXeIfjv6nIDitOFgWjrOhth12yXbSaEziTUnTK5+6ymaMposeSWp2eK1aYZ3 4z1B6yC1sijpq0m1cs8uvcYgiH+4l4m9wXTrcdQWPbPR2zVT645J61+Sdk65wwIAwE1c +RgXxHMqODQ0q0mbspKKUKvu2zReUP2q8MCJIlJhpgrmi+LNcGbMtMWne/6a3Y8oRYh3 rMPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x15si23956618jas.31.2021.10.04.00.47.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Oct 2021 00:47:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:38784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXIgq-0004Cb-LM for patch@linaro.org; Mon, 04 Oct 2021 03:47:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeM-00048F-DH for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:38 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:57997) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeJ-0004oa-6m for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:37 -0400 Received: from quad ([82.142.3.114]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MEC8L-1mhRfR2stB-00AFRl; Mon, 04 Oct 2021 09:44:24 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 02/26] linux-user/aarch64: Implement setup_sigtramp Date: Mon, 4 Oct 2021 09:43:57 +0200 Message-Id: <20211004074421.3141222-3-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004074421.3141222-1-laurent@vivier.eu> References: <20211004074421.3141222-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:UUo/MIhsvSBxqSlSr/5Haj4RKGK6NXQdy2Lhrtm0Ftm+vXIn+ql rLFjFpI/4Af8hUSSlQ6FIJgA23Y9oC3Pi6TAod/vgK4a7LhS+9p8Bs87K6BzdLv2m9bkBL5 G+fc7+VrXDYTm0u2Tb64+QDz/LtsnUL0iE7ayVmVNXvCfiopzFTCbhR8k45hbbVo3YU26Z3 g+5EgQTuQnBpfhZA1eFgQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:QyAXt03HjcQ=:D0yY+QJvZK0rSkIUQp/jKI L2hzrP5sEYxiLmmtJxm0m+BXZtg3ZX5gJeOqhk34s+zcxOWbaBCrTD+OPozuYqlEe0123T2Hj 2C+o06JBwpl2pY+MATE1wAJd/a80mPJbZbQcij81kbCroZgiN10zaVdYp3IrOW8SHqkjRf7WQ FnQoF9pC0PC+7ISqe0UufRL7pFtxcZb2/Y5Yrnx4PeuLj6vFyFrIvRwpiYrlRS7Y0u3il9R4o unIK9iajeLz2Iqz5dWrslA1irXTXo4YXVPXIq1CHe8vZ8q8MYQQ3JSW7fKqzuygHhgV9WpQPR SfRjUciVhQO+VXngGD7d/HQXdAfEw4krXsGozVEtvHF837Cd/7mSIBN0tR1+rfumpASufFfFE 0NGK51mE+Ql7KRhZZS18AKeIDM26C+sWf9cv8arjNnffzBfXakGmmF6Sp+g+R/DLOmMCnBRRH Z1DK+P6NQ0XOI3shpOcywPeF2jXI8e4CWoExGe+7yNr2v0VD47sAH8318b2N+rhl6v7/mQIeX J2Sqxoq7v6PkhOxGGHRDzeUxuo5XLTYMqEXqc+F3IlOPcJPEwoqmsikKg4w/4Q0TPh/2REHEG 0HUO4HCDcSDJZ28waUnLxV7/JsO6F3fDn/5A1dlvSAkpAVHcMZyHByxXf+eDJulTaNSBv1I7w IxjMGB4wgWUC/XTbTqdyvVtI1tVOvhY/wlTdSr31sKuqpqy1FHswWiO/Rztgr2+MHSXKeUVyk 28Msm6JQ3B0+vKZaTW3rCWYXLvhXbhh78F8F3A== Received-SPF: none client-ip=212.227.126.134; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_NONE=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: Peter Maydell , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Create and record the rt signal trampoline. Use it when the guest does not use SA_RESTORER. Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20210929130553.121567-3-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/aarch64/signal.c | 34 ++++++++++++++++++------------ linux-user/aarch64/target_signal.h | 2 ++ 2 files changed, 23 insertions(+), 13 deletions(-) -- 2.31.1 diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c index 49025648cb4f..29c52db3f130 100644 --- a/linux-user/aarch64/signal.c +++ b/linux-user/aarch64/signal.c @@ -109,7 +109,6 @@ struct target_rt_sigframe { struct target_rt_frame_record { uint64_t fp; uint64_t lr; - uint32_t tramp[2]; }; static void target_setup_general_frame(struct target_rt_sigframe *sf, @@ -461,9 +460,9 @@ static void target_setup_frame(int usig, struct target_sigaction *ka, layout.total_size = MAX(layout.total_size, sizeof(struct target_rt_sigframe)); - /* Reserve space for the return code. On a real system this would - * be within the VDSO. So, despite the name this is not a "real" - * record within the frame. + /* + * Reserve space for the standard frame unwind pair: fp, lr. + * Despite the name this is not a "real" record within the frame. */ fr_ofs = layout.total_size; layout.total_size += sizeof(struct target_rt_frame_record); @@ -496,15 +495,7 @@ static void target_setup_frame(int usig, struct target_sigaction *ka, if (ka->sa_flags & TARGET_SA_RESTORER) { return_addr = ka->sa_restorer; } else { - /* - * mov x8,#__NR_rt_sigreturn; svc #0 - * Since these are instructions they need to be put as little-endian - * regardless of target default or current CPU endianness. - */ - __put_user_e(0xd2801168, &fr->tramp[0], le); - __put_user_e(0xd4000001, &fr->tramp[1], le); - return_addr = frame_addr + fr_ofs - + offsetof(struct target_rt_frame_record, tramp); + return_addr = default_rt_sigreturn; } env->xregs[0] = usig; env->xregs[29] = frame_addr + fr_ofs; @@ -577,3 +568,20 @@ long do_sigreturn(CPUARMState *env) { return do_rt_sigreturn(env); } + +void setup_sigtramp(abi_ulong sigtramp_page) +{ + uint32_t *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 8, 0); + assert(tramp != NULL); + + /* + * mov x8,#__NR_rt_sigreturn; svc #0 + * Since these are instructions they need to be put as little-endian + * regardless of target default or current CPU endianness. + */ + __put_user_e(0xd2801168, &tramp[0], le); + __put_user_e(0xd4000001, &tramp[1], le); + + default_rt_sigreturn = sigtramp_page; + unlock_user(tramp, sigtramp_page, 8); +} diff --git a/linux-user/aarch64/target_signal.h b/linux-user/aarch64/target_signal.h index 18013e1b2350..7580d99403cb 100644 --- a/linux-user/aarch64/target_signal.h +++ b/linux-user/aarch64/target_signal.h @@ -25,4 +25,6 @@ typedef struct target_sigaltstack { #define TARGET_SEGV_MTESERR 9 /* Synchronous ARM MTE exception */ #define TARGET_ARCH_HAS_SETUP_FRAME +#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1 + #endif /* AARCH64_TARGET_SIGNAL_H */ From patchwork Mon Oct 4 07:43:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 515157 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1148275imy; Mon, 4 Oct 2021 00:50:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzrzlYGbc7Qd4qV/r0W8DNZtEdN399h6u9lyUIL+fnVsz/EOtlHxXWwGcStKb7E9iqG1hm X-Received: by 2002:a25:aa6d:: with SMTP id s100mr14258709ybi.331.1633333837469; Mon, 04 Oct 2021 00:50:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633333837; cv=none; d=google.com; s=arc-20160816; b=PyiXFO385RPXb/hNUjRAa7svXG1gb5f4H3UNQhMmaWS+FSeIz8ybYIkLIKy4p6qw8p AdBQvLn3AqLLnp4gf/y0rR7x0OjhByfwQSJr/BV8mDJwIu0j0LVPQH3lxzhYcRwBzDHQ HglFboUIi+3MVCXISOOgzQZ9gwCXHErkr+OC0oM2zzbkb9r4mE00b66EmgFX13QpJrSR 0bkGBxwuPPubd4We7qix3fAAm/IcO30qDDc9RAp2Bt6V7mZDk6m+Rni2V8oS/T+YMvXm 9O23tewecHS5PE23nhS6lSlw8aW+TF+7cbanEq5HyvJri4uKQdCihMYwf9vK3zbFjU4i vDKw== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=YYLfvpXxdFjji2cPT0E5MyJO1LHkbXOt6zfKwLcz4DA=; b=Snh6c/2//Oc73bz3A0BMJOxWxhi0WOiug59CMa7vVcsHqYEqg4lwkh05sAv38gWvHA ZkeJtdR5dwfQNP4BwQHhvWpMZWK38rILNvhSA4TRZSAkAHWTl1oFovXOzqGc64rbnHDZ 4KaKn1UAS1RhgFpFLaxKCr6ruq57tWGlmdW4F18bhx429oE9qC0VwhS08QiqwM1DHosg acnonXNs4aO1sK9uRDJgRQCuFyzHFZh2sG/UReL9v8Q9CANPzW88Pr5Qdo/xOb1TGl1o tSEZ81xI/YOrGccKospZ7jLOqMHcBFEWLZrJ35x0r1+/zClUjhXlaMAYvy5TqYwFfdXY FJGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z4si17660060ybb.333.2021.10.04.00.50.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Oct 2021 00:50:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:45800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXIk8-0000w3-Ss for patch@linaro.org; Mon, 04 Oct 2021 03:50:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44100) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeM-00049R-Pq for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:38 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:56197) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeJ-0004oh-7E for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:38 -0400 Received: from quad ([82.142.3.114]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1M3mHT-1mX1nW0uwN-000vlz; Mon, 04 Oct 2021 09:44:25 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 03/26] linux-user/arm: Drop v1 signal frames Date: Mon, 4 Oct 2021 09:43:58 +0200 Message-Id: <20211004074421.3141222-4-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004074421.3141222-1-laurent@vivier.eu> References: <20211004074421.3141222-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:Jjy1kR7GKaMakXoNP65v09xvEXc663oIV0YmRCVH06ZBoFthymT g9NgX0m+rG3pk86iPJM7cXhVRRW5ysTNFFn0kRfELDWVgXlQefzLAc/+9U2RwZCCbmn2Ucy kGRE0Kqxj3H4NgxCP6x1sT6rHz7NMPixPyEN2OM/5ivLAS5zsNsxzFUJVWKNpeFQvUyJvjy rcP1ZP/5Gi94XJ1B2qiTQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:A7XtHWZLtwA=:hSA/2m0+116f+MdzgSqbZZ YCh3y/zpEfvVb6qpjCyz8ucsDkMe8um4jzWCmKTY+bh39QWm1cjVDaesZV4ZiyMtr4zHJyQDw /LGPeZ6wwGTxWY1MqluTR2yBbtV668fUOcrkwOAPr2xf/4BN0jItakiVJBiHfheI6/fi2rD1A Kldf+k9br3rm3tig+1H0JLyuT6Ty2N/EHlOd3WLs2MhZ2nFwH+3pUUafaL2pfiLhvRQuwYXTB GG5qYKHxPn646AvFor0XBVkuggeZE+x8SUzimc/ZolByfqfeG73BspKCOSwMDw6kwpecTWHD6 95grP/fNH7v7rzPoU+WpBALEsUz1TVmurwE3zK70oMVz34T3JrPkJCqDdp3rvvJ9Oxdg8kANy 6iua14WNwJZC6kfL8fSQhLlXaT62EdpuABN1HEm1g7cswswXxEVUsGVg3SXiCeUOInqvO0YfQ tDyhVikUDUN5sqcRkbBKWx6cNF1aPUkeqyp/ztwj40BjcGDbwIhEVJjne4tIX2pJlJUTNAAmT EhBSd82Zjq7DfbTXS5s0jsludHm0+2nANYvoVDfN71KpiKoSZDHMP5a4lNbG7Mdgmf5z87MFR 43VyAFIwLTy9svKoY9XSxcjDmc7VY9o3meQtQWJLOHIoIn0wBwcdtliLk4+8K3vMrSe3ikb7D Td+ttpeVgngjDMYcSuag4r1yAXuG/SqcMV4HV6hpAfaVA90xYhK8tM5FhQDO2BoRA3qen5yP+ 2uzoEt/YuG7H1Y2xqfsj5SWJA1bMETm4YhRn+Q== Received-SPF: none client-ip=212.227.126.187; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=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: Peter Maydell , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Version 2 signal frames are used from 2.6.12 and since cbc14e6f286, we have set UNAME_MINIMUM_RELEASE to 2.6.32. Suggested-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20210929130553.121567-4-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/arm/signal.c | 220 +--------------------------------------- 1 file changed, 4 insertions(+), 216 deletions(-) -- 2.31.1 diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c index ed144f9455d2..d0940bab479c 100644 --- a/linux-user/arm/signal.c +++ b/linux-user/arm/signal.c @@ -46,14 +46,6 @@ struct target_sigcontext { abi_ulong fault_address; }; -struct target_ucontext_v1 { - abi_ulong tuc_flags; - abi_ulong tuc_link; - target_stack_t tuc_stack; - struct target_sigcontext tuc_mcontext; - target_sigset_t tuc_sigmask; /* mask last for extensibility */ -}; - struct target_ucontext_v2 { abi_ulong tuc_flags; abi_ulong tuc_link; @@ -98,28 +90,12 @@ struct target_iwmmxt_sigframe { #define TARGET_VFP_MAGIC 0x56465001 #define TARGET_IWMMXT_MAGIC 0x12ef842a -struct sigframe_v1 -{ - struct target_sigcontext sc; - abi_ulong extramask[TARGET_NSIG_WORDS-1]; - abi_ulong retcode[4]; -}; - struct sigframe_v2 { struct target_ucontext_v2 uc; abi_ulong retcode[4]; }; -struct rt_sigframe_v1 -{ - abi_ulong pinfo; - abi_ulong puc; - struct target_siginfo info; - struct target_ucontext_v1 uc; - abi_ulong retcode[4]; -}; - struct rt_sigframe_v2 { struct target_siginfo info; @@ -363,37 +339,6 @@ static void setup_sigframe_v2(struct target_ucontext_v2 *uc, } } -/* compare linux/arch/arm/kernel/signal.c:setup_frame() */ -static void setup_frame_v1(int usig, struct target_sigaction *ka, - target_sigset_t *set, CPUARMState *regs) -{ - struct sigframe_v1 *frame; - abi_ulong frame_addr = get_sigframe(ka, regs, sizeof(*frame)); - int i; - - trace_user_setup_frame(regs, frame_addr); - if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) { - goto sigsegv; - } - - setup_sigcontext(&frame->sc, regs, set->sig[0]); - - for(i = 1; i < TARGET_NSIG_WORDS; i++) { - __put_user(set->sig[i], &frame->extramask[i - 1]); - } - - if (setup_return(regs, ka, frame->retcode, frame_addr, usig, - frame_addr + offsetof(struct sigframe_v1, retcode))) { - goto sigsegv; - } - - unlock_user_struct(frame, frame_addr, 1); - return; -sigsegv: - unlock_user_struct(frame, frame_addr, 1); - force_sigsegv(usig); -} - static void setup_frame_v2(int usig, struct target_sigaction *ka, target_sigset_t *set, CPUARMState *regs) { @@ -422,60 +367,7 @@ sigsegv: void setup_frame(int usig, struct target_sigaction *ka, target_sigset_t *set, CPUARMState *regs) { - if (get_osversion() >= 0x020612) { - setup_frame_v2(usig, ka, set, regs); - } else { - setup_frame_v1(usig, ka, set, regs); - } -} - -/* compare linux/arch/arm/kernel/signal.c:setup_rt_frame() */ -static void setup_rt_frame_v1(int usig, struct target_sigaction *ka, - target_siginfo_t *info, - target_sigset_t *set, CPUARMState *env) -{ - struct rt_sigframe_v1 *frame; - abi_ulong frame_addr = get_sigframe(ka, env, sizeof(*frame)); - struct target_sigaltstack stack; - int i; - abi_ulong info_addr, uc_addr; - - trace_user_setup_rt_frame(env, frame_addr); - if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) { - goto sigsegv; - } - - info_addr = frame_addr + offsetof(struct rt_sigframe_v1, info); - __put_user(info_addr, &frame->pinfo); - uc_addr = frame_addr + offsetof(struct rt_sigframe_v1, uc); - __put_user(uc_addr, &frame->puc); - tswap_siginfo(&frame->info, info); - - /* Clear all the bits of the ucontext we don't use. */ - memset(&frame->uc, 0, offsetof(struct target_ucontext_v1, tuc_mcontext)); - - memset(&stack, 0, sizeof(stack)); - target_save_altstack(&stack, env); - memcpy(&frame->uc.tuc_stack, &stack, sizeof(stack)); - - setup_sigcontext(&frame->uc.tuc_mcontext, env, set->sig[0]); - for(i = 0; i < TARGET_NSIG_WORDS; i++) { - __put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]); - } - - if (setup_return(env, ka, frame->retcode, frame_addr, usig, - frame_addr + offsetof(struct rt_sigframe_v1, retcode))) { - goto sigsegv; - } - - env->regs[1] = info_addr; - env->regs[2] = uc_addr; - - unlock_user_struct(frame, frame_addr, 1); - return; -sigsegv: - unlock_user_struct(frame, frame_addr, 1); - force_sigsegv(usig); + setup_frame_v2(usig, ka, set, regs); } static void setup_rt_frame_v2(int usig, struct target_sigaction *ka, @@ -516,11 +408,7 @@ void setup_rt_frame(int usig, struct target_sigaction *ka, target_siginfo_t *info, target_sigset_t *set, CPUARMState *env) { - if (get_osversion() >= 0x020612) { - setup_rt_frame_v2(usig, ka, info, set, env); - } else { - setup_rt_frame_v1(usig, ka, info, set, env); - } + setup_rt_frame_v2(usig, ka, info, set, env); } static int @@ -553,54 +441,6 @@ restore_sigcontext(CPUARMState *env, struct target_sigcontext *sc) return err; } -static long do_sigreturn_v1(CPUARMState *env) -{ - abi_ulong frame_addr; - struct sigframe_v1 *frame = NULL; - target_sigset_t set; - sigset_t host_set; - int i; - - /* - * Since we stacked the signal on a 64-bit boundary, - * then 'sp' should be word aligned here. If it's - * not, then the user is trying to mess with us. - */ - frame_addr = env->regs[13]; - trace_user_do_sigreturn(env, frame_addr); - if (frame_addr & 7) { - goto badframe; - } - - if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) { - goto badframe; - } - - __get_user(set.sig[0], &frame->sc.oldmask); - for(i = 1; i < TARGET_NSIG_WORDS; i++) { - __get_user(set.sig[i], &frame->extramask[i - 1]); - } - - target_to_host_sigset_internal(&host_set, &set); - set_sigmask(&host_set); - - if (restore_sigcontext(env, &frame->sc)) { - goto badframe; - } - -#if 0 - /* Send SIGTRAP if we're single-stepping */ - if (ptrace_cancel_bpt(current)) - send_sig(SIGTRAP, current, 1); -#endif - unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; - -badframe: - force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; -} - static abi_ulong *restore_sigframe_v2_vfp(CPUARMState *env, abi_ulong *regspace) { int i; @@ -733,55 +573,7 @@ badframe: long do_sigreturn(CPUARMState *env) { - if (get_osversion() >= 0x020612) { - return do_sigreturn_v2(env); - } else { - return do_sigreturn_v1(env); - } -} - -static long do_rt_sigreturn_v1(CPUARMState *env) -{ - abi_ulong frame_addr; - struct rt_sigframe_v1 *frame = NULL; - sigset_t host_set; - - /* - * Since we stacked the signal on a 64-bit boundary, - * then 'sp' should be word aligned here. If it's - * not, then the user is trying to mess with us. - */ - frame_addr = env->regs[13]; - trace_user_do_rt_sigreturn(env, frame_addr); - if (frame_addr & 7) { - goto badframe; - } - - if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) { - goto badframe; - } - - target_to_host_sigset(&host_set, &frame->uc.tuc_sigmask); - set_sigmask(&host_set); - - if (restore_sigcontext(env, &frame->uc.tuc_mcontext)) { - goto badframe; - } - - target_restore_altstack(&frame->uc.tuc_stack, env); - -#if 0 - /* Send SIGTRAP if we're single-stepping */ - if (ptrace_cancel_bpt(current)) - send_sig(SIGTRAP, current, 1); -#endif - unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; - -badframe: - unlock_user_struct(frame, frame_addr, 0); - force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return do_sigreturn_v2(env); } static long do_rt_sigreturn_v2(CPUARMState *env) @@ -822,9 +614,5 @@ badframe: long do_rt_sigreturn(CPUARMState *env) { - if (get_osversion() >= 0x020612) { - return do_rt_sigreturn_v2(env); - } else { - return do_rt_sigreturn_v1(env); - } + return do_rt_sigreturn_v2(env); } From patchwork Mon Oct 4 07:43:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 515164 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1150918imy; Mon, 4 Oct 2021 00:58:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydR2aV1VhTtfc4o9/pk50fX40BTtN4Fd2opi6XIEfJpZMQS5LPzsBwEoMmRtkM04IBOSlm X-Received: by 2002:a05:6638:3383:: with SMTP id h3mr5781390jav.5.1633334330090; Mon, 04 Oct 2021 00:58:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633334330; cv=none; d=google.com; s=arc-20160816; b=e2F6PVM20wnCseOqHd5/Tnhd4H1D4tQgVZzighqBVJCIA1WJgMFhtT/6GGfT74IWmE 7heTpQii8NfqVBjiRo3pVby3srd+OvJ4fGj762XHw8hwxBovi1DT5THvBYYEYY1wF9pZ 9NVu3QQF18f73dEIqAhShUCVOA4INY5hHBQ+fHC1odyft9wZ59dQyDIHYd65HAwaT3hJ OZNFCa4AmLnHFd1bRgg5WI7m18kkCsGOa4VTETI94dm8DebSk9v5PsvIAQhmwAgqffLF AwAVF/hKkdChjVmZo2oEeicT+bzu67+LqBaZvlkbArnukq0cHEQ5hYzIUosD7gB72Kvu CtNA== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=yKY1QQQosN/fFvLkptjsiWEaek4WRLsmIyPrzBnkU00=; b=geiij1DbU8gnGOj7YSrIcG+nOirxVYEvenkkbzVukyId2dUZ+ZKdJvbh2SwgGZkjCZ I5hM8jkddrIquuyX70ob8aVOLJxwni2Sn6aBNitiGZzlZr2KFZuuuPJhDigwKxWSy+Yo ix0y/RZvWgEmxVN7egWdFyOqHEkhfSb54z9f8pKScpVIg6n1p/KFGVTZjxKesDo/5WeM gEkDF1lOrmP+RzqqE3omhpRKsF59895r5fP+/h1k7zGgHAh4EKZEtl1PUg2ls22BGaYu oGbhvnTN6YGJLuXIV+aBB8Un+5tF6gvqE1j0JAzNJ7ayZ9adtDa/J9o9bhE0tDAwUNBI dbgQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d1si1397001jaq.133.2021.10.04.00.58.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Oct 2021 00:58:50 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:34320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXIs5-0004xm-FU for patch@linaro.org; Mon, 04 Oct 2021 03:58:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44138) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeO-0004Cl-0D for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:40 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:50015) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeK-0004pp-Jl for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:39 -0400 Received: from quad ([82.142.3.114]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MbTCr-1n4RbU3kj3-00bvDd; Mon, 04 Oct 2021 09:44:26 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 04/26] linux-user/arm: Drop "_v2" from symbols in signal.c Date: Mon, 4 Oct 2021 09:43:59 +0200 Message-Id: <20211004074421.3141222-5-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004074421.3141222-1-laurent@vivier.eu> References: <20211004074421.3141222-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:ftPMbVF9cQjNs4HTRnOplBPNQXMkSWgTHlt6TYrmpzw7t6keMzi LQKs1q0xJ9QZlNxgPtL6ZvnuUN0ctcrfAhh13uXuT4TlgKMEZJ34WuabeCab3EqnJyMwMSp N7C8LlD1lcybcS5sAGHEodZlwmwIWzzSHyK5ATwjCwXX0X2ytccaI8c9XXqR1Qx4M090I7m /oJuyRLQlKQnQNxamscWg== X-UI-Out-Filterresults: notjunk:1; V03:K0:Fzrn2R16ljs=:hc+mD4NWEvctGvX7sQ231w Kpi1PnKU27u4yV5jIwDwhnRmqvaCRiwS/DfS5J6hVC6KDTjM2KfP8tSE729Se4SqqJceU5MEG g5wblxtd4rN7YCGJzTPQgH6rrzdPUVP77s1NR08rgfBJAq+ZhsGIBqpUBHlLSklYztTvluhR0 VlQVPgDq0IbZHHSxQRpmIHtij8vyCltJVbCBKH1Vbf6dttVZSscjVfFhh/swXz4rcTBjXQWDi 3U0uM3iwA596X/2Vn68kCIndR/zq5CcF+QeDjoH/A5bFuf03ocHkd7aSp8sooDIotyhB2eIR5 LM/5e/m/Of1XsKeNeTMnUzUjF61BCth1abPjUM+IanAhzkdFghSWS3xZbLRlGB/1KrSwcsn+u xr4T3jd00I2BJgTlJSTuEyVUoJDvVooPTAmuFr7kizg1WR1LYLeZAgRdBnyuIRPKRu4wSBcEM 69YgbEUkSgOPzxOZVmknRzQGvMFTZ5gj/GUEm5tw3fJN3hyND8F9/ksV30NKhJu74g8KMbrNZ S1DKgR+cirg4XyUryJY06eeDI5Bvonl6rhwhUSJzdO4OSbH8z7P/d9nxp7f03hMRZNgKNm6R+ ja4oXPbtb4DrELncGIoyt2WA/Qz4xld70VZa/1fqtQcYbIw1cNsnoZ54JB2QjnPzpxfmMMs2Y GTYMUE7bWMVkdWI6hJU0F6EoUHtZuc69i5KwGAXIvDU2DS/oyLLVyqZ6XOn3KWjNMa67eJpuc Wif7hn98cLMyGHalFnGFGYr+uGhH8o22FeUMvA== Received-SPF: none client-ip=212.227.126.135; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_NONE=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: Richard Henderson , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Since we no longer support "v1", there's no need to distinguish "v2". Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20210929130553.121567-5-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/arm/signal.c | 115 ++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 70 deletions(-) -- 2.31.1 diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c index d0940bab479c..ed7d1d80bb9c 100644 --- a/linux-user/arm/signal.c +++ b/linux-user/arm/signal.c @@ -46,7 +46,7 @@ struct target_sigcontext { abi_ulong fault_address; }; -struct target_ucontext_v2 { +struct target_ucontext { abi_ulong tuc_flags; abi_ulong tuc_link; target_stack_t tuc_stack; @@ -90,16 +90,16 @@ struct target_iwmmxt_sigframe { #define TARGET_VFP_MAGIC 0x56465001 #define TARGET_IWMMXT_MAGIC 0x12ef842a -struct sigframe_v2 +struct sigframe { - struct target_ucontext_v2 uc; + struct target_ucontext uc; abi_ulong retcode[4]; }; -struct rt_sigframe_v2 +struct rt_sigframe { struct target_siginfo info; - struct target_ucontext_v2 uc; + struct target_ucontext uc; abi_ulong retcode[4]; }; @@ -270,7 +270,7 @@ setup_return(CPUARMState *env, struct target_sigaction *ka, return 0; } -static abi_ulong *setup_sigframe_v2_vfp(abi_ulong *regspace, CPUARMState *env) +static abi_ulong *setup_sigframe_vfp(abi_ulong *regspace, CPUARMState *env) { int i; struct target_vfp_sigframe *vfpframe; @@ -287,8 +287,7 @@ static abi_ulong *setup_sigframe_v2_vfp(abi_ulong *regspace, CPUARMState *env) return (abi_ulong*)(vfpframe+1); } -static abi_ulong *setup_sigframe_v2_iwmmxt(abi_ulong *regspace, - CPUARMState *env) +static abi_ulong *setup_sigframe_iwmmxt(abi_ulong *regspace, CPUARMState *env) { int i; struct target_iwmmxt_sigframe *iwmmxtframe; @@ -307,15 +306,15 @@ static abi_ulong *setup_sigframe_v2_iwmmxt(abi_ulong *regspace, return (abi_ulong*)(iwmmxtframe+1); } -static void setup_sigframe_v2(struct target_ucontext_v2 *uc, - target_sigset_t *set, CPUARMState *env) +static void setup_sigframe(struct target_ucontext *uc, + target_sigset_t *set, CPUARMState *env) { struct target_sigaltstack stack; int i; abi_ulong *regspace; /* Clear all the bits of the ucontext we don't use. */ - memset(uc, 0, offsetof(struct target_ucontext_v2, tuc_mcontext)); + memset(uc, 0, offsetof(struct target_ucontext, tuc_mcontext)); memset(&stack, 0, sizeof(stack)); target_save_altstack(&stack, env); @@ -325,10 +324,10 @@ static void setup_sigframe_v2(struct target_ucontext_v2 *uc, /* Save coprocessor signal frame. */ regspace = uc->tuc_regspace; if (cpu_isar_feature(aa32_vfp_simd, env_archcpu(env))) { - regspace = setup_sigframe_v2_vfp(regspace, env); + regspace = setup_sigframe_vfp(regspace, env); } if (arm_feature(env, ARM_FEATURE_IWMMXT)) { - regspace = setup_sigframe_v2_iwmmxt(regspace, env); + regspace = setup_sigframe_iwmmxt(regspace, env); } /* Write terminating magic word */ @@ -339,10 +338,10 @@ static void setup_sigframe_v2(struct target_ucontext_v2 *uc, } } -static void setup_frame_v2(int usig, struct target_sigaction *ka, - target_sigset_t *set, CPUARMState *regs) +void setup_frame(int usig, struct target_sigaction *ka, + target_sigset_t *set, CPUARMState *regs) { - struct sigframe_v2 *frame; + struct sigframe *frame; abi_ulong frame_addr = get_sigframe(ka, regs, sizeof(*frame)); trace_user_setup_frame(regs, frame_addr); @@ -350,10 +349,10 @@ static void setup_frame_v2(int usig, struct target_sigaction *ka, goto sigsegv; } - setup_sigframe_v2(&frame->uc, set, regs); + setup_sigframe(&frame->uc, set, regs); if (setup_return(regs, ka, frame->retcode, frame_addr, usig, - frame_addr + offsetof(struct sigframe_v2, retcode))) { + frame_addr + offsetof(struct sigframe, retcode))) { goto sigsegv; } @@ -364,17 +363,11 @@ sigsegv: force_sigsegv(usig); } -void setup_frame(int usig, struct target_sigaction *ka, - target_sigset_t *set, CPUARMState *regs) -{ - setup_frame_v2(usig, ka, set, regs); -} - -static void setup_rt_frame_v2(int usig, struct target_sigaction *ka, - target_siginfo_t *info, - target_sigset_t *set, CPUARMState *env) +void setup_rt_frame(int usig, struct target_sigaction *ka, + target_siginfo_t *info, + target_sigset_t *set, CPUARMState *env) { - struct rt_sigframe_v2 *frame; + struct rt_sigframe *frame; abi_ulong frame_addr = get_sigframe(ka, env, sizeof(*frame)); abi_ulong info_addr, uc_addr; @@ -383,14 +376,14 @@ static void setup_rt_frame_v2(int usig, struct target_sigaction *ka, goto sigsegv; } - info_addr = frame_addr + offsetof(struct rt_sigframe_v2, info); - uc_addr = frame_addr + offsetof(struct rt_sigframe_v2, uc); + info_addr = frame_addr + offsetof(struct rt_sigframe, info); + uc_addr = frame_addr + offsetof(struct rt_sigframe, uc); tswap_siginfo(&frame->info, info); - setup_sigframe_v2(&frame->uc, set, env); + setup_sigframe(&frame->uc, set, env); if (setup_return(env, ka, frame->retcode, frame_addr, usig, - frame_addr + offsetof(struct rt_sigframe_v2, retcode))) { + frame_addr + offsetof(struct rt_sigframe, retcode))) { goto sigsegv; } @@ -404,13 +397,6 @@ sigsegv: force_sigsegv(usig); } -void setup_rt_frame(int usig, struct target_sigaction *ka, - target_siginfo_t *info, - target_sigset_t *set, CPUARMState *env) -{ - setup_rt_frame_v2(usig, ka, info, set, env); -} - static int restore_sigcontext(CPUARMState *env, struct target_sigcontext *sc) { @@ -441,7 +427,7 @@ restore_sigcontext(CPUARMState *env, struct target_sigcontext *sc) return err; } -static abi_ulong *restore_sigframe_v2_vfp(CPUARMState *env, abi_ulong *regspace) +static abi_ulong *restore_sigframe_vfp(CPUARMState *env, abi_ulong *regspace) { int i; abi_ulong magic, sz; @@ -471,8 +457,8 @@ static abi_ulong *restore_sigframe_v2_vfp(CPUARMState *env, abi_ulong *regspace) return (abi_ulong*)(vfpframe + 1); } -static abi_ulong *restore_sigframe_v2_iwmmxt(CPUARMState *env, - abi_ulong *regspace) +static abi_ulong *restore_sigframe_iwmmxt(CPUARMState *env, + abi_ulong *regspace) { int i; abi_ulong magic, sz; @@ -496,9 +482,9 @@ static abi_ulong *restore_sigframe_v2_iwmmxt(CPUARMState *env, return (abi_ulong*)(iwmmxtframe + 1); } -static int do_sigframe_return_v2(CPUARMState *env, - target_ulong context_addr, - struct target_ucontext_v2 *uc) +static int do_sigframe_return(CPUARMState *env, + target_ulong context_addr, + struct target_ucontext *uc) { sigset_t host_set; abi_ulong *regspace; @@ -506,19 +492,20 @@ static int do_sigframe_return_v2(CPUARMState *env, target_to_host_sigset(&host_set, &uc->tuc_sigmask); set_sigmask(&host_set); - if (restore_sigcontext(env, &uc->tuc_mcontext)) + if (restore_sigcontext(env, &uc->tuc_mcontext)) { return 1; + } /* Restore coprocessor signal frame */ regspace = uc->tuc_regspace; if (cpu_isar_feature(aa32_vfp_simd, env_archcpu(env))) { - regspace = restore_sigframe_v2_vfp(env, regspace); + regspace = restore_sigframe_vfp(env, regspace); if (!regspace) { return 1; } } if (arm_feature(env, ARM_FEATURE_IWMMXT)) { - regspace = restore_sigframe_v2_iwmmxt(env, regspace); + regspace = restore_sigframe_iwmmxt(env, regspace); if (!regspace) { return 1; } @@ -535,10 +522,10 @@ static int do_sigframe_return_v2(CPUARMState *env, return 0; } -static long do_sigreturn_v2(CPUARMState *env) +long do_sigreturn(CPUARMState *env) { abi_ulong frame_addr; - struct sigframe_v2 *frame = NULL; + struct sigframe *frame = NULL; /* * Since we stacked the signal on a 64-bit boundary, @@ -555,10 +542,9 @@ static long do_sigreturn_v2(CPUARMState *env) goto badframe; } - if (do_sigframe_return_v2(env, - frame_addr - + offsetof(struct sigframe_v2, uc), - &frame->uc)) { + if (do_sigframe_return(env, + frame_addr + offsetof(struct sigframe, uc), + &frame->uc)) { goto badframe; } @@ -571,15 +557,10 @@ badframe: return -TARGET_QEMU_ESIGRETURN; } -long do_sigreturn(CPUARMState *env) -{ - return do_sigreturn_v2(env); -} - -static long do_rt_sigreturn_v2(CPUARMState *env) +long do_rt_sigreturn(CPUARMState *env) { abi_ulong frame_addr; - struct rt_sigframe_v2 *frame = NULL; + struct rt_sigframe *frame = NULL; /* * Since we stacked the signal on a 64-bit boundary, @@ -596,10 +577,9 @@ static long do_rt_sigreturn_v2(CPUARMState *env) goto badframe; } - if (do_sigframe_return_v2(env, - frame_addr - + offsetof(struct rt_sigframe_v2, uc), - &frame->uc)) { + if (do_sigframe_return(env, + frame_addr + offsetof(struct rt_sigframe, uc), + &frame->uc)) { goto badframe; } @@ -611,8 +591,3 @@ badframe: force_sig(TARGET_SIGSEGV); return -TARGET_QEMU_ESIGRETURN; } - -long do_rt_sigreturn(CPUARMState *env) -{ - return do_rt_sigreturn_v2(env); -} From patchwork Mon Oct 4 07:44:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 515154 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1147089imy; Mon, 4 Oct 2021 00:46:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUkfsaClxQCXLR3J9cKk4qkRpUb645YLl0YskZYQV2oVGiv30d/uWjCzg7x0Zb7B7EnR8t X-Received: by 2002:a05:6638:1483:: with SMTP id j3mr9724517jak.63.1633333610719; Mon, 04 Oct 2021 00:46:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633333610; cv=none; d=google.com; s=arc-20160816; b=xzmv9a35nX1CzPPSC70WrBhKIuxX0tEgMxPgZ+FKrqRVB4en7U4z79efb1QKCyOI5X 5FVTugBGb20rEeP/E5mOVRbPOOXGzdCZ2vApK1lmbPz9MiAdkWK2mtOvHkz0PBRAHb9L /n2WBqkGQB6R2KisT/02sD1yPZffkaxcdgrRcYYdpJG85b6xLIAcuGwLANbAFmdHWleX b/iCF5Id3+pzu55ehXDp/9NJtaTiKa6AOwyKICfw5Jrvlkj7xGTl0Oim3xsVZj7CFwL1 6qLMN3l/BGS9Cw2PyeC+3buwK3aIZwbB2QEiPVSglnj3qKYWCQ9fnjzQT1bHvvGZXbCz +OTg== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=5jRbysxb+45IGaEqlFTCsu2tKSfupai29dxeXBkDuO8=; b=eVGX7x/D5MwDvEFCkKPSYmF+V/3b5/qaECA1/vFNSRYIYCt0doSiJpemC9+427zMm3 3WfzmpbJHqd6fBWUq4uERPY/4OfZVBbVuFpptybiqxQecjE0lZTA4CgYLFsd+Ru/u8p2 htZp+N5jnzNSugVBmKx5lOHkRfjo0lRnGBkqiRTx42900V85XBaGPr7B5IticywqxXqz HxvfCIWkJhvZJUPiuXhhltJEUMUgpfP3DenOb+197sT6FDGwk7gDHm1PLYaGY+PPfE1m ckA3b1/TsdxvjAL3UGDWuMGkEENq8R1CuwLb/v8Skw3X5dSirs6U04H0bV0WXHf7vpxN YRcg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l17si15509758ilt.1.2021.10.04.00.46.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Oct 2021 00:46:50 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:38512 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXIgU-00040M-5Y for patch@linaro.org; Mon, 04 Oct 2021 03:46:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43986) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeF-0003xW-Sz for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:31 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:39501) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeD-0004jP-PO for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:31 -0400 Received: from quad ([82.142.3.114]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MIKs0-1mckhS2EGi-00EOBQ; Mon, 04 Oct 2021 09:44:26 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 05/26] linux-user/arm: Implement setup_sigtramp Date: Mon, 4 Oct 2021 09:44:00 +0200 Message-Id: <20211004074421.3141222-6-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004074421.3141222-1-laurent@vivier.eu> References: <20211004074421.3141222-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:BpMV7MYJ3KBTrwRhXxI8g4uWlxW009SvsHQmydTkkL/8Y5Aytzl BLMesy5q86ZatZMKlmVV/QsiBCIGwW7hNcHsBCXYZcZIPIQHR1iTL7ijyFRjsbXq1B457mU C3OvNKcpA4/co9wFVWeAmb+q4hN7ZeViG6K5RiRtUX51NPLcnQdvUvsWcSyhRqVe4CqDEtG Xn3ZY1e1Bz6Zu90jQsxuw== X-UI-Out-Filterresults: notjunk:1; V03:K0:Yt/O+VDPuPs=:6c1PjHiI5yxwafdn8LEQCM GxUlxSfLTYR+L8DZ7gpJh7rgvt3e9+wTH2nwHEIAL87Kzlb89lMMbK4400iZwjQr3bF/fAhFC HEIWfWLjI5t8OZ7RUT7GhbXxfhodfSVtH7RSc0/HumAHdTNlTKY+3v94l53xgiLolkIqSyo5W DyyIOK7tYpWzYUV1x4K5Uve3XDE5QGiYW/UOdYrJX0yC92kAO22rzTTeptL+qNz5siYyJPR4y ZRvjeBx7MMn6d9V+OCxC0oDrUMVyaiTfn8s3byGtDnPlaF4ZOKt1ZS6USvdkQ9Sc8mYR8seWN T52hfQyIlW7P89WXBTVqMre4k9HxfOVImBmcJAkHNJQzuiBgECDj/Y9XTSduHbhMyqeOZ3lEv 0aLZUzbYfinTm3vT6dhVyiX/5Bd3wZOGx773YRdKAL5YkNr9Pi3L1MprxxgkcuN5U43tn2Hie WR3/y1GSeG5NJVH1aGM6SIjttQ7eDV3oWwGw3LsRF3s3QgXAEIv11I0S5isSt6hw/pd5Yuq/W RjQUUM4LF4a3RQ8uYQMAvMP/2zd/uiKifz2OAGtoP18UGbhOORhwdQdGhMcRizqL05X5mumDn wBin6yrSDHNLG94VcyNBhY/Z1BjQzZ7yG5znsbtLbT92BuduyxsB0DFf5Vu3mMEGGUnKLfe05 rlLtlJqTho0meEjU/kLWuoZIzjUK+tcVaUtYIXc4Ds7cZ92oSJOAGMeCPtftdlVgl9UJm1nUN hhxJSs16EfByM5aK8+9++bzW2TD55PAFonENMg== Received-SPF: none client-ip=212.227.126.135; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_NONE=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: Peter Maydell , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Mirror what the kernel does in arch/arm/kernel/signal.h, using the old sigframe struct in the rt sigframe struct. Update the trampoline code to match the kernel: this uses sp-relative accesses rather than pc-relative. Copy the code into frame->retcode from the trampoline page. This minimises the different cases wrt arm vs thumb vs fdpic. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Message-Id: <20210929130553.121567-6-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/arm/signal.c | 179 ++++++++++++++++++++------------- linux-user/arm/target_signal.h | 2 + 2 files changed, 110 insertions(+), 71 deletions(-) -- 2.31.1 diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c index ed7d1d80bb9c..df9f8e8eb200 100644 --- a/linux-user/arm/signal.c +++ b/linux-user/arm/signal.c @@ -99,43 +99,21 @@ struct sigframe struct rt_sigframe { struct target_siginfo info; - struct target_ucontext uc; - abi_ulong retcode[4]; + struct sigframe sig; }; -/* - * For ARM syscalls, we encode the syscall number into the instruction. - */ -#define SWI_SYS_SIGRETURN (0xef000000|(TARGET_NR_sigreturn + ARM_SYSCALL_BASE)) -#define SWI_SYS_RT_SIGRETURN (0xef000000|(TARGET_NR_rt_sigreturn + ARM_SYSCALL_BASE)) - -/* - * For Thumb syscalls, we pass the syscall number via r7. We therefore - * need two 16-bit instructions. - */ -#define SWI_THUMB_SIGRETURN (0xdf00 << 16 | 0x2700 | (TARGET_NR_sigreturn)) -#define SWI_THUMB_RT_SIGRETURN (0xdf00 << 16 | 0x2700 | (TARGET_NR_rt_sigreturn)) - -static const abi_ulong retcodes[4] = { - SWI_SYS_SIGRETURN, SWI_THUMB_SIGRETURN, - SWI_SYS_RT_SIGRETURN, SWI_THUMB_RT_SIGRETURN -}; +static abi_ptr sigreturn_fdpic_tramp; /* - * Stub needed to make sure the FD register (r9) contains the right - * value. + * Up to 3 words of 'retcode' in the sigframe are code, + * with retcode[3] being used by fdpic for the function descriptor. + * This code is not actually executed, but is retained for ABI compat. + * + * We will create a table of 8 retcode variants in the sigtramp page. + * Let each table entry use 3 words. */ -static const unsigned long sigreturn_fdpic_codes[3] = { - 0xe59fc004, /* ldr r12, [pc, #4] to read function descriptor */ - 0xe59c9004, /* ldr r9, [r12, #4] to setup GOT */ - 0xe59cf000 /* ldr pc, [r12] to jump into restorer */ -}; - -static const unsigned long sigreturn_fdpic_thumb_codes[3] = { - 0xc008f8df, /* ldr r12, [pc, #8] to read function descriptor */ - 0x9004f8dc, /* ldr r9, [r12, #4] to setup GOT */ - 0xf000f8dc /* ldr pc, [r12] to jump into restorer */ -}; +#define RETCODE_WORDS 3 +#define RETCODE_BYTES (RETCODE_WORDS * 4) static inline int valid_user_regs(CPUARMState *regs) { @@ -183,15 +161,15 @@ get_sigframe(struct target_sigaction *ka, CPUARMState *regs, int framesize) } static int -setup_return(CPUARMState *env, struct target_sigaction *ka, - abi_ulong *rc, abi_ulong frame_addr, int usig, abi_ulong rc_addr) +setup_return(CPUARMState *env, struct target_sigaction *ka, int usig, + struct sigframe *frame, abi_ulong sp_addr) { abi_ulong handler = 0; abi_ulong handler_fdpic_GOT = 0; abi_ulong retcode; - - int thumb; + int thumb, retcode_idx; int is_fdpic = info_is_fdpic(((TaskState *)thread_cpu->opaque)->info); + bool copy_retcode; if (is_fdpic) { /* In FDPIC mode, ka->_sa_handler points to a function @@ -208,6 +186,7 @@ setup_return(CPUARMState *env, struct target_sigaction *ka, } thumb = handler & 1; + retcode_idx = thumb + (ka->sa_flags & TARGET_SA_SIGINFO ? 2 : 0); uint32_t cpsr = cpsr_read(env); @@ -225,44 +204,29 @@ setup_return(CPUARMState *env, struct target_sigaction *ka, if (ka->sa_flags & TARGET_SA_RESTORER) { if (is_fdpic) { - /* For FDPIC we ensure that the restorer is called with a - * correct r9 value. For that we need to write code on - * the stack that sets r9 and jumps back to restorer - * value. - */ - if (thumb) { - __put_user(sigreturn_fdpic_thumb_codes[0], rc); - __put_user(sigreturn_fdpic_thumb_codes[1], rc + 1); - __put_user(sigreturn_fdpic_thumb_codes[2], rc + 2); - __put_user((abi_ulong)ka->sa_restorer, rc + 3); - } else { - __put_user(sigreturn_fdpic_codes[0], rc); - __put_user(sigreturn_fdpic_codes[1], rc + 1); - __put_user(sigreturn_fdpic_codes[2], rc + 2); - __put_user((abi_ulong)ka->sa_restorer, rc + 3); - } - - retcode = rc_addr + thumb; + __put_user((abi_ulong)ka->sa_restorer, &frame->retcode[3]); + retcode = (sigreturn_fdpic_tramp + + retcode_idx * RETCODE_BYTES + thumb); + copy_retcode = true; } else { retcode = ka->sa_restorer; + copy_retcode = false; } } else { - unsigned int idx = thumb; - - if (ka->sa_flags & TARGET_SA_SIGINFO) { - idx += 2; - } - - __put_user(retcodes[idx], rc); + retcode = default_sigreturn + retcode_idx * RETCODE_BYTES + thumb; + copy_retcode = true; + } - retcode = rc_addr + thumb; + /* Copy the code to the stack slot for ABI compatibility. */ + if (copy_retcode) { + memcpy(frame->retcode, g2h_untagged(retcode & ~1), RETCODE_BYTES); } env->regs[0] = usig; if (is_fdpic) { env->regs[9] = handler_fdpic_GOT; } - env->regs[13] = frame_addr; + env->regs[13] = sp_addr; env->regs[14] = retcode; env->regs[15] = handler & (thumb ? ~1 : ~3); cpsr_write(env, cpsr, CPSR_IT | CPSR_T | CPSR_E, CPSRWriteByInstr); @@ -351,8 +315,7 @@ void setup_frame(int usig, struct target_sigaction *ka, setup_sigframe(&frame->uc, set, regs); - if (setup_return(regs, ka, frame->retcode, frame_addr, usig, - frame_addr + offsetof(struct sigframe, retcode))) { + if (setup_return(regs, ka, usig, frame, frame_addr)) { goto sigsegv; } @@ -377,13 +340,12 @@ void setup_rt_frame(int usig, struct target_sigaction *ka, } info_addr = frame_addr + offsetof(struct rt_sigframe, info); - uc_addr = frame_addr + offsetof(struct rt_sigframe, uc); + uc_addr = frame_addr + offsetof(struct rt_sigframe, sig.uc); tswap_siginfo(&frame->info, info); - setup_sigframe(&frame->uc, set, env); + setup_sigframe(&frame->sig.uc, set, env); - if (setup_return(env, ka, frame->retcode, frame_addr, usig, - frame_addr + offsetof(struct rt_sigframe, retcode))) { + if (setup_return(env, ka, usig, &frame->sig, frame_addr)) { goto sigsegv; } @@ -578,8 +540,8 @@ long do_rt_sigreturn(CPUARMState *env) } if (do_sigframe_return(env, - frame_addr + offsetof(struct rt_sigframe, uc), - &frame->uc)) { + frame_addr + offsetof(struct rt_sigframe, sig.uc), + &frame->sig.uc)) { goto badframe; } @@ -591,3 +553,78 @@ badframe: force_sig(TARGET_SIGSEGV); return -TARGET_QEMU_ESIGRETURN; } + +/* + * EABI syscalls pass the number via r7. + * Note that the kernel still adds the OABI syscall number to the trap, + * presumably for backward ABI compatibility with unwinders. + */ +#define ARM_MOV_R7_IMM(X) (0xe3a07000 | (X)) +#define ARM_SWI_SYS(X) (0xef000000 | (X) | ARM_SYSCALL_BASE) + +#define THUMB_MOVS_R7_IMM(X) (0x2700 | (X)) +#define THUMB_SWI_SYS 0xdf00 + +static void write_arm_sigreturn(uint32_t *rc, int syscall) +{ + __put_user(ARM_MOV_R7_IMM(syscall), rc); + __put_user(ARM_SWI_SYS(syscall), rc + 1); + /* Wrote 8 of 12 bytes */ +} + +static void write_thm_sigreturn(uint32_t *rc, int syscall) +{ + __put_user(THUMB_SWI_SYS << 16 | THUMB_MOVS_R7_IMM(syscall), rc); + /* Wrote 4 of 12 bytes */ +} + +/* + * Stub needed to make sure the FD register (r9) contains the right value. + * Use the same instruction sequence as the kernel. + */ +static void write_arm_fdpic_sigreturn(uint32_t *rc, int ofs) +{ + assert(ofs <= 0xfff); + __put_user(0xe59d3000 | ofs, rc + 0); /* ldr r3, [sp, #ofs] */ + __put_user(0xe8930908, rc + 1); /* ldm r3, { r3, r9 } */ + __put_user(0xe12fff13, rc + 2); /* bx r3 */ + /* Wrote 12 of 12 bytes */ +} + +static void write_thm_fdpic_sigreturn(void *vrc, int ofs) +{ + uint16_t *rc = vrc; + + assert((ofs & ~0x3fc) == 0); + __put_user(0x9b00 | (ofs >> 2), rc + 0); /* ldr r3, [sp, #ofs] */ + __put_user(0xcb0c, rc + 1); /* ldm r3, { r2, r3 } */ + __put_user(0x4699, rc + 2); /* mov r9, r3 */ + __put_user(0x4710, rc + 3); /* bx r2 */ + /* Wrote 8 of 12 bytes */ +} + +void setup_sigtramp(abi_ulong sigtramp_page) +{ + uint32_t total_size = 8 * RETCODE_BYTES; + uint32_t *tramp = lock_user(VERIFY_WRITE, sigtramp_page, total_size, 0); + + assert(tramp != NULL); + + default_sigreturn = sigtramp_page; + write_arm_sigreturn(&tramp[0 * RETCODE_WORDS], TARGET_NR_sigreturn); + write_thm_sigreturn(&tramp[1 * RETCODE_WORDS], TARGET_NR_sigreturn); + write_arm_sigreturn(&tramp[2 * RETCODE_WORDS], TARGET_NR_rt_sigreturn); + write_thm_sigreturn(&tramp[3 * RETCODE_WORDS], TARGET_NR_rt_sigreturn); + + sigreturn_fdpic_tramp = sigtramp_page + 4 * RETCODE_BYTES; + write_arm_fdpic_sigreturn(tramp + 4 * RETCODE_WORDS, + offsetof(struct sigframe, retcode[3])); + write_thm_fdpic_sigreturn(tramp + 5 * RETCODE_WORDS, + offsetof(struct sigframe, retcode[3])); + write_arm_fdpic_sigreturn(tramp + 6 * RETCODE_WORDS, + offsetof(struct rt_sigframe, sig.retcode[3])); + write_thm_fdpic_sigreturn(tramp + 7 * RETCODE_WORDS, + offsetof(struct rt_sigframe, sig.retcode[3])); + + unlock_user(tramp, sigtramp_page, total_size); +} diff --git a/linux-user/arm/target_signal.h b/linux-user/arm/target_signal.h index 0998dd6dfa75..1e7fb0cecbdd 100644 --- a/linux-user/arm/target_signal.h +++ b/linux-user/arm/target_signal.h @@ -22,4 +22,6 @@ typedef struct target_sigaltstack { #include "../generic/signal.h" #define TARGET_ARCH_HAS_SETUP_FRAME +#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1 + #endif /* ARM_TARGET_SIGNAL_H */ From patchwork Mon Oct 4 07:44:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 515165 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1151059imy; Mon, 4 Oct 2021 00:59:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxd2M888De3p6mHbFqt7D8eaRdirZlWHpV5gVsCTrt6VU3i13vI+h72lKoR7EeYax6TZJt X-Received: by 2002:a05:6e02:c2e:: with SMTP id q14mr8950760ilg.109.1633334359792; Mon, 04 Oct 2021 00:59:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633334359; cv=none; d=google.com; s=arc-20160816; b=Ne3hIaHKuvfNp1R1vuctHT8+4OI5NmyeBmqP9pQrT4RM0JnE55IdhVQC6COD1Jyik2 J1b3VM8hqTcEyCvgDYphFYuestgLGp4vPL0OvfOgERnhrdws//IUoUV+GkAB2SZtqIT8 WJaOClfRUIckrZh5/mlue1nXyXglGyhYVFFpsssXtgiVm+gJSFhjyweei5WkibDG6u9O XWJPBAFN0lp0d+/rVsXqDlVnjucUMWllWfuvjVbujM1qH8Q9KPh13l4sNcCU8gLKLEhk Pn7XWNIYIxJabSsGCRa77/denZ7aYYmtWmcAgCmtm04hRc4udsKwlYxWkTdmsaDDZHyY N/ng== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=WpxbqBXFm+RPhSJAe258Q0MpYTGBCtyBiJdsBoofGeI=; b=VWaaXwA1VXb6eNR6Yj6i0zWOfPBKttfeufmvH13yySBU76/FMOCy0G8+UlxtETZnKx tR5YWmdhxkr4Vhou6manbjZQV7uAGlxBUhVADvxRtgB5g2v20VgKgjjHNeuOnVIhfVXh wml8e1NGVypDdEzftszULket7ZPryVVD2HxduK3q6J3Tj6FhytTbHg5yWguCmh/o7U65 ZSFUZCmEPc68YP0SWJqDM/tU6LWrBBwzVC4d+RMxdt+Vld6PK0kKBRyi9Reu8aeKiBqv qOVnODfp182rP75KdSDurD9PFCl+JDs+jaesHwZPqhV22WqnWJ1HcVY7zzPLoRmdRcWD 620Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q10si21868151ilu.41.2021.10.04.00.59.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Oct 2021 00:59:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:35700 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXIsZ-000617-7D for patch@linaro.org; Mon, 04 Oct 2021 03:59:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44182) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeP-0004GJ-7Y for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:41 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:36269) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeL-0004qo-HM for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:40 -0400 Received: from quad ([82.142.3.114]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MAchM-1mdsEF0VVg-00B4nI; Mon, 04 Oct 2021 09:44:27 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 06/26] linux-user/alpha: Implement setup_sigtramp Date: Mon, 4 Oct 2021 09:44:01 +0200 Message-Id: <20211004074421.3141222-7-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004074421.3141222-1-laurent@vivier.eu> References: <20211004074421.3141222-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:XVeBUSeOwZnzOlG+IEND3rgkvbLJ6109GbKVXTYia06403FDWPD B+U4UPe4XFgcBQr0kOGVCYG+VciCuNVvFM0TL5CxXHVvXTiq5IXhRDVzsOqGKUhmBrbLIf4 xdpcOCK91V0H+04KeKLal7mCtxUZVwkuMZM4wUJFkxML07hWnQcqb/CzeDpSK+YTqWkbE2q 2UfFgkCfl7gAX1qhAH3sg== X-UI-Out-Filterresults: notjunk:1; V03:K0:FSkllQucq2U=:YUaKR6QqyjVtDtZE+bvL/b oB3eMiVamvxxrHmhMWTmfHuVtdDDdCb/mJMggLToZFaoNrnphe9Gx4ZrMH1T3Gse0rrap0Pl7 pxcD6HGFgrGs2NqRi2FWsI6j98QMA3XnyD9c4sk2foif7YL00vZOmhpokzWwo95nCUvcRvEe/ IuB3PCKwtAIFW+wUFdNHC0W8Sb+EdJL61G9aOO5jkNSBtfwLnTUUUowOhxp4KidTdTtiYp1HL pgtZ4AXSnH5tdfdkoSx9wxEB2fCX5bOqgqXOGy1P/C4UAtETSnC+Ct6X49g/eG9nIrAid8XWE bGydb69DaWQ+nFRuZofkraBFoWmA9wzVkbOy8TT+11uONWcFBduV6CuL/Vgl5H3vEqcmBuyGz KeYmxPoUINwfulRQoPfG15hbYVbN5oYv5fxj/4mKMbPc3h2TOdiSBrLDa8OA2/f7EP7RBUq9+ yV6tyvdMoui6Q6hMPC3r2BRrf29TV/aINEtlCiJdYY8sUEiBVmEGHqw9Ujor0XI3PahyDhNvn rLE60uqGu5ZSD5lNbQpkuy8xsDAm7WG36OpGG6B0ran6zBywlueAgc7xXivI6y/8H9WB3AzGz aC9YLv5xv/i0SLSoL6ueWvBtFzmncv4cFdUw8Bf2SdVgf2Qx8qv4zFzCCu4QgZVWkya+ECzZT SPynbyTYwGbUghfzLnmtVWJVx2byDgjHiB2MmHQcp8iUEyaGwGwfEdmxYg2LxmBP8xgV6clep GvOzTKxIs1IgY/h89xa8EZLlN33mcXnZf2DFgQ== Received-SPF: none client-ip=212.227.126.131; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=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: Richard Henderson , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Create and record the two signal trampolines. Use them when the guest does not use ka_restorer. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20210929130553.121567-7-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/alpha/signal.c | 34 +++++++++++++++++++------------- linux-user/alpha/target_signal.h | 1 + 2 files changed, 21 insertions(+), 14 deletions(-) -- 2.31.1 diff --git a/linux-user/alpha/signal.c b/linux-user/alpha/signal.c index 3a820f616b3f..bbe3dd175a7c 100644 --- a/linux-user/alpha/signal.c +++ b/linux-user/alpha/signal.c @@ -55,13 +55,11 @@ struct target_ucontext { struct target_sigframe { struct target_sigcontext sc; - unsigned int retcode[3]; }; struct target_rt_sigframe { target_siginfo_t info; struct target_ucontext uc; - unsigned int retcode[3]; }; #define INSN_MOV_R30_R16 0x47fe0410 @@ -142,12 +140,7 @@ void setup_frame(int sig, struct target_sigaction *ka, if (ka->ka_restorer) { r26 = ka->ka_restorer; } else { - __put_user(INSN_MOV_R30_R16, &frame->retcode[0]); - __put_user(INSN_LDI_R0 + TARGET_NR_sigreturn, - &frame->retcode[1]); - __put_user(INSN_CALLSYS, &frame->retcode[2]); - /* imb() */ - r26 = frame_addr + offsetof(struct target_sigframe, retcode); + r26 = default_sigreturn; } unlock_user_struct(frame, frame_addr, 1); @@ -196,12 +189,7 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, if (ka->ka_restorer) { r26 = ka->ka_restorer; } else { - __put_user(INSN_MOV_R30_R16, &frame->retcode[0]); - __put_user(INSN_LDI_R0 + TARGET_NR_rt_sigreturn, - &frame->retcode[1]); - __put_user(INSN_CALLSYS, &frame->retcode[2]); - /* imb(); */ - r26 = frame_addr + offsetof(struct target_rt_sigframe, retcode); + r26 = default_rt_sigreturn; } if (err) { @@ -269,3 +257,21 @@ badframe: force_sig(TARGET_SIGSEGV); return -TARGET_QEMU_ESIGRETURN; } + +void setup_sigtramp(abi_ulong sigtramp_page) +{ + uint32_t *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 6 * 4, 0); + assert(tramp != NULL); + + default_sigreturn = sigtramp_page; + __put_user(INSN_MOV_R30_R16, &tramp[0]); + __put_user(INSN_LDI_R0 + TARGET_NR_sigreturn, &tramp[1]); + __put_user(INSN_CALLSYS, &tramp[2]); + + default_rt_sigreturn = sigtramp_page + 3 * 4; + __put_user(INSN_MOV_R30_R16, &tramp[3]); + __put_user(INSN_LDI_R0 + TARGET_NR_rt_sigreturn, &tramp[4]); + __put_user(INSN_CALLSYS, &tramp[5]); + + unlock_user(tramp, sigtramp_page, 6 * 4); +} diff --git a/linux-user/alpha/target_signal.h b/linux-user/alpha/target_signal.h index 250642913e2a..0b6a39de6576 100644 --- a/linux-user/alpha/target_signal.h +++ b/linux-user/alpha/target_signal.h @@ -93,6 +93,7 @@ typedef struct target_sigaltstack { #define TARGET_ARCH_HAS_SETUP_FRAME #define TARGET_ARCH_HAS_KA_RESTORER +#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1 /* bit-flags */ #define TARGET_SS_AUTODISARM (1U << 31) /* disable sas during sighandling */ From patchwork Mon Oct 4 07:44:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 515168 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1153165imy; Mon, 4 Oct 2021 01:03:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/cc0sreGoP0/2YibAh92YJevAFnDvYxAlPpx6sW8l30lBzMbME1IBcp1f+8m+3mzfbFmH X-Received: by 2002:ad4:44e4:: with SMTP id p4mr20734391qvt.40.1633334624260; Mon, 04 Oct 2021 01:03:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633334624; cv=none; d=google.com; s=arc-20160816; b=laeuxtRQagr2jSCYjwy8svkuMdIKXGPyS5SuEdeCl1CwwdQv/zVkYqtCP26Lyv7XDT mV6Bjt63+KWgx6y3L4cudw620jRAL1oYGLqW9TSAeBa9K88z9/o3r/0kNnn+YKjtRmej 1laD3u9ui0j48EU06hDjU/C9s4rtLGR4QX/z6OtBe/q8IgnukJAJmcjuRgSoFBbvhIDC uqpC9o0vbReswYIpW7J+mV+Y/JMRcoFuXFJtj7W5afA/Kv5yD/Ah92A/zcT2++y3Slun ltcJI8So8jdgInMLFF+sGPJQzPUac3je6H0ELw7vSwTlbKb6L7gIqtlpvc2JEMbpxv7w Xj0Q== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=Ymintmny8Axv50WhEziNyXT4eScy3XI0WxBAOWyZD20=; b=C3P82IOaH43FQQ/uyTkjIc7sI7YdvaQUsh8A0Dee8lyDm+obuGh4CVPusTM6p74VAs MuxhD3MS8+5xW/jb9vgoFOkUe3cVXz5LyoVbB454tNq7HnoZBKw+b6Fr5jP+7+cSE/wx fAMnN9gnmOZH+E/OVAIbDjt7uTvas3WL2SLUSR4wbr1ZdMeLs7b0ej831RKTN3W7b/wP g8+NLF4w4ZWT99QEu2Us4Hj8AS5HD12uSooFljlrPnA5yQMzSYUhnt58oD+uZNILwesi d4p1dowerjhV0OasOvqsjFKXu+c5P8KqegkgjdCEUeIKn/nnj3WYKr61DeExh5qQ0JVH ijng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id iv15si10539197qvb.64.2021.10.04.01.03.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Oct 2021 01:03:44 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:43944 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXIwp-0003Wy-KX for patch@linaro.org; Mon, 04 Oct 2021 04:03:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeR-0004Jr-Qn for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:43 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:41309) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeM-0004sE-PP for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:42 -0400 Received: from quad ([82.142.3.114]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MavF5-1n3tdg2jG7-00cTRz; Mon, 04 Oct 2021 09:44:27 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 07/26] linux-user/cris: Implement setup_sigtramp Date: Mon, 4 Oct 2021 09:44:02 +0200 Message-Id: <20211004074421.3141222-8-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004074421.3141222-1-laurent@vivier.eu> References: <20211004074421.3141222-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:AYWD5ubbTywWVnEnEWbtAJt1YIMMn+hzNn3Ydo/W2UVOb8idEB9 ayB7BHmXbQWD70dHNpm35qft9JW2b12zmCY3fdaSq6WO7W/0RX6OcfnuvZC7BeMf7JixdiH rxPYtzW0Gr3irH4cxH/06oX3KAhXMgI0g5GQHXDpgxpZvkkJq8SnzYxgBhumaaTG7+qkZb4 DX3hb7GAfF1HOu6a8llxw== X-UI-Out-Filterresults: notjunk:1; V03:K0:SdfmUmY/5fs=:Ww+QdfCfSRkwIHVoo3BXxG 8bRnbhBGg+pA1SQ9235wRIHafgrtToj82uL/bTPJHsrGfOzSikl12zyBbJCmZ6O9kWeEmgbED HDSV9mmoeaUJSA5IB+nvk1HphQkyYMwPcdGFLe8QeTBh5t+0YdjF6rVsP30lB+f22G0R/JU6W gMcHSed2lhzivuPFcjIWHTwfltzyAak/gZEldOjA9bV0wUYv8JXPymWC1obHOLNeaul+7fhdn dIuMq2WN94jwsA1bBU/VyrGpsJVC5WPktgZ1JKl5jaJstAPkS8fi2DVtc2Ldrr9Lj8sNf7rcS gf4hy7aaZsUSBJQAb3qyrdMnfdt3dK1G8si3PYXHwFkaA8XJkGXbi/p4Le5q9qjupybmFTUL8 9ErtXjxJXTYRRHNlJjZLD62i75zAi/epwVDdW50nKPxDPWvHKf0Vk/43IHOTgKUEULywUY/E4 g8k4+AsybKBW6dxChHqFX3POJCPZj3Iqs3pr7DiYg5TUOfwpMUihidPaAkYH+EiHumY4LjfvF aAp3T3gLqdVPVMHRXRlL0KvG86TdXG42inQNMy7M094xWE7iIKHcfVK9FTwnt4DuLzBdORcn+ WCGQZWFeNSAQUA0Alr92Vuwjntr86d97jGJIMuPRvBibefJrQSKSF3NHHtOTjyX+oyoK+Qntn YFxx2vNGDccoPUmyf0qLmZ0BkmWCnOxe2L/NPN9G/ZPZaBp3IhE+4Szoe8XuNWRppiOjIPENb zrfTA2sghjAZB7yinFyvZ2b3q1MQ2dVu6DD03Q== Received-SPF: none client-ip=212.227.126.131; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=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: "Edgar E . Iglesias" , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Split out setup_sigreturn so that we can continue to initialize the words on the stack, as documented. However, use the off-stack trampoline. Cc: Edgar E. Iglesias Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20210929130553.121567-8-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/cris/signal.c | 29 +++++++++++++++++++++-------- linux-user/cris/target_signal.h | 2 ++ 2 files changed, 23 insertions(+), 8 deletions(-) -- 2.31.1 diff --git a/linux-user/cris/signal.c b/linux-user/cris/signal.c index 2c39bdf7277f..7f6aca934e10 100644 --- a/linux-user/cris/signal.c +++ b/linux-user/cris/signal.c @@ -97,6 +97,14 @@ static abi_ulong get_sigframe(CPUCRISState *env, int framesize) return sp - framesize; } +static void setup_sigreturn(uint16_t *retcode) +{ + /* This is movu.w __NR_sigreturn, r9; break 13; */ + __put_user(0x9c5f, retcode + 0); + __put_user(TARGET_NR_sigreturn, retcode + 1); + __put_user(0xe93d, retcode + 2); +} + void setup_frame(int sig, struct target_sigaction *ka, target_sigset_t *set, CPUCRISState *env) { @@ -112,14 +120,8 @@ void setup_frame(int sig, struct target_sigaction *ka, /* * The CRIS signal return trampoline. A real linux/CRIS kernel doesn't * use this trampoline anymore but it sets it up for GDB. - * In QEMU, using the trampoline simplifies things a bit so we use it. - * - * This is movu.w __NR_sigreturn, r9; break 13; */ - __put_user(0x9c5f, frame->retcode+0); - __put_user(TARGET_NR_sigreturn, - frame->retcode + 1); - __put_user(0xe93d, frame->retcode + 2); + setup_sigreturn(frame->retcode); /* Save the mask. */ __put_user(set->sig[0], &frame->sc.oldmask); @@ -135,7 +137,7 @@ void setup_frame(int sig, struct target_sigaction *ka, env->regs[10] = sig; env->pc = (unsigned long) ka->_sa_handler; /* Link SRP so the guest returns through the trampoline. */ - env->pregs[PR_SRP] = frame_addr + offsetof(typeof(*frame), retcode); + env->pregs[PR_SRP] = default_sigreturn; unlock_user_struct(frame, frame_addr, 1); return; @@ -187,3 +189,14 @@ long do_rt_sigreturn(CPUCRISState *env) qemu_log_mask(LOG_UNIMP, "do_rt_sigreturn: not implemented\n"); return -TARGET_ENOSYS; } + +void setup_sigtramp(abi_ulong sigtramp_page) +{ + uint16_t *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 6, 0); + assert(tramp != NULL); + + default_sigreturn = sigtramp_page; + setup_sigreturn(tramp); + + unlock_user(tramp, sigtramp_page, 6); +} diff --git a/linux-user/cris/target_signal.h b/linux-user/cris/target_signal.h index 495a14289681..83a515550745 100644 --- a/linux-user/cris/target_signal.h +++ b/linux-user/cris/target_signal.h @@ -22,4 +22,6 @@ typedef struct target_sigaltstack { #include "../generic/signal.h" #define TARGET_ARCH_HAS_SETUP_FRAME +#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1 + #endif /* CRIS_TARGET_SIGNAL_H */ From patchwork Mon Oct 4 07:44:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 515176 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1160907imy; Mon, 4 Oct 2021 01:21:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/scJfKoaETqmc5kaDKCCrZFsFoHf7axqXXYlabB0thkSUCv2u6V0uXQCNl5FtsT6zXX7g X-Received: by 2002:a25:5954:: with SMTP id n81mr13275545ybb.435.1633335678866; Mon, 04 Oct 2021 01:21:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633335678; cv=none; d=google.com; s=arc-20160816; b=lKzaUBmJJ3s68k1zuQdIwgQpk2am5uEahu5qDZa07O+tExFa46wtvlKQJtDZoVXENk RNDFl9vf1hu/kIIXxsiDJa0Bgz7CI2zhD9W1UogftAxuj5buASDtAhuz+EcKQm+2SZpw bekqpPSKbdEp6k0BOXlqNF27YXFo6RcZdXfe8vJuaKLpzFiowudKmZHd/MM5pqdFPeMG v+RpaK5dlQiJD2kyv/4PkurvAGV40ovZ+RMJHPiF+bRR1NIi/PamN1YLy+d4hwPpNeZh FpZ2gFLQ/EXexMQQCNHH2TwR5V94B6/BJXNWxvQ2vK0zX40hlkxk8eUIrjzJQLqXR4er 6JVA== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=AG78bHynUdYCUuR/uObyTj6XZBdXeAmCPnFQPc/ETv0=; b=jyBVa7ICYHcWjmbdWMJsSEAkvH+Opq2ieO09+t8fkseZwv71iaCPaC9XtBOVdmat5N hxYAdWs1pzWbIF81g4KeuZh/3LpotJo5pAZU45K3hTrzR+Z7AS+q98JXW2PWFzlcCzPv Kf+kK3VuRyLZS0FnQ9bbTsuR6OIbgdNekYBN6dMLzsRWY6gDwcG5Q5mJQKFBZZnag7Yh z/rFhWKv8cpGjBgq15NyGYeX+6MRMMjaEpzN7Ri1OJsEn/zNKaa3knj8g0qpkrsnGv1b suK3p1Taha+vNJBuKMgCdiAxCrSzb4G1aKjIBTVaYKnVQ0zNXpmA5uy+E9ySmjgMhnmE jY/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p13si26692066ybu.80.2021.10.04.01.21.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Oct 2021 01:21:18 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:46290 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXJDp-0007oa-Ld for patch@linaro.org; Mon, 04 Oct 2021 04:21:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44328) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIed-0004Qq-0x for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:56 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:51971) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeX-000520-Sx for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:52 -0400 Received: from quad ([82.142.3.114]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MiuGK-1n32xU10lw-00exUa; Mon, 04 Oct 2021 09:44:28 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 08/26] linux-user/hexagon: Implement setup_sigtramp Date: Mon, 4 Oct 2021 09:44:03 +0200 Message-Id: <20211004074421.3141222-9-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004074421.3141222-1-laurent@vivier.eu> References: <20211004074421.3141222-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:LoLYmLm85yRnkWD0guv+MYG5Mcs+tcLyixwGFhU7m6rwv2S8ZMN 0Ax2KYBH5XlCMsvEqFoGxka0AfraBjIJj212vX1QqC4NxC+bcDviT12QeO/1S4o5NT0BpUA /qC6LtbCDaYhFpgKnh8DkoHzx7A4jn+gr3zGGlgGZHqoeTSpgSLRk2BiiPvodJ6KchvRnzx am8bFvFuFZnNH3ial25Uw== X-UI-Out-Filterresults: notjunk:1; V03:K0:LKZZj7ZF/a8=:3fQoV7qT7bdH0SF+Pm9AzP v2qAa8+dq+fSIdm4PvKna/1d65B6cQJvf2+Tcg/UaY+u7x0aiXD7XP7LXf3wrPUGqboJSFDau 1a7sOnl9YOiWhaxz0XwYxRunyei/FVz0z3S6Rg7jdb6+n9LtAIRke8qaXsl0w6FGY+AzOAQwP aGT1PeOXENTWmRygf4dqZbr9J0Fev9MEW4TBP2Dct2T9rKc4Ospc4xcHrp6iPH5//3+6c/2TI mCbzwm4HUKPL4cJLBL1/0xXOIJKbuXQnazRGZyMuzPgdXfCoLUVGLjq++/zo2wiSdb4RCdz8K TJYwe1xMOURPrhRFcygcgwhPyiphY7X5zkz8B5N7ue7Bczw9gdS6M+ml8Cbt7D64FBniN87sz MuGEKnc1lSRPTlUjIn2vVVpcHjR3N8yjJO81bba2MeqzQFpASFvxUN2tKm764o0RpD3RUGICg L4rjwUMrsKJ2j/zuGXTfI3fLYGKVbm/VCur20d6t2p5RlCIg4pXt1dbcYE+csNDD59smsLjZY BlOiomyMEuoG767IW6fP0UdqJCCOabhBIoqpZqvzzEBt/dvWXdP4B0m8fGM9m+X3sv4Psu0J6 wt1758RrX3N+hHZaezmERXQfli2FxSnDElyNofg5pBOP0Ea81QVK7r/ltoJFQ69q2TfgRrBQS W1GE6XP72+g5yKIXEh+I+/HP4DP0F2+/TVYTnTqzW7EUGxMn0uhwgeV610iyORljRLx27AOMy cblmdt59zekE7qDqcw2LIaXHNgEIDj6DVM/UHQ== Received-SPF: none client-ip=212.227.126.130; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_NONE=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: Taylor Simpson , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Continue to initialize the words on the stack, as documented. However, use the off-stack trampoline. Reviewed-by: Taylor Simpson Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20210929130553.121567-9-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/hexagon/signal.c | 19 +++++++++++++++++-- linux-user/hexagon/target_signal.h | 2 ++ 2 files changed, 19 insertions(+), 2 deletions(-) -- 2.31.1 diff --git a/linux-user/hexagon/signal.c b/linux-user/hexagon/signal.c index c7f0bf6b9283..74e61739a0ab 100644 --- a/linux-user/hexagon/signal.c +++ b/linux-user/hexagon/signal.c @@ -162,6 +162,11 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, setup_ucontext(&frame->uc, env, set); tswap_siginfo(&frame->info, info); + /* + * The on-stack signal trampoline is no longer executed; + * however, the libgcc signal frame unwinding code checks + * for the presence of these two numeric magic values. + */ install_sigtramp(frame->tramp); env->gpr[HEX_REG_PC] = ka->_sa_handler; @@ -171,8 +176,7 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, frame_addr + offsetof(struct target_rt_sigframe, info); env->gpr[HEX_REG_R02] = frame_addr + offsetof(struct target_rt_sigframe, uc); - env->gpr[HEX_REG_LR] = - frame_addr + offsetof(struct target_rt_sigframe, tramp); + env->gpr[HEX_REG_LR] = default_rt_sigreturn; return; @@ -271,3 +275,14 @@ badframe: force_sig(TARGET_SIGSEGV); return 0; } + +void setup_sigtramp(abi_ulong sigtramp_page) +{ + uint32_t *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 4 * 2, 0); + assert(tramp != NULL); + + default_rt_sigreturn = sigtramp_page; + install_sigtramp(tramp); + + unlock_user(tramp, sigtramp_page, 4 * 2); +} diff --git a/linux-user/hexagon/target_signal.h b/linux-user/hexagon/target_signal.h index 345cf1cbb843..9e0223d32225 100644 --- a/linux-user/hexagon/target_signal.h +++ b/linux-user/hexagon/target_signal.h @@ -31,4 +31,6 @@ typedef struct target_sigaltstack { #include "../generic/signal.h" +#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1 + #endif /* TARGET_SIGNAL_H */ From patchwork Mon Oct 4 07:44:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 515170 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1156016imy; Mon, 4 Oct 2021 01:09:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzf1Sv5BUyc23wuFNzOfk+yrDVPpe5v6Acic7ZU00qJIKPYklp5RCnvIES3z+//K3hT7mwh X-Received: by 2002:a05:6638:d89:: with SMTP id l9mr10308213jaj.74.1633334997551; Mon, 04 Oct 2021 01:09:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633334997; cv=none; d=google.com; s=arc-20160816; b=Z5rgBuhFSvUJqJrgymzQtqvjX581pf/JBlRfTbFNx54LKBZ7VEtGiNPyB4AvJ2wvU0 QPGxXXcT6Lti5Iu7AxSSrwaTJnvq6/DAn2gAPG5tZp5R69IICe37V2wYcH3WoZ36XBDs nvPug4BP1SvS/jsnEqDuTeqKZ/R4tKf5aeO/KXNXJeb4HfG0lfbmVPK0dnLt87gdcI32 DjWM4uwrPEiQXWUUxUUY4ZNZU8X6x859olDRWc5rW9tt7ex2IpZQd6hjJeTtdgL+Xcgf Mjzvo/N1SWXs2WwaF66DaOjTDFjywXnoKXwij3aJ8H4uuM9SkoSDfAd3O7uq01j7edA8 obug== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=FXaofohVMnMOytazr1ttGGrrDC1hm0PgR8Ca4N68CxU=; b=ulupochht0Ga8XWjE8rcaRtriTZOQb9wmQMo5yNsLu7kyn7bMMQ0FwvfrKswIJMoY2 t0PQW/muXn5FVj2pCGVP5pvpS/67v3ThHNT2j+pch8xU8umPdjXaPjIOi69bvqa1K6et tUC17Wr3ZPxbk2eXafrokdns2A3/4dOBW498M3G/PHumX23oeWvBSgjFfbeVe6+Kw+n1 tKi8m1Ip5UwZZ+H7euHQI3IJBH0+alszm4UGbpypBUFR2eeRosN0hgN5rkQfDWW4QrPM D9a0vAy9hnpv1Ka5FMSiMDR8hs80UF5hlecg/Jhg58nRUiYI4e+9E90zqR3+Pa3lqbjy y4QQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x8si17036618jaf.127.2021.10.04.01.09.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Oct 2021 01:09:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:52268 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXJ2r-0000vk-1K for patch@linaro.org; Mon, 04 Oct 2021 04:09:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44200) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeP-0004IL-RR for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:43 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:54897) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeM-0004sB-JK for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:41 -0400 Received: from quad ([82.142.3.114]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1N6bHC-1mrXgw3HSA-0180yc; Mon, 04 Oct 2021 09:44:28 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 09/26] linux-user/hppa: Document non-use of setup_sigtramp Date: Mon, 4 Oct 2021 09:44:04 +0200 Message-Id: <20211004074421.3141222-10-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004074421.3141222-1-laurent@vivier.eu> References: <20211004074421.3141222-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:H7hPEbc0/IcgVY0a7EXKCSa4CVlDmHMyMLX+19lYPv7g9ym74Wi O0w1/Ps/0N2WBAEFYTHQ8JEMODn42EcSL8alOtI15kY70k9/i3Zp6GqbhGTBtcotI0cfyFW pKlQ7cWrS2B8T/MIXcpbSbq2f0S6e7622MFpPHqY5qpaERZ4IKZIJyVO3yPyT0abBrJTZ/N HBTmADS+01QtCZn1llATA== X-UI-Out-Filterresults: notjunk:1; V03:K0:AEUs1Usz8F8=:sLi2/Qidxzbztmn4VwzvqR Mz/nIFl9fruobZ5UBmoabsUQZJis8qZs4NXIKtdC5cDm0hWyuMaOTldK2ywhsQzTtMRS6NOfk qwsDzKw36lwL1I7xUON7IDsIxCY1UEAJT3Z7yzEHN99lv4cJ+oY0DMS6i1d9vHW/ozmAjfqN5 dHFIvqNEYphXE6yEg93gGpAt9JFSdWLnqHRlYg6gM58lrR2jojZt0cYBhUohu6w/OjVE2A9TU 6qK1IbfU6yW6yf86oJP8W4CtsNGVQfpXC4xSsJ1e7J0iktmBKTlrFvt+yToVwVyszjBWd5gcv vRHLATzGBho6vEK54253P8pRFE1ScXjpZQAoYlD7e9TIZyC0gv8ZZCjmPBhozfr96I5AC/X3M Hg0CDIqo9Kx85aidtbHACNEWWDp1BQCivceuu3ESRvzdbMPSHZNEHNbnlHszp+MoACkTU4ZFD G+IXSQzC17/GmMfagq45KhKNo9cbSrs5zCgJKdgY8JQizEKX+k6vwejsPa52kiFSzhjOBA/E4 ozsbyaBdbcCP5oCBao8zwyKn1M1iM7WxJvQ94oDRXHQaePv327WFZCHSZ2TN5VsBAc4qIwHSC 6m+vmd5ijoJ10HEhV27PAUhGHMme5vbe/ie46m/xfeqQ2cY2YnjhP5xdzVD2bxgpFpcmnVRjf Xv4WpAyPuLKHS3vk+ryGVgxCdRqh8dGsOIuGQ46A2L9dY6iUksUkCoZyqG9Om1hijtDehEH+5 huve1FMkmsf/XzwuoUJMjIX+TRYGzqVrE2LcKA== Received-SPF: none client-ip=212.227.126.134; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_NONE=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: =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson We cannot use a raw sigtramp page for hppa, but must wait for full vdso support. Reviewed-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20210929130553.121567-10-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/hppa/target_signal.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) -- 2.31.1 diff --git a/linux-user/hppa/target_signal.h b/linux-user/hppa/target_signal.h index 7f525362e91a..d558119ee7bd 100644 --- a/linux-user/hppa/target_signal.h +++ b/linux-user/hppa/target_signal.h @@ -71,4 +71,18 @@ typedef struct target_sigaltstack { /* mask for all SS_xxx flags */ #define TARGET_SS_FLAG_BITS TARGET_SS_AUTODISARM +/* + * We cannot use a bare sigtramp page for hppa-linux. + * + * Unlike other guests where we use the instructions at PC to validate + * an offset from SP, the hppa libgcc signal frame fallback unwinding uses + * the PC address itself to find the frame. This is due to the fact that + * the hppa grows the stack upward, and the frame is of unknown size. + * + * TODO: We should be able to use a VDSO to address this, by providing + * proper unwind info for the sigtramp code, at which point the fallback + * unwinder will not be used. + */ +#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 0 + #endif /* HPPA_TARGET_SIGNAL_H */ From patchwork Mon Oct 4 07:44:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 515169 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1155476imy; Mon, 4 Oct 2021 01:08:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJys+Uh37yVhc9kcy0R124sVbkd+tXeRR2CUSpRRSsWsWCO0fQUYq4UxlwK/zjXsDcKtnkp3 X-Received: by 2002:a25:c714:: with SMTP id w20mr14216937ybe.336.1633334927635; Mon, 04 Oct 2021 01:08:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633334927; cv=none; d=google.com; s=arc-20160816; b=Hsp71Kcn9D6uooCkSfnUyvBMB1ugvbjzBMCn5cqeIkbOSLzP2n1VuahCb2Km21vGKx 08zXCbXkyLQ8Jw1Rnf7F0SHiv5hc29PJ7wuKiMFeD8azrlkyarVPvuprsu+oOLPSNAEY egpACDDmt5myoR44wNJZHsHSURMoSLFU0cd05/0l86seGBdfRtbUuYznDX89+4cVnBaJ BOnnZxjNjIoBgS6crd6Ex7mVvA/MSaMkla84kRlAK2ZF5BsShggU6LVYmW7gkoFX9Hdu DzxLIxbDexBjIcFgDOctqVYlWdhdhLW8pOQb6W+eYIptbvUYeFxvhMlLztxaLTU/+ame /N8A== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=J9yUem7WXclUej0f6AXjXq2fAurFWpx6Ywd81ztIjcM=; b=A/68JMRxAV7CUh7YfWXz3a+jgXL9ABfg/iKL2cgSIhkOgxK7Agl/xjihQ6mQZyCdB/ oRrDsvTJFWJ/s5dLfp9uCHvaNlCCg7lDixXVdW5vaji5nEThJS2i4JFeOaXddYMAozyH 4dyOujM0cf/Mi2P88O5RDhRwZSRWzM+VpG95vzuLdUv1kDqaJ4TNKO0G/eIJiradIXr9 KYktc7U32ZpiMB67aV/vl823OQ+0UJLq6Pm20BdnDtDMUW1mnwMq+9DkBNVqR7sS5/qK aQ3QdYegNZ1mB18RVbcT3uETtwJrzTfdbj+AaHU6GoqfwPB51iNVGeLoLkIuVeHatmCz Jdwg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s77si16099584ybs.463.2021.10.04.01.08.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Oct 2021 01:08:47 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:49092 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXJ1i-00073J-Uw for patch@linaro.org; Mon, 04 Oct 2021 04:08:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44230) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeR-0004Jq-R0 for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:43 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:33885) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeM-0004sk-Vv for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:43 -0400 Received: from quad ([82.142.3.114]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1Mr7iw-1nBGR918Ew-00oHAM; Mon, 04 Oct 2021 09:44:29 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 10/26] linux-user/i386: Implement setup_sigtramp Date: Mon, 4 Oct 2021 09:44:05 +0200 Message-Id: <20211004074421.3141222-11-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004074421.3141222-1-laurent@vivier.eu> References: <20211004074421.3141222-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:3Hn4Y6DOOZamlkovEm0vKdk0tNNiCY9r1+xDPG3nJLDaigqX7Ff QO/v0C8VWCCVNkbIzzAyxWCsm5xCNS5Qgx6a+0orfP24gPMrVV+9m+osgn/TCM3xT8HElBR OtjX+VqbuOK5LcVfo6OQZKUsgGxoj14blTiYFHKTJoZ8CqcjU4A2OOiojuEsyEMBdkGF5iX HtRSCRyT6KX3nNBqS/aqg== X-UI-Out-Filterresults: notjunk:1; V03:K0:KEL9EdmPuG4=:KAo/KQ3jH3oCeu4yqmwnND fxFE6X2insTNGQCwgfpArycwCnCq+KYVMXC5jgmkSIDKTrXIe85bhwE0QeVgWkY9S4oLJV47P F6bemA9KEhB7GcB76mrDvFuufA2PrdbrMIbdwX1kmL6r7jjoO/5V4t1l4mOLQw6Y0pXpAncsv SQp6rmVDKJal3tYEhjP0QBmjsDCtCevvabei/UR9t7TqVJ4ghd7ESCceO80BdyupCa2Dm/gvz 8/oHU4iQgIv6RxFm8wGSr7/3jOG+mE5DmZT7WMGprvefalMOzZv4Wn/Kxc0CkvVoSAV53cj/w k6Qdv6DRlD5d0VHADKYKIITq24KnQZNc4Vbt6yFHVvKgWhZG/VtlDYbzg/ZIveNWwpPWFmYSG N4S2xTzortYwYhPHLcAQq2wHDggQGEM5CIzgs0oVypw5wfpSJbIjFNqcw8DF0r0BNWja7HHr/ h/OS0F/4OwI12vwKtXKKavc+y91BFWBrA79Y6AOAIoBFQgvEDB1V8nJEZqftoGTEYXoUiccP0 I0PL0w9xuzfZS93ZmXR/59ggVWINofaZD1ArsxvQknyijyBKyF5rIxkLJDa9wLIBtR6llzqqe wPfuPWgPqDPqu5vaH+ObVzemojRyBKDQFrzMOu3YUaat9e70yT29xP1N2ulumqfIr+EvLG7Xe SnB9Y5hTuoFVvd4iuSA/TDYKN/iia2cbKlJLlsX/2N1EZBBnetPmq9fG70c3YnAIk1/CDpj30 GeG3wR0yx1bCaEfCMkzTqtaOmGCML7XDJdgxHA== Received-SPF: none client-ip=212.227.126.131; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=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: Richard Henderson , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Create and record the two signal trampolines. Use them when the guest does not use SA_RESTORER. Note that x86_64 does not use this code. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20210929130553.121567-11-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/i386/signal.c | 56 +++++++++++++++++++++---------- linux-user/i386/target_signal.h | 2 ++ linux-user/x86_64/target_signal.h | 3 ++ 3 files changed, 43 insertions(+), 18 deletions(-) -- 2.31.1 diff --git a/linux-user/i386/signal.c b/linux-user/i386/signal.c index 3b4b55fc0a24..b38b5f108eaf 100644 --- a/linux-user/i386/signal.c +++ b/linux-user/i386/signal.c @@ -310,6 +310,22 @@ get_sigframe(struct target_sigaction *ka, CPUX86State *env, size_t frame_size) } #ifndef TARGET_X86_64 +static void install_sigtramp(void *tramp) +{ + /* This is popl %eax ; movl $syscall,%eax ; int $0x80 */ + __put_user(0xb858, (uint16_t *)(tramp + 0)); + __put_user(TARGET_NR_sigreturn, (int32_t *)(tramp + 2)); + __put_user(0x80cd, (uint16_t *)(tramp + 6)); +} + +static void install_rt_sigtramp(void *tramp) +{ + /* This is movl $syscall,%eax ; int $0x80 */ + __put_user(0xb8, (uint8_t *)(tramp + 0)); + __put_user(TARGET_NR_rt_sigreturn, (int32_t *)(tramp + 1)); + __put_user(0x80cd, (uint16_t *)(tramp + 5)); +} + /* compare linux/arch/i386/kernel/signal.c:setup_frame() */ void setup_frame(int sig, struct target_sigaction *ka, target_sigset_t *set, CPUX86State *env) @@ -338,16 +354,9 @@ void setup_frame(int sig, struct target_sigaction *ka, if (ka->sa_flags & TARGET_SA_RESTORER) { __put_user(ka->sa_restorer, &frame->pretcode); } else { - uint16_t val16; - abi_ulong retcode_addr; - retcode_addr = frame_addr + offsetof(struct sigframe, retcode); - __put_user(retcode_addr, &frame->pretcode); - /* This is popl %eax ; movl $,%eax ; int $0x80 */ - val16 = 0xb858; - __put_user(val16, (uint16_t *)(frame->retcode+0)); - __put_user(TARGET_NR_sigreturn, (int *)(frame->retcode+2)); - val16 = 0x80cd; - __put_user(val16, (uint16_t *)(frame->retcode+6)); + /* This is no longer used, but is retained for ABI compatibility. */ + install_sigtramp(frame->retcode); + __put_user(default_sigreturn, &frame->pretcode); } /* Set up registers for signal handler */ @@ -416,14 +425,9 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, if (ka->sa_flags & TARGET_SA_RESTORER) { __put_user(ka->sa_restorer, &frame->pretcode); } else { - uint16_t val16; - addr = frame_addr + offsetof(struct rt_sigframe, retcode); - __put_user(addr, &frame->pretcode); - /* This is movl $,%eax ; int $0x80 */ - __put_user(0xb8, (char *)(frame->retcode+0)); - __put_user(TARGET_NR_rt_sigreturn, (int *)(frame->retcode+1)); - val16 = 0x80cd; - __put_user(val16, (uint16_t *)(frame->retcode+5)); + /* This is no longer used, but is retained for ABI compatibility. */ + install_rt_sigtramp(frame->retcode); + __put_user(default_rt_sigreturn, &frame->pretcode); } #else /* XXX: Would be slightly better to return -EFAULT here if test fails @@ -592,3 +596,19 @@ badframe: force_sig(TARGET_SIGSEGV); return -TARGET_QEMU_ESIGRETURN; } + +#ifndef TARGET_X86_64 +void setup_sigtramp(abi_ulong sigtramp_page) +{ + uint16_t *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 2 * 8, 0); + assert(tramp != NULL); + + default_sigreturn = sigtramp_page; + install_sigtramp(tramp); + + default_rt_sigreturn = sigtramp_page + 8; + install_rt_sigtramp(tramp + 8); + + unlock_user(tramp, sigtramp_page, 2 * 8); +} +#endif diff --git a/linux-user/i386/target_signal.h b/linux-user/i386/target_signal.h index 50361af8746e..64d09f2e75bd 100644 --- a/linux-user/i386/target_signal.h +++ b/linux-user/i386/target_signal.h @@ -22,4 +22,6 @@ typedef struct target_sigaltstack { #include "../generic/signal.h" #define TARGET_ARCH_HAS_SETUP_FRAME +#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1 + #endif /* I386_TARGET_SIGNAL_H */ diff --git a/linux-user/x86_64/target_signal.h b/linux-user/x86_64/target_signal.h index 4ea74f20dd42..4673c5a88691 100644 --- a/linux-user/x86_64/target_signal.h +++ b/linux-user/x86_64/target_signal.h @@ -21,4 +21,7 @@ typedef struct target_sigaltstack { #include "../generic/signal.h" +/* For x86_64, use of SA_RESTORER is mandatory. */ +#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 0 + #endif /* X86_64_TARGET_SIGNAL_H */ From patchwork Mon Oct 4 07:44:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 515160 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1149785imy; Mon, 4 Oct 2021 00:55:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysf3QpRnHXdMRsgYR5T63mCtawKESdB0wSLxeH8jUeIry7oHbkv00kAYlq7tEnJf15kv+/ X-Received: by 2002:a5b:ac3:: with SMTP id a3mr13454469ybr.197.1633334116674; Mon, 04 Oct 2021 00:55:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633334116; cv=none; d=google.com; s=arc-20160816; b=gslEWF/V30TdQZ4K9+J5Z9KmxjcXyr6exO0jaiI/vchjT31H6BYTrSWBHibXd+WvZn GGmYfhFe2zmiZLXJUxrwLH1k4qOZSS7WrZYDV1R+LzuJwNcPEhGnj9XC0SgMzx/wUEVU 21i1cmSKiadOIvDSgRpH1BvVi3hrTrWyJaisho/tlmIdWFOA0gQggIC8duOUnbFYq/AP NqOiWTv+hXsS7XnJF/boFgfjTMlph1Kxt9e3t49aVPVY3XJolE4Tbnm9Z/8zTZPYo0OC /ifgN6FFc7EuEeluPWhhCUW2laxTYEb6yg3kAmhIsxXVmwIBhjrRLge45yJ+/2XLVdA4 z/6Q== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=4QJro5+SRwkreru9Oh/Ljx7V3EBstymDzPJ2JtY4QkI=; b=GXHsY8Vat/zYZ2DxFEmKxkvKMJ5l+aG74RbhJhwgEGoIt4qQ8WEtYyUaK73MbZJhXB 2qdtAeWFhQzee+KxMPXldbME3BnFrOK/oOo2T43nCxISOmR+EgebuEhOwlq4ebeajQy8 Eo+Kw6ocKR5Q7LbbdsoF2nSGU0wYLsniD/8Vm5ctBbEAO1H1btH2tXZjcdkao/vASngw mbEn2YgnaJXDnJk3D7ddWo93PO3X1Fr0t4HZ99GtPLJCuvhlDpZx4YD366r5ehithB72 7w/mk5RhYaPsX1pS+hROSckvPgf29aGUwFOhSr/xjrOZkyNfeJtooK3Bbis9j00ngSEi OKaA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j1si17878416ybp.150.2021.10.04.00.55.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Oct 2021 00:55:16 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:54514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXIoe-0007JQ-30 for patch@linaro.org; Mon, 04 Oct 2021 03:55:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44020) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeJ-000422-H2 for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:35 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:34195) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeG-0004lt-01 for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:33 -0400 Received: from quad ([82.142.3.114]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1N3omW-1mxauL3WlM-00zjVI; Mon, 04 Oct 2021 09:44:29 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 11/26] linux-user/x86_64: Raise SIGSEGV if SA_RESTORER not set Date: Mon, 4 Oct 2021 09:44:06 +0200 Message-Id: <20211004074421.3141222-12-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004074421.3141222-1-laurent@vivier.eu> References: <20211004074421.3141222-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:+mQEQfC0509EGqg/4LAdEazqc+ZehDxXmp1nPzsudUqmL4bkkOB pqjUi7IBvfyNi3OjHcIzMMqAIM4qVtQwvRVKRLh/ZrY7XWeK5J+2tMyxNJkRjQd8R0aM9i4 wXU3jeHreFia/t59MFS4Ml14S4bU0I1CjJs1TzX20cbuOzLytMRkYmNtb0VgSgL9U42REZv CppibBYnTaUzdZCuB6vhQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:r2e8AkzkGss=:1W7KQWCGhFyeaMZ1eGzZUu wpvxRcqq+K1m04Ki1UGnZuBZzbTFjlSF5WcmUon/VEiIZVaEfjKn3WftjO6EalQTWmceRn+KW Ko8lz9krYpuMPgsoqHIQsklbgLkh757lHlEr/0DFsWaaNnxeY2QXVpM79uZIijkfxPVAH6inT rc/39qdeRIbYEz7OAxB9KkAUg1gQksbvOk8eNq72dH9zQVXBl6WnkPoJqSXVYh6KWVhGnGiyE 8SG1JFpasGJ0lBzF68teJTSD/8fuQidXpUjvWftXjlnRdTCT/0xIyHHzjB3x/VCzfZXreRdmd PFkR6TTCncUzMVf9paSRU+Ng43R8Mm0zS3V8aV4tTBtsjVYj41PJE4Lt0E5hW/vWbl+CJXHj3 2ElVg8sVXIdH0KXUKlW1zrDp3aTRGH8qvVhIlndmm0oZZIcvO0459mfKhNyRcVi8e74Zi1iCt qs9RpOx9xWs/vEuErhkGnaz80WePPYoefLouujOKohOOyUZHZRI1ogBUpTB+d5+WILTI+sCF4 r8dk0ihoGpJDlNNxXrR8LqcQNzRoWAze6tXe+h7EKNBnyj0DFh/q4UVp5jV76osQnYzlORHRN XssW82T52jUbr1LpvdnO81DsWGFTKe/0Zc40sep7zxxTBNNMujc21WQ7CY1N8diGHvyxy8Cnq 7KVVxqDdMw5GioN8oal0jXuXqCri/29fOwocZbQb5Cm2nPd9C1uK89iAjyvXm0Xy6i9wYaBJn GRIJEn0FnRr+HDXy8YbW3+p2Oj86+OwVBXvGuA== Received-SPF: none client-ip=212.227.126.131; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=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: Peter Maydell , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson This has been a fixme for some time. The effect of returning -EFAULT from the kernel code is to raise SIGSEGV. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-Id: <20210929130553.121567-12-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/i386/signal.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) -- 2.31.1 diff --git a/linux-user/i386/signal.c b/linux-user/i386/signal.c index b38b5f108eaf..433efa3d693b 100644 --- a/linux-user/i386/signal.c +++ b/linux-user/i386/signal.c @@ -421,19 +421,18 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, /* Set up to return from userspace. If provided, use a stub already in userspace. */ -#ifndef TARGET_X86_64 if (ka->sa_flags & TARGET_SA_RESTORER) { __put_user(ka->sa_restorer, &frame->pretcode); } else { +#ifdef TARGET_X86_64 + /* For x86_64, SA_RESTORER is required ABI. */ + goto give_sigsegv; +#else /* This is no longer used, but is retained for ABI compatibility. */ install_rt_sigtramp(frame->retcode); __put_user(default_rt_sigreturn, &frame->pretcode); - } -#else - /* XXX: Would be slightly better to return -EFAULT here if test fails - assert(ka->sa_flags & TARGET_SA_RESTORER); */ - __put_user(ka->sa_restorer, &frame->pretcode); #endif + } /* Set up registers for signal handler */ env->regs[R_ESP] = frame_addr; From patchwork Mon Oct 4 07:44:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 515174 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1158234imy; Mon, 4 Oct 2021 01:14:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycxU1IZu+b11i35DR4szOkB0enu5oYZ9qKdVTd5dz5KA3/yXxvNqi8MHX0T81ZZ94jwgT/ X-Received: by 2002:a05:6638:d89:: with SMTP id l9mr9953350jaj.46.1633335289393; Mon, 04 Oct 2021 01:14:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633335289; cv=none; d=google.com; s=arc-20160816; b=iBm9t6PNfqdUXB3oBcyR9YVycqhS9X5rZ9z2d/eiNczQKPB8bEXLWpvXgcuUTpounE kY68EgjPZqiLlcCRP1krAJXVF6gAPW6M8k+6Q1f+NRVq8lS0kB7MFfS7/Dl2cIhzweMF RVZ+xW0SdbRSqjD4e2+boyVNsb9BfT2I+aAwsaIfYTl6BtWzFvXl/Fwgwg4i3YH/ELIw bTwpBDXflolvL0QCPwsZ9b1Bl9m+isomk+NTdYYLSU0oxtFgZwzAaMxWF/Ie52itOf6E /frx0DKHE5ZefzwEcCoDmtAu1nKgEi+8FAG1yrBbt1Q8nBX6CmLchDKQSZ0pJSjjhf4t 3XYQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=P9OoR8zKGir6vbAy+50FgFcG4TX8uHiAqLsD+YJsT0Y=; b=YSklSXiYVCTZker8c37RMAAg3cS1ofeJWJjSxQTeccFwjSNILbf5sac595QkuY8Axs YiaK/Sz4XVAWwNxLDn8CerlQSmOrnSTkBgL/QwoYFL4BYooq/Gq86MJT7nj4r37MpYxe Q0jDIdsudgHDYxbgIKEsIYa/GZezet56uqOiuw4NFRI7hV9YFXYvJyFARj+jTZmkEs8u dgoMtRBkJUTkgO+asKqoYRo1IJ7EXWZwzxch377tNN/x+HNNJ1RCKPTiFyK+92fHk5TT ITFgMjx6wBzRcGbey4UwEivaHd8yt85lQfG/ISwDmBUkNgNursLzjwS1RYU2t5n4F7nD chOA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i19si1984310ila.84.2021.10.04.01.14.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Oct 2021 01:14:49 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:37986 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXJ7Y-00020W-RH for patch@linaro.org; Mon, 04 Oct 2021 04:14:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44294) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeZ-0004Pt-BE for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:52 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:34427) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeK-0004p4-Jc for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:49 -0400 Received: from quad ([82.142.3.114]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1Mi4un-1n2Dc71PXt-00e893; Mon, 04 Oct 2021 09:44:30 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 12/26] linux-user/m68k: Implement setup_sigtramp Date: Mon, 4 Oct 2021 09:44:07 +0200 Message-Id: <20211004074421.3141222-13-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004074421.3141222-1-laurent@vivier.eu> References: <20211004074421.3141222-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:1DgHCBPdYMlNL/Lp4AhHSyXZbDc7LU/FnUP6wCSRdv05/tMNsTB 2bLZBoAY86xD344ehaov7bOYrdzkD+JroQn9aPdzXx7vJU+KfIYuLfVrujBu1bTF/Srv8p5 Ijpw0CaNtFsn5ADEUp32rSE92WNLv37oi1xi8TkgjdaQHTB5GoY6r4MpEaWJKygNbg7x77k g4brSshE2CMWrAAwzt3yw== X-UI-Out-Filterresults: notjunk:1; V03:K0:DlnajSSkPlI=:UDu4WeGaNL1/Nxp26rFBx1 1RFzH35h18kqAhIoWeZIbMzonW7fFjNdlOhSCKMwSi0DPmMfb5dCb855lwxzXQwPXnQg7sQWY aprPUPSLvIOIUKFjXjH4Fz9zz1W2zBqJfIUHkPqtDsYS0F3bYrGV+rdsWDGqeEdKfojC9a6S2 AXkG613+fQavwFd/z+hx06hYesy77fjeZi1Xs6Tg6we2KrIBsqUKYg73yVSBvhyPPaTY/wTbB yDofgwD6KRSJXHVyRVXLf2jbVUHEyiJP2JsHR+eTgzNdTNJUEneih5X6lshlgzQXUlX33FBF/ IQygHvb882I9CHoNV0w6QsuBX7zZtomjuy3GZnFKvLa8BkjyYQV8zsKstGMMtS4Qbf/+LgWW8 EGuvBGVZS/oBB1uXiyr4v94dM+kL/0ZHSH17NoPGDFCxxMX+liMzo1O7Uwzfo9TAM75Vmtzvb 8KZpCfqtBy2dMNQQn+u4Dl8oH8NVHAwGNhhWnzMCyBiBkP8ng3cC9xQPX4OZfGXiJGe2OyOji g7G6paqNg21coVY8Oq1zMReAD/+yzowTBPP35CfrfHg2eQmmz8ZhiVdzZEgoE3UlFMQv2humU j9LcPor9Dr4WuT3QmAlB3oUB5DdIcmw8UKVuc0oAc9+Sh2AXsMfZfVu3wbXT38ah8292mhnxP ymph7U4b3KJhaDOjlPgVTGS6U3+TBgbcmepYgMnC3jtSsswt0LApY8AnqkW0NAYFWQDpmY9OF dPO7WeQZaI5W1rh8mI2mhodz2jQU1T6k0IrRvg== Received-SPF: none client-ip=212.227.126.187; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_NONE=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: Richard Henderson , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Create and record the two signal trampolines. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20210929130553.121567-13-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/m68k/signal.c | 47 +++++++++++++++------------------ linux-user/m68k/target_signal.h | 2 ++ 2 files changed, 24 insertions(+), 25 deletions(-) -- 2.31.1 diff --git a/linux-user/m68k/signal.c b/linux-user/m68k/signal.c index 4f8eb6f727e4..ec33482e1403 100644 --- a/linux-user/m68k/signal.c +++ b/linux-user/m68k/signal.c @@ -39,7 +39,6 @@ struct target_sigframe int sig; int code; abi_ulong psc; - char retcode[8]; abi_ulong extramask[TARGET_NSIG_WORDS-1]; struct target_sigcontext sc; }; @@ -76,7 +75,6 @@ struct target_rt_sigframe int sig; abi_ulong pinfo; abi_ulong puc; - char retcode[8]; struct target_siginfo info; struct target_ucontext uc; }; @@ -130,7 +128,6 @@ void setup_frame(int sig, struct target_sigaction *ka, { struct target_sigframe *frame; abi_ulong frame_addr; - abi_ulong retcode_addr; abi_ulong sc_addr; int i; @@ -152,16 +149,7 @@ void setup_frame(int sig, struct target_sigaction *ka, } /* Set up to return from userspace. */ - - retcode_addr = frame_addr + offsetof(struct target_sigframe, retcode); - __put_user(retcode_addr, &frame->pretcode); - - /* moveq #,d0; trap #0 */ - - __put_user(0x70004e40 + (TARGET_NR_sigreturn << 16), - (uint32_t *)(frame->retcode)); - - /* Set up to return from userspace */ + __put_user(default_sigreturn, &frame->pretcode); env->aregs[7] = frame_addr; env->pc = ka->_sa_handler; @@ -288,7 +276,6 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, { struct target_rt_sigframe *frame; abi_ulong frame_addr; - abi_ulong retcode_addr; abi_ulong info_addr; abi_ulong uc_addr; int err = 0; @@ -325,17 +312,7 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, } /* Set up to return from userspace. */ - - retcode_addr = frame_addr + offsetof(struct target_sigframe, retcode); - __put_user(retcode_addr, &frame->pretcode); - - /* moveq #,d0; notb d0; trap #0 */ - - __put_user(0x70004600 + ((TARGET_NR_rt_sigreturn ^ 0xff) << 16), - (uint32_t *)(frame->retcode + 0)); - __put_user(0x4e40, (uint16_t *)(frame->retcode + 4)); - - /* Set up to return from userspace */ + __put_user(default_rt_sigreturn, &frame->pretcode); env->aregs[7] = frame_addr; env->pc = ka->_sa_handler; @@ -411,3 +388,23 @@ badframe: force_sig(TARGET_SIGSEGV); return -TARGET_QEMU_ESIGRETURN; } + +void setup_sigtramp(abi_ulong sigtramp_page) +{ + void *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 4 + 6, 0); + assert(tramp != NULL); + + default_sigreturn = sigtramp_page; + + /* moveq #,d0; trap #0 */ + __put_user(0x70004e40 + (TARGET_NR_sigreturn << 16), (uint32_t *)tramp); + + default_rt_sigreturn = sigtramp_page + 4; + + /* moveq #,d0; notb d0; trap #0 */ + __put_user(0x70004600 + ((TARGET_NR_rt_sigreturn ^ 0xff) << 16), + (uint32_t *)(tramp + 4)); + __put_user(0x4e40, (uint16_t *)(tramp + 8)); + + unlock_user(tramp, sigtramp_page, 4 + 6); +} diff --git a/linux-user/m68k/target_signal.h b/linux-user/m68k/target_signal.h index d096544ef842..94157bf1f48d 100644 --- a/linux-user/m68k/target_signal.h +++ b/linux-user/m68k/target_signal.h @@ -22,4 +22,6 @@ typedef struct target_sigaltstack { #include "../generic/signal.h" #define TARGET_ARCH_HAS_SETUP_FRAME +#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1 + #endif /* M68K_TARGET_SIGNAL_H */ From patchwork Mon Oct 4 07:44:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 515173 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1157639imy; Mon, 4 Oct 2021 01:13:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWez81KTfLxk/Z8Rcgipdd+e3JneQERq7xXFJGLXP/sIDgjJTwXyQ02w2ohOyYVHTTs2cg X-Received: by 2002:a92:ce85:: with SMTP id r5mr8511473ilo.159.1633335205340; Mon, 04 Oct 2021 01:13:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633335205; cv=none; d=google.com; s=arc-20160816; b=k0NLoPiU/wiKe8ZLgX+leFl+Znug/GQlH6zrGLf4/IMjP8WtYCxWEUNpfvRjNjQwfX 6+OK/MhFZrTAQHyFGB9k7GdvlRXvYw4Dw3ba7VqaTEyoIpZb3nxzsPj13wp6pZhAbMwj iN5h4tFZl1DeLNEizPqRSirpO5uxYll0UnPFJ9GpQpIlFLtYATGrqFS3kNS50NIwH/IU F90sOhW+tRpvNq8XuQN0DZLjHFxPi1YEoCuA/BC8A9cRhlwlBM13jDeNWqz4NMX63EqN oWUtFm9YJyThxfCV+arHVkAszNCjsMe/uPFbqYaGMuY5eJNzzblpm+wpe2KdRULrfeJ8 a38A== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=9sTmdpRrxGHDtK1pWakExt9vhwoIzfL2Ps7v9k1tV3Q=; b=jkkj3WRomvMWIq3N7kwnyl9YgxoJ7VMcnqyLOTXAJtVjcRxgi4/85FINa8PUi9lNKg K5oW/a0z4LhjDaUIj1AjWOAV9/Dux2tv919bFMJYKBJ3PT7fV44pb1UGLzBN7qNMYfvn 7ZkKVP6jaNYywvoMdiGstoEhFRokoAm/eiZC18aQVZO03oHqIrBacOUhYzC4veCPIj+6 UmAXervVCA78wi2pRmI6iCHeNxgVh5RGiLiGRk3wJKTWOPlTh2GtxigU4BQdRYmZu4W+ wcFGJ0iOC58dwZPtRhnndAJaCLw1OJM0POM1Uztuj4HJs9Ff9vz1y8VSYgAY8dE+KREK 42aA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s10si13905636ilh.107.2021.10.04.01.13.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Oct 2021 01:13:25 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:60560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXJ6C-0006dA-Qr for patch@linaro.org; Mon, 04 Oct 2021 04:13:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44252) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeT-0004LI-Pk for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:45 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:43651) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeO-0004ud-RG for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:44 -0400 Received: from quad ([82.142.3.114]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MaHOX-1mLUvj3iBp-00WCBR; Mon, 04 Oct 2021 09:44:31 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 13/26] linux-user/microblaze: Implement setup_sigtramp Date: Mon, 4 Oct 2021 09:44:08 +0200 Message-Id: <20211004074421.3141222-14-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004074421.3141222-1-laurent@vivier.eu> References: <20211004074421.3141222-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:4l7eGtcRveYhX4odyEQivFKvdbJIzUWFifdlAqmvuB2neBA0v/d GVU4W/P9LZ29soWEb2EFWa1QwQXqSD9ITVIOUs1b8oQ/hY54BGTcOLqxwf838k0h7gxRaun tNF5kWbi1qzvgJ9GdngQxSLayJY5s56LqOmvR9l4TJtMOKgZ/RnXUsNWrAMrwr2DMzwO372 jRvSMb6CDWdJda9QdffWg== X-UI-Out-Filterresults: notjunk:1; V03:K0:IpcpzYlwy5Y=:6F48JdVxwBB7HPWNs5D4Ki yfcPQH6pukA7IxPTE2ZMYIiOXMDyy+EMkUWgtOlik6bGfbOJdTw2oErCY9qsMRVR1WJ3r8odd fG1+GBF82xkJmYYfaXRBELHIAJy/FX3M6VhF96XRWyVOjnYzoZMRikckmmqbJX1N4OSmjQCEu BQEsnowl1SMU7/MfiWeEOkaUGSOFxincBRFD48zjqvpOA5OFNNCoc71bGbWF3YX3y7ir/UYi3 cZjfOiH/HZ8yGEH/bFdGByYUP4v6h8ZYANZoOkEZ9t6RZiS7gPdcuPW9kuuZut7PLL0Oiodnz Df02qi4NcE8gprF5CPUV2693R4zy+mttBtN6RzPnDXsZokGSV2YIlIxblsLXHTA5weZIE2bbW sC4befQc4WgtA8l695RskwB5uewzlrxLNHSttMp/U2Lzm48kihdfup0ogEeAaMqd7wTSFtfNQ 6OJ6lGwp7PPyqpyalhNd2aJKUUNF9jP9DRePg4dsU5oXl6d2ufJ8buMYXSrT0aLezfkL+fcL/ 7TC3WGGBRaVoli/ieUSdTAbdAgR5C1SxP8ISp2pa4FT5a/Iq3nQ/vsWuXhakFrxo4+GPbMwmP 73EzAnMJqOuB6qCZNqZ/Jx8c0mSjt92Ce1qnFiT37r+9/y1qN2TubOhRculsyYe6ElOERX3fh Fhc3MzbwT/lvIoqLfGDiXyVAAelPKZ1BejR5TwC3cLw+mdEWDXUSijdYS5+IwbMzf/yFckoG7 iEQYsQF24NpHSN7NuiCD9SORZ9dw+meXX80a9A== Received-SPF: none client-ip=212.227.126.131; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=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: "Edgar E . Iglesias" , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Create and record the rt signal trampoline. Cc: Edgar E. Iglesias Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20210929130553.121567-14-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/microblaze/signal.c | 24 +++++++++++++++++------- linux-user/microblaze/target_signal.h | 2 ++ 2 files changed, 19 insertions(+), 7 deletions(-) -- 2.31.1 diff --git a/linux-user/microblaze/signal.c b/linux-user/microblaze/signal.c index b822679d1805..8ebb6a1b7dfe 100644 --- a/linux-user/microblaze/signal.c +++ b/linux-user/microblaze/signal.c @@ -161,17 +161,11 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, /* Kernel does not use SA_RESTORER. */ - /* addi r12, r0, __NR_sigreturn */ - __put_user(0x31800000U | TARGET_NR_rt_sigreturn, frame->tramp + 0); - /* brki r14, 0x8 */ - __put_user(0xb9cc0008U, frame->tramp + 1); - /* * Return from sighandler will jump to the tramp. * Negative 8 offset because return is rtsd r15, 8 */ - env->regs[15] = - frame_addr + offsetof(struct target_rt_sigframe, tramp) - 8; + env->regs[15] = default_rt_sigreturn - 8; /* Set up registers for signal handler */ env->regs[1] = frame_addr; @@ -220,3 +214,19 @@ long do_rt_sigreturn(CPUMBState *env) force_sig(TARGET_SIGSEGV); return -TARGET_QEMU_ESIGRETURN; } + +void setup_sigtramp(abi_ulong sigtramp_page) +{ + uint32_t *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 8, 0); + assert(tramp != NULL); + + /* + * addi r12, r0, __NR_rt_sigreturn + * brki r14, 0x8 + */ + __put_user(0x31800000U | TARGET_NR_rt_sigreturn, tramp); + __put_user(0xb9cc0008U, tramp + 1); + + default_rt_sigreturn = sigtramp_page; + unlock_user(tramp, sigtramp_page, 8); +} diff --git a/linux-user/microblaze/target_signal.h b/linux-user/microblaze/target_signal.h index 1c326296de42..e8b510f6b182 100644 --- a/linux-user/microblaze/target_signal.h +++ b/linux-user/microblaze/target_signal.h @@ -21,4 +21,6 @@ typedef struct target_sigaltstack { #include "../generic/signal.h" +#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1 + #endif /* MICROBLAZE_TARGET_SIGNAL_H */ From patchwork Mon Oct 4 07:44:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 515161 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1150170imy; Mon, 4 Oct 2021 00:56:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwaYtHUwqo2Zre6cGEsvsiTvZrC9VD21SjdVEDCiyq1s8xhpOzihoP4QZnXW3Ye9vYnzZUI X-Received: by 2002:a05:6638:25cd:: with SMTP id u13mr10040970jat.114.1633334186156; Mon, 04 Oct 2021 00:56:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633334186; cv=none; d=google.com; s=arc-20160816; b=onJPWcVh8ptw8kkH4pcPLDNmCFbia+phNu+OJiq/ELssv+itB4fy4PtLfXBBnevvZj PNGYPAqkEmHKA95UA72iudvhR/QXzEyIICPLxcpxUMop7QAP1ZE259JRPzGkagdLEH3n JD1oytjqpGHE4aR1yDPs6hx3PMRRIk9x8hJm9vYDu7MUliYBzwgODsbxZvYdnTBSFLsX uI5IVsECfap3xOjXo/vvZCTkY3sDBivrMOpHNz0O+uU7wbsQDcYuMChLvJJAaGrZcZFA GHtxMJCicSucmBVqEqMBlcJK0o54n8td8OefKlpdOtYvK4HVbc1m/fMXDRw1k75ziXrp RQjw== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=pqIFRiVxSdE1eT19fdAt9PdYtKGD49EtXWdFuwqfchs=; b=m7B3MEqt+Csc0o5DMNT8Tlbmxweh3y53pHEx4Wsw8GG5S4c8VzAqGhBzJTdliVc9gk 9jeuvab95Kp9rmrin5W5zKjvW5xhRT0KNhAufVTw3Lz6n6VawLO5uhw/mrKRqNl3c4c1 1vio8LMhvMTTZtXuET64EEAkHWptFB5eH27M7c5fRKeoRezfC8tYXiNMfGjQs+KGowMC f7tsHBa23lKHntW6aLY+hubc2KJSsm9WV+xvXwt7UJjC/xmRZ35RFRD2UG19Zq8KQSSM E86kuizRa9E/I1fuNhxmosO7Ppl5+HKLMluGOcDdenrCzTw5ZnvrRZ5Jor1osgiu7Z2D +sxQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m16si23657069jat.53.2021.10.04.00.56.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Oct 2021 00:56:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:55510 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXIpl-000803-Kn for patch@linaro.org; Mon, 04 Oct 2021 03:56:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44130) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeN-0004Bj-JC for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:39 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:36207) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeJ-0004om-A6 for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:39 -0400 Received: from quad ([82.142.3.114]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MjPYI-1nCNy11fw2-00kxmE; Mon, 04 Oct 2021 09:44:31 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 14/26] linux-user/mips: Tidy install_sigtramp Date: Mon, 4 Oct 2021 09:44:09 +0200 Message-Id: <20211004074421.3141222-15-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004074421.3141222-1-laurent@vivier.eu> References: <20211004074421.3141222-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:MF1ClMZWLH7snp9g0k31JJ4nz9sKCHsId4zVvy56P3u910pMbcJ sbH1OBPzVpKMblsZgP8WUVjuogAksbzQfSflwr1YTKtSxHlxwNBGNqdWqGu7nsWIURRjJtL UBmCcIlUm/dphBZRRU+0EeiaXCtw8H7sHTSoS5N9qtfss6XfDf6Dp5cSPRD9W9A/ZADQNdy QfjHfvOfhxKSy97Rii5Zg== X-UI-Out-Filterresults: notjunk:1; V03:K0:sKq/+TSn7VA=:ldsHfOsU17GXWA4gBbTvLG nfDqB73jA/PIFwxKSl0Vwy4nVqIope+m+RoQOe/9WtJegYrurNbVcpm7ix+tWHv3cVih6+3tq UnCEMcra36o78VeQ3+FYf0X7Ay6OFWbK+0ERqM4bDP7qhBbLZSNJV5uYDYLPg5jYBDeq4dfsL 63HIqmOlLUVhyDuWiqwaBd68QYfWctZzh0D3rDOLjNCCKH8KSjjEQKOImK9AJ3g41oMZUgXpW zM160BIW4yz/rXJinxH8Mfs2wZxlduGJ2JqciQ0HxqyJy6ttNB8k5T43gZhbxSreD03mOmDMJ 94gmr8pnGJJCA/j+CUH2CMa0ULDJwr44U8COx6plimSLU3iRLfgaysooNn8GHtkm0GWXdXhDj BCLUOcl5lRQe8Tog/DpTwXcM8XshvVnDXQlq3NVn+H2/Ou4iGFhKV6l6B4pxjmRc2XS941k89 sXWzU9Ch8aqKf1vbfeLXespGCWvdlB+cn/ipdn28HhNO02iyhSt5qZhrgYrq25pdn5qvKFRul JBFgQRiGnAtuYog1Hx1OkGFKOjAsT6Cg7/eSKeZz8IJ9FTaf9nvAHtyacjw0cnF2PHaFSbwZW bY9aIE7LUJOO9k0fJv2/UyaEhaB2eV43Ia071q7VSvjcVhdBoyfNlBe4Ylq6lHy7GqMA4IE83 hK/j0PAsj8nuPn9iHCb8GPlHJylVDQyixUrYFKJZIdk9Z91501FBZ2bjSb2xqbjSVudCgHcSC beYQr/jLJvl70NlZ7OE2g7YabthWFvPBWAm34Q== Received-SPF: none client-ip=212.227.126.134; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_NONE=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: Richard Henderson , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson The return value is constant 0, and unused as well -- change to void. Drop inline marker. Change tramp type to uint32_t* for clarity. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20210929130553.121567-15-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/mips/signal.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) -- 2.31.1 diff --git a/linux-user/mips/signal.c b/linux-user/mips/signal.c index d174b3453cc0..64072779b94a 100644 --- a/linux-user/mips/signal.c +++ b/linux-user/mips/signal.c @@ -87,10 +87,8 @@ struct target_rt_sigframe { }; /* Install trampoline to jump back from signal handler */ -static inline int install_sigtramp(unsigned int *tramp, unsigned int syscall) +static void install_sigtramp(uint32_t *tramp, unsigned int syscall) { - int err = 0; - /* * Set up the return code ... * @@ -100,7 +98,6 @@ static inline int install_sigtramp(unsigned int *tramp, unsigned int syscall) __put_user(0x24020000 + syscall, tramp + 0); __put_user(0x0000000c , tramp + 1); - return err; } static inline void setup_sigcontext(CPUMIPSState *regs, From patchwork Mon Oct 4 07:44:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 515167 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1153028imy; Mon, 4 Oct 2021 01:03:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFZqPldvkgpte8FtFsIfceg+Mm1EAlbiQhp2QibkNZ1eirGpQC36eNTLmHsd1RGasBZCtZ X-Received: by 2002:ac8:411d:: with SMTP id q29mr11967281qtl.349.1633334609928; Mon, 04 Oct 2021 01:03:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633334609; cv=none; d=google.com; s=arc-20160816; b=vyhHtcBd2eq977fBb4wBmkvkmmcHE4yseZL03z965IlC2MDclzdzOINNhxSdjWcIWq C2X9WSkBbEvhmVER1D0jRyehle+QyO3UAZNRueQercNR+nNdjEzctUuvs2DdrhupST0I zuF8AiVyUMCDNynwqn8BZomKqWsT0ToQSsfk1lVSw6L7CcmunFuEPZ1c5bKjkhFUSzHZ ja2T8apVqoYd78EsYyC+XwWZE9RxQFSUig54O01eomCmOxepIvxc5J/VXzEwZCSM5gWc 6eD06f2I3tO23apffTOaQX8f5mjdiL1RHGMgUYjJjUKetx6akzk77X3yu40o5YOFLbY7 7Zjg== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=HzXKqUkF5zYf0xagYL05XwtZae9vhr/pQem7CC2NDrs=; b=l4GV99x7NNqp5sKvSyZ3lUxjGDUxmrfnjJP4T0KTYtxGbP4YnWd1VOd7u3ecvAstD5 MoHCDna6Gu+O0P4NlqSyIJXKHln9HuP4daG3mfTHg/gpkoeFgH2kkXcixcXJvGK8N/IS THv9xB0qI82aeMNJ4AgJFzS/7m36033+8zn6wSvSSji4nBXBdOEtkliP6Io+WsCi736w bMy6XC93AloD+auhieYpBSGmP3p/z3DiNFLipA4idY7DJgtOSPyseBRZ+Vtxkd8EmD6l al5tkBKxZQB6d9qGLseJ1sFFlX5PQWCY7O8/3gMVtsGG4fl3OXQfX/yE/HRgjTpNEc4C ucXA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l21si7735356qtn.373.2021.10.04.01.03.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Oct 2021 01:03:29 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:42748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXIwb-0002hk-Bt for patch@linaro.org; Mon, 04 Oct 2021 04:03:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44142) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeO-0004D0-2y for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:40 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:46337) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeK-0004po-LP for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:39 -0400 Received: from quad ([82.142.3.114]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MkW10-1nDUQb3uKE-00m4Ew; Mon, 04 Oct 2021 09:44:32 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 15/26] linux-user/mips: Implement setup_sigtramp Date: Mon, 4 Oct 2021 09:44:10 +0200 Message-Id: <20211004074421.3141222-16-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004074421.3141222-1-laurent@vivier.eu> References: <20211004074421.3141222-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:xvvdkEmr98B5CPc7SE/Er3pcIEah+YIIYdmvPXFXP/b2CE7FMsW YwjgEwjUp1Y3LZNJNuyzXvL5Xz6S9SQVhaXxTE/CCMY4w6JqW64SMsc+JCpTZUlK0KdhF/u C2PoCke7CWpS0uOeiEBuFFL3GRZjeqTxYjlGziUeZi81zn2KX+S6gGzxRldcr3CZF2UpLv+ 2CS41U8Cg+jD/XvQVNZNg== X-UI-Out-Filterresults: notjunk:1; V03:K0:OVEiW1ipNe4=:JsTg7sjQtGGIsHiJrUAAj0 xhX1MJgbBcLy4Rrv+N5gRKvAKf/oNT27gRwvq1hXlQzN965Gnu4dH6eyLFgOIZwKntoi08I9c bb+Y0kFq7x4uKvat6gZFhVJEPVPIGoHZB3R0Ajs+OjhPp3UShj/doloHnkiHWaHcKvjlIHdkD cIknS6WRXOYD9MYsYLi0kxFJMh0f+3tC3oyHIBtnhKUDrnmkNa110B+U/mTglJQ+Ad6uApV5g ImHky8H/1VsjmOkqaujey7WgvaeiqeiB94kNxEXvYtuV1kDjUqIT7zXH55hEiyLfHwCXp7F8t T41IZZO8OeW5+Vt2QXJ8J2Ahr5ljWEfUqELRypJ/bWE69qNaRK/F9NDTD7JCn1HyM61KyLdVH vxU/s5avE/xYdNBxeYytVDaivKjtZ9xTGNQt9+CJGPFo/vII6tzdAKv14tTvdhEvF2u1KNyaO 7KeyIdNvhwVqVent38dMXYZRTfXex34OyEKxkrPEetFgmr58ORTsJMrJrqamET+/ixKDrMU1t 8Bpo/Lx+vH6PB/s3XQWZFL5pIeZHRToddgdTdlJ/5I6ZFa97fubnRhfYBlC1Ph0xLVpXFbWcf w6jgN8ysOofwZOq2L0URiPHhlG8IMTT4HgOqSdlga86y6XLSzernjN8bG9A6IEs7Sj3icxtJb XYqNOJctN5O8JWYog3202Ji1OhYlt76cY8wu18X21j+DOs7Z/sj3kaMCfml6QroURfCyN0DWq eSrkuouRcwsEXtl9agRnNX891okY/TXbLbTA4g== Received-SPF: none client-ip=212.227.126.133; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_NONE=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: Richard Henderson , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Create and record the two signal trampolines. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20210929130553.121567-16-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/mips/signal.c | 34 ++++++++++++++++++++++--------- linux-user/mips/target_signal.h | 1 + linux-user/mips64/target_signal.h | 2 ++ 3 files changed, 27 insertions(+), 10 deletions(-) -- 2.31.1 diff --git a/linux-user/mips/signal.c b/linux-user/mips/signal.c index 64072779b94a..8f79e405ecb7 100644 --- a/linux-user/mips/signal.c +++ b/linux-user/mips/signal.c @@ -209,8 +209,6 @@ void setup_frame(int sig, struct target_sigaction * ka, goto give_sigsegv; } - install_sigtramp(frame->sf_code, TARGET_NR_sigreturn); - setup_sigcontext(regs, &frame->sf_sc); for(i = 0; i < TARGET_NSIG_WORDS; i++) { @@ -231,7 +229,7 @@ void setup_frame(int sig, struct target_sigaction * ka, regs->active_tc.gpr[ 5] = 0; regs->active_tc.gpr[ 6] = frame_addr + offsetof(struct sigframe, sf_sc); regs->active_tc.gpr[29] = frame_addr; - regs->active_tc.gpr[31] = frame_addr + offsetof(struct sigframe, sf_code); + regs->active_tc.gpr[31] = default_sigreturn; /* The original kernel code sets CP0_EPC to the handler * since it returns to userland using eret * we cannot do this here, and we must set PC directly */ @@ -305,8 +303,6 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, goto give_sigsegv; } - install_sigtramp(frame->rs_code, TARGET_NR_rt_sigreturn); - tswap_siginfo(&frame->rs_info, info); __put_user(0, &frame->rs_uc.tuc_flags); @@ -335,11 +331,13 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, env->active_tc.gpr[ 6] = frame_addr + offsetof(struct target_rt_sigframe, rs_uc); env->active_tc.gpr[29] = frame_addr; - env->active_tc.gpr[31] = frame_addr - + offsetof(struct target_rt_sigframe, rs_code); - /* The original kernel code sets CP0_EPC to the handler - * since it returns to userland using eret - * we cannot do this here, and we must set PC directly */ + env->active_tc.gpr[31] = default_rt_sigreturn; + + /* + * The original kernel code sets CP0_EPC to the handler + * since it returns to userland using eret + * we cannot do this here, and we must set PC directly + */ env->active_tc.PC = env->active_tc.gpr[25] = ka->_sa_handler; mips_set_hflags_isa_mode_from_pc(env); unlock_user_struct(frame, frame_addr, 1); @@ -379,3 +377,19 @@ badframe: force_sig(TARGET_SIGSEGV); return -TARGET_QEMU_ESIGRETURN; } + +void setup_sigtramp(abi_ulong sigtramp_page) +{ + uint32_t *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 2 * 8, 0); + assert(tramp != NULL); + +#ifdef TARGET_ARCH_HAS_SETUP_FRAME + default_sigreturn = sigtramp_page; + install_sigtramp(tramp, TARGET_NR_sigreturn); +#endif + + default_rt_sigreturn = sigtramp_page + 8; + install_sigtramp(tramp + 2, TARGET_NR_rt_sigreturn); + + unlock_user(tramp, sigtramp_page, 2 * 8); +} diff --git a/linux-user/mips/target_signal.h b/linux-user/mips/target_signal.h index d521765f6b2c..780a4ddf29de 100644 --- a/linux-user/mips/target_signal.h +++ b/linux-user/mips/target_signal.h @@ -73,6 +73,7 @@ typedef struct target_sigaltstack { /* compare linux/arch/mips/kernel/signal.c:setup_frame() */ #define TARGET_ARCH_HAS_SETUP_FRAME #endif +#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1 /* bit-flags */ #define TARGET_SS_AUTODISARM (1U << 31) /* disable sas during sighandling */ diff --git a/linux-user/mips64/target_signal.h b/linux-user/mips64/target_signal.h index d857c55e4c6c..275e9b7f9a2a 100644 --- a/linux-user/mips64/target_signal.h +++ b/linux-user/mips64/target_signal.h @@ -76,4 +76,6 @@ typedef struct target_sigaltstack { /* compare linux/arch/mips/kernel/signal.c:setup_frame() */ #define TARGET_ARCH_HAS_SETUP_FRAME #endif +#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1 + #endif /* MIPS64_TARGET_SIGNAL_H */ From patchwork Mon Oct 4 07:44:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 515159 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1149538imy; Mon, 4 Oct 2021 00:54:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRsrOJHBj2+3zVQu6ShQVp0L6SFjPQ5y7R43dM0OjvgH6BnP7yOFGcPA58UELvbElVKhVF X-Received: by 2002:a25:e906:: with SMTP id n6mr11871458ybd.248.1633334075484; Mon, 04 Oct 2021 00:54:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633334075; cv=none; d=google.com; s=arc-20160816; b=GV5BsxSEp0xoddT/tbY9XTLWWc7/1/CP7XYpcYka09+J1CYfO44h8tsp188j56lI2q uG/68UuvnvnfvqPhHZtYGbRuZZjy8wVWsD9J4MAdek+mGZd35/UUtGPx+q60huXEe0gk WoPE1sln86z+iqlXC87D/YrqLoprPG7sx9J98LwwIO9rlh+D7CxgRuOumEhO13kZ0AQU t/7cClxa9aTeOwQuwb4j/FpwwbuzSkKuPn4v4ki8ormIIIJVF26Qb++un3QdEpmWyKvD b1ZfKtMApAWIwFS9mSu0tFxFT0I5/p0HeeE9bjY7PyMOQjnydFOa6wSYuE/7xn0h2C9s 8S3A== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=8tF8XILPe4oG8gKuEYCr8AKi9GvUsH+p4wBKln6AiTw=; b=osPW3d6uYh9IcdLWcDKxKcPnG3Wp1Gv+yHaCxKBIc01EQSAtWdXLy+lmBzf8IkuvLR WaKLhl/Z95CCdp8RFZLRExj7Y82hyYGTa1VuqznNp7P+/LzoJYZZUQ9rR83eJMPgTtl8 9PRSQlRe0ZusnxqFxXQyvSYwQEDNkFWmy3bK6rMXgv/8oIDACOwrZOmhrs36eKR6m8nx BENKZ5daW4MYHgQJcPz2oeMZMLYT5bpcsApLrYyvfMaYzlAsW0GFEOzibVHjDI0hhXMb c2SCorqkqQR3YrbnPEUAOXZRHY60nqi2wG+qBkE7xzmuQV1anC5xJz0kJtZSQLxZ42qP P7OQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o22si17779420yba.357.2021.10.04.00.54.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Oct 2021 00:54:35 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:52744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXInz-000635-0Y for patch@linaro.org; Mon, 04 Oct 2021 03:54:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44116) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeN-0004Ab-47 for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:39 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:49391) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeK-0004ni-Fw for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:38 -0400 Received: from quad ([82.142.3.114]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1M3mHT-1mX1nf1jcZ-000vlz; Mon, 04 Oct 2021 09:44:32 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 16/26] linux-user/nios2: Document non-use of setup_sigtramp Date: Mon, 4 Oct 2021 09:44:11 +0200 Message-Id: <20211004074421.3141222-17-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004074421.3141222-1-laurent@vivier.eu> References: <20211004074421.3141222-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:Wm3fA3ayo+Vpo1cXsJOJBEgO6suS+FDD9FUn/Xj0CcNrUldiO2F QBFYfVY0Kg4MdygbpL30bsnY5OHMz7b6XIzUSbbrtRNheWgFbynezpnvIszbApIMOJN7ibB 9fF+I+PxEnqs9JBWQn7yaDENwt+G6e7aQmeujiqTgssMyF5B8XzNJMErM6ZVRJ/hB4zeYON itF2Nmz7eBqX2mjv/YEfQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:ioMF1ozEAk0=:luPzz7beYWTJSeGL6rsLt8 uX+gA6wZCC76xQIA18/nt2Asd50Qhe9Wt66c4zVwXUyaCmvW1RYimwko4S3b3IEZIdVQXdzzp oHVjSqvuaEJLB/KKAXZIUGhBSE8NqVsNmp37Duj35za3jdLyTE7KirrdvrTINWGNyohEiuGWO lexyqo3NiTCJr9NqQegvutyYbVx+fgc5mS9sI563/McTJOoBZHTOrmLwSu9Yc9ky0GfDipJx+ bq1zvib0S/gOokKpK182qmyhzRMQLDVwRprGRWxdH+3ZnHtg70ZmAyMvZSWAyEpVqHZeyzXpz 5OZ4E8qBoZtc/tBWnvRw+Uq50RAoWx1sq7eQqOwWrQ4GLQBTbCPSk3WgBd5VUCPWrzM4+Vn8N 5II0sjFuQV6ktQWc9cwzzQ4Wi1HTkMIDrPRCDHDOLCmiCTtovGpH1D3o+9PFD/LFAVQiHTfjq X2R8beXP0QBzpKYg9v8Flp3VIm0gMFMnNKQezHpPhJlryAcfoTApOvro4f79Cl2kTfJm1giOB esrfc5g8YBmU5YBlDdd8Nu7rk9OYrmKwjLp+o2mAdRoJJjyKxcOv7gR6KsHmNWsqbfGwkUL4X xS8s1evy5XyOqIykk/EUUrKdMF6YfecvFKkN8x+Wn/8QD6w+3bT3LTE8tf/RJnTZgm/YG/zkz mRXZIVTqzVWs17CVfOxQFfhT+Bd7W6J8iBktMb908BEnBdUVQDZsLSof0vawvV6Cq9hVOrcBd RI1ijiAltteAH9cCtAkp5qpzdK9J8JRtlk7D8A== Received-SPF: none client-ip=212.227.126.135; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: 0 X-Spam_score: -0.0 X-Spam_bar: / X-Spam_report: (-0.0 / 5.0 requ) RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_NONE=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: Peter Maydell , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-Id: <20210929130553.121567-17-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/nios2/target_signal.h | 3 +++ 1 file changed, 3 insertions(+) -- 2.31.1 diff --git a/linux-user/nios2/target_signal.h b/linux-user/nios2/target_signal.h index aebf749f1278..fe266c4c51dc 100644 --- a/linux-user/nios2/target_signal.h +++ b/linux-user/nios2/target_signal.h @@ -19,4 +19,7 @@ typedef struct target_sigaltstack { #include "../generic/signal.h" +/* Nios2 uses a fixed address on the kuser page for sigreturn. */ +#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 0 + #endif /* NIOS2_TARGET_SIGNAL_H */ From patchwork Mon Oct 4 07:44:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 515158 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1149423imy; Mon, 4 Oct 2021 00:54:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0qqpoVn5BURbnK0J6qECxJt+lZFsxcjqCF89ncKL23wOdWdesKfcg8yxkW2hnaUIKWWBn X-Received: by 2002:a25:3082:: with SMTP id w124mr13323619ybw.6.1633334059368; Mon, 04 Oct 2021 00:54:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633334059; cv=none; d=google.com; s=arc-20160816; b=D9gIk3jCq4CZOJ7QTxSI6vVDM8pOQz5/Ek6OLp8ITs9nssul4wNBvfwaZCYGPnM/DM DbqSmU7KNW5uRaltMeJ3kLxVE5pTlLtDRO0AV8I2kLa5rTQTlWDzMoIZLxad/+iaHF7S fvG4tzVGBdg1O2Ra98dXC7ggF4DshR6icgw107ULiFLA9t7/JvFHBoga6EGjAKv00lL+ ZysjG/YedW4XJv6lvGJAP8eU84anv7ihq12E52EmuQekz8Unr9jzftfaQLt70+K2Gqmx jZb1rGZIITUAs+PaPJGdDP7pcCv91ecylUUD2j9dAgvtRsHQK613HFzqu71rWFgUTQu/ pEng== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=bWAVZ+dPkjkWF0eaHxyZE1/xMeITTwZlBfJI0JRNEi4=; b=cW/qKpI/qwjKbqckAPzvFpIIPANprH8BFCNLuvYeK5+Kod4rfE1k6y8m8wFYH97gvp iv3C0pusX64W1bXwf8jA7BhVSKIa3tusOeytiSzq7wCdhwzOLJYdAD/j0ogff2827i4X 2Ajha5cFmYpWemSIF+sbmtkGjXIeuMN3cZH6aHt5aYq0dmha190iPPw0+rPB65b5Q0bR WAoR4ntIo0LomM9ESOyQpf42cc+tX+UO7T0yDvcyX+Bh8n/Ib7IE1lR6wHjCsL2N/Hb4 zsNbq30jBzIwBbYqMQJQtn2BpY1inhC2vcqxheeVDOJO7YMKC8iRuvKNTeA96OYFUpBc xnKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y136si10931142yby.287.2021.10.04.00.54.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Oct 2021 00:54:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:52118 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXIni-0005b6-Pz for patch@linaro.org; Mon, 04 Oct 2021 03:54:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44164) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeO-0004Ea-Kx for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:40 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:41607) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeL-0004qh-9I for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:40 -0400 Received: from quad ([82.142.3.114]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1M91Tq-1mTRIt0D3e-006AyM; Mon, 04 Oct 2021 09:44:33 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 17/26] linux-user/openrisc: Implement setup_sigtramp Date: Mon, 4 Oct 2021 09:44:12 +0200 Message-Id: <20211004074421.3141222-18-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004074421.3141222-1-laurent@vivier.eu> References: <20211004074421.3141222-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:IV0ogjXMl7VEDcZT/Xq0tFT3pt51U8A8BqPvpAiQ6Jx9h3PS5h1 XLWriprsXWrjso6sa7E1yuPK8KauGCY0JnkFSsWLREv763aOs/e45CN7moKn6Lb3BRNZQKG /qPDL87JcHSki281cpfcbHdUZFlNmvkRQ31F0NU8uqsHSuHDFfO6kPtRHMRHzKNkIl/twD0 5PqjJrTUmc3Jny5n/ZskQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:tGuIXfAHjlc=:uXwqV4rdXtHs69vVJLzQXi e7ZxQ+GbwqR9CwKR+i/ULnp+ADgyHvPCJEpJjlgx7zvZmb/4ZBRFSQRpWk40TNxyKbE1LeYb8 i7yNDuD9IvQ2+rvW7wzC0Hg+Kde+MBRuQxaSxlGs3SVEa+VibwNbccBrET7S5TOKULrxl92Fb +rFrHFYlKnOpOcxcUohcuW/zjclhaPMj3Cv931ZIL4BzjVnMp3BssgizpJEpW7lGQJKgSttfu XP+91JNzsJ9vHMCKy8SVSuQrgbmBbPHLhLBc1pgi2lEmeZsUB/gjY3yN+4rDz7XWV7aBieyS1 Rshcy6p9UPnY28HiDH2tMNV7u+e7Sbx4qKzU8EJo+xZDoc1Cb5pfOQ69rrAUdzuGw0pclSCh5 ksJISIL6IPYJafXL6uaABCTMLz/mEhLEkW3uoVEc15DoK5f/swcXfw3F20dsO6Ft1PAB/qt14 Y28qkGMkIcCjjmNp7YW6cB78PvRmGgYM33Vw8MVuix9uyzAAWt7fY/p3ciyU4hs/i5YEAOTq0 Q/JXQgx7APtI73/Fqk4z/b71j1ksFGmX/NOa7JAJ/1n8aGFiFWOtvP2rxDV2l8naQNj40MiYs E/nauKx8TPAt5XecbyzOSWtclX4xD1nnNY5go91x2+WVuc02JE395dDk6RztMcQ4MxeoBB8LI huJF7JgFI8EpycgeNlRYr65D3iNAPim36PSAddpnXYd5KuCeXVNf/l2qNkTdMJ5zS51FUYLp4 FikVE+Vq4wqt0311wxI82xlWPZbDyrSLcXHq3Q== Received-SPF: none client-ip=212.227.126.134; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_NONE=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: Stafford Horne , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Create and record the rt signal trampoline. Reviewed-by: Stafford Horne Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20210929130553.121567-18-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/openrisc/signal.c | 22 ++++++++++++++-------- linux-user/openrisc/target_signal.h | 2 ++ 2 files changed, 16 insertions(+), 8 deletions(-) -- 2.31.1 diff --git a/linux-user/openrisc/signal.c b/linux-user/openrisc/signal.c index ca2532bf500f..be8b68784a20 100644 --- a/linux-user/openrisc/signal.c +++ b/linux-user/openrisc/signal.c @@ -38,7 +38,6 @@ typedef struct target_ucontext { typedef struct target_rt_sigframe { struct target_siginfo info; target_ucontext uc; - uint32_t retcode[4]; /* trampoline code */ } target_rt_sigframe; static void restore_sigcontext(CPUOpenRISCState *env, target_sigcontext *sc) @@ -116,14 +115,8 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, __put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]); } - /* This is l.ori r11,r0,__NR_sigreturn; l.sys 1; l.nop; l.nop */ - __put_user(0xa9600000 | TARGET_NR_rt_sigreturn, frame->retcode + 0); - __put_user(0x20000001, frame->retcode + 1); - __put_user(0x15000000, frame->retcode + 2); - __put_user(0x15000000, frame->retcode + 3); - /* Set up registers for signal handler */ - cpu_set_gpr(env, 9, frame_addr + offsetof(target_rt_sigframe, retcode)); + cpu_set_gpr(env, 9, default_rt_sigreturn); cpu_set_gpr(env, 3, sig); cpu_set_gpr(env, 4, frame_addr + offsetof(target_rt_sigframe, info)); cpu_set_gpr(env, 5, frame_addr + offsetof(target_rt_sigframe, uc)); @@ -169,3 +162,16 @@ long do_rt_sigreturn(CPUOpenRISCState *env) force_sig(TARGET_SIGSEGV); return 0; } + +void setup_sigtramp(abi_ulong sigtramp_page) +{ + uint32_t *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 8, 0); + assert(tramp != NULL); + + /* This is l.ori r11,r0,__NR_sigreturn; l.sys 1 */ + __put_user(0xa9600000 | TARGET_NR_rt_sigreturn, tramp + 0); + __put_user(0x20000001, tramp + 1); + + default_rt_sigreturn = sigtramp_page; + unlock_user(tramp, sigtramp_page, 8); +} diff --git a/linux-user/openrisc/target_signal.h b/linux-user/openrisc/target_signal.h index 8283eaf54419..077ec3d5e8d7 100644 --- a/linux-user/openrisc/target_signal.h +++ b/linux-user/openrisc/target_signal.h @@ -26,4 +26,6 @@ typedef struct target_sigaltstack { #include "../generic/signal.h" +#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1 + #endif /* OPENRISC_TARGET_SIGNAL_H */ From patchwork Mon Oct 4 07:44:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 515166 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1152581imy; Mon, 4 Oct 2021 01:02:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLSiLdru4C79NutAL78ZHT6RNZCQJTMwreDM7IGxn+I5PJimLe9dJbUDtdTRg29wfsOqwU X-Received: by 2002:ac8:435e:: with SMTP id a30mr11999078qtn.227.1633334552330; Mon, 04 Oct 2021 01:02:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633334552; cv=none; d=google.com; s=arc-20160816; b=dBh81/CrwsPuOP0YbbEThVMg6B1H3VWiOxId1JjR/kmL/IgSjIrwL8+D/dOrPJCn7c I7u4362RCeyYlGwOgR6FFwf+GOimUd0ISlA0kghi7Om5dWDLSdXt3GV8ZgEnf/vPii5V xpkUX47CBNF/asBP1I5OFmDJoomO5jqizBEM/vy6oXmALFjiWm8r163a+33M/JiX/8Y+ A1j99rckPrrex1sW6J5ugsNZjri0FuNpSb56cvF6LZv6nLyInTHv4dmAYjaVcZYrlmSa B/96/+wxki88mC79B5kwlZgxOAiXfCUJ7DxXx1CNYb463Fn4tTPn5TAHuoKC9MGkqKIQ Vayw== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=Yz5/5M3f+capwKMmjPdXDQ2HnTg4Hn5a3wFAvnOmErU=; b=rDyKbkn/MdlZArcCbJWnXndCIz/IIxe5MeXpJhI+hA+FTzYGGrvGVq0ZmLgTvYRNXY swoOtCSrzF4MFJennMRe+eUrFIMXuqpjwqYySVLl1UNx84J7HOWsOFZ+i7gXVXebYeou EKmFIvF0YPKWON1Fnt3VPyyPeKu50Rd8sEaRqP5FStkYSp3cl2Q9eUH0ojbDQ/dvSITN d5vMsU0KLFlResaY2ElOxJ/uiU8QE8ZO8/mdr34veFZFJHC8VgTJHuhST0Zw7+cg6Uth MyUPYzUq2mpY/FiLeOfbvALGfY6UO3JBEkmAKEPDnAK4sV8sALx3pWFs5+TrQAeKg7vj LCQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h10si10937531qko.232.2021.10.04.01.02.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Oct 2021 01:02:32 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:40612 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXIvf-0000yA-Qc for patch@linaro.org; Mon, 04 Oct 2021 04:02:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44204) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeP-0004Ia-VY for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:43 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:46667) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeL-0004rI-Pu for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:41 -0400 Received: from quad ([82.142.3.114]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MIyiY-1mD1wZ2Sew-00KOT4; Mon, 04 Oct 2021 09:44:33 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 18/26] linux-user/ppc: Simplify encode_trampoline Date: Mon, 4 Oct 2021 09:44:13 +0200 Message-Id: <20211004074421.3141222-19-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004074421.3141222-1-laurent@vivier.eu> References: <20211004074421.3141222-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:deIQL4aMLtFiJv9LRvDOHzDeVuluamEtc++PCU1i7nnpBLCSOwi 2CDVXC/K7ISYCacJElVCoSmUuPqRK0Bit4/Hj3gABM87kqx6BSC1IML2X7ue9H3AZRU4oac m0egFsd1TZXW0lQPH1qcZToXyX1EkvgUPf0u098uxKlUZy6YBDUwnGnZQjZrJNgfbCbP0iU SxqOFwYtSG1VTaCD0xG/Q== X-UI-Out-Filterresults: notjunk:1; V03:K0:Pmn51ffgwOA=:bsE8F6YdstWAJZg57eG8zw yLXqSLbYJsfAmtejfBAYW5c7wNyLrdv0X6+lm+GDZKIx4VA0/3oKl+7RGGxBIShJ0bLkoTee7 Y0Y7zTv1TAC1l/5tGssnCFWr/LFyHkUZySrgxDTkJZpImZ2s0ZOM7wuQS/LbsT3qabgdi7pCr OBBVy22pXNbEAZDODHhqw+qLiD5+StZAzombd45u9hOn3cCmrTJTLh+uq59JMlvBAAy2EeAzT US+9o+d5Y8luiNmh6+mIx1Dub7YPxIuff1LddlivhLrv5tgoLFX9onB44G84FK8W5Ftdmv4kQ ewj57vy5nyF0m3kfrnVMbxBAJnTctDlaXxm4xP7c09aocOmwbyGJsEVQaWKo7wb/D7DhjMuKV S7gOx3dxkJyymdZBC2HPge0YS7McFKhdWxvpYd+/yvyuZTIz4FiaFduzt46EQctOOKf8rJh5I IUGQmUD5Mo5jqhfZa3BGUeUk3rVp15YI3dzPZ1DtjZYpQH6e8pLkcjwGInyD3iZgDMQGY75AY YDi1XcY1PvBZU0HoDb85hmPdbTJ0gaFOxgyzOkVbKdGEYTpfGXATvPapmojsAQnRdDHn0inoh 1KrQnW1dHPuZL/FmTk8UirBJQ+Jnku6nL36F4vKeRs+sk1IAWKUYpzvY9l4pnCdlPDoOgEQaS xAzDFIUjJhJbOBgHDBvGxTxMfRsMUY2LJPN6VzrBPXNNV9LX883N8dBCX5t1pZ8XZqFFWQhx8 h+Qj9Da15oh1FegDJBcTAxhfm8SqaQXMlY+BxA== Received-SPF: none client-ip=212.227.126.134; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_NONE=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: Peter Maydell , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson The sigret parameter is never 0, and even if it was the encoding of the LI instruction would still work. Reported-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20210929130553.121567-19-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/ppc/signal.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -- 2.31.1 diff --git a/linux-user/ppc/signal.c b/linux-user/ppc/signal.c index e4d0dfa3bf75..77f37b9f0131 100644 --- a/linux-user/ppc/signal.c +++ b/linux-user/ppc/signal.c @@ -309,10 +309,8 @@ static void save_user_regs(CPUPPCState *env, struct target_mcontext *frame) static void encode_trampoline(int sigret, uint32_t *tramp) { /* Set up the sigreturn trampoline: li r0,sigret; sc. */ - if (sigret) { - __put_user(0x38000000 | sigret, &tramp[0]); - __put_user(0x44000002, &tramp[1]); - } + __put_user(0x38000000 | sigret, &tramp[0]); + __put_user(0x44000002, &tramp[1]); } static void restore_user_regs(CPUPPCState *env, From patchwork Mon Oct 4 07:44:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 515163 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1150739imy; Mon, 4 Oct 2021 00:58:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyh+YdytgvQVNCzfr/qLGLeLE7SbUlSHKoqAG8cROlhks+twTvDEt4q0JMmyGZyrWmgXpQ1 X-Received: by 2002:a05:6e02:154f:: with SMTP id j15mr7766335ilu.181.1633334290600; Mon, 04 Oct 2021 00:58:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633334290; cv=none; d=google.com; s=arc-20160816; b=N/lClZSuiwnN5U7Agag/pwl9yT5JMkAY9PL2tOmFpWJhijOVo6V2oi9L+/LfWbvWNV PRadC+qITewtOvLISQpqjvV9mr8zzLMk/iKL0Ee76eUMoX1PwGi+nq29g5Ph75XoXBkg CaY+U8oa2Tf5O3gtWLvtyQzUbDs+IrZ7+DtdPE40kIrj6fIKW+4VOpmu7qEl/RI1fiVE sHkmLXpJFYq0hMxBBzVJIB/zd+pgBXQ16sOjwqLZcnsZkQb9vbsYojx0Eptr8ZnzKBRQ 2rjwsOtLHAkUdoadNbxmzbxFseLAmfdbVETxycU0K05/ItSMK63729Qy7l6/IOdGwPt0 2RgQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=SFNL1HP3eLwMiVKbq1/M+AHmjpFh8NKiFr6EixSICxk=; b=d82Vod9JpTouc/5HIy24oXGsOxokQP8MW+yDz6spyVSHsQFMIkkVzvIsUW6u9hwgU1 rkOOQo7jO85i7bjD0X3bRAe5wgVeix4qMGbA97Wgq5PKXWWvAJyo2iMeyvcRN98I5oxK Rpzl4l5jbdZlOfVtpTVud3o1LyGuyGG5Q+e5rpnalD+RK/ms5x2SCWjDnBe9QOL2ADHX E8wPzFJiYB83T+pPHepb85CEzyCtR2ATped/lUTBFqKTXQpA9NgZfUZxc8pt8oodiVXr MzHNG6gANTb9dtJZ6/pqQaMMalDyz6jzADS7LSsiTobPvYP3jzocx7ykIXCSZjMR2fJC aM9Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c30si14613771jaf.100.2021.10.04.00.58.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Oct 2021 00:58:10 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:60566 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXIrR-0003W4-VA for patch@linaro.org; Mon, 04 Oct 2021 03:58:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44172) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeO-0004FM-Tp; Mon, 04 Oct 2021 03:44:40 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:40317) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeL-0004qK-Ck; Mon, 04 Oct 2021 03:44:40 -0400 Received: from quad ([82.142.3.114]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MvazO-1mpNxt0G6I-00sh6y; Mon, 04 Oct 2021 09:44:35 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 19/26] linux-user/ppc: Implement setup_sigtramp Date: Mon, 4 Oct 2021 09:44:14 +0200 Message-Id: <20211004074421.3141222-20-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004074421.3141222-1-laurent@vivier.eu> References: <20211004074421.3141222-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:zJQDeNvfKA3D0pmA19DTna78yMG7NV0QZ+MSC7gMdgRf7L3WuCj 57+TdP5GjA0aEFupg66KMZ8cP2Kmlbn8R6DNPCKsIEZzHKH30jJAjpVp59htzJfUU5exSaV lkJ/mL8URDXyWunBrHZaE0osjrNbvZag31kDmfqA+IvuGwMzOC62MLfVHCTq3NQw/koZA0V lQ7pzgh0TM1k3f0yeMy2A== X-UI-Out-Filterresults: notjunk:1; V03:K0:pee8h0ATvpo=:3mfWjJAR2w9x0MJ43r6JvO sVHIbsWBsRir0vyv0gOmO/DEAmjv6BtywiYoAkozSmDJr8FGcKi6yqIh773Dc3gHuFHhJuRLK hICqVznEl0Ugrf3QneRtzblzoXse/EkhuP9SLwEtZ8tadunxvzy6uQRYL5zhjwIMuWA98pYWU R6dBJNOE2hGU8AdLVidGWVQjSoV15F2Nc93f63DXmkKG3PZnFT+orKBUaiZ1ht2rL+4Muo/Ng CD3hrREsrjhsiV+3gtfAiNm6XZiZB83TKk4/biMaOyJmNkBOa3ARI0okVq4K5WLDcRZYd4FYO XrZ8QScdRj3qBTKE+mLpOQNl15cUiqQz7K8Ps4tVjbuF/zK7lPZucG9upA7EL2zFmSVGI02jO SrKLlsjbpVLLzUZ2WgUdM3YMJlLiouvmZ1T4ogpws046NDoSxKs8XMlMgfJlngALPSSiVOYfb wgGd6RsdH8zrQqV/x7rJtP/cZlLs0hoklvdv3EMVVAQtSSrCjxgnljvE/QIU4jsaeKahSCt6A 1CfozmDV2E9lnProvVo6ZLIko2pvJrmQImerV+Qn4fGxVEo80KMijYbgldDrhJttQXDyjusVK HPNf8PFGH9xG2n4cptU+agAuuasXYv/KsfI7iCYTf1sfB1Cbz1r32cvbGh1tJuRtyTIHB4H7p Vj/khk3nmvKKpBBokOZ9YbEuVz859g4Kb1kIM193VsFsRgchNFA/3iOItZZrCd8N/5m9XNCYO qnmecVGt/Ws4YhwyzAlN0ZrgiznKCmazrhdZ6w== Received-SPF: none client-ip=212.227.126.133; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_NONE=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: qemu-ppc@nongnu.org, Richard Henderson , Laurent Vivier , Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Create and record the two signal trampolines. Cc: qemu-ppc@nongnu.org Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-Id: <20210929130553.121567-20-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/ppc/signal.c | 34 ++++++++++++++++++---------------- linux-user/ppc/target_signal.h | 2 ++ 2 files changed, 20 insertions(+), 16 deletions(-) -- 2.31.1 diff --git a/linux-user/ppc/signal.c b/linux-user/ppc/signal.c index 77f37b9f0131..c37744c8fc55 100644 --- a/linux-user/ppc/signal.c +++ b/linux-user/ppc/signal.c @@ -203,9 +203,6 @@ struct target_func_ptr { #endif -/* We use the mc_pad field for the signal return trampoline. */ -#define tramp mc_pad - /* See arch/powerpc/kernel/signal.c. */ static target_ulong get_sigframe(struct target_sigaction *ka, CPUPPCState *env, @@ -436,12 +433,7 @@ void setup_frame(int sig, struct target_sigaction *ka, /* Save user regs. */ save_user_regs(env, &frame->mctx); - /* Construct the trampoline code on the stack. */ - encode_trampoline(TARGET_NR_sigreturn, (uint32_t *)&frame->mctx.tramp); - - /* The kernel checks for the presence of a VDSO here. We don't - emulate a vdso, so use a sigreturn system call. */ - env->lr = (target_ulong) h2g(frame->mctx.tramp); + env->lr = default_sigreturn; /* Turn off all fp exceptions. */ env->fpscr = 0; @@ -477,7 +469,6 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, target_sigset_t *set, CPUPPCState *env) { struct target_rt_sigframe *rt_sf; - uint32_t *trampptr = 0; struct target_mcontext *mctx = 0; target_ulong rt_sf_addr, newsp = 0; int i, err = 0; @@ -507,22 +498,17 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, #if defined(TARGET_PPC64) mctx = &rt_sf->uc.tuc_sigcontext.mcontext; - trampptr = &rt_sf->trampoline[0]; sc = &rt_sf->uc.tuc_sigcontext; __put_user(h2g(mctx), &sc->regs); __put_user(sig, &sc->signal); #else mctx = &rt_sf->uc.tuc_mcontext; - trampptr = (uint32_t *)&rt_sf->uc.tuc_mcontext.tramp; #endif save_user_regs(env, mctx); - encode_trampoline(TARGET_NR_rt_sigreturn, trampptr); - /* The kernel checks for the presence of a VDSO here. We don't - emulate a vdso, so use a sigreturn system call. */ - env->lr = (target_ulong) h2g(trampptr); + env->lr = default_rt_sigreturn; /* Turn off all fp exceptions. */ env->fpscr = 0; @@ -720,3 +706,19 @@ abi_long do_swapcontext(CPUArchState *env, abi_ulong uold_ctx, return 0; } + +void setup_sigtramp(abi_ulong sigtramp_page) +{ + uint32_t *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 2 * 8, 0); + assert(tramp != NULL); + +#ifdef TARGET_ARCH_HAS_SETUP_FRAME + default_sigreturn = sigtramp_page; + encode_trampoline(TARGET_NR_sigreturn, tramp + 0); +#endif + + default_rt_sigreturn = sigtramp_page + 8; + encode_trampoline(TARGET_NR_rt_sigreturn, tramp + 2); + + unlock_user(tramp, sigtramp_page, 2 * 8); +} diff --git a/linux-user/ppc/target_signal.h b/linux-user/ppc/target_signal.h index 72fcdd9bfa20..82184ab8f2ef 100644 --- a/linux-user/ppc/target_signal.h +++ b/linux-user/ppc/target_signal.h @@ -24,4 +24,6 @@ typedef struct target_sigaltstack { #if !defined(TARGET_PPC64) #define TARGET_ARCH_HAS_SETUP_FRAME #endif +#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1 + #endif /* PPC_TARGET_SIGNAL_H */ From patchwork Mon Oct 4 07:44:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 515171 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1156065imy; Mon, 4 Oct 2021 01:10:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6JfPK09+cUqiWCdZdzOSaVrkg0e9z3pq6dGTW4W7PmNgc9gRw9OmZ4lkuStLcNnZwjGOm X-Received: by 2002:a05:6e02:f13:: with SMTP id x19mr9392398ilj.216.1633335004815; Mon, 04 Oct 2021 01:10:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633335004; cv=none; d=google.com; s=arc-20160816; b=hPyBUeSgYRUt250hMiEVEkrHqFpCAUq2Hp+p+GrGgb0JxiMNzYMAkFd/5ki0GJjbpF TXCRAOKWYGrf5IE49HYScRNlO/gD1Kghnd+u1gfdfyJ33kdmlY8NX9WrmrHXBAwgmP9q 20pNLube+vL7RzpDDinnnDfS7CnSl+h/L1eyeKxvPpbRQoC839QNRSIwr7FNN1ik5fS8 ehMOk9oD5oz+txpSoHOC5Cg5lSLJ6Y/sxxECQJXCPO9P0P29iu2pc+ZPgQlAVV8xUWEN fdZobQyMezja9bV/DB9HlnrD1Jb3o2L6vOCL+VuUx+Me47wVDuArvSJ2aqn4JswECzXp j1YQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=0NbXMlLJZiYZp9Lnkri4X//H9ctO3Cx8cRJSvppfkjo=; b=U9gRrMaBJfJh3GQM8HianEgj3UgZodyxdp5sB7stSlS8BfPhvCuoSx5tH16Vg955UH WddbIkMRJDD4r43qvJibiyMu8YcQHjltpuw6FR2Sgj/NLyrBejRjNE5RYDm0wlfXc6oH bQhwc2e5+1NtCAXipSAt/Bb+2BTGBlKUSPqYDoUqyMWKMy49r1e/oLRP30x6ofKjM7Aw itM2O6mVZMCdrcTtxJHeG9QEJl0mIel64TKfqTvfCaMIGlrhGuHaCfFqlaxkcUv3za+S 778qPZx4TdSO/pySHDKA4ZmEtrzjqmz+/+g9wzA9JcdHcuBXQCdxWn6E9yFxMZieBywK 6HRQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o3si16444339ilk.61.2021.10.04.01.10.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Oct 2021 01:10:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:52168 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXJ2y-0000rq-AK for patch@linaro.org; Mon, 04 Oct 2021 04:10:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44248) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeT-0004LG-Ox for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:45 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:47725) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeQ-0004wU-Rl for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:45 -0400 Received: from quad ([82.142.3.114]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MNc1T-1m8tDM3WGJ-00P9aT; Mon, 04 Oct 2021 09:44:36 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 20/26] linux-user/riscv: Implement setup_sigtramp Date: Mon, 4 Oct 2021 09:44:15 +0200 Message-Id: <20211004074421.3141222-21-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004074421.3141222-1-laurent@vivier.eu> References: <20211004074421.3141222-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:AAF27IW3lRIldQ+uE/IG01kCk2OyRCNFh3Xk17b48cO69mqRLTO Eh6RTxhIbvn1ABVjs7W/AoHN8TqQm2mhFEUMKmaS+56iNHGqHJbT1RLaBw5kmaYt1zaWLi7 ZlMLkHJce3c2SYh4HNJz48wh1/Xo38VWLpRM64tAsp5u1IV8nodHyvkOxxJo20PqXLY1zdO AwZzFJPwN+Papmv47pUPQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:wjxzRMMCZkw=:PHlWAiIXd+SUXl7/b/bzca 6anktjQ1IQoqRT/sTDZhl9jDiXtSkckfSIazjAPxx1vqbmt1/CH33GwubMb5+kjDsKKxKgipj liRmOqwpfJu3XNwSDq37jxy/3frxDtpdBIqdZf9Qf7k1oQ4xpt8VkVyEgSyw9M61/+LjeBQv3 ssEjVaVtvvG0vJIrrtLnTwtB+kLV81X9nBSW5O1uXglH8/rOcKRYZE9qKPPZglEAQRR7XWf9N zDHWXhTJ3YUQiGfVWVFaB1cEsXtB5eNjg5dXwRooZaX8xQxXsBNLCNPg3Z6cHFo5JcVsKG0lO 310qysyanZfnbk+QVzkmeTe4WJSMHuFgX217r0RHwnq0VhsSzWdGy4Zxl1X6/tZa+//MJ2IQs 8DcrKxv50Z3Ng3nkHLfi1ez5GmmoGkd1QTK6OVFkBS7yexXhtwJ7HQyDcItQUiMHoKvQWwhSU noqkbVKUS0f/xrKSOYoNQWzmwFbIPYv0lw2cZKAHH4dNe2ryI0OuQNAdIpcYVSSOr3qSwvNr1 gMFZ3GRtW65iI8QrSwJURltGFMkRH1gsbU1G1zX3vlxQ/IlPC7mIP5RJ6s6z8sW+YXvcp69e4 P7I34h2UskGn7p08WgrH5OIBI+X9rO39F5Y6qZMibNPIDx560ky/GKHf4G2B26ozwtFkMWuHP qhSmF1ULuzrnEjoh3r+Uo/YrmZIHBZLJiM7XBu060LwmEi30lWHPTTro6xfYwCzX2qgxCIiZV nF2OT0HO1935+hB+sw8whzkUjJAxUQdnsMvUsA== Received-SPF: none client-ip=212.227.126.133; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_NONE=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: Alistair Francis , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Create and record the rt signal trampoline. This fixes a bug wrt libgcc fallback unwinding. It expects the stack pointer to point to the siginfo_t, whereas we had inexplicably placed our private signal trampoline at the start of the signal frame instead of the end. Now moot because we have removed it from the stack frame entirely. Reviewed-by: Alistair Francis Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20210929130553.121567-21-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/riscv/signal.c | 22 +++++++++++++--------- linux-user/riscv/target_signal.h | 2 ++ 2 files changed, 15 insertions(+), 9 deletions(-) -- 2.31.1 diff --git a/linux-user/riscv/signal.c b/linux-user/riscv/signal.c index f7f33bc90aed..a0f9542ce39a 100644 --- a/linux-user/riscv/signal.c +++ b/linux-user/riscv/signal.c @@ -47,7 +47,6 @@ struct target_ucontext { }; struct target_rt_sigframe { - uint32_t tramp[2]; /* not in kernel, which uses VDSO instead */ struct target_siginfo info; struct target_ucontext uc; }; @@ -105,12 +104,6 @@ static void setup_ucontext(struct target_ucontext *uc, setup_sigcontext(&uc->uc_mcontext, env); } -static inline void install_sigtramp(uint32_t *tramp) -{ - __put_user(0x08b00893, tramp + 0); /* li a7, 139 = __NR_rt_sigreturn */ - __put_user(0x00000073, tramp + 1); /* ecall */ -} - void setup_rt_frame(int sig, struct target_sigaction *ka, target_siginfo_t *info, target_sigset_t *set, CPURISCVState *env) @@ -127,14 +120,13 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, setup_ucontext(&frame->uc, env, set); tswap_siginfo(&frame->info, info); - install_sigtramp(frame->tramp); env->pc = ka->_sa_handler; env->gpr[xSP] = frame_addr; env->gpr[xA0] = sig; env->gpr[xA1] = frame_addr + offsetof(struct target_rt_sigframe, info); env->gpr[xA2] = frame_addr + offsetof(struct target_rt_sigframe, uc); - env->gpr[xRA] = frame_addr + offsetof(struct target_rt_sigframe, tramp); + env->gpr[xRA] = default_rt_sigreturn; return; @@ -203,3 +195,15 @@ badframe: force_sig(TARGET_SIGSEGV); return 0; } + +void setup_sigtramp(abi_ulong sigtramp_page) +{ + uint32_t *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 8, 0); + assert(tramp != NULL); + + __put_user(0x08b00893, tramp + 0); /* li a7, 139 = __NR_rt_sigreturn */ + __put_user(0x00000073, tramp + 1); /* ecall */ + + default_rt_sigreturn = sigtramp_page; + unlock_user(tramp, sigtramp_page, 8); +} diff --git a/linux-user/riscv/target_signal.h b/linux-user/riscv/target_signal.h index f113ba9a55f6..3e36fddc9dbb 100644 --- a/linux-user/riscv/target_signal.h +++ b/linux-user/riscv/target_signal.h @@ -15,4 +15,6 @@ typedef struct target_sigaltstack { #include "../generic/signal.h" +#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1 + #endif /* RISCV_TARGET_SIGNAL_H */ From patchwork Mon Oct 4 07:44:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 515172 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1157206imy; Mon, 4 Oct 2021 01:12:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysILh4ZMYM5faE0vs8zL75ss/C+DBmSsuWfzMiy3F+B/9BiXBTv5Ii7Ygn9OLB1t6j+yI4 X-Received: by 2002:a5d:9613:: with SMTP id w19mr8665632iol.144.1633335152953; Mon, 04 Oct 2021 01:12:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633335152; cv=none; d=google.com; s=arc-20160816; b=J4QcmvCmUqeG7WzPRQz+hfEXrt8k4H4VIi8Bw2eE0mOuXkV/GAQtoUzI//k/6aKVsB mGojNAfehcWdMaX8/h2Rkg6eieAEfupgd3H9iiaIxVvJ7MOG1NMxIKxcCGM7JLjIsU9z D3qkfF+pdXKOxRKyRO/H9489dEK0vigtqLLpND3/HuGNGtB1YlycQc4IbkkVKPvkyR4X LcnwLXDuKv1MrDvASvLjAI0LToWeU+pNBBzkDktNehspsoFLXTVZ6FHJnC8HR1f2k/TK 5C+8jzA9zYo6gXnFuNTZfwurL0MHetyOr+A4EROrYYNrwuZtNhkMcJ2Jjfx6K76KqZWz aK0w== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=HEwRYtrDMubQmgtXtblVDodn1Ik8msyMCVRJ9LuL7k8=; b=jZeDZexVeONG9ON7y08Zx8iJcAQ6KguUnD2ycmDSE/B29Nf9ALMsAOevFFAxq8aFZ4 Im/jkx6oZRWuSq9HYJWjcbYAaZwIxtg2+I1PMQFCdd/5RUWLJrKS1wvfxOsuJOdc/h4G hP1/gUnYLZua/5LSeYbq+r4tUbBPT1r8pmSBpKEdU5Q7KKg8+ZIo36oeiPRaLkYnnADK m76I397+HoItJb2NR61CvyBY2FRkYQYBWBmeXonEk+9xdRTnO0CvKR4HLGdfFVGXEfUE jdKJBaaNvXjtQmHrmwFC3q+zxMPitwmc8cfGcGdeY3w4Oh0rs87iDKgshXLdGmY1uLdv l9pA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y2si22274350jat.4.2021.10.04.01.12.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Oct 2021 01:12:32 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:57610 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXJ5K-0004dK-Tj for patch@linaro.org; Mon, 04 Oct 2021 04:12:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44234) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeR-0004K7-TH; Mon, 04 Oct 2021 03:44:43 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:36429) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeO-0004uM-MJ; Mon, 04 Oct 2021 03:44:43 -0400 Received: from quad ([82.142.3.114]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MysmQ-1mjrew1vjG-00w0V6; Mon, 04 Oct 2021 09:44:36 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 21/26] linux-user/s390x: Implement setup_sigtramp Date: Mon, 4 Oct 2021 09:44:16 +0200 Message-Id: <20211004074421.3141222-22-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004074421.3141222-1-laurent@vivier.eu> References: <20211004074421.3141222-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:c30x3yUmnq8Umz5Jiv9UEsmawYcGms+lxlyFGWhYKfqkKjvF5i/ b/0UJNaHtB2njBXLFQIt0RmodO/UaOLE9MHwetgL7sAq+T61qPXQ0qDrKoQHQzvQY9+WYmO zyMnO+g4IKofj/x2wzj7lNn6/bYHdC+VRhUaL8LO5iu/I6Q8khcHSsd2YGRIsGS8GRptME3 w3miAhemiy06MZoq2bV8A== X-UI-Out-Filterresults: notjunk:1; V03:K0:NIgMMTv4LDg=:l6bhVuCLN/AH4Dv9D4GxmF Z2BreH4FdN5pCnTLTmK5H+AHCP7eFOB04IkLLPC16Vt8wZB94Cwq69GRwOWEf/WX7PmRzZL9o nbs7DXizH4EkDkzd/CQv+tkx9xTLlDhoN3eGeqKSjiqX5+drf44yENUeBUErFftnHS1fp6j/v 4K1oD88DnPojqzz95/vALdfj6znpkfwUzgkHQjMT5h80ZuViWxEXCLFPuDZLYXGaXCzTzD67l 8kIb8G6TIh/3cFDQpU3sH4LmRZo9+nD4apNECu1AiaDknSKe9mMZbUaV4+5VA8B/3q3rsj7V5 yAz+9LWiElUW5C3V+0zR+w7tN0HjEQ1ZqVvZjszuznFHDcIWBbsZwlWxVetpF80kgB0jDnkQl nIcgYtN6p7U2RYot50Ra5tDzHSmzOH+j1isEvycz8uAPr9d4Oma8GDU4uMvxUuNizTzZXLkxX RGWJYJPjwhwSlcX5lbQ/fepUS5gpZntnCdzo9deM7qx7jWxtNYeFeETZ4ESS4+hUv5Xm/6KZ4 f+ihI/9NYC3KmLqLjPf/WTLTeHbirHE6HgGngulzb9pBxk5ThQOCDQC+AMsqnd3wNSLxjoWEe EciuYlyYz+p7iKZKB3N02G1D1YmsX8eBA/LQRO5dyAKwB2jOvJMnAKDwAeI7rFdNa0wKPBfEt U1dIAfX1GpQCO3kEC+8UQAqPYzB/uFKeg7o/iokfzqT/0phKcZamGWhPw/wDiQEUFcP8jgpYs j4uyGQfsnUA/hG+du2LYCPCZK4QCf/cMHbzN2w== Received-SPF: none client-ip=212.227.126.133; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_NONE=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: =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-s390x@nongnu.org, Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Create and record the two signal trampolines. Use them when the guest does not use SA_RESTORER. Cc: qemu-s390x@nongnu.org Tested-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20210929130553.121567-22-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/s390x/signal.c | 24 ++++++++++++++++-------- linux-user/s390x/target_signal.h | 2 ++ 2 files changed, 18 insertions(+), 8 deletions(-) -- 2.31.1 diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index 80f34086d7b5..676b94814769 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -68,7 +68,6 @@ typedef struct { target_sigregs sregs; int signo; target_sigregs_ext sregs_ext; - uint16_t retcode; } sigframe; #define TARGET_UC_VXRS 2 @@ -85,7 +84,6 @@ struct target_ucontext { typedef struct { uint8_t callee_used_stack[__SIGNAL_FRAMESIZE]; - uint16_t retcode; struct target_siginfo info; struct target_ucontext uc; } rt_sigframe; @@ -209,9 +207,7 @@ void setup_frame(int sig, struct target_sigaction *ka, if (ka->sa_flags & TARGET_SA_RESTORER) { restorer = ka->sa_restorer; } else { - restorer = frame_addr + offsetof(sigframe, retcode); - __put_user(S390_SYSCALL_OPCODE | TARGET_NR_sigreturn, - &frame->retcode); + restorer = default_sigreturn; } /* Set up registers for signal handler */ @@ -262,9 +258,7 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, if (ka->sa_flags & TARGET_SA_RESTORER) { restorer = ka->sa_restorer; } else { - restorer = frame_addr + offsetof(typeof(*frame), retcode); - __put_user(S390_SYSCALL_OPCODE | TARGET_NR_rt_sigreturn, - &frame->retcode); + restorer = default_rt_sigreturn; } /* Create siginfo on the signal stack. */ @@ -405,3 +399,17 @@ long do_rt_sigreturn(CPUS390XState *env) unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; } + +void setup_sigtramp(abi_ulong sigtramp_page) +{ + uint16_t *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 2 + 2, 0); + assert(tramp != NULL); + + default_sigreturn = sigtramp_page; + __put_user(S390_SYSCALL_OPCODE | TARGET_NR_sigreturn, &tramp[0]); + + default_rt_sigreturn = sigtramp_page + 2; + __put_user(S390_SYSCALL_OPCODE | TARGET_NR_rt_sigreturn, &tramp[1]); + + unlock_user(tramp, sigtramp_page, 2 + 2); +} diff --git a/linux-user/s390x/target_signal.h b/linux-user/s390x/target_signal.h index bbfc464d4417..64f5f422010f 100644 --- a/linux-user/s390x/target_signal.h +++ b/linux-user/s390x/target_signal.h @@ -19,4 +19,6 @@ typedef struct target_sigaltstack { #include "../generic/signal.h" #define TARGET_ARCH_HAS_SETUP_FRAME +#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1 + #endif /* S390X_TARGET_SIGNAL_H */ From patchwork Mon Oct 4 07:44:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 515179 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1162530imy; Mon, 4 Oct 2021 01:26:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrJ8ENIbRYeDQzvGDAAb+OyT/FhILEFmiBvq+F6nQusC0vW2hZNoV4LJEBEDH40c02IlEY X-Received: by 2002:a25:b84e:: with SMTP id b14mr14122629ybm.348.1633335966736; Mon, 04 Oct 2021 01:26:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633335966; cv=none; d=google.com; s=arc-20160816; b=SrvmRZDkRZY1mWE0vUWxqueIMwFo7QrFHhQb9ea5l3q/CBrrL+pC84NVb6tWb9+DJC T4ofmSUo+qAgzJEwBtCfRhKkYiwmvPKQr8sbt/lpAKFuOeTuTONav/B8wjG0qDYdY6SI g6C8mzReS2qhWA0QOxacXQmi7HzTdo+p/7i+Cd7A6XsA4UiTOjdT9wu1gDAKWIr1e5pT Wcc4hvc4lYfQYcEYz9Jmv/bvbW3n1ju8U7FhzkAXzP33qqPawVPLBiTQheL9IRiSjNE0 FZ2xxBHEdfxL6HdkXlwJXhgu1NmRiTYONqzypxEcEVjpA2LjAVKPrgYRFxK18g2qgxOK YPEg== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=We+TaIUueJVBe1rP+Dttj+haKXYRC7lN8G9/jzgP7z0=; b=qre35gbUz+0bp1oH1cbO6JygfsjAWnn6Ajksmov8CIFpLyBhYBzNHzwQngoFmQbaux tG7dfjr9fDZdhDxW5PEC0UMTdpS6zyXY9XOgpO7fm9hJ3XApmTWuOc40aSuOssBzERWE 6q7ecybeYNdUSJde7bYNZlmN0ZDZTsFCg71u+K4/l6cKGjfVBAb98jxZMIv+xI+vKz7M 9gTQb6b9+crnuEw2cRHF4EjnsGw1E5SosUCbBcJ+QxFCzHoDVtVzz1h5A8W0kJmTWgFm 6vBYvWGgNe7/PPUciq00AnEqZs5/VOlg7nCryAt3IXJSo4xsE6TSzPni1imO3+K8CTuO gogQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c10si16953582ybk.236.2021.10.04.01.26.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Oct 2021 01:26:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:57320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXJIU-000750-6q for patch@linaro.org; Mon, 04 Oct 2021 04:26:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44298) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeZ-0004Pw-CT for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:52 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:46171) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeT-0004yM-Bg for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:49 -0400 Received: from quad ([82.142.3.114]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1M3loZ-1mX1ni0Fql-000rRB; Mon, 04 Oct 2021 09:44:37 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 22/26] linux-user/sh4: Implement setup_sigtramp Date: Mon, 4 Oct 2021 09:44:17 +0200 Message-Id: <20211004074421.3141222-23-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004074421.3141222-1-laurent@vivier.eu> References: <20211004074421.3141222-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:UY5j0COrFLEmlfQfVnJ3koYLiU9Vl3VFrGwXK8OfbZYdruni67y FSBAz7JRYyf+ndjBPINEi9Pq9F79OKb1F8yrieF3vGY8XLfcKdPvhsM7rWiwzhvYCpEZpaM ZlsWgJMsWaMFVLuDjTi/jp+g3++YHo5GxkQnDbuzn5mOGNkiW+ruCV9A3HrIznGP1xfdX8l OC0rh0P9PQvxRYBoMHL6Q== X-UI-Out-Filterresults: notjunk:1; V03:K0:lBjxHDcKciI=:WiWlakfPIck/APP8uhbNij RQGRCRV9LotOilvhEKGtvWWl9qjLZqzHr8hw4BT1PSlO9/n06DoHY+l5VaKmqMmT9iLMGOyGj OlDCyiPjPw7l6IgJBixu2sYxNuYQd9UVGHru2SkVO/2oDsJrDYXkVwCYJVokgagZY5bQPN2XY rrEbXteVciswOrG8gFhPFE6S6REiPjOwQ4mUAXuCG8w7w0ri9pw+DZbVGU+1S5j8G4S9k9Qn+ HClpRGXZATU2YFY4kiAgYBwFlt7wbO8Nu9riSJjQV3DBQc3ZZLS3m7NwfUwnjRbcDzdjODtSm J0DGNX3neq0vR24PiODuvYJ/yfXNycnldKS5TgPmxeTtQ/pDdEas7wbRSY26p8aRn4XCE3Ehx mQmYVFA0PbZMUEHHiwY6ZxTBPEIQ31bzEw8D+IVWaA/6dalXfrTQNlSoTRKu54U04xgu++2uF rxEK2rXXg4iFUJULVMy/6T6SH6EpzKry/pbpgczfki9eqbZR2oeDTbrWbVwVTuZ567uYiJksP jmLF/oHBYoLmpBouwzY/hzMswqiHA9ygiooWDZ56JGny2/jYgkEKelqZ/IkX72mUA/C0jfjGU 9cigO3/2OBn+qA+RaYpd8Of4W8EXr94A8V3Ssu7thCaibPHllzvpg+LCWhYBJ9IUPazQVgJIa AZj/3Cy0k3JxsoM6MzcXFRSUO8crrNojjjBl/kWSlsV0j0OPMiV48Z0EJjOxQ1weGvnJxTqu5 8sfUc09KxWVl2OzP9VkMuNKGbHie/ZCh8LoaZA== Received-SPF: none client-ip=212.227.126.131; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=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: Richard Henderson , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Yoshinori Sato , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Create and record the two signal trampolines. Use them when the guest does not use SA_RESTORER. Cc: Yoshinori Sato Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20210929130553.121567-23-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sh4/signal.c | 40 +++++++++++++++++++--------------- linux-user/sh4/target_signal.h | 2 ++ 2 files changed, 24 insertions(+), 18 deletions(-) -- 2.31.1 diff --git a/linux-user/sh4/signal.c b/linux-user/sh4/signal.c index d70d744befc2..faa869fb1958 100644 --- a/linux-user/sh4/signal.c +++ b/linux-user/sh4/signal.c @@ -52,7 +52,6 @@ struct target_sigframe { struct target_sigcontext sc; target_ulong extramask[TARGET_NSIG_WORDS-1]; - uint16_t retcode[3]; }; @@ -68,7 +67,6 @@ struct target_rt_sigframe { struct target_siginfo info; struct target_ucontext uc; - uint16_t retcode[3]; }; @@ -190,15 +188,9 @@ void setup_frame(int sig, struct target_sigaction *ka, /* Set up to return from userspace. If provided, use a stub already in userspace. */ if (ka->sa_flags & TARGET_SA_RESTORER) { - regs->pr = (unsigned long) ka->sa_restorer; + regs->pr = ka->sa_restorer; } else { - /* Generate return code (system call to sigreturn) */ - abi_ulong retcode_addr = frame_addr + - offsetof(struct target_sigframe, retcode); - __put_user(MOVW(2), &frame->retcode[0]); - __put_user(TRAP_NOARG, &frame->retcode[1]); - __put_user((TARGET_NR_sigreturn), &frame->retcode[2]); - regs->pr = (unsigned long) retcode_addr; + regs->pr = default_sigreturn; } /* Set up registers for signal handler */ @@ -248,15 +240,9 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, /* Set up to return from userspace. If provided, use a stub already in userspace. */ if (ka->sa_flags & TARGET_SA_RESTORER) { - regs->pr = (unsigned long) ka->sa_restorer; + regs->pr = ka->sa_restorer; } else { - /* Generate return code (system call to sigreturn) */ - abi_ulong retcode_addr = frame_addr + - offsetof(struct target_rt_sigframe, retcode); - __put_user(MOVW(2), &frame->retcode[0]); - __put_user(TRAP_NOARG, &frame->retcode[1]); - __put_user((TARGET_NR_rt_sigreturn), &frame->retcode[2]); - regs->pr = (unsigned long) retcode_addr; + regs->pr = default_rt_sigreturn; } /* Set up registers for signal handler */ @@ -334,3 +320,21 @@ badframe: force_sig(TARGET_SIGSEGV); return -TARGET_QEMU_ESIGRETURN; } + +void setup_sigtramp(abi_ulong sigtramp_page) +{ + uint16_t *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 2 * 6, 0); + assert(tramp != NULL); + + default_sigreturn = sigtramp_page; + __put_user(MOVW(2), &tramp[0]); + __put_user(TRAP_NOARG, &tramp[1]); + __put_user(TARGET_NR_sigreturn, &tramp[2]); + + default_rt_sigreturn = sigtramp_page + 6; + __put_user(MOVW(2), &tramp[3]); + __put_user(TRAP_NOARG, &tramp[4]); + __put_user(TARGET_NR_rt_sigreturn, &tramp[5]); + + unlock_user(tramp, sigtramp_page, 2 * 6); +} diff --git a/linux-user/sh4/target_signal.h b/linux-user/sh4/target_signal.h index d7309b7136d7..04069cba6641 100644 --- a/linux-user/sh4/target_signal.h +++ b/linux-user/sh4/target_signal.h @@ -22,4 +22,6 @@ typedef struct target_sigaltstack { #include "../generic/signal.h" #define TARGET_ARCH_HAS_SETUP_FRAME +#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1 + #endif /* SH4_TARGET_SIGNAL_H */ From patchwork Mon Oct 4 07:44:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 515178 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1162032imy; Mon, 4 Oct 2021 01:24:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySe3YIqWnhVzIORrYTzHIoW7c3Ge2DYUL6u11UTISZElVOTjWW9742MqqE/YchykwygIt3 X-Received: by 2002:a25:3f04:: with SMTP id m4mr12835023yba.123.1633335876426; Mon, 04 Oct 2021 01:24:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633335876; cv=none; d=google.com; s=arc-20160816; b=Fe4fCkuJ47OTT4wtqZB1639jHx9EZNwqUCKzFEK6rgvK69Tp6IQwPqukSRHgmDEYtz ORdrs7Mvex/ovKrJl+ntSK3wvg/tPKY4DhXpGMM0CLW8yQ7BRRcvarqHAy1dgAfIlRBs H15yyPMw6RpYepuFL1Bf4U22u02/y0m/VpxaBFlpHLC2gfW+F7AZf8aNjQoqf/aIIkQe lse7nv050m6oSzVcxGeAnt0kjJ5MgEB8ViatD+mRm+7MuJnEnHvbDwq5R0wKUCHaKHrM uhpcVEY4ox88yxMqgHzWrSV0rmDIRNv2M4+FDnuSbFMw7FY0+andkGGdIyMcC5dW1sBF ieLA== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=fRLdxx4ktnlsiDej9uWwtqU48OFdmnGrwEcl+Lembac=; b=Zq09+seBjrbgbJvzzIOg5sp2GmqxdKedIK0axz7nXVrfEwYApxkawXrsP97LGNFWzD i/UKqAsBTEG0xcc4NP/uLDc6ljouVIe7WfNhfcpV8qRM8KzGhT6EWWG1DfLFTnXvuydu i20wUtSjCKIiKPFrzxzHdm+HPgCIZlxdg7nL+uW8R9UGPXLJG6kMbvzXOozUgvqcwpmX v1dV+ea8ChaWzmYPFryZKiBocy64eKpTW4yLF1YlpkPkpfLUV4K+U4wCB2oH3aYPtqKc 0PkkIiAghfAz3eGktBQI7CMdrCU7k4dUlssWctqaDJQtoVxD+kIJBw4fPN5ZQZWlSVHV 5b0g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p76si18272004yba.355.2021.10.04.01.24.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Oct 2021 01:24:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:54582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXJH1-0005EA-Tt for patch@linaro.org; Mon, 04 Oct 2021 04:24:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIee-0004RW-Ts for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:58 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:43243) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeZ-000525-27 for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:54 -0400 Received: from quad ([82.142.3.114]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MA7b8-1mdKFr2yx0-00BYno; Mon, 04 Oct 2021 09:44:37 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 23/26] linux-user/sparc: Implement setup_sigtramp Date: Mon, 4 Oct 2021 09:44:18 +0200 Message-Id: <20211004074421.3141222-24-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004074421.3141222-1-laurent@vivier.eu> References: <20211004074421.3141222-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:IkPWyBMtCWyULjUUx1wEAPfYlpIRwjtw7JuKjnNDtq8w7xY+fW4 6rpOyb0CtrgFDp5PhfwUojBVoJBlZNBD8Z2IkcntNHRsi8eHvISqsCvy0p012ePQTeBDZEb Q0HB3dCnyX2C1G/AlyA7qh+Hhnlqrc6wJntA1AzWQRYF+G7/6465obcQkIjO/SFj4R99s22 bm0D4bsKijAOBoUNfZeKA== X-UI-Out-Filterresults: notjunk:1; V03:K0:P5ySPbuQEPI=:5L1Txmpq1bxs0sMHVH8ONY pD43oSuAvRnS9hKgut3MaI8/at1bHlzJ5503hVGNtUf2oPZhQBhQsgijfLXeITURRaWPl+woR EJLCYOXfPD1iXiet/+5TgvSRhncfuPhodSmttz1e2EGZ+7ESZUfoglDuzsxmGeyFRFQcjJh+G BONQYBgEgSPQ46bJPQ988pGa5EFyFfOs78Y6cqx4ACqE0+Sc9X65XUMO2WUQakk8+xtKxKX0f lO/Pry3WBby93qzDh47UkX1cpVXRvUkxcPgoctz1pjqgVZEJHJFJEcYt/51z8DiovV6diO0M0 WfdB+tBctUpdD8ZnfvpRFKEM4nFZC2jwC2qg7Kai4dyjPnwg5wTiGMSYh3dArYDrurDtaa9gT jiLmYtX0vJQvRycd9QAq1BO3Hcz81Mg1XIYInEI7azq8jcuQZJSgRQZ+zkOkFzpfFTbCfuInI 8zCuDWBgERDYuqzArB6109YDwU98JPKvSjWszov1gKiGy3fTALbko+v16QuHzVR4S/yqUJ0Hj DDEkD9Aj5beE4ITMEU7lDw9kvOkb1o8J8Glmds56ECzzFZWAy7Jc2uBsyDOZ4kZHTPPiBJXCd lkFVwr/aJ4FyVK7FdThPjoprsLbRag3qlbxvwl2EFQa4yKxg2gAXkIM59IXOpvHHy7GS5CxlE /gVTiLvI9n2mS79Z46bGNkKvQiPfrqq2RFhw2Q+bHMFLaMOTi0RzYkutYb0LJA6lzxoAFP1tT x4f4duB+tLKahVTZG5fbAeiQ9cpwiNTD/rLRCg== Received-SPF: none client-ip=212.227.126.130; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_NONE=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: Mark Cave-Ayland , Laurent Vivier , Richard Henderson , =?utf-8?q?Philippe_?= =?utf-8?q?Mathieu-Daud=C3=A9?= , Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Create and record the two signal trampolines. Use them when the guest does not use SA_RESTORER. Acked-by: Mark Cave-Ayland Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20210929130553.121567-24-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/signal.c | 40 +++++++++++++++++++++----------- linux-user/sparc/target_signal.h | 4 ++++ 2 files changed, 30 insertions(+), 14 deletions(-) -- 2.31.1 diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index 3bc023d281a7..23e1e761de42 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -242,6 +242,12 @@ static void restore_fpu(struct target_siginfo_fpu *fpu, CPUSPARCState *env) } #ifdef TARGET_ARCH_HAS_SETUP_FRAME +static void install_sigtramp(uint32_t *tramp, int syscall) +{ + __put_user(0x82102000u + syscall, &tramp[0]); /* mov syscall, %g1 */ + __put_user(0x91d02010u, &tramp[1]); /* t 0x10 */ +} + void setup_frame(int sig, struct target_sigaction *ka, target_sigset_t *set, CPUSPARCState *env) { @@ -291,13 +297,9 @@ void setup_frame(int sig, struct target_sigaction *ka, if (ka->ka_restorer) { env->regwptr[WREG_O7] = ka->ka_restorer; } else { - env->regwptr[WREG_O7] = sf_addr + - offsetof(struct target_signal_frame, insns) - 2 * 4; - - /* mov __NR_sigreturn, %g1 */ - __put_user(0x821020d8u, &sf->insns[0]); - /* t 0x10 */ - __put_user(0x91d02010u, &sf->insns[1]); + /* Not used, but retain for ABI compatibility. */ + install_sigtramp(sf->insns, TARGET_NR_sigreturn); + env->regwptr[WREG_O7] = default_sigreturn; } unlock_user(sf, sf_addr, sf_size); } @@ -358,13 +360,9 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, if (ka->ka_restorer) { env->regwptr[WREG_O7] = ka->ka_restorer; } else { - env->regwptr[WREG_O7] = - sf_addr + offsetof(struct target_rt_signal_frame, insns) - 2 * 4; - - /* mov __NR_rt_sigreturn, %g1 */ - __put_user(0x82102065u, &sf->insns[0]); - /* t 0x10 */ - __put_user(0x91d02010u, &sf->insns[1]); + /* Not used, but retain for ABI compatibility. */ + install_sigtramp(sf->insns, TARGET_NR_rt_sigreturn); + env->regwptr[WREG_O7] = default_rt_sigreturn; } #else env->regwptr[WREG_O7] = ka->ka_restorer; @@ -775,4 +773,18 @@ do_sigsegv: unlock_user_struct(ucp, ucp_addr, 1); force_sig(TARGET_SIGSEGV); } +#else +void setup_sigtramp(abi_ulong sigtramp_page) +{ + uint32_t *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 2 * 8, 0); + assert(tramp != NULL); + + default_sigreturn = sigtramp_page; + install_sigtramp(tramp, TARGET_NR_sigreturn); + + default_rt_sigreturn = sigtramp_page + 8; + install_sigtramp(tramp + 2, TARGET_NR_rt_sigreturn); + + unlock_user(tramp, sigtramp_page, 2 * 8); +} #endif diff --git a/linux-user/sparc/target_signal.h b/linux-user/sparc/target_signal.h index 34f9a1251909..e661ddd6ab3c 100644 --- a/linux-user/sparc/target_signal.h +++ b/linux-user/sparc/target_signal.h @@ -69,6 +69,10 @@ typedef struct target_sigaltstack { #ifdef TARGET_ABI32 #define TARGET_ARCH_HAS_SETUP_FRAME +#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1 +#else +/* For sparc64, use of KA_RESTORER is mandatory. */ +#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 0 #endif /* bit-flags */ From patchwork Mon Oct 4 07:44:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 515175 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1158898imy; Mon, 4 Oct 2021 01:16:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+vo4oO0EjQqmsDgZ5ge6ejAtTMJgFFOmg1dOAx/qCdXoNUrcvwt7yli+Shl6s36CHo/+C X-Received: by 2002:a25:217:: with SMTP id 23mr13672932ybc.205.1633335380903; Mon, 04 Oct 2021 01:16:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633335380; cv=none; d=google.com; s=arc-20160816; b=ELfoJwLh9jMGpitM6GRfUCR9hIG2DaXdB1dOZBx03Lx2OWR4fclEwV9qacgiMolAKP GJCXDtICCqsrz4h0UFJqBlPHAB7owqwszgFT+J6tbFt5zvPwzqI9aTROnA25hJG0FFbT O9mnwb13elipgObc5eOokPbYVN0x7iTi6CaFPrSIr8CyI7Md8lkEg9ha0PNoquSiq+bi tGRkcqYvkHDbtyDBixLGq53W5WgrN1rIJJUV3vuQrG3vU3useGivsPVxB16wCoFoXJJ3 f1bNEgNmZO7d2V5CeGfQoZeBkifK+q3Ipcj2XOOPRh5Z8X3Rl9cMR2t+MHJ4M1jdwKGi fCQQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=ujc23ehFOz5Du76/MtCrIDHselDdfCEZKTOvbauL9Rc=; b=OFgPoDqK1EHiV5zTrUngG26jcg+9GkKK8bnvzCoJnRg+o/yAo8ZlEYlpdKypT1j9c1 6RWKDSUfGSOq+docEm9JycZMfE3ja9+0jLUap7PBhsztGj9wL43F17nrJ3eXI/K4zOv5 h+95qeb3QMJX2t6MEqvlBa62mNbKG/UJ3UoczrG9/0J7DCsWNbEqP4L9LdzZ67oxC8Ts j80inNIzANHF2PndKgRga7y8LUH7YlOFo0bP0ZWQBnGN1tA3pgZxwu4LFePky0KjZMCc YLuARw2aK5HUnzZd0nJ4ntvO2oB1rB9hCSo7Q86uRVQ5uO2/3n7KOXtob0XxCkhixpIh xOtA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g2si17880651ybj.197.2021.10.04.01.16.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Oct 2021 01:16:20 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:40712 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXJ92-0003ov-Cb for patch@linaro.org; Mon, 04 Oct 2021 04:16:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44292) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeZ-0004Pr-A4 for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:52 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:42841) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeR-0004wf-J5 for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:49 -0400 Received: from quad ([82.142.3.114]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1McGtA-1n5GxO1LLg-00cgQY; Mon, 04 Oct 2021 09:44:38 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 24/26] linux-user/xtensa: Implement setup_sigtramp Date: Mon, 4 Oct 2021 09:44:19 +0200 Message-Id: <20211004074421.3141222-25-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004074421.3141222-1-laurent@vivier.eu> References: <20211004074421.3141222-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:yOh9WAT3bb04r9IEmSGWPhDeaPOBZwJRmLGiIoAqiKMoK8onVzq VJmwPPh6lkBuTJOtjoeo5rb4zclA3EWx8uD2mY+keNR9we170TmUibU4hLYgE+eV4vpgwg5 eamVwkupqzNeEPr5lIPxcfKnOsjjejwhwhFNLfoas7nVINlgFPQYnHiZAuXQ0NTQzT0UEJJ 43I3gatgi36OFMnqzVFrQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:/RCtgT+yquE=:LVd1hJxhWUWMLe5lvFAcIm Hc3DYAR4/YY5ETL+VptKGMHKc3EoLf/LGwP3TjqKOoGwW4nQkQ3JUftnDOCAhST8Cu0YNFHXz Wt7pQIhc+CyLvJNNfuZYjwcu2EOoPn3y4YYWVkDj0OUJer2h+F062UCVQxzUaEtUbucTsmpPl Bg0jR5XJGNaCoL8BtnNRMvm5n8uZRff3dz+JVIWOM0jpSiNpqUDhalRVu/1roqnXzALT9bWaf M3OIJz8t9fXFf27K2uCtZN3wr+/FqpjgZ/lxMMwsG9A49oDXEnzIm8LpFFg5mxx/UbvYcptTX g0p9p6cY3Fd9xQ0wOc18FI3TQdlLjAj19sXyWvUy4BmAhPuescE/sONAEjbJVg4zgUufbv0R9 VmP35bTtuMXo6nEa2zrq5J+RYGSi0EMflXDIMwi+zMWp+KCQe9DQaoSWw7FQWbomoR8AYnQD3 K8Ft2j1ftDqsHr7b4+fBzyadQwAxuWnuZwXFofguhfxY+lXGWIF0ZFQBXnU08uaHY+o5TaQbY z5jG7LIxHt6UINqbUAI/kvBpE69KIrVYKhluv+b3DPpYk7CKkmny5q0Bkbrp6PeE0aFProsDG 92DoIgy1HO6+YlsDz3MEkGZprdZELedgnOzmXSyfl8ynKHsPTqO2lK2clFeEu/BZPtBtbj11D y9Oqf7d4c7h1JuF2vSHAR+63dizv12IBPUFUbXxeBQwfImy66qrQcb5W8VnBeW+ppZum1rPfo zcJpEjLj2+XVphupXk7WxL+2cGl/37rsqb1/ww== Received-SPF: none client-ip=212.227.126.135; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_NONE=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: Max Filippov , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Create and record the rt signal trampoline. Use it when the guest does not use SA_RESTORER. Reviewed-by: Max Filippov Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20210929130553.121567-25-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/xtensa/signal.c | 56 ++++++++++++++++++++----------- linux-user/xtensa/target_signal.h | 2 ++ 2 files changed, 38 insertions(+), 20 deletions(-) -- 2.31.1 diff --git a/linux-user/xtensa/signal.c b/linux-user/xtensa/signal.c index 7a3bfb92cadc..81572a5fc7b3 100644 --- a/linux-user/xtensa/signal.c +++ b/linux-user/xtensa/signal.c @@ -128,6 +128,29 @@ static int setup_sigcontext(struct target_rt_sigframe *frame, return 1; } +static void install_sigtramp(uint8_t *tramp) +{ +#ifdef TARGET_WORDS_BIGENDIAN + /* Generate instruction: MOVI a2, __NR_rt_sigreturn */ + __put_user(0x22, &tramp[0]); + __put_user(0x0a, &tramp[1]); + __put_user(TARGET_NR_rt_sigreturn, &tramp[2]); + /* Generate instruction: SYSCALL */ + __put_user(0x00, &tramp[3]); + __put_user(0x05, &tramp[4]); + __put_user(0x00, &tramp[5]); +#else + /* Generate instruction: MOVI a2, __NR_rt_sigreturn */ + __put_user(0x22, &tramp[0]); + __put_user(0xa0, &tramp[1]); + __put_user(TARGET_NR_rt_sigreturn, &tramp[2]); + /* Generate instruction: SYSCALL */ + __put_user(0x00, &tramp[3]); + __put_user(0x50, &tramp[4]); + __put_user(0x00, &tramp[5]); +#endif +} + void setup_rt_frame(int sig, struct target_sigaction *ka, target_siginfo_t *info, target_sigset_t *set, CPUXtensaState *env) @@ -164,26 +187,9 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, if (ka->sa_flags & TARGET_SA_RESTORER) { ra = ka->sa_restorer; } else { - ra = frame_addr + offsetof(struct target_rt_sigframe, retcode); -#ifdef TARGET_WORDS_BIGENDIAN - /* Generate instruction: MOVI a2, __NR_rt_sigreturn */ - __put_user(0x22, &frame->retcode[0]); - __put_user(0x0a, &frame->retcode[1]); - __put_user(TARGET_NR_rt_sigreturn, &frame->retcode[2]); - /* Generate instruction: SYSCALL */ - __put_user(0x00, &frame->retcode[3]); - __put_user(0x05, &frame->retcode[4]); - __put_user(0x00, &frame->retcode[5]); -#else - /* Generate instruction: MOVI a2, __NR_rt_sigreturn */ - __put_user(0x22, &frame->retcode[0]); - __put_user(0xa0, &frame->retcode[1]); - __put_user(TARGET_NR_rt_sigreturn, &frame->retcode[2]); - /* Generate instruction: SYSCALL */ - __put_user(0x00, &frame->retcode[3]); - __put_user(0x50, &frame->retcode[4]); - __put_user(0x00, &frame->retcode[5]); -#endif + /* Not used, but retain for ABI compatibility. */ + install_sigtramp(frame->retcode); + ra = default_rt_sigreturn; } memset(env->regs, 0, sizeof(env->regs)); env->pc = ka->_sa_handler; @@ -264,3 +270,13 @@ badframe: force_sig(TARGET_SIGSEGV); return -TARGET_QEMU_ESIGRETURN; } + +void setup_sigtramp(abi_ulong sigtramp_page) +{ + uint8_t *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 6, 0); + assert(tramp != NULL); + + default_rt_sigreturn = sigtramp_page; + install_sigtramp(tramp); + unlock_user(tramp, sigtramp_page, 6); +} diff --git a/linux-user/xtensa/target_signal.h b/linux-user/xtensa/target_signal.h index c60bf656f6b6..1c7ee73154ac 100644 --- a/linux-user/xtensa/target_signal.h +++ b/linux-user/xtensa/target_signal.h @@ -20,4 +20,6 @@ typedef struct target_sigaltstack { #include "../generic/signal.h" +#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1 + #endif From patchwork Mon Oct 4 07:44:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 515177 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1161386imy; Mon, 4 Oct 2021 01:22:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPmJ4FBH9onYMNQ7vLfXjPtrTkBkzZKUHMAqHMcr6TKBWMFjmrXfxk1dC/xiX9/KRHDeOW X-Received: by 2002:a25:1dd7:: with SMTP id d206mr13645184ybd.486.1633335768788; Mon, 04 Oct 2021 01:22:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633335768; cv=none; d=google.com; s=arc-20160816; b=YQoVyFgrpae6ch5s5pXCr6+NvQJdiG6s3qmfZGiqLW3p6I6ruDFr0F+5srU/8BhoHk k5Ma9k+u/lTqZTSLPtmjOa8IU/BQVuHAMNq73cLnFwPrELEwL7OqORUZl/wWwHXOCqUK 3R+J8ghxTUP5XjaNGj1uqZd+nTxpxEhuLoa3oUhi18PMBkA9g1kCpTmSaqkgDEJM366R 0FbrH2LwUWAx44t59nQKeIJiAIc2aemhIYhmrXgasvPZgjPkaC4CYDp6ncrE6QI34X2A os69LC95zwFAIbIe2NSYjH403ipgIDOK3vrDNm0JH2czv0o713NB3SZDGLD7okxu10Z7 lZSg== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=A3FkSKKlAxlpmshnZv+VwkaRcl6nArYMwm0L5n263x8=; b=U0lkes4AcbwsK1/+CiSwyAHaRRKOgt8fD3RIxXY/8+VPt/uzDkq+aN2RB5AybrpZMT 5gq15ipAZEQK86nNZ74UqwMIM40VtidVOTV0a+gokgJR7CcdwWdP/OfTafJFIeWSHjy+ 6wO8bwHFQnZVd89n873mdFuBFT6ZiEKOf1ei4UnT76CnjbDh5vxUGcUP56AVzyo2nTBf uBgBxf1J79pGTxaPDY76+FZF7bLnC/Ts+VfjUzwVGPjKqHnMrEEAS8W5QQewCbprDLR9 9UEehY80zu4CRQ+UA3ZbEp/bVYJ4jp52jjMVFdR3hjD3GI1/8202x1tVdSw5+p66LCAf ET7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x64si18114912ybc.495.2021.10.04.01.22.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Oct 2021 01:22:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:49128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXJFI-0001QA-8A for patch@linaro.org; Mon, 04 Oct 2021 04:22:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44296) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeZ-0004Pu-BY for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:52 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:50677) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeR-0004wg-Iq for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:47 -0400 Received: from quad ([82.142.3.114]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1M2NqA-1mVfI03Pqg-003tq8; Mon, 04 Oct 2021 09:44:38 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 25/26] linux-user: Remove default for TARGET_ARCH_HAS_SIGTRAMP_PAGE Date: Mon, 4 Oct 2021 09:44:20 +0200 Message-Id: <20211004074421.3141222-26-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004074421.3141222-1-laurent@vivier.eu> References: <20211004074421.3141222-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:5soxRWu2yGVdM3Llu+2dQcIuLq9WLfse5gEmizw2FdTMamNUgQv yxKD0aSaWLYVBXNKA+QIzBzCWxQ0jxfQ3GzDhxXyU9se2Ro18BpeUA3BIqEGUFugICZNgYz ZDEn34BcjAx46JcNoDe0FpM9VE6a9XIoVSuG4UXkidbCmekMv9zzTDlY6ttIdfkczBRJ0i7 erhfDr2LfnyzHFYpsu3JA== X-UI-Out-Filterresults: notjunk:1; V03:K0:0ZrXZCwCPrY=:ybyRHnZxh6F/t8qk2CgzfG 23Y/p5wqNR5/h7Uy+P3ACvTgHwxtaC/BUj0iHq9MjILzyez0K25MyYLsTHZ4rPts2dOFG4Isd Gps9btZ1Ml3h/jOJa+QlqNmKPfNqQ3+wLNKySGaSN/p9CNIU5q/Kazb0QzRn9EZL9sjVTvw9I ZpR9ZLXMt+h4SqIiWt2J3dDNWRj45L/aiEyXYOQjiTsqLVN9TzO1mZg0bu1K/EsJCSVGFZEbT LqXwMIftsuWKQjwGOhp5KvR1MfgBWCQgZwAR8Dla/ttVcx6M4kQmhjkzWpjIj0CcXrkhvEdvU fqY8FZKLXBHdkBg9IHK2com1xDFrZYTpMUy9I2KLroGD88+9+XKuHJFoSULn2IpfaorbLoQyV y7kykXQjEzuWc5MfNhvxAunDflNGNfxxDsBBtbGpfQ0QT8Rw8zHPpW8+AViY0+Ly8NhYUIbE3 /GW24MoVfnuMEFV2DXFk7M+vlxvfvf1qjmMg+63My/x+ICCX7sIJLTXTl2AKZHIdWuAI9RYfG WvEiCkN7tWl6yPJUIMGGCI2moEEfzqfDfae3HdZOTa7TUxqH/VFOJ3fPGpE9TQ+IAWoRCPqP1 l588b4cI2tqSqABGtU1vH1BZSUooaLf/Rm7Gb/cMrGNdwEpM9/QXHdOqVNzN2uYvbrarGiO+7 vVBrLJ/8YIV503YDc+3sfcb81oV0GYL7XossniAEpObVzXI7e7k8FhneP2//ra3kpug2ADKCp FuIYk62IMx3k8X5qMYECpjzOiHVu9L0L3O5CMA== Received-SPF: none client-ip=212.227.126.135; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_NONE=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: Richard Henderson , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson All targets now define TARGET_ARCH_HAS_SIGTRAMP_PAGE. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20210929130553.121567-26-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/elfload.c | 4 ---- 1 file changed, 4 deletions(-) -- 2.31.1 diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 459a26ef1d93..2404d482bafa 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -30,10 +30,6 @@ #undef ELF_ARCH #endif -#ifndef TARGET_ARCH_HAS_SIGTRAMP_PAGE -#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 0 -#endif - #define ELF_OSABI ELFOSABI_SYSV /* from personality.h */ From patchwork Mon Oct 4 07:44:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 515162 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1150681imy; Mon, 4 Oct 2021 00:57:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKtA4w9T3Zb0ju9Zi4c/M9jiaYXMOVcg1y13mCKZLA2bhqLlCYXWsH0kHgj8CZJbOg2rif X-Received: by 2002:a05:6902:510:: with SMTP id x16mr13242377ybs.287.1633334278302; Mon, 04 Oct 2021 00:57:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633334278; cv=none; d=google.com; s=arc-20160816; b=iRNPJRzPjveNGkd97SzPTMUyN8x3y3Uf1psebSTBqHzKkFvg3J8rraBhcaZGaJ3Ozm xwSRA/y/ZW+6NuANYQ8GR2OnJnrmqwSdO/f0np+iH2jEGx9ms+QKIrbhbngyHxWDF154 t/sa2sRpPDz8jPCilfc2lea72xopNq8aSYUN4MD7wvGm/R71Gx43tTJpgVcYdoWeIwZO Qe5aNZASlclJniEMOIl4SF5ziSYgNctKFOFJJhmp2QS0VZi/ty3IErHNILKXnmQRbkBk 9HMJFQpgp5zgsv85l+AOakoQ0qaNSuSGZ7hJbGkikboTq9YOV/TM+/uDW6UymBggU6tV cbZw== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=Yh+pg8TaUTA3FSAolYZFHNtXCGKpsZBm6mSLpup8nwc=; b=JyYf7Q6kk2/uQv41NMw4RYCxSnEJIiA9CnPRNtDiWIWyopHL+j+w/U2w4sl2IEDXUh humbwlrG2CmQNvucGi0FSCYC0dnzHLwGTcwIoFlebW8Fn3WbdK8BA8CcQNlXlu8GXpiW DayBUCEUx1AHuRFMWD9i+MeW/nHudDe4bZBVzH90HNcrNPfulIt1lEiJ2VX8c53zZbqR C++TheraTuBADxobNWUT42eO3c/9I3bYlrr9qkIXs11q4eWulAtta/X+qL9GtnIrKPUm 23/WNt16T6pHV/RH0rexXZc4tD5B7DFgxL8cBPIpW9kQC39hdV/a4c7KV8gUzimD44pc f1yQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u81si16694874yba.217.2021.10.04.00.57.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Oct 2021 00:57:58 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:59604 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXIrF-0002mD-M7 for patch@linaro.org; Mon, 04 Oct 2021 03:57:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44250) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeT-0004LH-Oi for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:45 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:51831) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXIeP-0004vW-D9 for qemu-devel@nongnu.org; Mon, 04 Oct 2021 03:44:44 -0400 Received: from quad ([82.142.3.114]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MV5rK-1mP5gf0ztW-00S7ie; Mon, 04 Oct 2021 09:44:39 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 26/26] tests/tcg/multiarch: Re-enable signals test for most guests Date: Mon, 4 Oct 2021 09:44:21 +0200 Message-Id: <20211004074421.3141222-27-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004074421.3141222-1-laurent@vivier.eu> References: <20211004074421.3141222-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:Tcu0udpoESPKie4FDxActY0GmyegS0o83Lu4WhRX0+qwW8ZPWZd 3oybT9Qa4LHuaG8q8Y7RjNKHafaPpq7MliasJUGmox9r2lOKP2/06+eU9LqtcT2YbU6A/q9 I7+RopQaXWrTeZBzeOCRcX7oHwaXxNw6D/TXoVfCeEtH36wX+q/6nuE3Ae6xQZn3pKw7cXm Yp8zYQ4G8OqWHy9/VoqLQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:fyGM0cK832M=:rcibrdgDs3LF5Zzhpy8oMR Bam7Dk1PdCTnAWsoXsooeXhCvl2+mCkyAUoHVotAZAY2ttcxQpe4h4WWQ0GmrXiX7W6aj0UyT qCrXJBUXw8TiDPySLiZlyPxmi5+XoBpMlsOJ9dFNtZ/K0tD7EIVdM8Dzn1v5bxtgUT1kkU9vT YnU47zpXs5Re5Uw1/ZTxclfb5+GfS6Ue8xYr98hltzTTeKlXtoHfh1YCLLF8UVs2TQxHmIKOo lGD+9X8fgXvSo7kUPJahr0zx0pzUTcMt0XoGZ6m7EX9+YpOw8LBCE4ZqdymKN20X7i0La/cKi P8ZkUmYKBdXM/anxMCi1hOFch4C86k0QYfvhsdZ+e8BEouW25MYAjrIdU4avJ8ivVazQfDrI7 G02O3NHqNUH2ILrgwKX9cXV6+hCw/8jUlCHqF8yyFU0NO1fHuTCC60IFM6imJv83pF4lvKAxC 8J1maaCXwYXnxKV/DKTutGGsp7j6sweAHDzscM3H4i3Hcj39B/dy4efXvhxbJT4PU/mYnTOYJ aEpJnj1bGEIDKQW17sI/Pq7/HXIloLdSm1Vx4vDdUwZUArCr9NbFvxW571LE8rOqd2EfURQui A3iX15Ykf+ysHRcLAducfFesubwWICsKc2pjhePseTzjxv7Ph8XuxyNg0wBxfOytj3S2sCjVD 3M3VxkP6gjn13qXXMFIJpeH7WJGkns+lbKokm3QHl/WamMCz7Iedhy5T6sPcxiA/gZVxUNPxM C3xxFK5n0BqrC5npDCmwM8J60+1R146d0fvxFw== Received-SPF: none client-ip=212.227.126.134; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_NONE=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: Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson With signal trampolines safely off the stack for all guests besides hppa, we can re-enable this test. It does show up a problem with sh4 (unrelated?), so leave that test disabled for now. Signed-off-by: Richard Henderson Message-Id: <20210929130553.121567-27-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- tests/tcg/hppa/Makefile.target | 7 +++++++ tests/tcg/i386/Makefile.target | 3 --- tests/tcg/multiarch/Makefile.target | 8 -------- tests/tcg/sh4/Makefile.target | 7 +++++++ 4 files changed, 14 insertions(+), 11 deletions(-) -- 2.31.1 diff --git a/tests/tcg/hppa/Makefile.target b/tests/tcg/hppa/Makefile.target index 473864d1d468..d0d5e0e25761 100644 --- a/tests/tcg/hppa/Makefile.target +++ b/tests/tcg/hppa/Makefile.target @@ -5,3 +5,10 @@ # On parisc Linux supports 4K/16K/64K (but currently only 4k works) EXTRA_RUNS+=run-test-mmap-4096 # run-test-mmap-16384 run-test-mmap-65536 +# This triggers failures for hppa-linux about 1% of the time +# HPPA is the odd target that can't use the sigtramp page; +# it requires the full vdso with dwarf2 unwind info. +run-signals: signals + $(call skip-test, $<, "BROKEN awaiting vdso support") +run-plugin-signals-with-%: + $(call skip-test, $<, "BROKEN awaiting vdso support") diff --git a/tests/tcg/i386/Makefile.target b/tests/tcg/i386/Makefile.target index a053ca3f1532..38c10379af0f 100644 --- a/tests/tcg/i386/Makefile.target +++ b/tests/tcg/i386/Makefile.target @@ -65,9 +65,6 @@ run-plugin-%-with-libinsn.so: -d plugin -D $*-with-libinsn.so.pout $*, \ "$* (inline) on $(TARGET_NAME)") -run-plugin-signals-with-libinsn.so: - $(call skip-test, $<, "BROKEN awaiting sigframe clean-ups and vdso support") - # Update TESTS I386_TESTS:=$(filter-out $(SKIP_I386_TESTS), $(ALL_X86_TESTS)) TESTS=$(MULTIARCH_TESTS) $(I386_TESTS) diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Makefile.target index 85a6fb7a2ea0..3f283eabe6da 100644 --- a/tests/tcg/multiarch/Makefile.target +++ b/tests/tcg/multiarch/Makefile.target @@ -32,14 +32,6 @@ threadcount: LDFLAGS+=-lpthread signals: LDFLAGS+=-lrt -lpthread -# This triggers failures on s390x hosts about 4% of the time -# This triggers failures for hppa-linux about 1% of the time -run-signals: signals - $(call skip-test, $<, "BROKEN awaiting sigframe clean-ups and vdso support") - -run-plugin-signals-with-%: - $(call skip-test, $<, "BROKEN awaiting sigframe clean-ups and vdso support") - # We define the runner for test-mmap after the individual # architectures have defined their supported pages sizes. If no # additional page sizes are defined we only run the default test. diff --git a/tests/tcg/sh4/Makefile.target b/tests/tcg/sh4/Makefile.target index 9d18d44612e1..47c39a44b690 100644 --- a/tests/tcg/sh4/Makefile.target +++ b/tests/tcg/sh4/Makefile.target @@ -5,3 +5,10 @@ # On sh Linux supports 4k, 8k, 16k and 64k pages (but only 4k currently works) EXTRA_RUNS+=run-test-mmap-4096 # run-test-mmap-8192 run-test-mmap-16384 run-test-mmap-65536 + +# This triggers failures for sh4-linux about 10% of the time. +# Random SIGSEGV at unpredictable guest address, cause unknown. +run-signals: signals + $(call skip-test, $<, "BROKEN") +run-plugin-signals-with-%: + $(call skip-test, $<, "BROKEN")