From patchwork Tue Nov 10 08:30:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 321010 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp39355ils; Tue, 10 Nov 2020 00:32:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJz4VrJhy3fiKiZh4yQpZYNXxgcIKJn1w1QwD/MCTr1uP/JAxmsHRFGmqPVLC7T4KvaPpNZD X-Received: by 2002:a25:781:: with SMTP id 123mr24773792ybh.108.1604997130290; Tue, 10 Nov 2020 00:32:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604997130; cv=none; d=google.com; s=arc-20160816; b=BebmvoizEFKLx/wnF667tgeiONbq1HffVx3UPeOKxc0OzgXzYn2ecRB1T24FvQnr9t E/eBJ5PZho0ZKAUVq3EFioohJVxYwIFGTRJWBMaP0b21HulLwavNcphQ/Xi3zz16igFs /n04gZnyAyY1//kuq+d76Fn4PS/n0EraAUtAgi+fV+qN2/JeDrUpz1d0bJFoMC9t8wdj fLFeycEx0b59qixaZLRfh4ph9OY/FJz1XMOQWZvlG2O2jl9LHoNtyoOZx5s+/kn+oemH xIkCv5uVrbzcXUnHCN6qis05K9bN+EWDMb2mVFoFU7KYFqIz6voNNpfkHPu02QaOziHA kYwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=2roiQwX7wb2jxeRO3mSU53BXzVpXMzaxJ22gYkTId2s=; b=nUAQ1+0o/aQE1W55EiHPYfEE+1B4mleuXUMKQyJ33CzjFgRs1onhKG2sR0+rZXsSvh gLRsnb4WQTq67rmRbzItjMr0/gqwwQFEvWNexvuvQVikQqGRFyoyPJWhmGA7pNphuCPL 3/nMfGLA6KkXuYZu5mlDtFRF40Nr+hCqW3RQhdJXaTVKam072ZWMjxuXqkoZP3C9ktd2 xqynmlkSw14tJ8TUBK27rCZEzUODZF2G6eiAcB0NreP1iQEmi5nqs1Dx+dD61nOX8S+K u0Fw1mUK7f0TfgU0osQxIb+Wukb79Z3sk+hprIgyjmDBxpcv36oqbCfAICr2aOczX2pl Y1EA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e3si10764420ybp.454.2020.11.10.00.32.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Nov 2020 00:32:10 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:39912 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kcP4T-0000mi-LF for patch@linaro.org; Tue, 10 Nov 2020 03:32:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37938) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kcP38-0000lf-Kn for qemu-devel@nongnu.org; Tue, 10 Nov 2020 03:30:48 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:45743) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kcP33-000733-Tg for qemu-devel@nongnu.org; Tue, 10 Nov 2020 03:30:46 -0500 Received: from localhost.localdomain ([82.252.154.198]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M89P3-1kgXeO1PJT-005GG9; Tue, 10 Nov 2020 09:30:39 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 3/3] linux-user/sparc: Don't zero high half of PC, NPC, PSR in sigreturn Date: Tue, 10 Nov 2020 09:30:34 +0100 Message-Id: <20201110083034.224832-4-laurent@vivier.eu> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201110083034.224832-1-laurent@vivier.eu> References: <20201110083034.224832-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:fTEwE+mQ3Xkaj3i71upGpFf6necyc4LgO4712/yqeVEG0otH7gO 7U0g3Zd2TuNjOooYKHiNV3u/SuvVOxmWgdGv39NxkxEOsbA1mnXkq08yGdbKoOL5btM73F9 pGiCG2uG1xIBswAgEph9ebuswLyqY2xYkcYkyEbfvhnsVh7OGcMx5n55KYoUdmmWUtl0VTe NpTpSTM7DQGlVB2VA6TJQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:ksDZc8uw4Wk=:jJLFMKcK/+CVtb2JE4+UZ8 ZOcdvCuh5lqAZhcuCMBu3ji22ElpTwupe4v4YSfRTUHhX2OOeDRk+0tLXOGc1ImhdUxRZP/Jq a6AlJJNvbsMIL352SDvw5HnX2myxrjSTSwt3C2Gcs0BrnXqdVUb7TzQTePcl7JeNqgPQX3B16 IX1OhBCG3ybRmOweOW9zAGhmOIxnQQMOut8XG8Nru1DJklZ6C0mVhQy1gQ9T72Y6s9EPYtY3V hjJMD6J2IlWztvKkqNjUPurAZcsGanFISfuBpS0Wvue6Dko4zUJEahimyztDaE/28PbnECNfp e/ecumXQ24Gm4Z0uG0NRMKsXoMcrnd/skQDoh11iEGwND9iDBNcqumPi6nOfaQsYEJ8W6Az5u xbNKFJHDs23WhXpJSLIQMpSzLX2FIww6kprmd9zOONLOwlGGj06q0MbdnIWUVvq0zgugNhSyw h6nMUd5aNQ== Received-SPF: none client-ip=212.227.17.10; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/10 03:30:38 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell The function do_sigreturn() tries to store the PC, NPC and PSR in uint32_t local variables, which implicitly drops the high half of these fields for 64-bit guests. The usual effect was that a guest which used signals would crash on return from a signal unless it was lucky enough to take it while the PC was in the low 4GB of the address space. In particular, Debian /bin/dash and /bin/bash would segfault after executing external commands. Use abi_ulong, which is the type these fields all have in the __siginfo_t struct. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-Id: <20201105212314.9628-4-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.28.0 diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index c315704b3895..d12adc8e6ff9 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -247,7 +247,7 @@ long do_sigreturn(CPUSPARCState *env) { abi_ulong sf_addr; struct target_signal_frame *sf; - uint32_t up_psr, pc, npc; + abi_ulong up_psr, pc, npc; target_sigset_t set; sigset_t host_set; int i;