From patchwork Tue Jun 23 08:54:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 11620097 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DD7286C1 for ; Tue, 23 Jun 2020 08:57:22 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 B72A320768 for ; Tue, 23 Jun 2020 08:57:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="MG7e9yXA"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="RkhY4bmZ"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="t+6B/Zib" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B72A320768 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=iRuuU4XyLWAYNwoHeuBd954lfeFENlunbcAh8jgjmEA=; b=MG7e9yXAjj6IULFs5hNPeSRSc ImbZQGgc+qPdlpg/WHwOlckHwzu395I0Hnnj9v0ebWVKZm5F4kONtg0FbhRB1JiP3TSuVcJLTjcre 4twt/cb4uXrKlIzBDeLKjhCZrbk4FMAw+R7WRIWYJLIBAKJ56hIqm0MIQQuTYoOGQFW6ODrbBeZKy IpB/TkPzqWfMpoqakDjOgXHxB/5C/aQoAiDCJU3WxeF1QlkpkNn2DKeYN1FTaBtfbKE5pQuXoJImE eLMEDroliIbLBt+DtYe0XTgYx+8m4Bucb+dz+IjvoH3Lw2+AEivskfyDU/Z66X37RRjdD4m8U/Tb7 SLlGMoWrw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jneiW-0004XX-3k; Tue, 23 Jun 2020 08:55:44 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jneiM-0004S5-7z for linux-arm-kernel@merlin.infradead.org; Tue, 23 Jun 2020 08:55:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=G3Ded9q9In0prTsCV1RsV71x/+HFwTx7CCve0r6BNi4=; b=RkhY4bmZuqJuTSGD381SRpCSEm CX1l7YG/w2fNUS72YxXRra8CUfVKpyFctIReVBuToKnuBN9H1n5B06b+fQYzDYJTIXjPJzJgAqGTo 9mOV+JTiEnoAdlsjPXI/pb3a0Pcgx+C2wlHFHVyh1d5pwDNTkCBLyUBjwyJrysFcpAzv6xi2iZZYy Rkdpbh9IEUB+U7guindg4VRpaHw1tvIKrEjcuzWUFwYdApTSLczY/AWmcjfyF0osT9UpjCI6O0Ln9 ylG79hzewE6WUcUcQdGl5ZD+k4yOtU2n8AuyyrgmLv7NDdCJtsIr+nuHQHs+z+22dE8wFtVtmh3N+ fN2uAVlg==; Received: from mail.kernel.org ([198.145.29.99]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jneiI-0001OD-Fl for linux-arm-kernel@lists.infradead.org; Tue, 23 Jun 2020 08:55:33 +0000 Received: from localhost.localdomain (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9561820781; Tue, 23 Jun 2020 08:54:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592902499; bh=wXUSdeY0bDJc+RxSqDg7NOjkqfjqrG37Xq/PpGMa/yg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t+6B/Zib9DuLn4YHF0Cwvc+NfBhSrIfFvME1eTqCDURPs2NzeLwwrwiljgow1nVRA EbccYMrhhXM3x1mAZzQy4ga2a95ZmPu/aDslaxRslVzNlRGCjBdHfW1ufw1nTdiQqt A1h0pF2DNv4RTd9CoS5SiIIQlCNDqIMcG6oihDkA= From: Will Deacon To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/6] arm64: compat: Always use sigpage for sigreturn trampoline Date: Tue, 23 Jun 2020 09:54:33 +0100 Message-Id: <20200623085436.3696-4-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200623085436.3696-1-will@kernel.org> References: <20200623085436.3696-1-will@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200623_095530_819064_709C3A79 X-CRM114-Status: GOOD ( 12.80 ) X-Spam-Score: -7.1 (-------) X-Spam-Report: SpamAssassin version 3.4.4 on casper.infradead.org summary: Content analysis details: (-7.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [198.145.29.99 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-team@android.com, Szabolcs Nagy , Catalin Marinas , Ard Biesheuvel , Tamas Zsoldos , Vincenzo Frascino , Will Deacon , Dave Martin , Daniel Kiss Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The 32-bit sigreturn trampoline in the compat sigpage matches the binary representation of the arch/arm/ sigpage exactly. This is important for debuggers (e.g. GDB) and unwinders (e.g. libunwind) since they rely on matching the instruction sequence in order to identify that they are unwinding through a signal. The same cannot be said for the sigreturn trampoline in the compat vDSO, which defeats the unwinder heuristics and instead attempts to use unwind directives for the unwinding. This is in contrast to arch/arm/, which never uses the vDSO for sigreturn. Ensure compatibility with arch/arm/ and existing unwinders by always using the sigpage for the sigreturn trampoline, regardless of the presence of the compat vDSO. Signed-off-by: Will Deacon Reviewed-by: Mark Rutland Reviewed-by: Vincenzo Frascino --- arch/arm64/kernel/signal32.c | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c index 0aa0b33744de..2f507f565c48 100644 --- a/arch/arm64/kernel/signal32.c +++ b/arch/arm64/kernel/signal32.c @@ -342,30 +342,6 @@ static void compat_setup_return(struct pt_regs *regs, struct k_sigaction *ka, retcode = ptr_to_compat(ka->sa.sa_restorer); } else { /* Set up sigreturn pointer */ -#ifdef CONFIG_COMPAT_VDSO - void *vdso_base = current->mm->context.vdso; - void *vdso_trampoline; - - if (ka->sa.sa_flags & SA_SIGINFO) { - if (thumb) { - vdso_trampoline = VDSO_SYMBOL(vdso_base, - compat_rt_sigreturn_thumb); - } else { - vdso_trampoline = VDSO_SYMBOL(vdso_base, - compat_rt_sigreturn_arm); - } - } else { - if (thumb) { - vdso_trampoline = VDSO_SYMBOL(vdso_base, - compat_sigreturn_thumb); - } else { - vdso_trampoline = VDSO_SYMBOL(vdso_base, - compat_sigreturn_arm); - } - } - - retcode = ptr_to_compat(vdso_trampoline) + thumb; -#else unsigned int idx = thumb << 1; if (ka->sa.sa_flags & SA_SIGINFO) @@ -373,7 +349,6 @@ static void compat_setup_return(struct pt_regs *regs, struct k_sigaction *ka, retcode = (unsigned long)current->mm->context.sigpage + (idx << 2) + thumb; -#endif } regs->regs[0] = usig;