From patchwork Thu Oct 15 04:52:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 302842 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDDADC433E7 for ; Thu, 15 Oct 2020 04:53:19 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 26E7D22247 for ; Thu, 15 Oct 2020 04:53:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="zq+6G8JG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 26E7D22247 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:42284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kSvGP-0007yS-VZ for qemu-devel@archiver.kernel.org; Thu, 15 Oct 2020 00:53:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38532) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSvFP-0006iP-3B for qemu-devel@nongnu.org; Thu, 15 Oct 2020 00:52:15 -0400 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]:36959) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kSvFN-0003OO-IE for qemu-devel@nongnu.org; Thu, 15 Oct 2020 00:52:14 -0400 Received: by mail-pj1-x1041.google.com with SMTP id hk7so1178794pjb.2 for ; Wed, 14 Oct 2020 21:52: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=k/KMHbcBe/psiXc0RgwR1e2SMDbT/ILF/e2Crf7DpqM=; b=zq+6G8JGRHXuQrlbN4d5anSsFlntJplRrBnJupX1xsZMQvZyjVx3tQ6m/RRhi69sGO dNcIqakSWvlkdAh6ibFZ9hvXdUBPexBqFTMcgnmvhIA7LdXY2EB5OZ8lUbQ9CQ6ZImQO pkTDopYxVGyecVDHlT8Bb3x3YbW3e2YaS1fCfv1wWGcelL9YH+xBFJ8UsXCccaPjoS8V Lb8TBjXK21hwa5Zoo5hdcfNsLx/93pz4R52l5RTH9hzVvMe3wXtszCWPP5UyTnuBd/hx 60N1veKE95VFtyL4v19it0fmz9Sf3MhSEUPy5wtbP8Pl410V9TD1mqEQw59yF3DjYVtP 5Lbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=k/KMHbcBe/psiXc0RgwR1e2SMDbT/ILF/e2Crf7DpqM=; b=dnRLPMsZOo8vuB1uOSbobXuEQcT5Us1XmNJp+hknnxcwOZVIyjNIeNoR+VtyG9lMwx qVG184D/b/9XpQ/a0pH1Rj9ckycNjz7GHgwsIV9KzV8lx0XMLqQVo6dyfBNPt7tyvFFj MmNm1fptat3DnIRLFf7LaGaRp8l6pheGnh+07DIHxztd9ZNLm3GVKg2GJOb6VzI/Qc2l tqPUCg08b9u1gNOiviQmVzGlbpDU1M8dIB5/o+GtO99mDQkVv0d2gVdIwJyN4gkxe7tp rOS5jUNGIj/u5czOhLvLD1zoIO8KiThmoAu9YTjVltXGpn0xg+/1d9sWJmClJy/aVzEo oS8Q== X-Gm-Message-State: AOAM531TnX9t2G/6wB/83CY4mPCK4BZ7m+w9vFvehZi7+FQxUacdvbLX FNddduZJgI4tJIFCCUFbAoJKKFnjHwYATA== X-Google-Smtp-Source: ABdhPJweGC9G+yAmjQuOOcMMj/xDyZ6dqJ5ZCSdLm6gGjx8cv8v23Z9CIq+L5BmXYyXAM0XZS7Y8XQ== X-Received: by 2002:a17:902:7c01:b029:d5:aad0:b7b1 with SMTP id x1-20020a1709027c01b02900d5aad0b7b1mr2546163pll.53.1602737531626; Wed, 14 Oct 2020 21:52:11 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id q66sm1407493pfc.109.2020.10.14.21.52.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2020 21:52:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 1/3] tests/tcg/linux-test: Adjust getsockname for musl Date: Wed, 14 Oct 2020 21:52:06 -0700 Message-Id: <20201015045208.595044-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201015045208.595044-1-richard.henderson@linaro.org> References: <20201015045208.595044-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1041; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1041.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Unlike glibc, musl does not use transparent unions to hide the different structures that overlap struct sockaddr. Add an explicit cast to work around this. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tests/tcg/multiarch/linux-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tcg/multiarch/linux-test.c b/tests/tcg/multiarch/linux-test.c index 8a7c15cd31..96bbad5823 100644 --- a/tests/tcg/multiarch/linux-test.c +++ b/tests/tcg/multiarch/linux-test.c @@ -296,7 +296,7 @@ static void test_socket(void) server_fd = server_socket(); /* find out what port we got */ socklen = sizeof(server_addr); - ret = getsockname(server_fd, &server_addr, &socklen); + ret = getsockname(server_fd, (struct sockaddr *)&server_addr, &socklen); chk_error(ret); server_port = ntohs(server_addr.sin_port); From patchwork Thu Oct 15 04:52:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 271246 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5C28C43457 for ; Thu, 15 Oct 2020 04:53:21 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C715D22247 for ; Thu, 15 Oct 2020 04:53:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="LrqgHKnA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C715D22247 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:42410 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kSvGR-00081Z-Rk for qemu-devel@archiver.kernel.org; Thu, 15 Oct 2020 00:53:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38554) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSvFQ-0006jm-IG for qemu-devel@nongnu.org; Thu, 15 Oct 2020 00:52:16 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:45499) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kSvFO-0003PK-Px for qemu-devel@nongnu.org; Thu, 15 Oct 2020 00:52:16 -0400 Received: by mail-pf1-x441.google.com with SMTP id e7so1221542pfn.12 for ; Wed, 14 Oct 2020 21:52:14 -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=1LCwDo1eVMbYFulmkO+AZzovxuJTVRnkzThWv1cuvF4=; b=LrqgHKnAnqWsHG1ZZjrjSydj+SxI9hI3jPEkbFl24t7FOOFlPGNXRx1s6kNdUGjmM6 AWvavUFZ6K3uQjdJI9yjCAvGQqCA+6XQiukq4wMezLEzR5adzUbQxHF4BTvjpFHyUfXD 0vBAlA7Vy8N+aIEBaeXstObJuR29gDtc17+LMajJubblFdjLMMUV5+KFljQF6tQhCCHr t/CnvOByMnsGZyHOL0f4n/N7bV8AXADLvbXVC1SSFlHf2l3Doju1HUOKcPTLEY5r+hAE qY6xU8B7sqelp3zMG/3E2Xqmk4aPQUsYs8U+g5ZbkFWfgfQp4BvsMhLJN4NMXTGYlGE0 4K/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1LCwDo1eVMbYFulmkO+AZzovxuJTVRnkzThWv1cuvF4=; b=XQdRBtHLRxEL1/GeIMK2EB4rKE/NxRyXQG/cXnNzcmR5G/TCI+asMfuiPJ3CBLG79T 82EeTy/89mtsK01YnIhgmsP30ZA+Ype8ckKIuJTqnAOXojMlb/CStXLcYdv+0O5dpknM ukjq/V7lxccudYv7CnNHkZoBmVz/dNTLxR/FmkHQ8zIaQ6PrQ8lB0WKBP51jSRucVVxm +bwZaGkrRDYbvDc33FPdcNkgee+/HOSM1z7O6+44OAjPCxXdoGHT/YaBZqREcsAcZm1L F9vs8C1Xc4HJrQnOXyzHJ1Sg89IQPHiY3Bh4yEgfohp147xae//Uc+/EkgaUZNzDzome wElw== X-Gm-Message-State: AOAM531vLqT65eHZuza/7zBx5Jw3sOogG3f5dxc9gGi2VEbXvG7i4OAF yukDnyZyE7W5im6pzr3Tt6NuSh0G5PwidQ== X-Google-Smtp-Source: ABdhPJy6E+5W64+fnQTkUv0NcYMYWaQQsdZWGHeDks11CctYJk/nObvJqeryytOZuQaCczcQNCLXVw== X-Received: by 2002:a63:4e4f:: with SMTP id o15mr1882600pgl.202.1602737532965; Wed, 14 Oct 2020 21:52:12 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id q66sm1407493pfc.109.2020.10.14.21.52.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2020 21:52:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 2/3] linux-user/microblaze: Implement rt signal frames Date: Wed, 14 Oct 2020 21:52:07 -0700 Message-Id: <20201015045208.595044-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201015045208.595044-1-richard.henderson@linaro.org> References: <20201015045208.595044-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::441; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x441.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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" , peter.maydell@linaro.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Allows microblaze to pass tests/tcg/multiarch/linux-test.c. Tested-by: Edgar E. Iglesias Reviewed-by: Edgar E. Iglesias Signed-off-by: Richard Henderson --- linux-user/microblaze/signal.c | 91 ++++++++++++++++++++++++++++++---- 1 file changed, 82 insertions(+), 9 deletions(-) diff --git a/linux-user/microblaze/signal.c b/linux-user/microblaze/signal.c index b4eeef4673..3d316a22f1 100644 --- a/linux-user/microblaze/signal.c +++ b/linux-user/microblaze/signal.c @@ -35,9 +35,9 @@ struct target_stack_t { struct target_ucontext { abi_ulong tuc_flags; abi_ulong tuc_link; - struct target_stack_t tuc_stack; + target_stack_t tuc_stack; struct target_sigcontext tuc_mcontext; - uint32_t tuc_extramask[TARGET_NSIG_WORDS - 1]; + target_sigset_t tuc_sigmask; }; /* Signal frames. */ @@ -47,9 +47,9 @@ struct target_signal_frame { uint32_t tramp[2]; }; -struct rt_signal_frame { - siginfo_t info; - ucontext_t uc; +struct target_rt_sigframe { + target_siginfo_t info; + struct target_ucontext uc; uint32_t tramp[2]; }; @@ -200,7 +200,55 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, target_siginfo_t *info, target_sigset_t *set, CPUMBState *env) { - qemu_log_mask(LOG_UNIMP, "setup_rt_frame: not implemented\n"); + struct target_rt_sigframe *frame; + abi_ulong frame_addr; + + frame_addr = get_sigframe(ka, env, sizeof *frame); + trace_user_setup_rt_frame(env, frame_addr); + + if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) { + force_sigsegv(sig); + return; + } + + tswap_siginfo(&frame->info, info); + + __put_user(0, &frame->uc.tuc_flags); + __put_user(0, &frame->uc.tuc_link); + + target_save_altstack(&frame->uc.tuc_stack, env); + setup_sigcontext(&frame->uc.tuc_mcontext, env); + + for (int i = 0; i < TARGET_NSIG_WORDS; i++) { + __put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]); + } + + /* 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; + + /* Set up registers for signal handler */ + env->regs[1] = frame_addr; + + /* Signal handler args: */ + env->regs[5] = sig; + env->regs[6] = frame_addr + offsetof(struct target_rt_sigframe, info); + env->regs[7] = frame_addr + offsetof(struct target_rt_sigframe, uc); + + /* Offset to handle microblaze rtid r14, 0 */ + env->pc = (unsigned long)ka->_sa_handler; + + unlock_user_struct(frame, frame_addr, 1); } long do_sigreturn(CPUMBState *env) @@ -239,7 +287,32 @@ badframe: long do_rt_sigreturn(CPUMBState *env) { - trace_user_do_rt_sigreturn(env, 0); - qemu_log_mask(LOG_UNIMP, "do_rt_sigreturn: not implemented\n"); - return -TARGET_ENOSYS; + struct target_rt_sigframe *frame = NULL; + abi_ulong frame_addr = env->regs[1]; + sigset_t set; + + trace_user_do_rt_sigreturn(env, frame_addr); + + if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) { + goto badframe; + } + + target_to_host_sigset(&set, &frame->uc.tuc_sigmask); + set_sigmask(&set); + + restore_sigcontext(&frame->uc.tuc_mcontext, env); + + if (do_sigaltstack(frame_addr + + offsetof(struct target_rt_sigframe, uc.tuc_stack), + 0, get_sp_from_cpustate(env)) == -EFAULT) { + goto badframe; + } + + 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; } From patchwork Thu Oct 15 04:52:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 302841 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 562FBC433DF for ; Thu, 15 Oct 2020 04:54:32 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B184A22247 for ; Thu, 15 Oct 2020 04:54:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="o5EsVUbg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B184A22247 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:47060 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kSvHa-0001Tq-OR for qemu-devel@archiver.kernel.org; Thu, 15 Oct 2020 00:54:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38566) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSvFR-0006lj-Ut for qemu-devel@nongnu.org; Thu, 15 Oct 2020 00:52:17 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:40986) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kSvFQ-0003PU-1f for qemu-devel@nongnu.org; Thu, 15 Oct 2020 00:52:17 -0400 Received: by mail-pf1-x443.google.com with SMTP id c20so1231571pfr.8 for ; Wed, 14 Oct 2020 21:52: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=kFTYIO1Up7S0GLWDRygckRyd826G+thQsyNR6vulcYg=; b=o5EsVUbgtAVDimW3tyAndNtGBlB1t/x4yZPpxILxtWTtQSFP4lIdYjqG3+3sFflXL5 Tn3Z4BiAmCuoWuYwXbEah9NPfWLjjL77ezMJTPsa/8zrJgktkJeJuBGFS24d9l1BCdiK s7DX05sMVMxkfsgtrmDBDZOAPySGDbGBDXVBozfA3t/5Foz8hZiDQfVrghgjSAC+lHBP eq4An+z4SsVTOATlzpsFxt/vb1WsdX0iwkSX0A11JGoDeNFcpPDqoO33Pzr59xO0Ya+l +Vi0sOvU1qJnjFrjEWXzvN61zaGT5BOlQ1nL4qYWJPEzu6FGuSQxBZ53cZWOkij7aJEk OV1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kFTYIO1Up7S0GLWDRygckRyd826G+thQsyNR6vulcYg=; b=L074wsFr0vekYkKMGSebk7CWYIiloVALBaDo2GLBBvEI4P/X6yRk6o46mNtvqtPvgR nXAGtcVpeVOfdIfKqlV1pSF/V2iEeF13GZrIXiZEheiNTsr3hhMrrauMw+XbB4mfa9jP HfXxbUhFFsGogeU0zB4ScsMmuHzXcIJETs4zLG2/lYqqGOKmkurdmqUyWtFyG/WYpMVt wQ6SScGWcDrtnkeGj0odbsHfPWeUA/EmqIVyq0g9YZYSUcnafVpKFvWewW32QwH1kSoD mHO+3E5OJ5cc/xEEvJw6oUabeuyR+ju6Jdp/oLGr3tfkEiy6cvVXZ2PsCizBBqPqE1nu 97VQ== X-Gm-Message-State: AOAM531j0lT95XniBcEArQYFngK+Ny8dZzpiPxnvGeFxz222TqzXSxMG KFmS4OS0j6LoSIbreUoYQ07s4NqT52Kq5g== X-Google-Smtp-Source: ABdhPJzo7TZhKmNBHwHyWctcJpnEIviKDD7ZDSbm2J8f3y9xQZ7eIPOQUn4L9yX51wcYW1KvHSprBg== X-Received: by 2002:a62:8497:0:b029:155:9366:381b with SMTP id k145-20020a6284970000b02901559366381bmr2487384pfd.15.1602737534300; Wed, 14 Oct 2020 21:52:14 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id q66sm1407493pfc.109.2020.10.14.21.52.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2020 21:52:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 3/3] linux-user/microblaze: Remove non-rt signal frames Date: Wed, 14 Oct 2020 21:52:08 -0700 Message-Id: <20201015045208.595044-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201015045208.595044-1-richard.henderson@linaro.org> References: <20201015045208.595044-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::443; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x443.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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" , peter.maydell@linaro.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The microblaze kernel does not support these, and uses only rt style signal frames. Tested-by: Edgar E. Iglesias Reviewed-by: Edgar E. Iglesias Signed-off-by: Richard Henderson --- linux-user/microblaze/target_signal.h | 1 - linux-user/microblaze/signal.c | 97 +-------------------------- 2 files changed, 2 insertions(+), 96 deletions(-) diff --git a/linux-user/microblaze/target_signal.h b/linux-user/microblaze/target_signal.h index 35efd5e928..08bcf24b9d 100644 --- a/linux-user/microblaze/target_signal.h +++ b/linux-user/microblaze/target_signal.h @@ -21,5 +21,4 @@ typedef struct target_sigaltstack { #include "../generic/signal.h" -#define TARGET_ARCH_HAS_SETUP_FRAME #endif /* MICROBLAZE_TARGET_SIGNAL_H */ diff --git a/linux-user/microblaze/signal.c b/linux-user/microblaze/signal.c index 3d316a22f1..cf0707b556 100644 --- a/linux-user/microblaze/signal.c +++ b/linux-user/microblaze/signal.c @@ -41,12 +41,6 @@ struct target_ucontext { }; /* Signal frames. */ -struct target_signal_frame { - struct target_ucontext uc; - uint32_t extramask[TARGET_NSIG_WORDS - 1]; - uint32_t tramp[2]; -}; - struct target_rt_sigframe { target_siginfo_t info; struct target_ucontext uc; @@ -137,65 +131,6 @@ static abi_ulong get_sigframe(struct target_sigaction *ka, return ((sp - frame_size) & -8UL); } -void setup_frame(int sig, struct target_sigaction *ka, - target_sigset_t *set, CPUMBState *env) -{ - struct target_signal_frame *frame; - abi_ulong frame_addr; - int i; - - frame_addr = get_sigframe(ka, env, sizeof *frame); - trace_user_setup_frame(env, frame_addr); - if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) - goto badframe; - - /* Save the mask. */ - __put_user(set->sig[0], &frame->uc.tuc_mcontext.oldmask); - - for(i = 1; i < TARGET_NSIG_WORDS; i++) { - __put_user(set->sig[i], &frame->extramask[i - 1]); - } - - setup_sigcontext(&frame->uc.tuc_mcontext, env); - - /* Set up to return from userspace. If provided, use a stub - already in userspace. */ - /* minus 8 is offset to cater for "rtsd r15,8" offset */ - if (ka->sa_flags & TARGET_SA_RESTORER) { - env->regs[15] = ((unsigned long)ka->sa_restorer)-8; - } else { - uint32_t t; - /* Note, these encodings are _big endian_! */ - /* addi r12, r0, __NR_sigreturn */ - t = 0x31800000UL | TARGET_NR_sigreturn; - __put_user(t, frame->tramp + 0); - /* brki r14, 0x8 */ - t = 0xb9cc0008UL; - __put_user(t, 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_signal_frame, tramp) - - 8; - } - - /* Set up registers for signal handler */ - env->regs[1] = frame_addr; - /* Signal handler args: */ - env->regs[5] = sig; /* Arg 0: signum */ - env->regs[6] = 0; - /* arg 1: sigcontext */ - env->regs[7] = frame_addr += offsetof(typeof(*frame), uc); - - /* Offset of 4 to handle microblaze rtid r14, 0 */ - env->pc = (unsigned long)ka->_sa_handler; - - unlock_user_struct(frame, frame_addr, 1); - return; -badframe: - force_sigsegv(sig); -} - void setup_rt_frame(int sig, struct target_sigaction *ka, target_siginfo_t *info, target_sigset_t *set, CPUMBState *env) @@ -251,38 +186,10 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, unlock_user_struct(frame, frame_addr, 1); } + long do_sigreturn(CPUMBState *env) { - struct target_signal_frame *frame; - abi_ulong frame_addr; - target_sigset_t target_set; - sigset_t set; - int i; - - frame_addr = env->regs[R_SP]; - trace_user_do_sigreturn(env, frame_addr); - /* Make sure the guest isn't playing games. */ - if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 1)) - goto badframe; - - /* Restore blocked signals */ - __get_user(target_set.sig[0], &frame->uc.tuc_mcontext.oldmask); - for(i = 1; i < TARGET_NSIG_WORDS; i++) { - __get_user(target_set.sig[i], &frame->extramask[i - 1]); - } - target_to_host_sigset_internal(&set, &target_set); - set_sigmask(&set); - - restore_sigcontext(&frame->uc.tuc_mcontext, env); - /* We got here through a sigreturn syscall, our path back is via an - rtb insn so setup r14 for that. */ - env->regs[14] = env->pc; - - unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; -badframe: - force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -TARGET_ENOSYS; } long do_rt_sigreturn(CPUMBState *env)