From patchwork Wed Sep 29 13:05:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514828 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:4087:0:0:0:0 with SMTP id m7csp8478jam; Wed, 29 Sep 2021 06:09:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwa8MVN1tMUnmtYKTSjNnu0iNUKN4IGy2s1aHCV0kJFkutagkUczngUH0FDMTZTRsiPCCb+ X-Received: by 2002:a05:600c:ac2:: with SMTP id c2mr360999wmr.118.1632920949158; Wed, 29 Sep 2021 06:09:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632920949; cv=none; d=google.com; s=arc-20160816; b=lWxghOi0hiBT/vN+Q9sJgfoeGtqO2UMmBrNkKhlslf7p7b981g8K8537inVjgHmrci N+8bhyYxJj5e3MVeSAQXbaLK/Q8YQOL3tSUDV8cHlGj/llEdFrq8ROplDkxgduu2ne5j sstE1yleMvvzA9b+MHYKLZI8BIozD4ia/nT6nJnwQNnwGLBCMMOrCV+LiYTGZ8xdXJP9 V/DTmBxcsWOtka+TjyLdtv52iHWYMtBnWU99+DLR4xp8MBgYMWRQEZ3fT797DnKMvv0h XfkyP/93vd8cZHU73c6Nqk3JIvZrFJblyfysNEKUtUPNuplwZd2WJZi/Wh+YWI7SeP0f garg== 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 :dkim-signature; bh=tmL+joXfoW+8Wn51iJgMBifiuqpS0R+kHN3F+bMNUq0=; b=V7mzdaHWLoqxA6xfsRT8X0yszO5LljfJOVS+0/hRhXfRBZYN/M21Fwy5KraaUGytRi Mnt7a1i9i0ZonPB2MA16RNmSlgJNIkmij0Vo4sbxAArHPCDqaHw2/Qx/kjv216QEneau etdMn3Z3C+L6aTp2cjvSzTbpbDbQRO9rq5yOFvjtlaeZJXfFvWjlJyVMpYXYU/8DIMxD Ijo8gHcI6Gco3JwSZDVI7NVdHAAx+HdqIuufZcKBrl7D5YZ3gvJxthN9Nw2mlWySgS40 G0QlrsWUUnuFbsp1JBEbB8ZKv6EnEP6aW1g974ZzfTkpew1zh7ErG1LJTiWPLW6x80TY r24w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="W3/43XY8"; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s3si2272144wrw.536.2021.09.29.06.09.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Sep 2021 06:09:09 -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; dkim=fail header.i=@linaro.org header.s=google header.b="W3/43XY8"; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34852 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZKc-0000Uf-ML for patch@linaro.org; Wed, 29 Sep 2021 09:09:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39084) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZHg-0005yd-IZ for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:04 -0400 Received: from mail-oo1-xc2d.google.com ([2607:f8b0:4864:20::c2d]:37499) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZHe-00061p-R4 for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:04 -0400 Received: by mail-oo1-xc2d.google.com with SMTP id h11-20020a4aa74b000000b002a933d156cbso728725oom.4 for ; Wed, 29 Sep 2021 06:06:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tmL+joXfoW+8Wn51iJgMBifiuqpS0R+kHN3F+bMNUq0=; b=W3/43XY8bHaGGHmnCw7HV+qJgnZt0ZWfKU2X1FkPklS1TUAulNtWe5RVdppZVXXsGC fHpNig3+eOLRYpUYuShCkDgir1V2BFIeOZYM5RklJWteXhzk52FqPeFMWAXTHPF9uM/R 12d6v7w5h/nXSwAQ0+uHHGTtd/IVveIhijkkB7wjp5Yv4Aw2KydKbl/ZY/COVBVYKbPB Hc/glQrwZyDfqgLedMDXZJ2GeVGo15sxk/p82RTKlg+u6R6SfUwCZ6RhkX3S8FTfQxLB 3TDiXlWYT69gHpxD1xDavHasY2MEgZtC3nskuNqeQ5BSWWfZJq+/tHseqIy8BRW2ZG1n 9a8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tmL+joXfoW+8Wn51iJgMBifiuqpS0R+kHN3F+bMNUq0=; b=C2vC2s2PpwtyXeEjf68AR1yzTtvxmqtns+LBwP8jMkYB/b8OmiiUtUscoFL1avGgw5 +Z9HhCxBTZh/5SF6HwjNwB/sxWuWL8oZx5NacFW/7ic2P2kF2fPFvfkf7pM7sIE83TzP wYvoh/PFixjuGqtnwpSsgeXF0hYm0LAoD1ORhcrLiyn+SmpT09SE7tT7MOmsJkzcUAqG u7rKqXYYlzPDk9BYOpjauGHSSG0lvBubhsFlDnsYKVDQ9lnLgC78ZCQzdXhUINv4YoJz +9H1uBa9H/EwCQSzgMD+wriiu3psIZfsLKCL3LuiNLQ0ValeIfTr/DE58I3Sa1Aw0Ci7 sQNQ== X-Gm-Message-State: AOAM531EZ6A3dp2xKsMqHQK+cBcRl+v709F4JvT69zNJ0GToOV9qVIxt rbbpEMtbCGLuOG7futZC5l4zibwD3OFJ6A== X-Received: by 2002:a05:6820:28f:: with SMTP id q15mr951359ood.78.1632920761302; Wed, 29 Sep 2021 06:06:01 -0700 (PDT) Received: from localhost.localdomain ([172.58.171.248]) by smtp.gmail.com with ESMTPSA id w1sm442823ote.41.2021.09.29.06.05.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:06:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 01/26] linux-user: Add infrastructure for a signal trampoline page Date: Wed, 29 Sep 2021 09:05:28 -0400 Message-Id: <20210929130553.121567-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210929130553.121567-1-richard.henderson@linaro.org> References: <20210929130553.121567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c2d; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Max Filippov , alex.bennee@linaro.org, laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- linux-user/signal-common.h | 6 ++++++ linux-user/elfload.c | 18 ++++++++++++++++++ linux-user/signal.c | 3 +++ 3 files changed, 27 insertions(+) -- 2.25.1 diff --git a/linux-user/signal-common.h b/linux-user/signal-common.h index 79511becb4..7457f8025c 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/elfload.c b/linux-user/elfload.c index 5f9e2141ad..459a26ef1d 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.c b/linux-user/signal.c index 2038216455..14d8fdfde1 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 Wed Sep 29 13:05:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514829 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:4087:0:0:0:0 with SMTP id m7csp8755jam; Wed, 29 Sep 2021 06:09:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyz4/rXGlmwhvoYY0blW84CjOhkVaZS5D3F0ifzXb9qaAdAoWb7XA04QpkdX6sFpLH4nPCe X-Received: by 2002:a05:6000:143:: with SMTP id r3mr6617315wrx.91.1632920966031; Wed, 29 Sep 2021 06:09:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632920966; cv=none; d=google.com; s=arc-20160816; b=RTQlgESusjD1hXRG4xGHi8FW25ZZE9g7S/h69CED68BnOBDvf2Cr26RtqfOAJtduDS z6ZGvq6K3HghFrSPzEIxTJy2X3pQw9p9fLfi72Mgi+S7SMOHuL4JvkER2p3XNxuqokhJ jZtl2uJoYebCV7A1kVUX56UV2QQhqKpqmuesAU92YcKM8gsKWryvtYqxh516AH31vcYZ wSGtfyGwjWEvh+HEUbuTnfK6SJwMalGkQ1TiC3+mIXjCWBqxz7dZa9NbmPogLSCJqh2W GYARJej2LDeNqWSbAUlorJKStOGH7o359F4Hnq4dXQxMOK2uIOaFKkltMLIphFuvuetG q3Ng== 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 :dkim-signature; bh=VOAvx3TChGYyGqXcRBxcpjzeCX+UxKswiiX03Eo6C3g=; b=HMIUVvec83vZPJi7wCaoSeZk6TgkKKT3jQJ4rXjy7y4Ay67kFTIyTg3fyJxoVW+Va7 jJyr1UtWi8mwEZgzK2QU460rQwdNWHnHQ0YQfXt9M4EiwjFVWhvRLN+piHHaaD4DU1AP uh9Mhg8bRfAh88csSNgbxTT4QvaP9zeG3xqVwaBppXpmvAG2LoPQ/UdCA1ZTQzBsDTPZ 6bmnECVTk5urrA5bYxIQcr77HADmqLs+JPJLo06usK28LLIWZ1mmZ2knCyMvht7OUdCU AZaZr73BYAb/1xHXRVQIYyE/2ja0fcuzdzUbXII43b1CjJcVr78w8vqJniM2J89OeTLr EiHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=CLa6Bceb; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 8si2985874wrz.91.2021.09.29.06.09.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Sep 2021 06:09: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; dkim=fail header.i=@linaro.org header.s=google header.b=CLa6Bceb; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:35450 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZKv-0000uV-4X for patch@linaro.org; Wed, 29 Sep 2021 09:09:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39108) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZHj-000664-5m for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:07 -0400 Received: from mail-oo1-xc35.google.com ([2607:f8b0:4864:20::c35]:33600) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZHg-00062u-Ps for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:06 -0400 Received: by mail-oo1-xc35.google.com with SMTP id i26-20020a4ad09a000000b002a9d58c24f5so737730oor.0 for ; Wed, 29 Sep 2021 06:06:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VOAvx3TChGYyGqXcRBxcpjzeCX+UxKswiiX03Eo6C3g=; b=CLa6BcebyJSQGf8uPtebpFpdlIR8YRDOOs+qO3M7/M1ZB9o9yRtfdv/5GOjqwMhRB4 IrDQ1X3NDzAL33CsZF+fzpsAj5W6TDjvW84p1ijHroWk1XntBmJeL7RLUna9bqcqqFQ5 bQXsHuPskH2QA+cCGBxcHoupaqLl9JwwgPgkYWpwpWO+iXynsVlFN2x7iWgxwxy/VnyB o3Bm0SZorbLl8a5sphnD2On8na+bRzc5Skg4JapuFZz+wyJZbYDQx4FTGPz0gYVqT9ot JDsyoA33o3Jjbo0uUc7qj5QdrJMDcf2fVFI8AI/055S6SlmcH9BB69SJiRDUkuCmaz6s JF/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VOAvx3TChGYyGqXcRBxcpjzeCX+UxKswiiX03Eo6C3g=; b=1qrtJtfMGdWregdnc1ngXuRICAIrAaIq3VDyKNbpv2r6ApvighOye8Ax8GWE71Bler FbctzYdB4LmCjY02OW2qRz/B0Vg0RgQX7TRkXAYVoAxoau3iBaaR0ak8FxYlP5L/cN8C J3E8UlXGlYzOSEiQAn31vaMrlOo+kl7a0IMnM+fMhD5/TMZjIk+h9kbWTLD7LJ/Czg0U 94ndVN1+K95T/CfTOA8BSOmonAe/TU7RDYewpwsxHvKJqcHIGVpoWRkUksdt/Hz/Xtut goGKFqfEeu7EVLzbFtpiUFdRhwhyUhxz+1LgYpIiWkQwsrbi8p0+xRswQr10yPyxTKVb 3YFg== X-Gm-Message-State: AOAM532gCjmWJ/Cx+fMDfmv0ima7HCx3NYC71R5qoBt8aMDnETrAN1yr VtVF1clcVT6o2oL5zPL01ZdkXvY30XKmuw== X-Received: by 2002:a4a:adca:: with SMTP id t10mr5458561oon.19.1632920763588; Wed, 29 Sep 2021 06:06:03 -0700 (PDT) Received: from localhost.localdomain ([172.58.171.248]) by smtp.gmail.com with ESMTPSA id w1sm442823ote.41.2021.09.29.06.06.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:06:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 02/26] linux-user/aarch64: Implement setup_sigtramp Date: Wed, 29 Sep 2021 09:05:29 -0400 Message-Id: <20210929130553.121567-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210929130553.121567-1-richard.henderson@linaro.org> References: <20210929130553.121567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c35; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc35.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , alex.bennee@linaro.org, laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- linux-user/aarch64/target_signal.h | 2 ++ linux-user/aarch64/signal.c | 34 ++++++++++++++++++------------ 2 files changed, 23 insertions(+), 13 deletions(-) -- 2.25.1 diff --git a/linux-user/aarch64/target_signal.h b/linux-user/aarch64/target_signal.h index 18013e1b23..7580d99403 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 */ diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c index 49025648cb..29c52db3f1 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); +} From patchwork Wed Sep 29 13:05:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514833 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:4087:0:0:0:0 with SMTP id m7csp11682jam; Wed, 29 Sep 2021 06:12:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/09kN8iwEJDACJFP15SzSYSFLaW+WUvLQXkhniqdbLpZUIICDgp8W/1XdY/RRdV+440D8 X-Received: by 2002:ab0:8c1:: with SMTP id o1mr9972138uaf.113.1632921156893; Wed, 29 Sep 2021 06:12:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632921156; cv=none; d=google.com; s=arc-20160816; b=R71St1Qf039M8031WFGplFImXdIKkxT11N5uCMZco+CZykVrVYRUIq5KQK5BGnFxBR bjI8dSRjg7Tc0+Ce4xnrS6br7BmpzOgBiPNVegc6ACC1db1rWJpUevpz8uvvsJbgBxi3 rU15/qDq1NXAtOTgRFPU/E3Vi+iHQM5PX3j8NayvKVBOdUZjXQm3TsMTmA9GoBLgvVSK q0rB62dXNjlJJ0iLiyPHYacxK9q34r+le3Xl0NMSuRmx33HVsS9aBDvPb/GNO4yjMvy8 tqM9LS33L6E/dy6GaKR1+jOvPV3cLf4+nD+ryREBQsr7XT0epyxcoEEaUPRCukkXdg/o d/qA== 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 :dkim-signature; bh=qw4dD1OgISmN9k1dJ+QkWah6FxPb8XtaJuuTt7cvGa4=; b=zDZg2vkVtchs3iHCC2buNbUfwvL1YFRjxVw/wxpPyq6lXByAl2/whACOe1rnwatBHE m+BGwBDtujG/Srb7mPfhYRhLDLUMwbiOrMQNeKsov/vnL5y55owMlERK26Xoo7bRo+zr bIqSMZsxfIT06x9ziHoTAyjMQKXAiogmAjl2E7p2t2EVW7p9vdSSsRyIKDd12+5Lyx/n +N7pwX4IxmvRq3GNyxi/KCXpM90VbSyF+bypVrY3y0CTZkKPq+qSFDjKE5aSgIpVYz8M eIUcVYOQ93smYehBSbVVIx4dpaLc+/AcVRD40Zzm2jT8fiLfIIU5m5/xKbrLw8US/vRd S/Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="FWme/Yqq"; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d126si1597669vke.66.2021.09.29.06.12.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Sep 2021 06:12: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; dkim=fail header.i=@linaro.org header.s=google header.b="FWme/Yqq"; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:44006 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZO0-0006gk-8b for patch@linaro.org; Wed, 29 Sep 2021 09:12:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39126) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZHl-0006CJ-08 for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:09 -0400 Received: from mail-oo1-xc32.google.com ([2607:f8b0:4864:20::c32]:36792) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZHj-00064A-3b for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:08 -0400 Received: by mail-oo1-xc32.google.com with SMTP id e19-20020a4a7353000000b002b5a2c0d2b8so731926oof.3 for ; Wed, 29 Sep 2021 06:06:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qw4dD1OgISmN9k1dJ+QkWah6FxPb8XtaJuuTt7cvGa4=; b=FWme/YqqeNwrcBJ+/zGocJTw661TTLENqN+b7XHHdVcUaCWuv0eOSNYs4+AAh8Q+yQ ChMoyJDOZzLCfmQ3XV0iSkZZL4r1hoVX7SptIwwXh1TY38OG8WYAYUOmINVdiJVK5DSL rl17GLpwk3KEIhqCuYt/0XLWxN/Eto8Qwu4jKKxcZ9Zov+sEIv8SUj19EvGLgqOPuLhQ 5ooLdzZ/NGAqY2/YTbhx1DGYRn+1B7In0xWxdqXJltzQASzVLmkY7hEwAFjbrAhqwcx1 cAzPTfWxQaf2bUpAp01L0PSYTvProczCf3YJExj8bqeBTFRYUxXMwlh+32maw0/ZjjlU tATA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qw4dD1OgISmN9k1dJ+QkWah6FxPb8XtaJuuTt7cvGa4=; b=MvhDOoueAZYtphYSLwaglCNmIiJlJBF+czyk1MNxDRttxDdahL60mo6dZOOf021kkt SDDw67wkhAf2d3Bj5f9RuTMoLnkN0vXtrBNogxpAEZZsOiRucE9BbBBlSJdYMBxJzvf4 lrsV2hp3Nv+XEfZSNnzbyVfkndr7r5YfhpDJIRIfhftur9fC54z/yF0j2GueY6LPMxCw TArfJkK3nsfJtzOlzr4m07PL9XSxuECsYwYNq9YnNz1Aix4tayjZBZTO3gpw5dpUp6N8 qFt3Sq/slTVnbSrA4s4O0EAdj8QmlxAvuiebFKAfX9hwTI5etW4Pcj4zxk9qU4AEJ0FA s/dQ== X-Gm-Message-State: AOAM530GxVekI2mYaPyjxRqv6p/clZN7bWkl+8HPMHh/4Z4klA0XGAcv Kd0S4v/6lkH0CqxTXHlFVhDAG7uc46Mf0A== X-Received: by 2002:a4a:a9ce:: with SMTP id h14mr9663616oon.89.1632920765951; Wed, 29 Sep 2021 06:06:05 -0700 (PDT) Received: from localhost.localdomain ([172.58.171.248]) by smtp.gmail.com with ESMTPSA id w1sm442823ote.41.2021.09.29.06.06.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:06:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 03/26] linux-user/arm: Drop v1 signal frames Date: Wed, 29 Sep 2021 09:05:30 -0400 Message-Id: <20210929130553.121567-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210929130553.121567-1-richard.henderson@linaro.org> References: <20210929130553.121567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c32; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc32.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , alex.bennee@linaro.org, laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- linux-user/arm/signal.c | 220 +--------------------------------------- 1 file changed, 4 insertions(+), 216 deletions(-) -- 2.25.1 diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c index ed144f9455..d0940bab47 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 Wed Sep 29 13:05:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514827 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:4087:0:0:0:0 with SMTP id m7csp7156jam; Wed, 29 Sep 2021 06:07:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZ1dBZirMFFGDvFwoISFGWC4381docYAjfmgHrJ9u0wvO+VcI/0bBB7dpWJ06vEdCzBc1E X-Received: by 2002:a1c:f00a:: with SMTP id a10mr10188493wmb.112.1632920863646; Wed, 29 Sep 2021 06:07:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632920863; cv=none; d=google.com; s=arc-20160816; b=qQC7LFo098/Cw/VBFU8d7TM643bS95mhT+ypkV7LLmNKvFYuJEleBM3CswSADViYp1 5nd3SncEHLHmEHpGiKDaaY7TnHf6Q8T8CGuaszMMODftPDEMq2hAwCOChHKusVIb6Fa+ sY5R3bnojfCo2BFh1Ddk/WILRTRR2qxJKHsYXZb7G2veBX5gPbw5QXm7haIL7bt/yMI4 bXQzilhn7xVzaj/O6CskkgpmxHNU4/2+rCGz9mHOMyrAw+rsxx+h3CYQCDI64lnifioS S32a5BvT5TVGJ0uArrM+pJzMgeWnRrt35QK7o4QK2WT1bJgR1NJ8/UCKaoOCB556Dl0j q/vw== 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 :dkim-signature; bh=Ix3gXlqnervNFIKDwCYoxZx+7RHohDod9PWp4e0JtEc=; b=CK/9uHtmonUqgAuDACSNUOJNcX9lLbarpY1c3PSrPrtzC7OUJthMaDxMkOOezVoq1S k/M0DQgZzHa6Y/eAC2E9gCbyZED0ufsp0qwCjHroXZZHjXhlHkRYm0ErIMKbEwPUdC1X cstS5h4ANVFIA0GAmDoNWZX5kX1SkgXhwy+HiqIMEwLLiIr1S2w9G/wmT2Yj4VJQR9pB utEkgTbZw/qDMzzhOMl2HdFCXusQ9y/GcYqjIT5+wErNduR841cTy4yg/HeY/rVL/Gmi dwo6JcwMU49IWuWK9PuFgdTYGqZZS3Y9rnUO9ExXqTFUftY4rxU9wqLGJJZnWXDwu2f+ EHyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YpEkiuXd; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 207si1535498wma.177.2021.09.29.06.07.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Sep 2021 06:07:43 -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; dkim=fail header.i=@linaro.org header.s=google header.b=YpEkiuXd; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZJF-0006Oi-2z for patch@linaro.org; Wed, 29 Sep 2021 09:07:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39150) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZHo-0006KE-CV for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:15 -0400 Received: from mail-oi1-x22b.google.com ([2607:f8b0:4864:20::22b]:35789) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZHm-00065m-EX for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:12 -0400 Received: by mail-oi1-x22b.google.com with SMTP id n64so2811593oih.2 for ; Wed, 29 Sep 2021 06:06:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ix3gXlqnervNFIKDwCYoxZx+7RHohDod9PWp4e0JtEc=; b=YpEkiuXdnOElJzpWiDaGq637v5j75bR9cWG/mwBusNxNQnGmoP4BEB8fqZohG7/Iaw Nf4GH0hcfXhL/oj/ESfAfBsx683ETeaMEd858uxwu05hgvJ7Sn3If4OvmAp8zBRwdEfi CbClGSEuvNEuElXxctSPnjpVjHucwEJhIYRsdrz6gnVnixpxDqStMmO56OEHCFC4F41U 24KUhAtK+1YJSZJIom+ZV4EVZkpp5TT4spUCY/WRUG3Gr+muzRqI+H9OKbVgvdoK0TEN xSpnvNMgnlrQFlWYT8jkhGnGUvwuyGyP31QbRynb9kggHWrmcNXrPFCWdglPli7vLFWq lFZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ix3gXlqnervNFIKDwCYoxZx+7RHohDod9PWp4e0JtEc=; b=pXverbcTmQ5k8Low14E8Kas07dxKeKlpTiC42i2OnxNPapqnWh0eMRa76XJhrQC0pZ Kn7AW1ZEj0YHm5kRGVS2sNoRoSREm9D+NDsEzeZu2HnCEtpBaglUZiALNq4AfP839YdG 8kU808erN4rMJbZNc0NnXm1ycF5ssI4FrrhA7BFZBuC/ozsWlFn2BHoAAP8PGMfYLNw2 G2IJGaml/O+Q9fZtx38ck5qq+uzCYMGHexjT5KbtOrjWcLtZgEPUz9ujzLdqcl0DPPBS cjx+LKfpTkKoxJJxXD3iGdJQurnKOrvGkYLaKpo28CNcQAa740XaUOpmjkNP8bj/7oT2 v7dA== X-Gm-Message-State: AOAM533zQSz3NwbazxwAKlTHkdVMVThPydpwv58TWGbEVEP9Q4o6CCay MUmfYKpb0y0EaVxPe7zPCrsn9DwwVggkmA== X-Received: by 2002:a54:4e98:: with SMTP id c24mr7720140oiy.159.1632920769113; Wed, 29 Sep 2021 06:06:09 -0700 (PDT) Received: from localhost.localdomain ([172.58.171.248]) by smtp.gmail.com with ESMTPSA id w1sm442823ote.41.2021.09.29.06.06.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:06:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 04/26] linux-user/arm: Drop "_v2" from symbols in signal.c Date: Wed, 29 Sep 2021 09:05:31 -0400 Message-Id: <20210929130553.121567-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210929130553.121567-1-richard.henderson@linaro.org> References: <20210929130553.121567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22b; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-?= =?utf-8?b?RGF1ZMOp?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Since we no longer support "v1", there's no need to distinguish "v2". Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/arm/signal.c | 155 +++++++++++++++++----------------------- 1 file changed, 65 insertions(+), 90 deletions(-) -- 2.25.1 diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c index d0940bab47..ed7d1d80bb 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,51 +363,38 @@ 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) -{ - struct rt_sigframe_v2 *frame; - abi_ulong frame_addr = get_sigframe(ka, env, sizeof(*frame)); - 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_v2, info); - uc_addr = frame_addr + offsetof(struct rt_sigframe_v2, uc); - tswap_siginfo(&frame->info, info); - - setup_sigframe_v2(&frame->uc, set, env); - - if (setup_return(env, ka, frame->retcode, frame_addr, usig, - frame_addr + offsetof(struct rt_sigframe_v2, 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); -} - 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); + struct rt_sigframe *frame; + abi_ulong frame_addr = get_sigframe(ka, env, sizeof(*frame)); + 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, info); + uc_addr = frame_addr + offsetof(struct rt_sigframe, uc); + tswap_siginfo(&frame->info, info); + + setup_sigframe(&frame->uc, set, env); + + if (setup_return(env, ka, frame->retcode, frame_addr, usig, + frame_addr + offsetof(struct rt_sigframe, 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); } static int @@ -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 Wed Sep 29 13:05:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514832 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:4087:0:0:0:0 with SMTP id m7csp11672jam; Wed, 29 Sep 2021 06:12:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYXwr7dIYH62q6M+roHaLwhEzpqJGPHaPBe/0xNmB3fWhhYLNur+r6umpTwdqVWidZr4XV X-Received: by 2002:a1c:4c0d:: with SMTP id z13mr10075614wmf.58.1632921156495; Wed, 29 Sep 2021 06:12:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632921156; cv=none; d=google.com; s=arc-20160816; b=I8DIztVG78hdpFdYYRT2bd3HSlbZuS6s6Vwv2Y6Z4ujLiGXEh7iKE5hrRsvJeC7FAg ikXDWI/P/FZpbhESY56QFVWLRn1AC1/N1kNJpUXPHKe747bBKuF2DRBnKW0svHvwzImi N18v8GtZNAizrAQ9wZIG6Nf37ZYBaijyMmDf0G/TipTja1Nzv6frrd7Qk+gwnMosxlOZ ugY0buEGGW23dnDFAks0KLrm2+mhsa9i1Z8AOKdYJg4mZ5LwmLYKHJjDsP+nwi8mH81T zQFpZpPYZ6zffEUGiTCxUlTyQmwVtlbEbXXqydhMhi6Y+CyaSbKi2QSkqb2T3Uhs+Cbv p10g== 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 :dkim-signature; bh=0r+E7RiJr0wNZif4tofij6rNBC+53jR8hadrEfCYx9E=; b=mbtV4gIXBewU4Y3gEdokWU9hwOPhYlKMN3ADR4u2hzXv8+uJGKQitdR0c3+O2Zt0TI k/muS6MBDmzvRfJYwrGu/h/mbh4ZeXvVT2yvkjpdxuJKJW/4TRAETHZfM/fGDgpQxwsW QMOaOJxtlAtpWSDS3dAJm+lchWqbas/5FBelRO28wjQ+qKL+25XhTn14LqL8mXgVt33l yyzYgO01YvEOX1XKv9NPmrymBbqb/0j3IvCDAhYoeXWy2RAVih5QMTQjFcDkyAyuBozQ f+WwhKryPGpsX9E/h4rwYO0SzzOWmNUt5ba53K/3OomnZXxyj5DRLnPRTlXaSTswv4mB 7DLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=L4uEFr7a; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c3si2054052wmq.139.2021.09.29.06.12.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Sep 2021 06:12: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; dkim=fail header.i=@linaro.org header.s=google header.b=L4uEFr7a; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZNz-0006Vp-9U for patch@linaro.org; Wed, 29 Sep 2021 09:12:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39206) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZHt-0006R6-LA for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:17 -0400 Received: from mail-ot1-x330.google.com ([2607:f8b0:4864:20::330]:37493) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZHr-00066d-AK for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:17 -0400 Received: by mail-ot1-x330.google.com with SMTP id r43-20020a05683044ab00b0054716b40005so2760826otv.4 for ; Wed, 29 Sep 2021 06:06:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0r+E7RiJr0wNZif4tofij6rNBC+53jR8hadrEfCYx9E=; b=L4uEFr7a04vwl6FrnqJGC6AJu9CnBffn+xpoxYlkQ1QSHbUMOnybIxno+uJHuIE7/p Z410lH6IsV24TJNsoLaxYQSQirlVqqKbWl2x6E0fYd2kFzdQoUPQL8OkFATOa0upmkfY Ok26LiO18La/gCl6B3+9o/YR4hQK5zAJh7uKMmtCC+VuYS9hao4liknp9gk6+cRhsiBe eCk6jGPNGxY/hShWYy9YtcMf4dTby82ii1w9eKOZzqaH4fZTglfgwmKCQGeUOQdcMCxu IDNlroYX6pbh4k8Xw+u7jcGmH3DYTCESCEnGrkvcpV7h8iqxSiRTM1eeyr54ZEZqw995 5yng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0r+E7RiJr0wNZif4tofij6rNBC+53jR8hadrEfCYx9E=; b=wplk22/86Xh/4qUEUSJix1FNQwAVF3vAFM2V7OemsWwkgqo15F4BbShkzEqA3JxMrO TM3Szw85FblsmcVZ9ZPzyeqmervbT8DrjJawrVoUdDkqueLenojh8pJvvDzuTXKsIm4+ d0QIJHSXIFOARrs8yuK8CAwpWtqbiwLp3JPoYBq3HtIQG9nAVw/HLsU7kEwHylxSjC1q mxkza9Lr1sER/iwtFevgKHievWyp+eLQjFFgjlCWv1m2tGCRcJ5N9T4iZl6g7M5fzsGM z1Xdly7YOEPbP4yPn97J2eIaOi3kNdULFWbhx8taCVvxiuZdbXxQte78nP9YmIcqRAFw MFRw== X-Gm-Message-State: AOAM532KNdcuO71lgzcnit7ALKQjA5edqoBqPquc+eLcXIOpFicZbJf8 C15DMc3zhvr1u8ejskXPi3cwrbGSv+rlcQ== X-Received: by 2002:a9d:7b48:: with SMTP id f8mr10242913oto.112.1632920771081; Wed, 29 Sep 2021 06:06:11 -0700 (PDT) Received: from localhost.localdomain ([172.58.171.248]) by smtp.gmail.com with ESMTPSA id w1sm442823ote.41.2021.09.29.06.06.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:06:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 05/26] linux-user/arm: Implement setup_sigtramp Date: Wed, 29 Sep 2021 09:05:32 -0400 Message-Id: <20210929130553.121567-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210929130553.121567-1-richard.henderson@linaro.org> References: <20210929130553.121567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::330; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- linux-user/arm/target_signal.h | 2 + linux-user/arm/signal.c | 181 ++++++++++++++++++++------------- 2 files changed, 111 insertions(+), 72 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/linux-user/arm/target_signal.h b/linux-user/arm/target_signal.h index 0998dd6dfa..1e7fb0cecb 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 */ diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c index ed7d1d80bb..df9f8e8eb2 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; }; +static abi_ptr sigreturn_fdpic_tramp; + /* - * For ARM syscalls, we encode the syscall number into the instruction. + * 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. */ -#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 -}; - -/* - * Stub needed to make sure the FD register (r9) contains the right - * value. - */ -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; + retcode = default_sigreturn + retcode_idx * RETCODE_BYTES + thumb; + copy_retcode = true; + } - if (ka->sa_flags & TARGET_SA_SIGINFO) { - idx += 2; - } - - __put_user(retcodes[idx], rc); - - 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); +} From patchwork Wed Sep 29 13:05:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514834 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:4087:0:0:0:0 with SMTP id m7csp14672jam; Wed, 29 Sep 2021 06:16:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPRuzjniUBlZ5vhpX9mhCHSh+QpsySn3yyRFE2Mi/ktBhvkDx6LSh/9zBCcoJJl2ysN/Gr X-Received: by 2002:a50:d8c5:: with SMTP id y5mr14709889edj.370.1632921361819; Wed, 29 Sep 2021 06:16:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632921361; cv=none; d=google.com; s=arc-20160816; b=X03LFOFg9segEzyA4Ygmi+htCxTsblo/iUXsNPK6D/+qq22No6+Du/ZZH+GP6S0+Ns dXEwtUwr40Hok0MZ+p82u3U2JRbF/Yn+URnhTUeuyhNFqTL+vcGKhIx3xju+433tjsNY ZoVNrXRHpGbfsdMMy+ziSdQzvsY9SNtud8IJhyOWsWjya2gdTIsq3hFMxGkMa9kEiP4d gDn62JPYhZwGy5nxrhYDuP6VjwQq/U/aYESDr7sdQTANkXO00fX6qEVP9ei5dRhFwfxw XaY2MIpxfCSQ5hI/vXTCEMttqK6oTW4ypl/91zT3Q0zyOsjvpo9/SmDBdDDQbUFiB5ZE 3mxw== 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 :dkim-signature; bh=E9r1xAdALpfQj8Y2p7MHsD/Kt2/NgPJhspyOQqw2vSE=; b=RyanEA5uM69Lv92WXVGKUMnRYJvhZ2fazLBmcmZfMUxz5EWwLPGqwiScjzB6e53tve j2+SQC/0SgeR9GuBF/+yHWSZdGtk7nc5ejqWNFE7x+zNjSx13S8888sHPSnp+qkM8ubc rvNPHXA7p5NImPyTxMqRNbRdkVlAlacR6180BBUs6IJFbCs1Se2aY4TSs7R+58B59N0n ELdfglm46c+HiM/7OrPFyuiDgpOuExYHtNxTTrx8n0FAtggxKUHMH5MCjS+O1Ok1ut3t 5EPWnOlO4xn/OglJ5VCH8TQhcSWjpxTBWegkl1Jlpxmmp4rWNPzqFP281sUOF7z+ajyE qX+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=h+tH8fr3; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 13si2611740eje.666.2021.09.29.06.16.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Sep 2021 06:16:01 -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; dkim=fail header.i=@linaro.org header.s=google header.b=h+tH8fr3; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZRI-0002wt-Q6 for patch@linaro.org; Wed, 29 Sep 2021 09:16:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39198) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZHt-0006Px-4o for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:17 -0400 Received: from mail-oi1-x22f.google.com ([2607:f8b0:4864:20::22f]:36771) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZHr-00067A-Bg for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:16 -0400 Received: by mail-oi1-x22f.google.com with SMTP id y201so2808223oie.3 for ; Wed, 29 Sep 2021 06:06:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=E9r1xAdALpfQj8Y2p7MHsD/Kt2/NgPJhspyOQqw2vSE=; b=h+tH8fr3/9ZC1OM8M7fvqox3Opcx7g+eogUAnhSv+qlFu8DPXMHrKZkmZ82vCDXQR4 p97vgyx8ju6Q2cTovTpaOej7s9v7mfhom1yzYnDn0SP/3bfiIpa4YIzLXpVnqxy4pxIQ CycDEbKcoVyYMCxPYY/FraR8GoY8P9UgYv3eE2mN0SchepynHy8pQAaJovqsXMYvuWpP gpuhQboCv+l69azMoTtVYWfkBPT6G21djy9BU4H9r1nW2D157Gepbi036Nohie7dJe+i m94cw4gBw8PCJWf6AnCL67g9QZpbQWCar8m8gZRbjKu2SeUrCk8y2cr1ztEFXLF26XrD Y5yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=E9r1xAdALpfQj8Y2p7MHsD/Kt2/NgPJhspyOQqw2vSE=; b=CQyETeIhere7r/OXvmCIJ1pwjw5PIgTGoUE1oFCwHXLYFiFJE/Rhr3i/Ed1HgWNvQD s67zdKsKXA5kuecWcWRUyq3j3zAFsIAipvsXvjK5nYXQe4d8bCEsFbNFh4XMkoopekj6 b4uZmUTYv5iwBVoJuTKaohTkz2PLPlPBYkpB8aI7DKFbUeTxBVAoG3mpUYBB7yqHQHIB r1IDc15eLM5QFH8D6Nx3rN+QTU7VHyvtZap5z6y9z+f7hBY9VWgyQDihrZ3iyY1zhn78 CfLb5KV2rISBTgzgzrGrg9AEfYAC/FI8U0icwXEBrIYtcliv2DnFz+ogSGvqtuN0IauD z8YQ== X-Gm-Message-State: AOAM531xR+vzrO4OnJp1PdYP1Qik3BEuMkrftM6G8g+QnIC8P9RX88xs hRkmETlhOmJrcSLrYs7bY+YxY2kCPoiE+w== X-Received: by 2002:aca:e004:: with SMTP id x4mr7692435oig.155.1632920772755; Wed, 29 Sep 2021 06:06:12 -0700 (PDT) Received: from localhost.localdomain ([172.58.171.248]) by smtp.gmail.com with ESMTPSA id w1sm442823ote.41.2021.09.29.06.06.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:06:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 06/26] linux-user/alpha: Implement setup_sigtramp Date: Wed, 29 Sep 2021 09:05:33 -0400 Message-Id: <20210929130553.121567-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210929130553.121567-1-richard.henderson@linaro.org> References: <20210929130553.121567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22f; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-?= =?utf-8?b?RGF1ZMOp?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- linux-user/alpha/target_signal.h | 1 + linux-user/alpha/signal.c | 34 +++++++++++++++++++------------- 2 files changed, 21 insertions(+), 14 deletions(-) -- 2.25.1 diff --git a/linux-user/alpha/target_signal.h b/linux-user/alpha/target_signal.h index 250642913e..0b6a39de65 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 */ diff --git a/linux-user/alpha/signal.c b/linux-user/alpha/signal.c index 3a820f616b..bbe3dd175a 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); +} From patchwork Wed Sep 29 13:05:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514836 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:4087:0:0:0:0 with SMTP id m7csp15511jam; Wed, 29 Sep 2021 06:17:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+PFQEzDBmUaIuQlid19/K4ezp7ARqOgikBk1TBHul299VTgbsmHwowrA1a2bLFNnih+++ X-Received: by 2002:a17:907:9703:: with SMTP id jg3mr13977909ejc.449.1632921421214; Wed, 29 Sep 2021 06:17:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632921421; cv=none; d=google.com; s=arc-20160816; b=U9uZjcv9nDFhl0/Nk714FUxnyU5fSD3FUpgtPpqebC6uQMJUiYBI52Hd47K1cVmESU SyEWvr0ZdgZBiEAyhbqHhnq81UjFjpZySPet4xfCPNi9eopiA7yPxbsoTEojGYOJHaQE K7zhDrGl9pElXFg8JgoNG5II+ftqMfQtIS5TFLLOl6ADYNgC4kewJMW1lrTER8JpBW7P gOW2AsxFbJFpr8Xz2LpFS/JS7+/KAeQN7DZBn5qN/MT6lXmUt+V7YYUaLp+4ml/P46Lv ahSGrrr0XkEi7wAZ9oy8NJK45JyxDh6yktvkgdkfIG157FNcWydRET/+iXZd3E0LXlY7 RHDg== 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 :dkim-signature; bh=gwFLRVkTdcJ6AaaaGFzbcnne0zgO30rR8Nm1DoFMwjE=; b=BWjCHce7QydNj+Hun+ROBXkOYcrpjDr+a3EnlFVsYXvT1WHXd63nJ/OXvxDiix8l/2 WJOF5ulkc5BU+BCbz/jj6eQ+YnR5V5V+CE21pcaxJzufxPyygQLCnBTh/mvczOudm4cP 2qHnJnYBVtMtfce+mUV/JczdBkC4W6MTfjrMI1CgS9UMAWzdBiC8uU8yb3slrb5bsUFe YrX3J5xSup5tqk/BEf2rWEYOscT1NAZByAPa1Xm3cJWCnV6PsKiMH0BreME2KQBAnZDW /AW6+wlboPrna8B45mlu14lBT6rMfSVsI7Ga7uysF8LF385/R0OnDCbBnhnIvh9KG/Dr dTYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=tuAHU8Y8; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n7si2824081ejl.237.2021.09.29.06.17.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Sep 2021 06:17:01 -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; dkim=fail header.i=@linaro.org header.s=google header.b=tuAHU8Y8; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52362 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZSG-0003sk-5q for patch@linaro.org; Wed, 29 Sep 2021 09:17:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZHt-0006Rx-Th for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:17 -0400 Received: from mail-ot1-x330.google.com ([2607:f8b0:4864:20::330]:35573) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZHr-00068U-QO for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:17 -0400 Received: by mail-ot1-x330.google.com with SMTP id 77-20020a9d0ed3000000b00546e10e6699so2768920otj.2 for ; Wed, 29 Sep 2021 06:06:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gwFLRVkTdcJ6AaaaGFzbcnne0zgO30rR8Nm1DoFMwjE=; b=tuAHU8Y8jFPwSKMFL94UOY8tJclHW50/+CblAqou+4w9yhbRWrUfML/Idu4vqbEM/F UYeDFUmMHbfjatDz4K56P8PWFeAuADV0ByAxNcTikuZZf5xsa8iZZeFTRUOFl+mKFCah iiFf61+STLR37pf7QYtiQgU/TtXm52QtKWj11xvV6DByJKRaodULkcesyi7QFALWHVMo tbSlxjhtfALqR7eBC+wQ5DpqatGqNrg1V+EF46eOrMdEIKlUcBrWP2vUMvSI8qwnxJvJ FwtaOfQF+aMBtkbnn+qIXWmSkOIcEtNBRhkGVWgcsIlIo6HH3ZJfOkqyhRRLqg9h131p 7kdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gwFLRVkTdcJ6AaaaGFzbcnne0zgO30rR8Nm1DoFMwjE=; b=deY+Y5vD4Cc7OYVYn0dnYPMAy8xwSX5d9ZgyZ0MpZJYxUV4+9iCj1mMOMGgCv+bxEB 3ZGX5a5TD4lFhYUkJBOenbW9B6CDNeidYP36bRARzCUe58J5RIM8x+RIv8gmd4nwhmsj frseipH+kAIrEUlXSbHHH3nnf6H5wc2mU2+Y4totGr+5tHE89R8elaD+yv1OIKnfpxjo a6RKEWlgkDF/SsHRteFT5Mcz9pfgIlCebkOZcn2hX1JCddk2CvlrK3ATU5n+6ikpacVR kibfaOZNal5oYbe2izT62ftMvOPEA5YEQNchQzLDwS9Dp8IyoS2l/KoHh5eF4GfOpOSX ixnQ== X-Gm-Message-State: AOAM530LW5ekOf43XR28uDSAraiQCza/+VNSObrM/9cRje3y6Py7JzRs 13mJmNoUWU47iWOENIz4kaEiQfk+paMKYw== X-Received: by 2002:a9d:6396:: with SMTP id w22mr10176866otk.26.1632920774754; Wed, 29 Sep 2021 06:06:14 -0700 (PDT) Received: from localhost.localdomain ([172.58.171.248]) by smtp.gmail.com with ESMTPSA id w1sm442823ote.41.2021.09.29.06.06.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:06:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 07/26] linux-user/cris: Implement setup_sigtramp Date: Wed, 29 Sep 2021 09:05:34 -0400 Message-Id: <20210929130553.121567-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210929130553.121567-1-richard.henderson@linaro.org> References: <20210929130553.121567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::330; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E . Iglesias" , alex.bennee@linaro.org, laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- linux-user/cris/target_signal.h | 2 ++ linux-user/cris/signal.c | 29 +++++++++++++++++++++-------- 2 files changed, 23 insertions(+), 8 deletions(-) -- 2.25.1 diff --git a/linux-user/cris/target_signal.h b/linux-user/cris/target_signal.h index 495a142896..83a5155507 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 */ diff --git a/linux-user/cris/signal.c b/linux-user/cris/signal.c index 2c39bdf727..7f6aca934e 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); +} From patchwork Wed Sep 29 13:05:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514830 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:4087:0:0:0:0 with SMTP id m7csp10559jam; Wed, 29 Sep 2021 06:11:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylYsllIuugw82ND7A6NHpPsDo1nv3dpr+RLHyk9yr45jwSmv53KsmA+yK0k/DOZIba47IR X-Received: by 2002:a5d:6b89:: with SMTP id n9mr6656623wrx.372.1632921084895; Wed, 29 Sep 2021 06:11:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632921084; cv=none; d=google.com; s=arc-20160816; b=rdrkeTMp/w4TpKyI1GGEC4bVvk5PQiAgMcnt1smZ3IN3lt5U4om3fU0OU7J5HEVbeV Kl9UNGud+pYaua6BzFNLRYoDKxT3LMTY9MtaSTAAYo7X1VUeGACCr1r4jYaZzFrnzRt1 /YV1ADJgWTnvpWgWfqcHHbbSbInYRAPfuwbkvk+37RwrIEACwpGeOTX4z33ksCpnnCby hd8j8HODV9lxmbxuUVuAgDAkKsIGNT8C0IahTNxHcfvjZ1dulRebvSqzGC8d4wDvCBk6 ZEFw/pmVUWhUPYZZjiFMsh3ZTs/vHsJ/XaKIVKasHPn1GFnXw3lf4uQv+kMe5s4kJqFx SDuw== 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 :dkim-signature; bh=1f4aYpKsB+ja4QJ7hAEtER7A5IlRmh/mgnhLrHPEyy0=; b=V0lpVFGFsnU0XfdiimJoLhDxlK/vIdY6OHyS0E7S1KJeHPcMfUcCJGBqsW6DebP5Sa 66+CGQS1EV1CmeWyrJdB1WP+lRFNhz178+8A10+IOyZ4h5VQATxJuD/0ANW5+e1VO7ce 168uvrIhkSVIXRnFGswhaxIiLCXt4vFjrI6BqGD6Ika9CdcdrOdpg1ZyW64hTbNIgc9z VricbjrjXFYdM4M/yIDTY4yi9NrwQyhD7BF8jilIX9W/wQTmnfY3Vx801fnQmvV0QHpQ z0NTjxAWAItu9K3u+n6iftXuGXqESP30qjh1mXg55iJga4QPtnLYZy74iWUjedIA5ffC TB0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=lKMEdvbv; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 2si3744992wrz.407.2021.09.29.06.11.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Sep 2021 06:11:24 -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; dkim=fail header.i=@linaro.org header.s=google header.b=lKMEdvbv; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:40378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZMp-0004CH-Mi for patch@linaro.org; Wed, 29 Sep 2021 09:11:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39246) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZHw-0006aw-1m for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:20 -0400 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]:40659) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZHt-0006A2-NK for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:19 -0400 Received: by mail-ot1-x334.google.com with SMTP id l16-20020a9d6a90000000b0053b71f7dc83so2750115otq.7 for ; Wed, 29 Sep 2021 06:06:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1f4aYpKsB+ja4QJ7hAEtER7A5IlRmh/mgnhLrHPEyy0=; b=lKMEdvbvcFY/uSD1n4udJCgXqKjbImCTqkQ3svlZ40/BBqDWTqUyu6CyhL7cFi2xdd +Ga1IgBS8ck9SIP38aqwwlxTycZjxp+J6rWNgGGYnoKYufF/OSE8bpkmay4Hn6qf1/Sj tDyXlihSXbbAluIM4aLxFRqi+HyNkvsH1vE9w3J8l1wd+y1N3aW9yQVJuNYGPUoYMTc6 Pu/sLfV7x6Avn1B2INlsANK6gxIEzv2PBrcGUo5nzwW+By9lmK50ljumLoCBWBtzuGP9 ascmM6ghKYGY55hwZVTllnPDD2pYwVNsYJq3a9aLfE6NW8UNoQf3Oldh3awGpvuKqQry L72A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1f4aYpKsB+ja4QJ7hAEtER7A5IlRmh/mgnhLrHPEyy0=; b=o+3ayP/TfxxFx8kowtk3UmAwtYsCZ5x8jrhyBKr0Tgv7RA/W1Fe0Bm2C2iUM2Blhez /jkwj4D54DNktYlggHUAsfe0Acstml30xI/8aboKwsrJVJkFZ+YcWcIi9ZEuNN0QQX4v UPWSJHso9xTRcZDsrrs39ruEgjlquJUWE+Ve7EtCwoWnfizD0GQvogxUiGjYnuI17axa F5eHk+Qbuxmug2dXLK2GJvOZJEUVuj/E0SUtbrwitse/hLljG7s/kPCztAbXviqLKsq9 4Y+J3KzPg8wqoxTbmvI6FjY6+El6i4Yfr8xZzYJ8q561nerCjhGp+GRVSEYgPTmu2q3A oXWw== X-Gm-Message-State: AOAM532nzv/M0TGgA722RXSMtKG1w/RK11bKyHOeqJJTjvlZF+TRKq1v KuNg+WSONUti3yVryYUu36zdi8lid0lwAg== X-Received: by 2002:a05:6830:31b8:: with SMTP id q24mr10117464ots.275.1632920776534; Wed, 29 Sep 2021 06:06:16 -0700 (PDT) Received: from localhost.localdomain ([172.58.171.248]) by smtp.gmail.com with ESMTPSA id w1sm442823ote.41.2021.09.29.06.06.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:06:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 08/26] linux-user/hexagon: Implement setup_sigtramp Date: Wed, 29 Sep 2021 09:05:35 -0400 Message-Id: <20210929130553.121567-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210929130553.121567-1-richard.henderson@linaro.org> References: <20210929130553.121567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::334; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Taylor Simpson , alex.bennee@linaro.org, laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- linux-user/hexagon/target_signal.h | 2 ++ linux-user/hexagon/signal.c | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) -- 2.25.1 diff --git a/linux-user/hexagon/target_signal.h b/linux-user/hexagon/target_signal.h index 345cf1cbb8..9e0223d322 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 */ diff --git a/linux-user/hexagon/signal.c b/linux-user/hexagon/signal.c index c7f0bf6b92..74e61739a0 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); +} From patchwork Wed Sep 29 13:05:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514837 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:4087:0:0:0:0 with SMTP id m7csp15518jam; Wed, 29 Sep 2021 06:17:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2hKXEoB+sM89lDckYcdUCAHzxDxpLDlJniw2OIziMypnJCLaLNxf4M0EpKLHSuwYc0imo X-Received: by 2002:aa7:cdd1:: with SMTP id h17mr15194350edw.346.1632921421849; Wed, 29 Sep 2021 06:17:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632921421; cv=none; d=google.com; s=arc-20160816; b=h1f6jR8JMku+xprarkNWRTKiRGJ71FCGPIsSqrhH2eBrv2nEb6xm5Jz06mK8qYjlqH RYmStE9tu5+B94eRa/mAvYRKjjiUfe63I9jJXkUdNfk3Svs4hnszeU4qBj2X6akbnPFa cTL9lxweXmPdYM3F93UtBAId0zyTbsdv099Plsh/Q+ic7XKCtTXDmm78j8b90hmFpQt6 Zb8sm5zDwqBYVvMrDJPE2CyhmTYbchkMKWhPO0iYJ0Mo2ifg9UwrVoGApOWdO5da+Fp3 qkg2EYdC3vr0ZH9QTk/w3CDtXL+WKwyQxOrbIvUtTvApwPCOUvClfUUYN26Hm1HNxBwO K6fg== 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 :dkim-signature; bh=9uDmWChPs4lp5UI8b6weWaZXX8zbdz4czXb1drnckGg=; b=c2onLrzZIRChW5Q0NeM6m0otfPyjOSkijg7pE1K7yvfUGichp8MwgR6ycNkiwFEt/7 vH3X4YXZ/FvFboQljetrXctwHijPUw/ZJUGKMRyNdMclBFoXTMc12H8H6t4hOQQ6rRjs HJJ3AldeML2Xj0Y7nash9mI0u2I4mzhcpfVuF/vDgpM6huq7c+IqQdN3KI9+JoRTxNQ1 10rMan1ry/FkfRfdFkfzaweOcXt2T5wwN5zxBJdnX/ZbS9O7tl2HmB1NFBsfne/uUyhy ZlSqGMHHI2KaRbrgeOY9cQMQAS9jxwf8EqyBWICA7+0CGjVWQvphY1j9o9E7o6/havA6 h0bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=gOYu1niv; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v3si2389399eji.473.2021.09.29.06.17.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Sep 2021 06:17:01 -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; dkim=fail header.i=@linaro.org header.s=google header.b=gOYu1niv; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52392 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZSG-0003tT-Ro for patch@linaro.org; Wed, 29 Sep 2021 09:17:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39280) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZHy-0006k6-7Q for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:22 -0400 Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]:35572) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZHw-0006AS-HS for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:21 -0400 Received: by mail-ot1-x32e.google.com with SMTP id 77-20020a9d0ed3000000b00546e10e6699so2769199otj.2 for ; Wed, 29 Sep 2021 06:06:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9uDmWChPs4lp5UI8b6weWaZXX8zbdz4czXb1drnckGg=; b=gOYu1nivdD0Jq4FXVEuBcoKZM4WPNoB268Jd8qxrxVRBpSc71Whk0vtrgpBDCLjfQt VQAFk2gzu4Fn7Aj2ted9JbLNzJVoef53CmUEcNIhmsz5U1PEf+X0flHJ3AZZjpt4sTzl Rm/Rk+1zRXSxKiYPwhpKo3EtYuAPR9aOYn+XCbln2swuA/FWaaq1HvCqjYbCwAaecMN5 lPCGAwAoGRQgI9KnH2oBGHrazF67rR2GAjq3g0fS/VX+DXe/F7DLNKub1C3VSqqhH5pr M52Z8WGfrxrdjaAKB2oZ3e57i8B/6SyG/aQtER4OglBpAox546NVfA86cB1c1wpFooyY PLEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9uDmWChPs4lp5UI8b6weWaZXX8zbdz4czXb1drnckGg=; b=BmrthV+vXi6AzphKiifXmB/MRVfcr+2w531Yi81Suwjsooc1goMSgttFz9Yr4/MyJ2 Y0es14Jt7AiCLzP4OscriTzVJCvUrnPb5VE8hSCJBfmN7y4048KTpHIme5uZ/Dtqx8kv na5uWOaNE5AlZpNS8krDmlp03val3wYp+D8Fh8nQNUR5qQnyqiHURLl9qR01ruh2R53b iPiUIuD8UdhMyXYD5SDcPs/iyB9rDVlS3s5zhfq29mJxd46SJKgKJw/phBRmZpEUa8WP 0QSoIH37PzlGQW/6z4kbZIpnpzZXrjenrltqZ0vUwkUF6Is2x1a8aDHEUTwn707YuuVr G7ww== X-Gm-Message-State: AOAM530nv0hNQD9yPojd6u5taUT7aMYKja6a/qLwTQoLhI8ycKMa2tiY uhwyCqT4kvM4kLXM2l89PK1f/zmzuSFVtg== X-Received: by 2002:a05:6830:101:: with SMTP id i1mr3608581otp.107.1632920778787; Wed, 29 Sep 2021 06:06:18 -0700 (PDT) Received: from localhost.localdomain ([172.58.171.248]) by smtp.gmail.com with ESMTPSA id w1sm442823ote.41.2021.09.29.06.06.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:06:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 09/26] linux-user/hppa: Document non-use of setup_sigtramp Date: Wed, 29 Sep 2021 09:05:36 -0400 Message-Id: <20210929130553.121567-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210929130553.121567-1-richard.henderson@linaro.org> References: <20210929130553.121567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32e; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-?= =?utf-8?b?RGF1ZMOp?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- linux-user/hppa/target_signal.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) -- 2.25.1 diff --git a/linux-user/hppa/target_signal.h b/linux-user/hppa/target_signal.h index 7f525362e9..d558119ee7 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 Wed Sep 29 13:05:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514838 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:4087:0:0:0:0 with SMTP id m7csp17779jam; Wed, 29 Sep 2021 06:19:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6KSP090RQPUytq6L/PStFc69pUSlzmVvoWuJVQk9fuYjlX1HwXG1xwDfCtg9RusVlK/j7 X-Received: by 2002:adf:dd8e:: with SMTP id x14mr6951419wrl.260.1632921578193; Wed, 29 Sep 2021 06:19:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632921578; cv=none; d=google.com; s=arc-20160816; b=G/8e0xxGhj/V2/X8nA5X1po++gOJypeBSPnc9ONdCbAMbTqckeQfv1maYS40sg6zCh Qr3NmjqOduR5HFw/9ewL9GZBl3SiXfLryCHXj5C8+A4PFfGTkhsdjDlQzJM50YeSPUxm J9ReZ8rOcmldC382Q6B12rmPwCXyQ+JZqwUJdftwYA247rQLXpefE2yMwcEndagUjdz1 dMENXIb/+zRseB+kecFKv1cVT0MlYR8PFLWVo7mhVvVWMgZHWv5V7dyoxudDQshfGh5S vyMuhp1s1LcYGejlFRK/E6KR5eF2DSfRXJ+vQlvMRJ9/t7yLha70BPfOQ6grHlqauFBH sHhQ== 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 :dkim-signature; bh=/JBwXy3z5lR+XAAxPTtDygRF9ftMDjdSwtnKr4eEXKE=; b=wBXvgsl/ssg9z9Zy3EZDTXZLRjAjCVZDYlgBxBnPpa+AGWzSfPq2LuA3+gNJuoCpj8 tlT5qwiYLsOA1ZJkYrlgnwxe0gXQcP0l9gzhtDGLwx4zSrUs7Iy+ewPuO+/yBGk/h8BJ wIr2cnrV9sRg/Tu4uEhJ2p4GZRD7VE2sqeus96JsYVAX5/Xesb9CkSC8nUbIDkCgPibC 9vxJK5CbmnL3MdaBo5iYfcOfPPiLsgZZb3f9K3VtoNF9GgUcF23ei25Ex0h7cMRlqcPN /VjjWwFipjH0i3p1Mwi13h2Xwz/r1wEesNh9R/YJPFz3vPJPwBO1gB+4swmAqlKxMM1D 5s/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Zn2ExfFG; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f11si2199451wmq.187.2021.09.29.06.19.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Sep 2021 06:19:38 -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; dkim=fail header.i=@linaro.org header.s=google header.b=Zn2ExfFG; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZUn-0000ai-30 for patch@linaro.org; Wed, 29 Sep 2021 09:19:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39292) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZI0-0006s9-Ik for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:24 -0400 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]:46878) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZHy-0006C0-0K for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:23 -0400 Received: by mail-ot1-x333.google.com with SMTP id o59-20020a9d2241000000b0054745f28c69so2708408ota.13 for ; Wed, 29 Sep 2021 06:06:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/JBwXy3z5lR+XAAxPTtDygRF9ftMDjdSwtnKr4eEXKE=; b=Zn2ExfFG6FFHnTnWDlW/TO4P81U/lrd6S7owvw16ltEgEHafFUATWLp7XDFMDwr0cY fXcf3oasfOVA+PODZ+YrPhA0Q3sPPsNV3EDoqptsMD0lZ7AXP7ySw1YUtEI1qIOHTRXO x5NYx40Igo3GSHrmWD/b8lnZXhl4FgRA2eJXzA+eZcGJcTXjk5yAcEvThrd1a7DyUS6k D/IzOQJxpNaMBQSB96i04g1oeXXSkMicsgu2yaItPYxChoPC6YSUO/2yiQyuc/OcBuqk 29wSRNl4ZWkCxTVHgng3XJ31FLYrf7BspvVgH4pbKVcO/E4LkChKxBl8IO1ESKkaUfSP 4lvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/JBwXy3z5lR+XAAxPTtDygRF9ftMDjdSwtnKr4eEXKE=; b=uSTR6ETO66J8YubVHJyhjKA5suECkdYdz8G6QYtV7hGEeoNr9d9DLxsRTXmu62HTm5 t/0ukIWXgjTeSwF32a4MbYGka2SceXGpY6wHRXKWmNE3oyXuwA1tw3F5t6q+nNj7NssO KSlzMYuhenGTx0RdWje1dPxxKiQZGhVUGltI13kS/uiVvkPkhuXNMHl7Ut08K/inqTPN mt3wlvVPUeFVTUYNj/ET4RrQX9+azm8o11Ae4CiCD2xKzptRs3hyQpw51DThd9QDdkwZ rmYutQG2RRtOwrNAqp6TrTgSmE53DKLUwiv8Y8dn9EhS6xdmdpJxQMmxQaz+ZdJy2xFC yXgw== X-Gm-Message-State: AOAM533bP5jc3Y5URipXOOcfBd9Z6krJys0bw6PLQHiupB6bti20QTRd EvoWh3dsqyLMO6E9IX8j8z63eNX8muAXdQ== X-Received: by 2002:a9d:7746:: with SMTP id t6mr10167697otl.72.1632920780755; Wed, 29 Sep 2021 06:06:20 -0700 (PDT) Received: from localhost.localdomain ([172.58.171.248]) by smtp.gmail.com with ESMTPSA id w1sm442823ote.41.2021.09.29.06.06.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:06:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 10/26] linux-user/i386: Implement setup_sigtramp Date: Wed, 29 Sep 2021 09:05:37 -0400 Message-Id: <20210929130553.121567-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210929130553.121567-1-richard.henderson@linaro.org> References: <20210929130553.121567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::333; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-?= =?utf-8?b?RGF1ZMOp?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- linux-user/i386/target_signal.h | 2 ++ linux-user/x86_64/target_signal.h | 3 ++ linux-user/i386/signal.c | 56 +++++++++++++++++++++---------- 3 files changed, 43 insertions(+), 18 deletions(-) -- 2.25.1 diff --git a/linux-user/i386/target_signal.h b/linux-user/i386/target_signal.h index 50361af874..64d09f2e75 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 4ea74f20dd..4673c5a886 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 */ diff --git a/linux-user/i386/signal.c b/linux-user/i386/signal.c index 3b4b55fc0a..b38b5f108e 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 From patchwork Wed Sep 29 13:05:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514841 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:4087:0:0:0:0 with SMTP id m7csp21624jam; Wed, 29 Sep 2021 06:23:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBkexjbKTsHznfnANTfFGGF9PAXDe+7HqgDJfXfyGAkhbn0iSZMJ/qX+SGV/mSUHEoq0LK X-Received: by 2002:a05:6000:1446:: with SMTP id v6mr6962237wrx.427.1632921806500; Wed, 29 Sep 2021 06:23:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632921806; cv=none; d=google.com; s=arc-20160816; b=HXzBp3v6EuYb3Ttiq4H/StVbKUS80OWQlUR3WxR44NzuQ/wO6gcbd/GL8SuKCjVTlj eouiRjzxUe1TVQYBtucQOE1tzhxVdqR568naYv8vF4l5CjBNrlPzRdOCPzHyt7ZpBFX5 3H2q1coWr7lLud+CzrwROgEaLA4RPQsT+MRh3CVSJmX8ZlByKwmqyWo6Wt6Ez+XWFKYF TGwzj6qbCqj1GgGvV1TN0sfk8nZhV99YIgVlcsifU/iqeegNMUaMU7EPA9WLouWm2KKk Mo/XcbzOa2EdkgpSQQwK/BRvFn4xtxBy98jXeYh2juPx/bZ7vhidD7P3l3EUNps3cxF4 Qqwg== 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 :dkim-signature; bh=vFT/6UTjn+SRrtv7SJvOboDTfiqpHPjXAVLEeQqZ7rU=; b=Y6lbYfsCLLR32Eg2bm6x5c8lOHEUnH5erTdfMPbW8RCL4Kqo8yRaOapqvn7fmEqfDd 1lgSvUeZY5VG/u10MCjhvKKoRvna3DrBvF3UdVGCe908FIMS2QILSqygo4w6NX6fRrDF ZVmf7btyMpODKBPrZVKCkir7I77XXIKPTQzw/WU7ieG1ZrZ/+rRfPfF5K1tnS6iRSExI l+OrEVpnKFQsyP79D9px4CFTp+5gnQY3h9Sa4LSBYP5iCFulCJt3jRvcvB3J0fxwUTUp N07mnJL9TQsfJQ5RQmvbGTJeXWWX59X6uG6CA2UCJQpG5m8XJOrj62Mrn7DBw6sSeJrL ETMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DibSKAy2; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 10si3053499wrb.57.2021.09.29.06.23.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Sep 2021 06:23: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; dkim=fail header.i=@linaro.org header.s=google header.b=DibSKAy2; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:40372 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZYT-0006jJ-IY for patch@linaro.org; Wed, 29 Sep 2021 09:23:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39308) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZI2-0006v8-G3 for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:28 -0400 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]:42646) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZI1-0006EN-30 for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:26 -0400 Received: by mail-ot1-x334.google.com with SMTP id c26-20020a056830349a00b0054d96d25c1eso2736141otu.9 for ; Wed, 29 Sep 2021 06:06:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vFT/6UTjn+SRrtv7SJvOboDTfiqpHPjXAVLEeQqZ7rU=; b=DibSKAy2R3rstnEKLGPw4vdbEtzcSfuQ5QuOOQoW45mxAzN2TwM2wB8G/tnV5y+Sg+ OrjCNTyag5UZc9mvKLmPmZwAZZLjKCKPsArdDbkfXPucFyRHrU1hdUG848KRQNYhgtX5 dSM0imBFpGBjhpPfaNtimtqi9wCTedb0Gg2cop+mITOItU0jojfEfhpmZ7Mux/SwLE/w v4/JgGJvG2P7krYvHQ9/OvcxbEj8oFfM+vldGIgA6ZgD6sDZNR61ehk2Lg/L3D79a9KM tSwtRdRew1Gk9tSVhqXmxULoGM2/QOIVwX0cmfzfytHV1IuTuM6x7vIvg/ri8QW/CDYW s8mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vFT/6UTjn+SRrtv7SJvOboDTfiqpHPjXAVLEeQqZ7rU=; b=bA0acQFFZMXxIoGKRb+fsn2vDc3nxFjnaX6ZF0P4+xKxciSZ9yqAeuhCm9qjwwHp4z 2eMV1PFauWy7QwMrkuPhqSP8CbTEGrQD5Bcj488x73tQsF0lRLSGl/XO+HF+FXPBZOop uF54pK0qe79icWvK5R8oriF4AXxAkhsZYNJhAusosK3uzn46LAuUYOMBvI5AQ/wBvnwp 8Waawm4NrRq3NP08VFsTL/teyYsgWMuZO1+MbvGQlZUQYYi8Ojqfx5Let+pgNousxCPt 1ltDOZ/N08NfAsYyWU0HSe21IrYk3PyENSY1oVPsZ/goshETRb1obb9o0PSbEbYb+SaS 0u8Q== X-Gm-Message-State: AOAM531FZlfJLM2OuKCMjDHC2ZMinFtUjFCwDeRhoqp/P0bJxlUDxnu2 uoQbutWFSxJGz2peHft1hi/EjvEXs6zinw== X-Received: by 2002:a05:6830:1497:: with SMTP id s23mr10125653otq.148.1632920782759; Wed, 29 Sep 2021 06:06:22 -0700 (PDT) Received: from localhost.localdomain ([172.58.171.248]) by smtp.gmail.com with ESMTPSA id w1sm442823ote.41.2021.09.29.06.06.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:06:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 11/26] linux-user/x86_64: Raise SIGSEGV if SA_RESTORER not set Date: Wed, 29 Sep 2021 09:05:38 -0400 Message-Id: <20210929130553.121567-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210929130553.121567-1-richard.henderson@linaro.org> References: <20210929130553.121567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::334; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , alex.bennee@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- linux-user/i386/signal.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) -- 2.25.1 diff --git a/linux-user/i386/signal.c b/linux-user/i386/signal.c index b38b5f108e..433efa3d69 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 Wed Sep 29 13:05:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514835 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:4087:0:0:0:0 with SMTP id m7csp15269jam; Wed, 29 Sep 2021 06:16:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdUTcqWQmMRL4icBhOCJlRnoLLIPFhQ9Fid61rM8IJzQEVhE23UbTjnSb9UeLvBJCKDpwv X-Received: by 2002:a17:906:7145:: with SMTP id z5mr13281254ejj.363.1632921403764; Wed, 29 Sep 2021 06:16:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632921403; cv=none; d=google.com; s=arc-20160816; b=dyWAjL5kVLdSEibLolhaYhfhtx7AdOzcp/P9TCm5IAVh8Mf4SjJqWiUg//peIpYrtT t5ZZ24d6efOlIOEDVh/Ut3J0ubYJ+YcQ9cjrhkRXKFuTfD6NQtlc2W/xzL7aubsLoG4l KA+1f6DGHo0HZ+vAEKSIBQ8Yd6LlWtNCFr62BaxgRSKtVrqp/xtVxbZ1wyA0olm9XQIE 0n7pAsyi5N7KuH23+NX6DRsT8Ai2sZNBS3TPS13dW77VsNHOvLqhvfWX1/s5LowCvig5 ua9tvamvwN3nMfpCSwlBZGIqKNBjMwuJKaF0NE9BssXLwse7FEC4ZAU38lzlO86AuNjC zyFA== 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 :dkim-signature; bh=UICQteUsiyVZ78cpdv1J4mwbKpxziCK3H4LazUFdv1A=; b=qs+4mDyeEQXe45sKaSv0ZYZAxwvDGn5POdRFP/n/1GR7jpp4Tn0YUJR5/bLx/20tbn T6yyPyml4H/7vbOS4HhyqCQ7dkPGHs73EC5qhn1a1w2hUvIppFGxbnnTJCV3lxuJXkwG BJZpLl0pJd+WnmXeOEJZkEUja0NihsopQqX29rbaPftS/6igWNiL3orstyP34hOGCOGn 750nqUxLQnMWQrTAEuZBs8ja5gLBKs07HPFTJSU/hwCG7tc55sOFowNxabW076O5TuRv RQ6TKJH+4eEzV2JoiHJ4SIHGS6qxg7CQpOBXDOicH1BKMV7TyONrxQrndMiMHPwEDwoo 7Guw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=wmtn9UqY; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q9si2644601edj.505.2021.09.29.06.16.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Sep 2021 06:16:43 -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; dkim=fail header.i=@linaro.org header.s=google header.b=wmtn9UqY; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZRx-0003e2-JB for patch@linaro.org; Wed, 29 Sep 2021 09:16:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39362) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZI7-00075B-1v for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:31 -0400 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]:42644) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZI4-0006G0-Ah for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:30 -0400 Received: by mail-ot1-x331.google.com with SMTP id c26-20020a056830349a00b0054d96d25c1eso2736376otu.9 for ; Wed, 29 Sep 2021 06:06:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UICQteUsiyVZ78cpdv1J4mwbKpxziCK3H4LazUFdv1A=; b=wmtn9UqYvO/mXli8WD7K7HX+P+BXnGTeUoanabbOOMterKCya7evmvBjYM2ywVYnsa h+6OEQvrghb0SY39zkyqn5a2cSXjqKQgHtZWGxNAG66tqso4U2E+MqJDZ4MJMjvbZo7J WViVC3BEIR6lYQnYQSDTnhLSeWmiMAucKmwfWOOGiJWgjmJJLKtA9sfLGAKQPKNPp8gO N2TxoR1bxdoE926kvWro/Lsrn4MJrZxpNICqKAxk8b4yU/xJsGE1fyBw3jVDEiY/J80O pkmLn9dtOwNnqKKgQ88RK+HruT3ItY0KNRnJqbtgMd0L6/javA5ZB7v+OcZJRReWHghJ NTjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UICQteUsiyVZ78cpdv1J4mwbKpxziCK3H4LazUFdv1A=; b=b3+awUK5TugNzq7zqs4Bl7031Sf9K8jbqhfz6ReMF4CD1mFb0m9lcF53hddg9R97G3 z/OHeG24+ZdV8nN8Ga+TJHvG3NEOeOYUHDCH9hbvCmo6rO1Hq/KakM22xyiAHER1Ai18 ewcpUXjW1TG7vAAabSBFtOb2A1HtJvIUyZy3FwoIwmdjf+8voVvaMT2KJJnJ8rvV4xxt 10Q4RvXJ8M1gIecxnfLhwRIBGVIfeqNsfRIcERxj2CPUnAj7S36yViqeaaz03f0oBCzh 9De1TjgbMCD3zD6j5zJHzg+z5hPq5DF2Zs6JfLIK3Ggh1y6fakFSVYt9WeF925m3PIRA K+pQ== X-Gm-Message-State: AOAM530bQTZkzEsnl0ATc7k0QlgHI2JDn3qJvzQALXJJSbmVFyyrnAlx rP0YaRmckHMvgvU96fxi+hjs3m7UcsNl/A== X-Received: by 2002:a9d:6948:: with SMTP id p8mr10309492oto.128.1632920785137; Wed, 29 Sep 2021 06:06:25 -0700 (PDT) Received: from localhost.localdomain ([172.58.171.248]) by smtp.gmail.com with ESMTPSA id w1sm442823ote.41.2021.09.29.06.06.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:06:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 12/26] linux-user/m68k: Implement setup_sigtramp Date: Wed, 29 Sep 2021 09:05:39 -0400 Message-Id: <20210929130553.121567-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210929130553.121567-1-richard.henderson@linaro.org> References: <20210929130553.121567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::331; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-?= =?utf-8?b?RGF1ZMOp?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Create and record the two signal trampolines. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/m68k/target_signal.h | 2 ++ linux-user/m68k/signal.c | 47 +++++++++++++++------------------ 2 files changed, 24 insertions(+), 25 deletions(-) -- 2.25.1 diff --git a/linux-user/m68k/target_signal.h b/linux-user/m68k/target_signal.h index d096544ef8..94157bf1f4 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 */ diff --git a/linux-user/m68k/signal.c b/linux-user/m68k/signal.c index 4f8eb6f727..ec33482e14 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); +} From patchwork Wed Sep 29 13:05:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514839 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:4087:0:0:0:0 with SMTP id m7csp17973jam; Wed, 29 Sep 2021 06:19:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykb+wT3dZgQ+nLMY39QlOobEqGSZIH3RQiEd57GpfAa65ctQMz9l7uOMpjaNuBBqkfGMbt X-Received: by 2002:a5d:4d84:: with SMTP id b4mr6081931wru.258.1632921589837; Wed, 29 Sep 2021 06:19:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632921589; cv=none; d=google.com; s=arc-20160816; b=j8M6OLRMtjb35ZPgbSRnZfFddxVFqEoF71yX8ylemuDiwi4dGpJZQwqK/sQL9QvcyO hRIU3/aCFNJB2J1yqOQdhADlU7idpu34gu5GEHYE1crudHvdjVTpKuybjLSDSwRWxO2m 93ns8xmZjGpTzu6Mi2Z1V3Z2967bCMw4jBAG1FQKMTixvJ2IAQbpPqL8j2tA+BTsWsyC HExwFgcLBNJ2cbQ6N7st37BQkTpFGthKgNJDULE1RpkaOtO3+AQnDsC2kzGbfwikCIex uYNyeXkV3wDFhqqERKeeDpMdY/a4EYxKSEjRKslTXhZgzDpQCMRc7U/Z40ebq8DediRZ 5cTw== 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 :dkim-signature; bh=OeHNvhPeuZfmulgUe9ozzImEdGk/YkGYzR1u2KyMGGs=; b=OSdvdPsRcWhs1JDho/mkMSs2DLSWs6Tw0ZJBGiwu/yx/WmxzlHV19QqBPFLkVmotZ3 mowB3wShIJGTMCIzsH7hoyaYRntHrQeR/17bdg/3yALwuJe0wX8SUzNdApbba6G8inuQ FK6Rszg0VwAA6FQ84H29guW7rU0p0v3EVgBnyKdhlC0WhmfOfM2CAJ7X9fqAv0vKXFKo Zcfz5sPQCwTal2ISzF3ObsJuICFpz3jBYQxFiwi0JYsntcjB4PQ8BDLHQAyEbe/ofuhF CmygxR4oKwQ5/3NasvgJBV2a/N43crUJ2dDZYQnr2RtMuVUGDYsDEkWVTNjny+tUlTeM C1iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=tzfUPuFw; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f3si2378343wrj.592.2021.09.29.06.19.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Sep 2021 06:19: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; dkim=fail header.i=@linaro.org header.s=google header.b=tzfUPuFw; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZUy-0001N5-Oy for patch@linaro.org; Wed, 29 Sep 2021 09:19:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39340) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZI6-00071o-0r for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:30 -0400 Received: from mail-ot1-x32f.google.com ([2607:f8b0:4864:20::32f]:43639) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZI4-0006G2-Ae for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:29 -0400 Received: by mail-ot1-x32f.google.com with SMTP id x33-20020a9d37a4000000b0054733a85462so2733454otb.10 for ; Wed, 29 Sep 2021 06:06:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OeHNvhPeuZfmulgUe9ozzImEdGk/YkGYzR1u2KyMGGs=; b=tzfUPuFwDIZC0sVrkWiKzmHYuihHmgcxLqmwPO47eI1S3wIuU/Nl/TiVQxlYIRxjA6 YGTlZ+qYXatq4nCdERPHrzhmPxK+ayunz887oXnMOKzUSfRy68jxg2OMqkXWCJf9Dcfo 78JozUtLxzpq6qJdxjuPEFeDPLWaAJu8jTHlQWPYHb6HNnwm9rdMb1lvMz+qbX0VvO3E /SCvrLcVZFlTzWKbZDoj/QwEvj4jc98L2v68pDRSO2tc1nnV6GniHKjFRlWdSLMVbQBi i+IRduT5I8hWe0FmnxoSm0xsxOiine6lHA0eRTwuBfO7IAjMJQ7pQ5ihvD5m1jkue+qE C8YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OeHNvhPeuZfmulgUe9ozzImEdGk/YkGYzR1u2KyMGGs=; b=oKx0XIDNVWvosj9a41m+Hgb8deEPUtLTBjUJcHKU6g7ifTK1pHN9FkjysWOzGIlOfF PFxOcfnv6cu+0XPW4iKPxEIKUXcoLTyZbhBFaFfWngvZZjdpAuiUfP+ITBS1C+nMAzxk hj190RNts5NGH+5F579AIkhdJPp76eoGOiZCmEeOaDDCiyA9QtRvxIsf6ubvw2UJXmly GycR5KIbeYfDB8ncmEK8vIjL+kB9SyB24A70hawmDZVfKCXMAQcjOhklsf5DBZYpNfgY smdV3ANwWfPpsAzNsBvKh6hl9wIOrFYIlnr9DRYrvQZ3RjxpIA7B61S0PeGJRwyvPdyU GGOg== X-Gm-Message-State: AOAM5335C8GwUHfTS6Iz7nc24pQLTiQVFf73FB++EDFuwXkQYXBWWc4z 1XA1WeXFv/s79jzVgbR1Hzm0LPXgpvKprw== X-Received: by 2002:a05:6830:4095:: with SMTP id x21mr4655146ott.352.1632920786837; Wed, 29 Sep 2021 06:06:26 -0700 (PDT) Received: from localhost.localdomain ([172.58.171.248]) by smtp.gmail.com with ESMTPSA id w1sm442823ote.41.2021.09.29.06.06.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:06:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 13/26] linux-user/microblaze: Implement setup_sigtramp Date: Wed, 29 Sep 2021 09:05:40 -0400 Message-Id: <20210929130553.121567-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210929130553.121567-1-richard.henderson@linaro.org> References: <20210929130553.121567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32f; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E . Iglesias" , alex.bennee@linaro.org, laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Create and record the rt signal trampoline. Cc: Edgar E. Iglesias Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/microblaze/target_signal.h | 2 ++ linux-user/microblaze/signal.c | 24 +++++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) -- 2.25.1 diff --git a/linux-user/microblaze/target_signal.h b/linux-user/microblaze/target_signal.h index 1c326296de..e8b510f6b1 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 */ diff --git a/linux-user/microblaze/signal.c b/linux-user/microblaze/signal.c index b822679d18..8ebb6a1b7d 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); +} From patchwork Wed Sep 29 13:05:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514843 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:4087:0:0:0:0 with SMTP id m7csp21801jam; Wed, 29 Sep 2021 06:23:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxX+/pGSMQ4S6vZNFuIwWY26yx7TWFoXRD1SGsrWE767dayGHP4EX7Gf5YLAecT10MQzdBT X-Received: by 2002:a1c:29c7:: with SMTP id p190mr10481065wmp.65.1632921819640; Wed, 29 Sep 2021 06:23:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632921819; cv=none; d=google.com; s=arc-20160816; b=r4TGjGgysfX6vIbQ77goYt0p+mlQ98r3+ZpOP+Pk1V4RofzkWykDmlkxeUkmKbtpux xojxosDOUypRsYq86v+rj1yAFjHuI5ih7JZbYg4xr0dBEgUwHpxuYYxctsXnG+U30cHI vcjgHkNIgjDl3T3JQMvvp8k3ctmuwBD6wnbUAR+e4LGKhyYM+/CWAMkPI4D3bxFmJtVP YfaVwZPmUwJvE9228uEXr/xz22ywJjoKhC7ecD2GSl1R3VxfQ7zzWi2y3MeBWS5McNyH jLcjFzppntNZ/oIeLsMDTrMy587neYJhsMc5WpuSgnCprOkOTQrJ8cxu08SHSJnbNUad lBZA== 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 :dkim-signature; bh=kxfPZ7H57dcm7rNQ+f9pWEPpiqUmhBqRaotBBFRVjb0=; b=eQpKxwEiVxtT5iNZHp11wLSuekHCR2Y9dW7tcMke+F9a/YqCA2c7QvO2xDAXN/e5B6 M3fTlhGTALg29pRWj7+5MOzib3CqFpBdDOCvXnub+UKgpaEus6IOnLZ+Qv4QaHfMmu7L wQ2Sg2utIqCg/DPz+yjcuOpGVDF6t/ryE7ugjFPEab8asAUaUvspx78LoaA9RJGyKuO7 3gsc7Af9cpxB8dS1+mtn58u1V5UbOVMrRPyML3iUGcNz1uYFt+MNZMv4QseTbsaKoACj KdViK2u4xrsRsLexuNWiICuk6woswqTBgc+ipYWMGs+u+m/yNFkhiBNB9cRhI+Od5BqL T51Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=duCHCXaH; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c14si3459416wri.266.2021.09.29.06.23.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Sep 2021 06:23:39 -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; dkim=fail header.i=@linaro.org header.s=google header.b=duCHCXaH; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41348 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZYg-0007Nt-Md for patch@linaro.org; Wed, 29 Sep 2021 09:23:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39368) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZI7-00076w-CT for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:31 -0400 Received: from mail-oi1-x234.google.com ([2607:f8b0:4864:20::234]:40457) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZI5-0006Gk-J3 for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:31 -0400 Received: by mail-oi1-x234.google.com with SMTP id t189so2790451oie.7 for ; Wed, 29 Sep 2021 06:06:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kxfPZ7H57dcm7rNQ+f9pWEPpiqUmhBqRaotBBFRVjb0=; b=duCHCXaHJUtA2SEMwqZKrJXZqWrsAz+Ay1RWsWOWtboCEhd9PbuaNKAYLl21mE/Ul+ sLF5GDJFtYid0Wiqfcskn5ObFOMDILyLJtlzTjxZoOe19xWuVcXOuwmJxryy03nOGYCi c8sy5zYH//fQ64N0NSZ9PJIQkRJ/aa9Bg3TL2Ncd/aB42ny1pZxf5222APqLWhtXmPj7 sGHAMOTecc48hk4dTYM1LssxgeJWNed1SK/yHTURshD/RQq/tTHxLWDTfzE4B8RgiclP 0UovcmiQ6sU/SDs6vDuWMTEFzdbYZldgPl1fymtL4nuvJ1xxpMZ/l8QfLwhJmYxDgDNE 6+0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kxfPZ7H57dcm7rNQ+f9pWEPpiqUmhBqRaotBBFRVjb0=; b=i0AhHkJD1ylW/lu6ju5meGWw1fl3uCY3y6pponGZqy+TJzLpEhAvQ4p7q17tOVnlZs zTaiPxNzjgBxuTd5CMtp83x3eSjs5zbd7w/c0SewLtEGCxK6ouZt5+XT7Itxrinz/GMg lSSgrGeSdaG3CfZUc1bDZFY8tbARh0fNSI19AjIbPiPAUUVaMegQ+P3JeVC/aN5aRMmU 8I8qaaRGOOimzx6yHpkqJYnul9aPGBGjODUdpJUG7i3+cTrXMHniTzp/5jCz/YGwfe6y DdnKCYug719/7ih/CuRTn3oe/guzqWX12byvlYk7YF8MTbpQzL5id5VdUs+1OnlOM5Tr jXdQ== X-Gm-Message-State: AOAM533FBZtlnfg5wyS9+8rncRK0GAjBm/jILtFEa0eZWFrdpqKQkdAX Kvo2FeCqDwpvIF/K5CBDNjmTeC9a/YNBnA== X-Received: by 2002:a05:6808:180c:: with SMTP id bh12mr7956316oib.78.1632920788466; Wed, 29 Sep 2021 06:06:28 -0700 (PDT) Received: from localhost.localdomain ([172.58.171.248]) by smtp.gmail.com with ESMTPSA id w1sm442823ote.41.2021.09.29.06.06.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:06:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 14/26] linux-user/mips: Tidy install_sigtramp Date: Wed, 29 Sep 2021 09:05:41 -0400 Message-Id: <20210929130553.121567-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210929130553.121567-1-richard.henderson@linaro.org> References: <20210929130553.121567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::234; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x234.google.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-?= =?utf-8?b?RGF1ZMOp?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- linux-user/mips/signal.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) -- 2.25.1 diff --git a/linux-user/mips/signal.c b/linux-user/mips/signal.c index d174b3453c..64072779b9 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 Wed Sep 29 13:05:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514844 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:4087:0:0:0:0 with SMTP id m7csp24899jam; Wed, 29 Sep 2021 06:26:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsQWjpawkdVW1sBMh71Ors1YL0hstqjnpwn+WxK7lk1UzeIIFvwg0sVcWxVqXq/n9mYKQj X-Received: by 2002:a67:2d92:: with SMTP id t140mr10591196vst.29.1632922017615; Wed, 29 Sep 2021 06:26:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632922017; cv=none; d=google.com; s=arc-20160816; b=U+i+yYEdXnuM1jg1CUpThdaL0G3SrLUEL4BM25puT/WxehyKtPrvFA2EAmUcPbEAZp xh3OchUoOCtj+ZkGyqWOg1+EtRDZfKrYonubUxZeOlUchK/5J2vjHLrvY/VDzoKO3n3W 4Lkbi6e7d7192UTvV+GkhJTuempMtALBuUwQOUr1qxKieFeWA+jX2fR6pp1NzR/pLihh W3ttyvZ5cGDKjoWJoSWGtHTKB4Qg5Wqp0rHeiDxwhAara0ZC4Vs2NLcaR3J8xDNM/GsF p7n1hQ0+hfwe1j/lkBm3ExE5ViDh+hv2jmcau89WtVUu5kkVBYZbX3Eb9qlTYMv5NC/r PyMw== 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 :dkim-signature; bh=+2oTGkDFDH981BJQF84oTMrfB4/Msl13jtU0KS59bkI=; b=vOymbF1YYjer8M9PTAoKGVSViTIlwiRpaFnZwYB405zLdqICy0dm6knKk0QsztIlRs 9mlyYcO8HZFexclk9QE6PpoLbSzTySragB8LkcCQIr2Wtyu1odslcFM08WOtT5gtL29n hLV9MiCdOY6mWQ70r1AjwdezTsSK9Fpmk62JsaZi04YJkMiQ6n60AoPzxvMXRRaMUSO0 SYk3D1vT9Sp2CDW1bnxEPEkcBIpwIkBFbiEEN730YWVVWrLZ0jB/ITCgYDUi1Vu1B8Uc //IJAfBi7+56sub0iiw/hMN/DuXlToy1XVIbmoLMk21l7ffQHeICNSLJMQ64d8vbR7jf inbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=yQalZLwS; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s19si1638989vsq.239.2021.09.29.06.26.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Sep 2021 06:26: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; dkim=fail header.i=@linaro.org header.s=google header.b=yQalZLwS; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47750 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZbs-0003JN-VM for patch@linaro.org; Wed, 29 Sep 2021 09:26:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39384) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZI8-0007Bf-VO for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:34 -0400 Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]:44858) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZI7-0006Hu-9L for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:32 -0400 Received: by mail-ot1-x32e.google.com with SMTP id h9-20020a9d2f09000000b005453f95356cso2727579otb.11 for ; Wed, 29 Sep 2021 06:06:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+2oTGkDFDH981BJQF84oTMrfB4/Msl13jtU0KS59bkI=; b=yQalZLwSDg5ZFirqsBlAFEQOUZvpKzeEXIa/RTYaP7XrqYcoL7BfojymlHoOsoFcNV oru5Y7tVr+XoPnXMRQHbIphDfS4Hk1Hbgifnwx6EK6tGmNY3gJ6/Zu3oVXwcL+VFi3fP wh6jfe9gA6posjz5wrkSWfC97out/vQEhudMWGlwZP+Zaw/wnX9g4XG3I4duNqbfy8DY wH7q9q3Sh81sm4kW6E/I5qnfDAUPtE6KufN/cG/vQlWcVYmiFDKKkNrq+Eu6Od2zY2Rw ujQ4PWFnN6/zOP3r8siFy9bL3mmFcV7WZ7ZU3x+8+4M/WJ7TLmbD9/7rijAIU17jK46z l3Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+2oTGkDFDH981BJQF84oTMrfB4/Msl13jtU0KS59bkI=; b=jbFGs2sm+osKmD0D0XP1KhVNxpbpM0vYHV8n+g9G7oH4z7j/epKYtS2zFvTAQkKJYd 4OWweThxTpXoLb6x6QUZlrZRYUf2HQhXi7XaXIRprQaW0SG7TciO2m0dkYFdilWVX0mC 2U919JbcSucWWzuJHkpn+2mdRswuLoBBQIdPc3g0e9/Xr68nwz++IXAG1HXlP7AjNfbs AxXBwFGiC37y9ZZgHmd3xgpGYXcDpTRyRlag0Oc10CsoDXIBnq1SM0flEt1SCjCIXgGw 0jfWkEmEYE7ZGPvAo3JhWlia2oUeZOcOJzfkj/FLVhpTqQ1DFcWBl7us+eGnMLYPsJP3 Hn7w== X-Gm-Message-State: AOAM530qHP7YWeHVl8u9nuQqUPJkTFQ8EnKuFlfIj/sLIv2KM9lukWT+ 4sQiOtSJTfHcndekpQTYAuBjqv3vzhtpvw== X-Received: by 2002:a9d:4595:: with SMTP id x21mr9954291ote.273.1632920790125; Wed, 29 Sep 2021 06:06:30 -0700 (PDT) Received: from localhost.localdomain ([172.58.171.248]) by smtp.gmail.com with ESMTPSA id w1sm442823ote.41.2021.09.29.06.06.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:06:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 15/26] linux-user/mips: Implement setup_sigtramp Date: Wed, 29 Sep 2021 09:05:42 -0400 Message-Id: <20210929130553.121567-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210929130553.121567-1-richard.henderson@linaro.org> References: <20210929130553.121567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32e; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-?= =?utf-8?b?RGF1ZMOp?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Create and record the two signal trampolines. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/mips/target_signal.h | 1 + linux-user/mips64/target_signal.h | 2 ++ linux-user/mips/signal.c | 34 ++++++++++++++++++++++--------- 3 files changed, 27 insertions(+), 10 deletions(-) -- 2.25.1 diff --git a/linux-user/mips/target_signal.h b/linux-user/mips/target_signal.h index d521765f6b..780a4ddf29 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 d857c55e4c..275e9b7f9a 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 */ diff --git a/linux-user/mips/signal.c b/linux-user/mips/signal.c index 64072779b9..8f79e405ec 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); +} From patchwork Wed Sep 29 13:05:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514847 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:4087:0:0:0:0 with SMTP id m7csp27063jam; Wed, 29 Sep 2021 06:29:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwq8Tv9LWRoNtuT4Gbgf4sS/abNVN+aaPOwToDYBBUjhQG5tmAgIwInzc0IoRbi435FBbTn X-Received: by 2002:a67:ec59:: with SMTP id z25mr2538391vso.56.1632922169311; Wed, 29 Sep 2021 06:29:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632922169; cv=none; d=google.com; s=arc-20160816; b=MHA5CNAefIlrnx1WEifR3LcIafVCH4vIwrbuWgW75xy37oJeVUm3Gs5SJTn94tzn5K aVFPH6zzX7lZ2Rn8tGSh8kcNaLoKdVSE356e06VGx5MVg89Lal45THfo3rnR3bOXqcGG cwjalMDgr6owg1OkM3kBpr+A5RSGDpKzvng2Y7Zl3V1B7PaNo3BZJSbTH47KP3c7nSSb O6jy5LGigYXmVld8+FCancKXkD7N71mnRC6I026lG+V1TJxelrmpHEAV+q7a2eL8z+Nd BfEoOjFwKpvTMJR0KeEyOyagI/4hCtB8bppugp4JRBjfHnMDEzzBrpOui5Y2Rz9Ou0Ty kfVw== 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 :dkim-signature; bh=WQzB7AxyjWRUXA4DYayXuevJtgVSORrMk8FiM91I24o=; b=chXrGAVq94h669w5BdLO1/w9bhK7jq6lweaaX74vUzWQ9DQbcwhBlnMZK1UnqsQvof VtOPYff3fF/kXUWWcqNvrc4av0IZq4moCFmDVqjhGU5aSGCeKsipmoQmyC2A67cgSN2b 9qLjAWM3hYImtTMoflwqBokauw6pbatisGoL1WcKsJpQNUq+JM/JzeUDS1pynNWCHJSK WxcxwYXviEkex5IM99YtK+ctJiOsa35+uv4Fxe5naoJd4zI2DsMKaIQgk9oDEr3NMFlA 6gVHPuuzL1WIFzA6dk3IdLSUfHTFFtSIsxNLoUeKlIUVywUWiUgGF01y9AbWPxbxnz51 ND0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cfR0Fbyh; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m16si1767740uab.30.2021.09.29.06.29.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Sep 2021 06:29: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; dkim=fail header.i=@linaro.org header.s=google header.b=cfR0Fbyh; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54136 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZeK-0007i6-PM for patch@linaro.org; Wed, 29 Sep 2021 09:29:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39412) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZIC-0007E9-3R for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:36 -0400 Received: from mail-ot1-x32d.google.com ([2607:f8b0:4864:20::32d]:45735) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZIA-0006Jt-KT for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:35 -0400 Received: by mail-ot1-x32d.google.com with SMTP id e66-20020a9d2ac8000000b0054da8bdf2aeso540738otb.12 for ; Wed, 29 Sep 2021 06:06:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WQzB7AxyjWRUXA4DYayXuevJtgVSORrMk8FiM91I24o=; b=cfR0Fbyhshx+JI65CP04Mr/1t5OQTwVeX5eOIHUfFAhoXlrrsWsRYvG2xJPlfJDwyv thg6Z6wbY7pA0F0TyigvWxmvImRLGgDMrSi3r7CU95Hi4iPiaIlA/y9J2hCHHSuQbBKz LshocQFt7zft4L13x2j2e6mYSDrTSXg12F+YBRozN4/iSFaTSXqNrOesZk0iX+Cm8idY c9T+FMD8wXLor/VX3hxh6eksJWKeK4s6/niVezrLeF/XDjTqW4dkWQd0ZopTEXRPse8Y O8NVyOHALU+UEG9dozOqvO33xkgytZD7gyzNatmbRsNszco7p+43YAA0GJu5eu4T5KAs lCeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WQzB7AxyjWRUXA4DYayXuevJtgVSORrMk8FiM91I24o=; b=VjHxNqBALcNdIFGPt8Gu8mgrbvncXDvtJ/0rfLkDPnKpCk1K36DrmNmkK6qvfikMFh s0ASkKSuY/oaWPg18PMI+xfpMY7qMImn71elT12el7aRcoUaFMi1xt39NlB1ob/E+FZh rSc2bQ4c4rPL4uUZUL2rJfOWufyjNAzyoFJMMmD8pDq6ck7QSm8MT6gZzLXLvTL9VxAy FObpN2A5HA8FvZuXtHCKRvcDOyG05079nIOMRusn6J1ulywAedLCOKPN3zGBUJ4AwBpx LT8XUkSH1FfSPEnTqlN4zvymypLCdwxsX1M8OG9Z+apuVQ7fP/f+VEZ82KOWby4BE1Gr T37A== X-Gm-Message-State: AOAM533xyhsoJkvDHxqj4QJJQbZVY0AvBL/mTgLSuo4B9QuctURQJTtD idcGK5P+9XuOypmavBXjy4BXXRo8R9CLJw== X-Received: by 2002:a9d:4696:: with SMTP id z22mr9849141ote.293.1632920792156; Wed, 29 Sep 2021 06:06:32 -0700 (PDT) Received: from localhost.localdomain ([172.58.171.248]) by smtp.gmail.com with ESMTPSA id w1sm442823ote.41.2021.09.29.06.06.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:06:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 16/26] linux-user/nios2: Document non-use of setup_sigtramp Date: Wed, 29 Sep 2021 09:05:43 -0400 Message-Id: <20210929130553.121567-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210929130553.121567-1-richard.henderson@linaro.org> References: <20210929130553.121567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32d; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , alex.bennee@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/nios2/target_signal.h | 3 +++ 1 file changed, 3 insertions(+) -- 2.25.1 diff --git a/linux-user/nios2/target_signal.h b/linux-user/nios2/target_signal.h index aebf749f12..fe266c4c51 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 Wed Sep 29 13:05:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514845 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:4087:0:0:0:0 with SMTP id m7csp25109jam; Wed, 29 Sep 2021 06:27:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrEsg1QdbglYGrynCC3RGVoHdgLylPy1bJihdvtDXNweKk6W/4pPVGgakoWFRLdXsSu+lH X-Received: by 2002:a05:6102:1d2:: with SMTP id s18mr10513279vsq.42.1632922030105; Wed, 29 Sep 2021 06:27:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632922030; cv=none; d=google.com; s=arc-20160816; b=gYDABSeKrXkl+ZdZR3K1CDUCNh3D3EPDDrLP3KG24eHX3aLqaOcllvdmun19FYFEHa 6p5lhwHYs3HnJ+ITWPKcBresjRCmLJzw7C2rlKSbPpnRqsXoNBIMBEaZNG9T81q+dcwZ dItYkmOfCNRmxaMAyRXW1waxGtfQoPuVn3QEK/rrBxXJ20nqoRlCaw5TVtlGR+HG28vG nAMaAmgASBMS1neR6Wb5TFR9ToBigGbYwrRvdUI+SxG5zXOPdmB+ev5dI54O2CcKlZG9 DL8ft7P0qgqQyx0jDgYpRqBuNzbJllDvSfx+B3FSSV83F36V/cqBdCtv6f3fGdEw78K4 N74A== 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 :dkim-signature; bh=lOx3X1NullOBxWQQkPTVyDx8zRAFH/X5J8rlFdQM6Qw=; b=lR9LORGJLMQucJvaD6O2yRiex/Mpk7VKVN4Igim+vXVAXI5tR6SYe1gPcU9prI94yW oB3lMRz72pqpuAujsetqEJPmk+dXY07Day7s4eeTmHS7y5oJ8ONeLSSQM6/Gg2A40o14 DtE0IoL666FNJJ50QppaabfNn2jNDO2/fl358euwVws5mJNZ2Y9zZkhBz8zD1u6/5Z2N y3W1MTGCN6kWrLw9YXgvf8+vbGnoFRm7qIyPqKo0muG39n4o5hBz0E5xX94u/o8Yi+7f rq73LM5DfdhXvKAHUiijvSOt0KRIrz1fKvrtweFWjq3RmFreTK2uQaNSbIvpXaUxJvhO uUiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=s+cOxUgJ; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a10si1980859vsn.228.2021.09.29.06.27.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Sep 2021 06:27: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; dkim=fail header.i=@linaro.org header.s=google header.b=s+cOxUgJ; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZc5-0003tW-Hu for patch@linaro.org; Wed, 29 Sep 2021 09:27:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39452) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZIG-0007JH-RO for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:40 -0400 Received: from mail-oi1-x235.google.com ([2607:f8b0:4864:20::235]:37626) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZIB-0006Km-RI for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:40 -0400 Received: by mail-oi1-x235.google.com with SMTP id w206so2798524oiw.4 for ; Wed, 29 Sep 2021 06:06:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lOx3X1NullOBxWQQkPTVyDx8zRAFH/X5J8rlFdQM6Qw=; b=s+cOxUgJhxJSEd+iF3RaesX37YvNz8xAhey40RQsAsSlLGaHowBZzizB8pHC/9d6YA jrubxV+GiFuYd/4nXt12fkdxZ4HVhUl8chB8uLfXj7y3Bsqt0ChNudEr3xK+E2plr0Mx fjpJv5BdqBwjI/5SaNgmPtal9/i4WSZla54xrep7Qd71yDIV9LVD8HhMfjrkgnoAdwbk ONtmY1MPlxRSdVKolFxE5lVrHTJjhJsDVnJ3bXXeWwvceeCdURYTZhRCVVP3YQ1dq0mV dEVH5jnhHzTIdG04B2hgsjwkWYFeXkeqEld4+IrxQ+2sIt/P61q9d2V7OlPbuGu7GmnF kXgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lOx3X1NullOBxWQQkPTVyDx8zRAFH/X5J8rlFdQM6Qw=; b=TDZM+piDN0qwq735TEKqTbK+anL46PeG+NT7Ua3WLlSwMXuaMLCI40rgc6DhC5f/N+ cNVjql2BKgs4YXs6uDLJ6zFAiN+VsQrghBVV3Hn3mG6u8NNems8R9k1nnC1RK1S6fFmb i62OU6qO+TOW6QC9v7weelAcMMbfx+02En4HIBXUIXhy0Bf8XQcCHNXIEnXWPjlPDgiw Fsj5SzpnnelnuZwbH0eG8i01O6Yyijpu0DSVy1095aU4Q2XZt3xvXcnZy0BhYjZTSlm9 oXW/FWT8ucINB4czsCcl9Rf6awt/XaDAeve1sNk6Gl/BYtpvekjhJsxzVh0+kZSiayja bSxg== X-Gm-Message-State: AOAM530AMgPo1xQbxcJeYrsaHxcmqZpQg/L2SFeCsVC3iNvstvbu55eG WVf83NTqLU6O1e0c82c8OBW70Soa7pVWOA== X-Received: by 2002:aca:de8a:: with SMTP id v132mr8008094oig.61.1632920794631; Wed, 29 Sep 2021 06:06:34 -0700 (PDT) Received: from localhost.localdomain ([172.58.171.248]) by smtp.gmail.com with ESMTPSA id w1sm442823ote.41.2021.09.29.06.06.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:06:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 17/26] linux-user/openrisc: Implement setup_sigtramp Date: Wed, 29 Sep 2021 09:05:44 -0400 Message-Id: <20210929130553.121567-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210929130553.121567-1-richard.henderson@linaro.org> References: <20210929130553.121567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::235; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x235.google.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stafford Horne , alex.bennee@linaro.org, laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Create and record the rt signal trampoline. Reviewed-by: Stafford Horne Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/openrisc/target_signal.h | 2 ++ linux-user/openrisc/signal.c | 22 ++++++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) -- 2.25.1 diff --git a/linux-user/openrisc/target_signal.h b/linux-user/openrisc/target_signal.h index 8283eaf544..077ec3d5e8 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 */ diff --git a/linux-user/openrisc/signal.c b/linux-user/openrisc/signal.c index ca2532bf50..be8b68784a 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); +} From patchwork Wed Sep 29 13:05:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514840 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:4087:0:0:0:0 with SMTP id m7csp17982jam; Wed, 29 Sep 2021 06:19:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVoQavVVaVqY4ke9s/22fkDmYtc4yw1D7ILVDAyU/ZBAsdE6YZp4mZj7FGzLPHWKV/cT0k X-Received: by 2002:adf:e44c:: with SMTP id t12mr6892198wrm.49.1632921590356; Wed, 29 Sep 2021 06:19:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632921590; cv=none; d=google.com; s=arc-20160816; b=cyxG4TS07dnlUicpaTYaVP655nQ4hUqyF3Vke7E/6aRpFJZ9fagfqlSKt+SUG3yVM8 +seI6+sdQPPljXNUFmyssVxGjsAfMWVKjBmjwwjkKl9ieIthbwbPsXuhpzrbnS5K0iN0 Hb5Xi4Xdlzv3Y0hvXDz8fzdEsNkU5zfzkwjh2fGjWBTD87lX53YelCk65zhbozvMLvzV 0tS/QVvGNkFffWps/AVvkmYSOq9oVk5OT+GxrBBIUvmXctB2XomiOtxh4kZpiwgx8MJU 640tDbQiugfQ4K69mKIvkJAiFdM7ioEmongnmA3Aci7V91qiOVlHlFZIqqTbErPMIO2W h74A== 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 :dkim-signature; bh=7zszFeWHoddqJiQjxDacbGdC0FlOhNlodUAD1GXKctw=; b=wDtJGOGazmXmI+jIL2tuk1YYbPFkvgnMjzJpxVBGqYDsbqbeE6y/fVffqnuixhl2ZD 338NNzFVWX8Bs6y9+DVGqZG2yZwNgWb8Nlu1qraJJFIJ45QzYMsWC82dT1HZufVl53Ux SqCA1z7Ls5Lkvvgn9rCPbDIo/MNPsbTVRoPSbgEBrs3Y6YrDQQU7SWexvRsAPoHGqFrc YPXUcadKfv+sIAJHJgQi1lhuXXZapNlBMaMR/w69zvInGrQ6EgbRCvXbtzs1GWKu7Nn/ HULu0GX7stBV0KPpDgBtV94DSWne8Kb4iOz0E1Mbu/8OtcVUD3EVM//jTSJACR4ghkc4 UvlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ubKz+tGh; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i29si1477250wmb.145.2021.09.29.06.19.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Sep 2021 06:19: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; dkim=fail header.i=@linaro.org header.s=google header.b=ubKz+tGh; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60650 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZUz-0001Ae-9d for patch@linaro.org; Wed, 29 Sep 2021 09:19:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39476) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZIH-0007MJ-Ss for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:42 -0400 Received: from mail-oi1-x234.google.com ([2607:f8b0:4864:20::234]:43663) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZID-0006Lt-8l for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:41 -0400 Received: by mail-oi1-x234.google.com with SMTP id q16so2764689oiw.10 for ; Wed, 29 Sep 2021 06:06:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7zszFeWHoddqJiQjxDacbGdC0FlOhNlodUAD1GXKctw=; b=ubKz+tGh0AlMI2BYp96swNidwDBdZ1rscbambE9t9NVmhJu0btAq1qR1DYjh1lQN+Q XMoEqmt6o7RzY4ecTzBXKUVRBMeuHA9zaz4geCV72WDARcIJjtuULArQgzBcfGG7L/XJ VRQye4wQRqvREC8eR17MDMjSZeUujqOe9ptMKuNM+2NA0/x68uRirNVSRF+5Qlg7d+r7 aLMRNemr6rSuN4gyO3GhTkecu+eJSCaHl+6zkcwF8hgb4aXBhJJGsGhfgqtjxzBleuUa HpnkU6pHa4gQ+ylFI9NJ50S/C+PBCDlXjTI9yiOTB4AAvCA6yVCobqvlz2xCi0Izr2zd GDXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7zszFeWHoddqJiQjxDacbGdC0FlOhNlodUAD1GXKctw=; b=x78VaHtJXCQm55dchtS3x7rFyewpXhVtcqJf/loVouNVhZqqqZrwxOu6wO11Q34OK9 9zx/KozoenfdyYnllyMau7F9T4gPWc/2Q2KYLWGs3T/Fel2aQGlVqnIitxqMXg0JlUi0 S5oo/poUIUsY7uTSNA902L9k2KVN6s9A950ZGnx51G4xRbsZLYDuuxxjsixx2xhe6ZVt vgRedJJPjMXOR8SfNDP2vWqF11lan/er6FZPzptMh2C3ihB06sq9XskK9+frIIl97Cj0 5oh3qq+/rBJGj/W1wtuGowem275+cQ/rP7ZsvUKQx/W2LoScnDrjVD6cr/6TysfXIJiF V2oQ== X-Gm-Message-State: AOAM532+x0vOSoOl7rnWp17S5zM1KsMrfDGLR1VZl3MZ4kW5b77SXe7u S1Uoj9/aU3oDEisxFUS2uYlblsgsfsyseQ== X-Received: by 2002:a54:4810:: with SMTP id j16mr8009994oij.103.1632920796235; Wed, 29 Sep 2021 06:06:36 -0700 (PDT) Received: from localhost.localdomain ([172.58.171.248]) by smtp.gmail.com with ESMTPSA id w1sm442823ote.41.2021.09.29.06.06.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:06:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 18/26] linux-user/ppc: Simplify encode_trampoline Date: Wed, 29 Sep 2021 09:05:45 -0400 Message-Id: <20210929130553.121567-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210929130553.121567-1-richard.henderson@linaro.org> References: <20210929130553.121567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::234; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x234.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , alex.bennee@linaro.org, laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- linux-user/ppc/signal.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -- 2.25.1 diff --git a/linux-user/ppc/signal.c b/linux-user/ppc/signal.c index e4d0dfa3bf..77f37b9f01 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 Wed Sep 29 13:05:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514842 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:4087:0:0:0:0 with SMTP id m7csp21792jam; Wed, 29 Sep 2021 06:23:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxetTqo7hQ/BtWShT+76qYcQBeKg/n8DEkHb1vl0gFuc3mV3ixtPzU4WdRHlMwBnk/NZvdt X-Received: by 2002:a1c:2785:: with SMTP id n127mr10072110wmn.155.1632921819132; Wed, 29 Sep 2021 06:23:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632921819; cv=none; d=google.com; s=arc-20160816; b=dOUnm/Y6KLJaO5vq7dF6GdLvagE96FwiuRuyLP5GBTFNz3KhkhjBHmmWKCBi9xENjM lUM60XI3WcR6xXPF2W2QqsWRxapQcmuWqQMuQqKuuKnVK59CBomrBcPdiQ+OCqBsBKe5 4653aQ8U92CBFMkSvTBafpmlK6JHn30X4CoPAwF8LvdXFrSLxL6TYOUqFauDY1uwonV1 3S01hKf3ffWQn0qNOCB5PEFkMnmQB8VNtbGJ8esajeeTyC3StY30WCISvODuYJThF40t NqrQYlw3hY5FEERZ8cTpsO3jOfSNc2p/QaYfDDslLItgpbWA82/zpfZnkRUwv0km+5vA uzug== 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 :dkim-signature; bh=MmSCGYIFzfMZzarwBYHnm0N3s8Oxz8OvMDOHLBQ9iBw=; b=Ud+67aAfrE8/JZMhfW5VPXeEssjuV+htIGyuZ0b6qujY5uFl5AUJp7kDLn2BTfpwfH Kb+Xxu7iZ5BdrLOYCIJOt10lOHTubTEGglLksQiuPPo9SFZtrWdZPw4Wt/l6qGNbk4+F /gN/w7Vhzt2eyP6UwkyRUBh9W//53NmZdwKi9tFar8WcCEs8wTJ7ZQmsoiV4leaOz7ld glZao+nVUVyi7YIq0papRGDBNzY0+w+XzVqBVH51ni9k+Kmcl4yjBGXVMSaO1fkvV7KL Gx2tQwUvJ35RaP9WLmrplTvTKtg7SGcU+JR/6M3JUalvD+Qk+zMlPOEzp5eaj5qJrhJN U5+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=xIGAflf6; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 7si1844687wrb.594.2021.09.29.06.23.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Sep 2021 06:23:39 -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; dkim=fail header.i=@linaro.org header.s=google header.b=xIGAflf6; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41260 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZYg-0007Kr-1l for patch@linaro.org; Wed, 29 Sep 2021 09:23:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39480) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZII-0007Mx-3n for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:42 -0400 Received: from mail-oi1-x235.google.com ([2607:f8b0:4864:20::235]:36781) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZIG-0006Mf-Bs for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:41 -0400 Received: by mail-oi1-x235.google.com with SMTP id y201so2809998oie.3 for ; Wed, 29 Sep 2021 06:06:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MmSCGYIFzfMZzarwBYHnm0N3s8Oxz8OvMDOHLBQ9iBw=; b=xIGAflf67FDK6UWvw0vzQ8mB6cZeXGB5mDEBNdeWoQ3NXx7nW0ybQg/+d60CIIiAaz G1V6xAmLl+kAnl8xpwpsDBFJ1tf3qKg1NcmGmmt+Pqqe2IJ6OrkX11bcV9r1g6RFBWdn YyKlNzijtYxKjoJQkffltVedsaavvBzwXLbfxkMUO0WeNY6i8uJYp8y6iGnFKtOlWqJN K8xGuV9XLXsnSqKL0LgIzoALeCEPHEImC7DfBw2V6aYfigfcaAkbChItXdNl8egcwh0Q zmKZ8BFs16T/cmEBoa0XgXeEeezwjX4Z5hwFMhJjCwOAo9s5vwVbZsM4+WWzdvISVYsU hb6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MmSCGYIFzfMZzarwBYHnm0N3s8Oxz8OvMDOHLBQ9iBw=; b=q8swQQ8FGmz49a2T7KScro8BbmHHDWPp9z58yO/zw5FHqzL3slbikagx9S9SUCqUIg J91URbvcPvqBA6YptM4pN4/SjioCdGyfDbd/dl0gC1BvG0+UYNU82k8Y2L/kIsCJTo6k BzeIL26SGbVt0P3gF7lIxeU8hRmP2fNoUWZnLCjhSN2LJlxW7/rBs01XShZbaMg70LN1 FSwBX6jtaMa9nQnipNfACKFT+gkcfOPVKppci4tAcA+v/TBQBNbLssGFp1DreH0IjocW TVXJt8iZlrseuAUpJuBMw1wmTvzyfOMFNkfi94iZ+a8Ove+kMwyazgCimr+35b95ZGsL oE+A== X-Gm-Message-State: AOAM530n+pJKfQHnR1fKM91j5AgHjBhIbqp5psNQFYRkxhk6qOy1jdWq m/O+GYQAr+ZB04mCABXV/nV4A2WLfIOa7A== X-Received: by 2002:a05:6808:180a:: with SMTP id bh10mr7998306oib.6.1632920798220; Wed, 29 Sep 2021 06:06:38 -0700 (PDT) Received: from localhost.localdomain ([172.58.171.248]) by smtp.gmail.com with ESMTPSA id w1sm442823ote.41.2021.09.29.06.06.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:06:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 19/26] linux-user/ppc: Implement setup_sigtramp Date: Wed, 29 Sep 2021 09:05:46 -0400 Message-Id: <20210929130553.121567-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210929130553.121567-1-richard.henderson@linaro.org> References: <20210929130553.121567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::235; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x235.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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, alex.bennee@linaro.org, laurent@vivier.eu, Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Create and record the two signal trampolines. Cc: qemu-ppc@nongnu.org Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/ppc/target_signal.h | 2 ++ linux-user/ppc/signal.c | 34 ++++++++++++++++++---------------- 2 files changed, 20 insertions(+), 16 deletions(-) -- 2.25.1 diff --git a/linux-user/ppc/target_signal.h b/linux-user/ppc/target_signal.h index 72fcdd9bfa..82184ab8f2 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 */ diff --git a/linux-user/ppc/signal.c b/linux-user/ppc/signal.c index 77f37b9f01..c37744c8fc 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); +} From patchwork Wed Sep 29 13:05:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514846 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:4087:0:0:0:0 with SMTP id m7csp25348jam; Wed, 29 Sep 2021 06:27:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfLYGAJKHpyDWhbpkLBAsojWxF3pgSyLkCS2h+NU4ZyFtWsMkyif5H6JJLWrl/3EniNj9F X-Received: by 2002:a67:5f86:: with SMTP id t128mr48409vsb.10.1632922048867; Wed, 29 Sep 2021 06:27:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632922048; cv=none; d=google.com; s=arc-20160816; b=1AOI6uw2K4uVNJ4EYoIh5A7ej926yVSOfXHHPC8QFRDfzQ7hpKtb16av6WloB71Gp2 unlyW+42WrQ/A9N0Uvu9rxVjKhDQc9SsPuYQ5/9VkzaMuMZNunE4mDquVVH9mU3IHz3e 4EB3oBM8u1t8tR2daNhgw8B00IiZZjEFUA+EjHxYZGdFZwh8WP+azjQK3I8y9yJni5Te v6REeE5neKV7IsHk38GbuX7qj6Gv6q8NlRNqrisp+sxuVTw/DoakGPkE5q5hAJa6xzOe /XvOamSe2USsqbegAFso3eGJVYXrPo3sDkekdlo6kSSsZWoSeESnVGxZGexuuM6wYn03 JbJQ== 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 :dkim-signature; bh=2KLcqQYFIaqI/6GBRBsTweGpPd52GQDyv8etIxbrli4=; b=PIvOGtbh0HDYIbbPd1Mg1dUEokqVC4ayXYKKwKgVsKFbCSm0bkUQQAtLoA/3GNoRin HvgSJcXGH1BvzaA2fyYsc84isI2UoxvNjzM4QC1EjQ2YHYovBukr8CH14SbaAjWjhQU7 M2eb2hQGv59CxTI4561W94gEU9n/x/+XfntirkZTgqJbYrd1D8ZOQu4s/VR34KcihKr1 9mOj8haU26sGcme45Jn8H6N2Iac+7HiksWKDWYfHPrsrgokxmfz7Be6KkG42enjMJ+cZ IfSQT/lpceaYt7/g7UBokIeoThItb6luBdXdvl/rIYZ3J7CWK/rhBQptum+6fCxwMWvN 5HTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="igXJmqn/"; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l12si779636vso.210.2021.09.29.06.27.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Sep 2021 06:27:28 -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; dkim=fail header.i=@linaro.org header.s=google header.b="igXJmqn/"; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48984 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZcN-0004Eh-Je for patch@linaro.org; Wed, 29 Sep 2021 09:27:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39496) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZIL-0007U8-4q for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:45 -0400 Received: from mail-ot1-x335.google.com ([2607:f8b0:4864:20::335]:40664) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZII-0006Oj-9O for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:43 -0400 Received: by mail-ot1-x335.google.com with SMTP id l16-20020a9d6a90000000b0053b71f7dc83so2751710otq.7 for ; Wed, 29 Sep 2021 06:06:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2KLcqQYFIaqI/6GBRBsTweGpPd52GQDyv8etIxbrli4=; b=igXJmqn/7DgNq/ZxMZ1fO4x5dU9AoiK2Jj8I6US3bDk/gRN77c3QL6ZJ/lGH6WW37O j7Shu1nv092Q7IaTpJ7/MGiia6dgmx2Ob0CkJwIMT2RR29rf5UVVSNoXSWFPoalnOPA+ lXEshwcx3WhH7fYCaLiFex/eiphc4URWikKUSTrxeqniHsY+SvRrcmlZc1j5cbOebaSC /eCnPLEY3+axoL3wHWi8DccbiUT0I8SlO2ZAY9Tv/nJaAEdWGFELAowsFxYD5diIqKRN h2+3pj01cdA7NCE2Yf+hxR0SgL97V5OE/iBQCEoTorJWHmTLDOrw4bk4lu3hKvy0OhbR woxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2KLcqQYFIaqI/6GBRBsTweGpPd52GQDyv8etIxbrli4=; b=tG0rjXEtD2O5+EMHM2BspwudTOmokuGChJYb8W68WFIMmeimUd+utb2wNQ7KknYjwS kF8Y9PstGlp5My9WE7UWXLVV9lon8QCFLpNvVAmK7JdCJEdm35kW6Aj+3InauQNm2MPR R8cKjZKYEd2Hd+vPUgwktwfVcQAY0QVc1FUlt/tglyat/U8Laokv1P07oqsKoyZUXPSb FVDvz7bTp6Hl049xBxuO1yBRVWWM0C+DgTko3e8HeBUw5TI6w4g7zmEZ6SMOp/ght/e+ KQ3gzpZQ9+DnP4FTMVw6WTHT8LeGpzKgeT3sRwGVg8+TEUWMZnE5loOKEBYGuGNiAdMR jQmQ== X-Gm-Message-State: AOAM533DkTsGlRr/CppxVZbXyBhVbgirKrVczJKVdzPMi5kLpbVcMB6p vHo8+ouVZwnqWka40oQ4IIZlDndVjotp8A== X-Received: by 2002:a05:6830:11c7:: with SMTP id v7mr9985289otq.355.1632920801162; Wed, 29 Sep 2021 06:06:41 -0700 (PDT) Received: from localhost.localdomain ([172.58.171.248]) by smtp.gmail.com with ESMTPSA id w1sm442823ote.41.2021.09.29.06.06.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:06:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 20/26] linux-user/riscv: Implement setup_sigtramp Date: Wed, 29 Sep 2021 09:05:47 -0400 Message-Id: <20210929130553.121567-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210929130553.121567-1-richard.henderson@linaro.org> References: <20210929130553.121567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::335; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alistair Francis , alex.bennee@linaro.org, laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- linux-user/riscv/target_signal.h | 2 ++ linux-user/riscv/signal.c | 22 +++++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) -- 2.25.1 diff --git a/linux-user/riscv/target_signal.h b/linux-user/riscv/target_signal.h index f113ba9a55..3e36fddc9d 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 */ diff --git a/linux-user/riscv/signal.c b/linux-user/riscv/signal.c index f7f33bc90a..a0f9542ce3 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); +} From patchwork Wed Sep 29 13:05:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514849 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:4087:0:0:0:0 with SMTP id m7csp30944jam; Wed, 29 Sep 2021 06:33:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnNU47BN+J8tNWHw6w6XvlfJWZ8WNqalHyEDMWwjUGy5+WmK5FzuoIOegmPdh9VqWZnuBn X-Received: by 2002:a05:6122:9a1:: with SMTP id g33mr9239289vkd.23.1632922415682; Wed, 29 Sep 2021 06:33:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632922415; cv=none; d=google.com; s=arc-20160816; b=LhHDRMu215KAegXaY3X6PN80ZjYByWzBjS1BAvVu2repiF6ZMFFlmlRp0P2UEwZvgJ wv6fXKkdp2aj/OSFqEnPtpvFyJjIISuvxfTjQZtKzAwiLeFond9UvZdYqpczOnwI8v2R etWC2NygngSFo82Gd3rt85vgM3mDBNSLX/DWfz96vEqeZUyJlAzPiPpoiTzpE5FjH24j tZu5cLapGxcZ0XX9gUwil81GDduQsOH1VffO9knnLML2PgUob4ft2WA7rRHk1T5lGMZM RJZByj441wx3H1tWHb6881jyBvGGeC8SOlrauYS5JiZT0DfdqAvIl2IyelwR+8OBFFEd ZGZw== 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 :dkim-signature; bh=z6sdM0HHcKJX3xm0cdq26GIq2QyBnBfucTBir90HJQ8=; b=gsTXCu7y0HkRhN4WDxilYWywbf5HRvZWQAyYINQRCz4ieLlPXwPJXbp39AQBc7a5sK Y4UfohudaZHlmIcUOxySNJvSEjpKjMCmsd6AN0xt6HG9wr11czAIJT/EA02CcrYw1J1R t8T6zNYEwkVTGyIAfkTuAC54+fBQuzxyTGYXtwMyCqugPQxVEhNYszwFVp/dzw3XfRnZ xLBdI08hnblR8s7tnL16c+FFoWSNSg0RtTtU+GJsiEWXWz0whN25ap1aqbE4dp7PKo1/ Q9xc+CFzL4WNHUfkGL3tCn26aRc529puTvq4D+i2Ys5I74Nz0YmNyTddWb29lZCkTijW +dGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fChyf+60; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k17si729903uao.253.2021.09.29.06.33.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Sep 2021 06:33: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; dkim=fail header.i=@linaro.org header.s=google header.b=fChyf+60; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60786 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZiJ-0003qy-2m for patch@linaro.org; Wed, 29 Sep 2021 09:33:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39554) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZIQ-0007aE-0v for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:52 -0400 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]:33309) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZIO-0006Q7-Dt for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:49 -0400 Received: by mail-ot1-x32a.google.com with SMTP id d12-20020a05683025cc00b0054d8486c6b8so2822749otu.0 for ; Wed, 29 Sep 2021 06:06:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=z6sdM0HHcKJX3xm0cdq26GIq2QyBnBfucTBir90HJQ8=; b=fChyf+60poumwB4KWy1JYYveh7q8+eXjWF484pqsz7vpfZmCOQxFadbX6gGrdKdnYN Ci3xEYmvVxQY0EEQE+etU/BjYApOKcIRkXQ2CSavKxT2u232Fr0VpNrkxXy4gLPCB0re xKJX8DiAG1/9LEP7/Gevx0n91Ck+YadF1FzGSol6TuX6asEmFTZ8o1OC76VAVAnSTVjn h+suH5QwBw1r2oqazzuX5o5UJjDvWTR3N5WJ9acwezj8Thb3GUuX5CLPO3XIznIfgOf1 CJ1Qi+m/A9VScTbTPeeVQPPXECWXiJJMIX1ln+u4tlxxpuh7ZK5zrpcTgpaX1NfkNoK4 EIPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=z6sdM0HHcKJX3xm0cdq26GIq2QyBnBfucTBir90HJQ8=; b=scSnQzp2RnGQj62GKrbTOE2/XdKO4j/FYF+1FbAryYw+Lwogq/JzFRk1zGfsV2AmUW QzgQdDeLGl6C4vvE2+32vaLHh/vCKzrhhNsb4LbLocruYF1ulmUSM3QL6AKNboFEXQk0 CZ2QkiMSvk1IbPOAbzBA5Mq2kkjSv90snBWNqP1q171oW38d0qzgyX/zAtR32duWawvv KJ14H/CQ6aRaRUmmLE76lQ9/Mf0dWU+8Kng6DhfVrUyRb0S2ErpDFiBUeywxTqp0CMzL QJu80L8H+rcH6cvwua3LEHWifAzCiB3cSNOZiS2Zt+Ovmx4u7xNHnmwldkF0E+Oh1cNl c7mA== X-Gm-Message-State: AOAM532/JfBNvUBzOf2KkAvwZUG03AWtwVwZQuIozI36EtJCbmMUOv5K E5asph4xqtZ7CAlxiP3JR/pvJ+4NEC1FQg== X-Received: by 2002:a05:6830:14ce:: with SMTP id t14mr10365204otq.250.1632920804843; Wed, 29 Sep 2021 06:06:44 -0700 (PDT) Received: from localhost.localdomain ([172.58.171.248]) by smtp.gmail.com with ESMTPSA id w1sm442823ote.41.2021.09.29.06.06.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:06:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 21/26] linux-user/s390x: Implement setup_sigtramp Date: Wed, 29 Sep 2021 09:05:48 -0400 Message-Id: <20210929130553.121567-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210929130553.121567-1-richard.henderson@linaro.org> References: <20210929130553.121567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32a; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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-s390x@nongnu.org, alex.bennee@linaro.org, laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- linux-user/s390x/target_signal.h | 2 ++ linux-user/s390x/signal.c | 24 ++++++++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) -- 2.25.1 diff --git a/linux-user/s390x/target_signal.h b/linux-user/s390x/target_signal.h index bbfc464d44..64f5f42201 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 */ diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index 80f34086d7..676b948147 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); +} From patchwork Wed Sep 29 13:05:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514848 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:4087:0:0:0:0 with SMTP id m7csp27331jam; Wed, 29 Sep 2021 06:29:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZHTYgNZm7G7jU5AiuGNKM8UCCBS05jUa7wbGPkiUoFKbjg3t0F4vGi+7mu1+eLljodS3w X-Received: by 2002:a05:6102:734:: with SMTP id u20mr675vsg.13.1632922189904; Wed, 29 Sep 2021 06:29:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632922189; cv=none; d=google.com; s=arc-20160816; b=TLbNT0NkAKMRJx3gTv6vjQF5+mZM/MM2arSowF3FmW7JUUWeXcE+CgaAkFJnandb0o xxhgQBRMAA5lIS/jC105T6Cj6EmvJAdbFJ7ZPbHHxa12R8dfP7KxzDRpZbYJL6UrrCkx ZfPcHtXP2VeIMhfaufHknyG8qhArJqiUncf5XY03i3YX842bHU5A9sgT44r/9z4JGU5k PBD4UqFxnRnW4jdS0TAT2ZFka2NOTEtFjf5QE52DzVAk6TUXGBlJ1uWMizy8RUBi5f3a /1do7ROPiNUCjymBgv8M5JJPS3sJMm5iaOpyVZCD0R/PJSKKrBgMa/83+KIVVN9+XD2M m2Hg== 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 :dkim-signature; bh=N1pQeWtC9n4Sw0tRD9grdf+GtJJknjzU5E/8NqeYIIg=; b=gOfE1hJfoA3UyTg8Pph5D0eOgMJCtVh14mT2R6jR4/PyDcC4XSh7JpaUgS0Kf81PN7 E1+lxEmqnLrujdspn/rfZZ0LqO/jdOfVNQ8RX8PtLPCoqYBBfqODXsKf4oyVi7kQmBeh 14o6Fwi95Z+zpKc15e0Za1+oFKB9D/d8VLvdBQUqO1qAjL1ucYPh4BGlDnL/ORgRCzrS u86q37nvjOLtuxfk1WfAJT5chkAmR71JINVAYRRRyrDnTrbHvC3Peth/RWtb631WieYx nFPhajicSWP4PFPUON6xD94xcp0iEXD6J+cWJ3NzbfAwoyauO7YoVvK4hvYzyk+ZeHj+ yH2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=V5OY+FFT; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ba39si1772686uab.193.2021.09.29.06.29.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Sep 2021 06:29: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; dkim=fail header.i=@linaro.org header.s=google header.b=V5OY+FFT; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:55724 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZef-0000J4-8t for patch@linaro.org; Wed, 29 Sep 2021 09:29:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39572) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZIT-0007bY-5U for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:53 -0400 Received: from mail-ot1-x32d.google.com ([2607:f8b0:4864:20::32d]:38818) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZIP-0006Qy-3Y for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:52 -0400 Received: by mail-ot1-x32d.google.com with SMTP id c6-20020a9d2786000000b005471981d559so2760456otb.5 for ; Wed, 29 Sep 2021 06:06:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=N1pQeWtC9n4Sw0tRD9grdf+GtJJknjzU5E/8NqeYIIg=; b=V5OY+FFTo6FKTxfutsXHG90MHRYs8350pQjF1Y3+I23Ln815aN4E2SdsapxocFXYkY xSjXWZXDIaZKsw2COvR1BllxYySj4BhTqu7fUdyw6g3UmyazdOaYHJsEGIdZe7YXk0vj N6AdFSj9gIzDgDLntB0a7TRx/9xTIZL1nO6YeCpEXl8xXtG7K6X2eVbfzZ+iBro2L7GL k8HOxs9uM9zrnoQ94Ftqx4H8panWPfO3XG+gDXhgRRuCe9dr7g7c6/wcivv+web9Xpno LEJHQRvYYqBAXP/CIsdJ94TrE4UkZ1nyBXK0alQv6b013GPYGccysPnLUUF/zniHlbAs LpHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=N1pQeWtC9n4Sw0tRD9grdf+GtJJknjzU5E/8NqeYIIg=; b=Lmm3wyP1yt0urh2wKkJC/Qm7IZm0vYG4OKGd1zlid7lnQIBrk5Mm9vfh7EyHNiPa5P UgcarW9SFZDod9MaFGIsYMbFIfi2rZdc3phjEOMVKifN3BPjmAbQcV7WQK7DlqmIsu0A iY40sCB6pPPz/JGlRdthB7e0uP86yQd8wkJYd1D0gwSBt4aDihpi4rfTVbm6kgVw8Gq2 L2Q1M1V4YRDOW7qM+BpV33g6/3xv+CNBgcM5IiuAqX7jsKkNox4s2lsNmkKEjSzVVeQI 4Y1Mg1LRMFtnlcHpGyG9yuJeRrLEdAvuFgS2hedKqNUQsZsEcg8BtEWvgpK2Otm1QRiW ByDg== X-Gm-Message-State: AOAM532fRa73tO0hY+fVAXfqM4xGpFSUmdUWiQBYjfZHJSZlTzJK5y4C xmDlBCcuHJygJeitoKIYpB+RpPZKeUsVhg== X-Received: by 2002:a9d:3e5e:: with SMTP id h30mr10031059otg.255.1632920806972; Wed, 29 Sep 2021 06:06:46 -0700 (PDT) Received: from localhost.localdomain ([172.58.171.248]) by smtp.gmail.com with ESMTPSA id w1sm442823ote.41.2021.09.29.06.06.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:06:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 22/26] linux-user/sh4: Implement setup_sigtramp Date: Wed, 29 Sep 2021 09:05:49 -0400 Message-Id: <20210929130553.121567-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210929130553.121567-1-richard.henderson@linaro.org> References: <20210929130553.121567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32d; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, laurent@vivier.eu, Yoshinori Sato , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- linux-user/sh4/target_signal.h | 2 ++ linux-user/sh4/signal.c | 40 +++++++++++++++++++--------------- 2 files changed, 24 insertions(+), 18 deletions(-) -- 2.25.1 diff --git a/linux-user/sh4/target_signal.h b/linux-user/sh4/target_signal.h index d7309b7136..04069cba66 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 */ diff --git a/linux-user/sh4/signal.c b/linux-user/sh4/signal.c index d70d744bef..faa869fb19 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); +} From patchwork Wed Sep 29 13:05:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514852 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:4087:0:0:0:0 with SMTP id m7csp34848jam; Wed, 29 Sep 2021 06:38:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8myV+F5Xc8RztjalSuInLyozVWjuGy75H4MTzGrNMKWvvSEKFSy9Fhu1jnBVujjANUv16 X-Received: by 2002:ae9:eb58:: with SMTP id b85mr5030802qkg.323.1632922686817; Wed, 29 Sep 2021 06:38:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632922686; cv=none; d=google.com; s=arc-20160816; b=X+pO9DbFnU6JilEQiHGcAxL/Cc5y8fP0Unz1F/xkAQlO/VfJeXrxkQzqmg3aoXjoon acZ/cqwwd9X8w01pRnSiUc+yEw3WfE4dpCeEbOB1c5DWn+IGUi21VRklp7HLGWcVdYbS LKqWYRfyEnNsh2P9bh6GQLNf60gmV7Tu6WSCF53wJdQ36E7vQX3YR4neCz/D0Xdr4Ly6 qt+GlHxzFEyTXa71uNRxjUMOxQkB/BXb58L06Pqbmq6F0Zr4WtD+Z1UYCdgm2xHqfPx4 PP+KnBCeLhmo8rVoeRIy1EIGzCo8kkLC8mwJtUqXeiO0GBLa/3UTehop5m1iVTi/SKQS fYBQ== 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 :dkim-signature; bh=em63mRXCyLKKFcAEyKw3h3vHxVxde+27GcHsVAZyLao=; b=BaoYyZQzcBqvTDG8F9eKzbO0fHltkWvFDvY7xy+x0DVRwee3AqzTSYScys6D10UK80 +dFcw11M49n7J5c2D6GXpYNdA5AMPfDra6bTSPGNOw+qfSF5Hnr99OkdPtgsd76sXmqQ C9kyVBTBOKf+Vf+/wXnmWIRTwvpeG1JGdNkMaQPs0jxRC9V/FkarqZr+AJynt+R5pn4K A5TDzYsjcZCBunBSX9AjIp8d1TvPvnIFF/AQhzcsEc8smHrxhDcXa0G4sHwIWnFuPIvJ Mz6DsKcgGZAqW/79/FNtMo6bqV1TiUTdtytDoFKwkPS/f883aIP/prQbMd5xFicIMTuc Tewg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=CqHXmF4c; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w12si2548813vsa.281.2021.09.29.06.38.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Sep 2021 06:38: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; dkim=fail header.i=@linaro.org header.s=google header.b=CqHXmF4c; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:45742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZmc-0004tG-Ef for patch@linaro.org; Wed, 29 Sep 2021 09:38:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39622) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZIV-0007hw-M8 for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:56 -0400 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]:35580) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZIS-0006T1-Sw for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:55 -0400 Received: by mail-ot1-x331.google.com with SMTP id 77-20020a9d0ed3000000b00546e10e6699so2771225otj.2 for ; Wed, 29 Sep 2021 06:06:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=em63mRXCyLKKFcAEyKw3h3vHxVxde+27GcHsVAZyLao=; b=CqHXmF4cer/jDGT/G6BeNp6ohx1YjS26WNnexhRj1NQsR2LxUe60F7sZForfRfAKCE Z6tgaBgQ6n8hI/utoPZEGxX+zcsEmmB89VDcMLbmRVqLenONeZPX2M3pm8mJYi+vJKcY nJPp+WbysYdbTgzPNbf+QNh0WnhGCFtTSPfk++7YXmwBlPwlUk3UcZdb4qIPYkbEr6hB ISBgIyZW1fGRsaVGBU7ZrRJZgiEsiG2VdcbbO158cgtWdYDMGVeQXzEiSPbJIwP5E6Wo HGq4ZCCi43LvRXmctg2UZqplNrhOflGTQVrptRV0sUJ024XnGpfp8QMD26HdlmXMbnV7 /pnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=em63mRXCyLKKFcAEyKw3h3vHxVxde+27GcHsVAZyLao=; b=dR6Ndv+i85/CEEO0hhx20ZDGMyqK/KjYNqucK1fMv5cnIF95teQywj1+Aq1cIPJ2YL AFgC0e/ECkGkkcjj4ZKPgL+VagsR2TPh8+tfBsoNP+DRkRwYzrSik0lpYZUma8QCV1sY FvlptLA2mqUIQGeQUs1Gvx4kJsoZuxTprnxBwNQRXrJmus+AI///SPzNJe8jzXNVvH3d Ytvuhl9WD2gAsEk0fvoLyKf5A9bcaubeqnM2pW1mMbRb/+Rvxyr7nwm1p4gYKGIC5hkZ qU1c4TPHW8CYRFD+WlsTwB6llBgSX/NioKAzz2WlFzByUpmLsPU2eQBVlVel/CsnJ4jF HxMA== X-Gm-Message-State: AOAM532qlU1mcWLwCOr1mcdcAl0AIKwleTCvN9Rh3uSHHJUDVowEP3lE KSnspfaAkaMH7hWF+CHGUsE6eY/4neRN0g== X-Received: by 2002:a9d:7d8c:: with SMTP id j12mr9858821otn.135.1632920808784; Wed, 29 Sep 2021 06:06:48 -0700 (PDT) Received: from localhost.localdomain ([172.58.171.248]) by smtp.gmail.com with ESMTPSA id w1sm442823ote.41.2021.09.29.06.06.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:06:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 23/26] linux-user/sparc: Implement setup_sigtramp Date: Wed, 29 Sep 2021 09:05:50 -0400 Message-Id: <20210929130553.121567-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210929130553.121567-1-richard.henderson@linaro.org> References: <20210929130553.121567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::331; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x331.google.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , alex.bennee@linaro.org, laurent@vivier.eu, Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- linux-user/sparc/target_signal.h | 4 ++++ linux-user/sparc/signal.c | 40 +++++++++++++++++++++----------- 2 files changed, 30 insertions(+), 14 deletions(-) -- 2.25.1 diff --git a/linux-user/sparc/target_signal.h b/linux-user/sparc/target_signal.h index 34f9a12519..e661ddd6ab 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 */ diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index 3bc023d281..23e1e761de 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 From patchwork Wed Sep 29 13:05:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514851 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:4087:0:0:0:0 with SMTP id m7csp32573jam; Wed, 29 Sep 2021 06:35:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGutKypC/D0vblO6o6rwjunghvLxBvkjGwYvXUfQzSJIbX4ZYOanpdJGvcFKg01TKFxftk X-Received: by 2002:a05:6000:1844:: with SMTP id c4mr6605854wri.355.1632922520551; Wed, 29 Sep 2021 06:35:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632922520; cv=none; d=google.com; s=arc-20160816; b=miaMGJXMRxT56Pyl4fOA6g4SvVIrt+VcgHXKzR5Dcvrg4MIJ3co+nchyXC/u6542P8 VfDZwopIlimP4TYmLhqy2jGSmoSWDRNhlp7bsMRHXdcCwsGdxhjYhB76ad5dsOJdup7b mMJB0OKJuw1TC4zdzLezHYWNEkCxFYnR+YEnWCrTfhP4cMM4ivUatA9X/0s8lt/AF9QM O8uVzCvvhMgiOgOrJKIyfUOxh5Cs+wjHaU93Jq8AqqxstSFJevs17ZG9RHUaj+mdNU9m +uNMfXMuXWXdRX+PHPJzdiySxnUnfEQjQ3Ph3xM5Aw0AvHy9z6SvveQgG/+PGfySS9PK 3B7g== 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 :dkim-signature; bh=/YCijfVDlMthAy6Aqm4CcfWtzvTL1hpUSrm3kzthwro=; b=B1Iht1cFkhK1bLKuDUqvJjHDhuUakvhNCJLm4d2a08GRZFOW/CsWk2H7kuz3ayJm/F sxbujvfmuN1yvQo54SHMehDmiChQGYFy4G3rRKDoaccrKnyhouo/AcMl4cqVY+qPU5ea KAZVqN9vrLHBNvWZXgWqCtKQlvbBB/KLhYm9ORGctVtcDXWUN7r+FHHofdmnti62wEG9 FgwK2g1tlx4XXLl7V7whlSDeM+JXyoaOWDqXYnZjQ2NSP5PvklUsqaypJd6atkubWb4J O2HayEhSTOfhOAs0TuWJJn76WHcLLAkR+lJkGzzeKnK4JgvOxsvQ2m9E/WpFs8kUtgOY yaoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="tXs/z8gB"; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y9si2636389wrm.357.2021.09.29.06.35.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Sep 2021 06:35: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; dkim=fail header.i=@linaro.org header.s=google header.b="tXs/z8gB"; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:37928 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZjz-0007s1-DP for patch@linaro.org; Wed, 29 Sep 2021 09:35:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39614) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZIV-0007fn-1z for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:55 -0400 Received: from mail-ot1-x332.google.com ([2607:f8b0:4864:20::332]:36577) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZIS-0006UW-TW for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:54 -0400 Received: by mail-ot1-x332.google.com with SMTP id 5-20020a9d0685000000b0054706d7b8e5so2770154otx.3 for ; Wed, 29 Sep 2021 06:06:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/YCijfVDlMthAy6Aqm4CcfWtzvTL1hpUSrm3kzthwro=; b=tXs/z8gB1BCxpcGziVvnWW//iMGPcPiqiduh3YwVpijle8vAT2ShIxH5ZESibFBeZe o9NASbEK/6zrSxW5g8hVlxTNv2/vQBLEtt78Z6DeF+lH4MYETSamAwFz4mzIqeAQ13TN XpnGP6dS+FZyEL9r3s3c8R9/JbgU1fe/0E7Djl6y8b3TYlUJFjJRKHpFtdvQHr3IawHA qjb5r0xEjijuzo4sHLTJ7zaEgDgToEVTaUM1Qr4OEGdoD50Afn97ihXl5MkQ1tn3lc/1 F8imOwTn6oGfvZbkFggqCZwpaCdz+C/x7Bvqr8KWSb+BApW3vrEwb1J20GKtRy5EdRzc dKug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/YCijfVDlMthAy6Aqm4CcfWtzvTL1hpUSrm3kzthwro=; b=1uJ128s/BxgLoHqO1uI1FXvuNcYX5kvTA/e+LiE0rdhJXpYqoe5yIuEP82KV4GvlXK n/d0we5nFmG2/H8jQ0FL8O7rkasRytiXTn1Fe2iSlKcnLReb4d5LH76vTHY8L3n1L0NV xJP3tqUlMSDt6oT2Ibbv2qeF3t1Sx7uy/4lCwh9evvWLLdKraE0IE+loCCFjXd2tmf5x EGsN6kV3MTvbpacsyipheutKf63l+NsbuagXhSe8BKTXtnICET15UQ2RGhnW2NDLar1p G6ZgIE/kQ9Sm7oLr8dv5zDqNXDwJzgiZe0Um1YRiMHR5IKB59XG60r0hAaU1cYWIt+y2 OwVQ== X-Gm-Message-State: AOAM5328SIYZMF2p/pryj2jbICULujYciGRZi3fyvcmCxkG3liXHQPc2 Io22gp5QfPZmoIC0s4j0T85kH5dgEwfQZg== X-Received: by 2002:a9d:1716:: with SMTP id i22mr10110387ota.20.1632920810433; Wed, 29 Sep 2021 06:06:50 -0700 (PDT) Received: from localhost.localdomain ([172.58.171.248]) by smtp.gmail.com with ESMTPSA id w1sm442823ote.41.2021.09.29.06.06.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:06:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 24/26] linux-user/xtensa: Implement setup_sigtramp Date: Wed, 29 Sep 2021 09:05:51 -0400 Message-Id: <20210929130553.121567-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210929130553.121567-1-richard.henderson@linaro.org> References: <20210929130553.121567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::332; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Filippov , alex.bennee@linaro.org, laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- linux-user/xtensa/target_signal.h | 2 ++ linux-user/xtensa/signal.c | 56 ++++++++++++++++++++----------- 2 files changed, 38 insertions(+), 20 deletions(-) -- 2.25.1 diff --git a/linux-user/xtensa/target_signal.h b/linux-user/xtensa/target_signal.h index c60bf656f6..1c7ee73154 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 diff --git a/linux-user/xtensa/signal.c b/linux-user/xtensa/signal.c index 7a3bfb92ca..81572a5fc7 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); +} From patchwork Wed Sep 29 13:05:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514853 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:4087:0:0:0:0 with SMTP id m7csp36712jam; Wed, 29 Sep 2021 06:40:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaA6k5xryZ9y8GuGdhaeBX+xMiVHHs/xM9R9DhoJFjAT6yiYVngxyunQeDh7Z2aWQjgOH6 X-Received: by 2002:a05:6122:e13:: with SMTP id bk19mr1777596vkb.15.1632922822147; Wed, 29 Sep 2021 06:40:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632922822; cv=none; d=google.com; s=arc-20160816; b=FQ7nULL9sUELynnHHPHor6WnyZTsmo9iiEo63kWztoJA7E//3xv/bPHTECrkZZFnj2 aqHObD1wAD7yAhY6uOretcjZw2SMXLcCTY8bnYBXXKOMD7Fn9w9SmcrdC7PMdlPYPLtb PrVg8nkOfqlvlCbmj0akw7LTV7Pdk69MkJ5QxuJZHDMK90O7fJPqcFrtQ1bnQDczSqqX Nsgf5e9neMK0AVziVBBZuBb5xV/tcrL+u50V80G6h7BtGJ9u7xPh7/hsctiE26yFkTwy rlKyde9dR/Fw37+PfA9j2ZJLZt3lgEZEFW4lpTnA4andOg6+jA9JYBP7TmY/UQkns6k2 qmcQ== 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 :dkim-signature; bh=m3BaOtd2sKvGGMkwsWvzzoYXWYcfmOr52yRDlczbFYY=; b=qECLHS3YeXwCULJ1RwZpW9od9SD8PVrI7PPUiIoB10fCDZSg34pKOInXQaWo1AKbBg knykC44XL4RT8YjzkWCk0PICfn3BDp19MBscbN/988A/+QFNbRopbJIglaqAo/DoYI6K AaPfmp20oGKV0Xuy888woTXKVDwRuaFjqS4kKLnoabGgpT+drZbSYJeJ3zTVJJS43nWC 8kI/Ft6/QffwvPAmy1lBuUKxo2bTe1229F/gudJJUPpBTuPwVTRRG3Ooeg6fI3zhKoWL 1yKZIF5av3zQfPtzWrzT4Zt6elbUXrHCZOQkSgZOY0VDrHXn362I+5iVb0SfNYzOzCHS 7t4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=sT3LLVRh; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c26si2006416uaf.24.2021.09.29.06.40.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Sep 2021 06:40:22 -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; dkim=fail header.i=@linaro.org header.s=google header.b=sT3LLVRh; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:53010 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZor-0001S6-Hl for patch@linaro.org; Wed, 29 Sep 2021 09:40:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39630) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZIW-0007i0-3F for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:56 -0400 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]:37494) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZIT-0006VT-C5 for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:55 -0400 Received: by mail-ot1-x32a.google.com with SMTP id r43-20020a05683044ab00b0054716b40005so2763261otv.4 for ; Wed, 29 Sep 2021 06:06:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=m3BaOtd2sKvGGMkwsWvzzoYXWYcfmOr52yRDlczbFYY=; b=sT3LLVRhNX954F2bKCK9Gwz++/g1bVRgNSHr3SMmnkq2eBgb3uBVXcTInyt0Cf37Y7 +8cV+WL5U/SMomdxCMfd7KUKudHk32h3R25i+lC++fyISjSnggUHquar6hnuinqU6rel dSPM0dy+h3nuBnp68746dJyHCjaaBdc6Yuihn59HJM17x7g2fMrbDC05Kxvi4/OgcpzQ MmeMTflB9Ns/UXTWumshnVGNrjZMIya/iDe5BN3O4DACOGGDnY3s5c30gM2g16AmR01v /PbUjEufbJ4pb7oVxlbFTyP3mveZ46sYwvwUjhpHQgADII0VXBIoat+542AEzGu6fspD q90A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=m3BaOtd2sKvGGMkwsWvzzoYXWYcfmOr52yRDlczbFYY=; b=J3jKTyd7x9lAY8tz9MtR486FIUnAzzUpcKZYtVmJi/+6h1kG5CU0InzGShImZgftGI 6h8Mx5Ky6by1WO9K9etSF928MSHoLwItmz029064V+S06rWNWUkgfiMryzqcVVS7vZ3J sJBH72G+nJfkJdp1nOpOpmMfMrygy629JDySQL632hFnxbhhXrmKEop1OBTHGYO1QzTX Nu1IhayY1D8mN/fY673hu1vCagP7o+210BSKHQNoAIEkvblG9WM4RcHJzcMeZPs8MODE HS8m6V0dMC5hbXbvGxVyapkr9gSCbThHiJuSfeDBrZklE8LyTepm7MZSXKvV8Ns95dGS mxuQ== X-Gm-Message-State: AOAM533qE32gO8kN40kiiULhKH4knkwOs2kl5Y+qZ/Rc2nc9FFunVbdz 2iwmfI9Omace+eZtjRDak+GAM8G/oc7QmQ== X-Received: by 2002:a9d:7b48:: with SMTP id f8mr10246792oto.112.1632920812381; Wed, 29 Sep 2021 06:06:52 -0700 (PDT) Received: from localhost.localdomain ([172.58.171.248]) by smtp.gmail.com with ESMTPSA id w1sm442823ote.41.2021.09.29.06.06.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:06:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 25/26] linux-user: Remove default for TARGET_ARCH_HAS_SIGTRAMP_PAGE Date: Wed, 29 Sep 2021 09:05:52 -0400 Message-Id: <20210929130553.121567-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210929130553.121567-1-richard.henderson@linaro.org> References: <20210929130553.121567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32a; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-?= =?utf-8?b?RGF1ZMOp?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" All targets now define TARGET_ARCH_HAS_SIGTRAMP_PAGE. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/elfload.c | 4 ---- 1 file changed, 4 deletions(-) -- 2.25.1 diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 459a26ef1d..2404d482ba 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 Wed Sep 29 13:05:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514850 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:4087:0:0:0:0 with SMTP id m7csp31271jam; Wed, 29 Sep 2021 06:33:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvvmOp6xieFr+Q9A96ohmsMbrsEBHAiww076SGBq3hFzjCqZz6Tamrk0zwjpsu7BRek7Nb X-Received: by 2002:a17:906:e82:: with SMTP id p2mr13604408ejf.50.1632922437616; Wed, 29 Sep 2021 06:33:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632922437; cv=none; d=google.com; s=arc-20160816; b=Fjf6bnpvb+eTbDXcQcq/4QjtSATB9MPQ31Nf0r8WYdSrqJG39ycdRVgkB1jrVHogYU uXijm3ROssaSfWEsqqvSdjQ4Gsw5OWOT8HLQQHtj+JIzkS4mPY0mxkuMOStIZm47BJuD iqd6jfYdws1p//7JMPv9/CfsmtX8JAnVoWmiq/Zk5BysUfbWwFGFPHzIxNjsBUK12wY0 sGuegj95V24gdf5vNh9oOb6MnQHLvYD0I+LQs9WuwCQP4UOZQ7BV1IiHM1Sd9UAh7djc Kv8fjyCsxjWDwcsIk7LA3o+eNbYE+9+uzS5NEmeWc2DElIg4Qc9ikVekwyKLWUdlaW0q kAPA== 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 :dkim-signature; bh=8ynnp9vGqHmT6kBqqAm5CvgCkc8r0kk+mLzxDi9UCsM=; b=SHtwlmnAvBgPqYuxlpR5RUd9ksjYUinf+fBF6ntGw21GFzO6E79UEMOkvXN4YHruDB mNkqNdPT1Z12ZxZ3lP8LYSJd5hNzF682BIzON2WG1yuuWFOqgRABABBVjhbnZdSWmGyq i+sjHQSob6sQFXW0d7gm2ZAh+t+cfp48W3f1UmLctpHloN7c4Pq0P8bOY1nix1eRHL2q BLFU9Y2uBZe2s1qDG4I477rt0JiiKnf1GJflgTHzV2k8yVG8VqRWIO/6bOL8Od4xQu3J evOoPUfcR9fFjyoGvDqMpGVjCM+IKEfnkWwWVw459mK6RTT3f5Ko6nw4vHZJPM0ewVNz Xq5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=mvRtgLBz; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i16si2621367ejd.241.2021.09.29.06.33.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Sep 2021 06:33: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; dkim=fail header.i=@linaro.org header.s=google header.b=mvRtgLBz; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZie-0005VW-Ng for patch@linaro.org; Wed, 29 Sep 2021 09:33:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39650) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZIY-0007mH-Nx for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:07:00 -0400 Received: from mail-ot1-x336.google.com ([2607:f8b0:4864:20::336]:33322) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZIV-0006XF-9v for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:56 -0400 Received: by mail-ot1-x336.google.com with SMTP id d12-20020a05683025cc00b0054d8486c6b8so2823363otu.0 for ; Wed, 29 Sep 2021 06:06:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8ynnp9vGqHmT6kBqqAm5CvgCkc8r0kk+mLzxDi9UCsM=; b=mvRtgLBzAt+bZSG8RlwHk4zvHquy+UygSVZG2U8ECHZxr5mHCMvcheturV0uFklSY/ mUtl1u/F4eDWrkKvKsKLFTCfEz+8cbzym+j/hlxnhjqXfO0z1Ji8qvIeqYMMmhBnn1YI sXsqH/TqjCvIc+jZrTgvISAE1Z5/x45g6gCOSnpPD885+9OQEl2bi6KUDVFcvybQxfXg 7a8MZRzcyoRSEEThKRM9g2LIo8uR9W9HYc78XMOKp0ghTQ+B0rodkHY9TnEMG/RC6Sqk 3i2pAYFaRPUfTzidN1v/n2NQOwoZIKCbpr0c6t2qwxFfByPDOsNsWlVqhEHWsdE8XV10 /itQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8ynnp9vGqHmT6kBqqAm5CvgCkc8r0kk+mLzxDi9UCsM=; b=1HYcKI5TTeKXhRdtNBwqTn2QcTAzqtzCoZmZrad0/TTEEe0KTvQsVLCAp06Rv8o6w6 R3EhcMn8XIFwR3Q7nWTfg/dfJ3jwYhUO94Mz5ZJqkNfgDgJoXrb352vZUJ6pG5WVYFLp PuXu3/fN2Nz3N89T9th017oUe6+EEAJRTwAF0rUBoPmnWnSZ6lzN9F0GM5zUt2yWXtXX 75GTkqSiXsiHlKjsn/DMHo2gTak7e5PR1foHj3aDnljN9mD89NREWrYPUcacXV6kaEQ0 FKFIcv2Mfx24o9Lmv5oLqnSE89QUDt11tzsb/GhYmFHom5Zjh0igh3WrDA2dM1xleDS1 m/Fw== X-Gm-Message-State: AOAM533AS9iEOcebcJty3+2L8CwKPlRzLZ4+qob40e7tK35rd8Y47eCw nJ+cC6bf2nVg114mqeM7dOTR+cEPDViDug== X-Received: by 2002:a05:6830:101:: with SMTP id i1mr3611867otp.107.1632920814238; Wed, 29 Sep 2021 06:06:54 -0700 (PDT) Received: from localhost.localdomain ([172.58.171.248]) by smtp.gmail.com with ESMTPSA id w1sm442823ote.41.2021.09.29.06.06.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:06:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 26/26] tests/tcg/multiarch: Re-enable signals test for most guests Date: Wed, 29 Sep 2021 09:05:53 -0400 Message-Id: <20210929130553.121567-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210929130553.121567-1-richard.henderson@linaro.org> References: <20210929130553.121567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::336; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- 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.25.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/tests/tcg/hppa/Makefile.target b/tests/tcg/hppa/Makefile.target index 473864d1d4..d0d5e0e257 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 a053ca3f15..38c10379af 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 85a6fb7a2e..3f283eabe6 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 9d18d44612..47c39a44b6 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")