From mboxrd@z Thu Jan 1 00:00:00 1970 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=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 1F535C433E0 for ; Wed, 20 May 2020 09:34:18 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 CE5E4207D3 for ; Wed, 20 May 2020 09:34:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Ws5TUZFy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CE5E4207D3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=50OtgjpAropGEhmbHMWim+OYXaJFmhi9ULo3rahNLJE=; b=Ws5TUZFyEVPbW5 vmoA5geDoUVXuhm9bQY89fHgNDtZ447JYhxXu8MBcDPEA+ddp5wvqPflFIXuf63iG7H5pac+B4K3t r8mYwfRXT0KnF4sZrhDfNmj1OLP53NKld2sKygmUOvIcI1THm2KF32TTdN3RaWulTe//Prg3zkeur mxkBNiJtj4Sr01DEwVR9OOH2GZow1wPFqOackSzAON9tmDAHyUkI6J6d3sY/CmmJX+dCHk3BQ0gKN kBujPQR/lGsVhJWg7rfxWDxRy1r1SFRKb9lv1GkX3g7lQ6Iw4blNZAvOILaJaguwmyF0WYPaVfCdC zz7r8xgx0DI3m9o2oCfw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jbL70-00014N-Kk; Wed, 20 May 2020 09:34:06 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jbL6s-00013h-RM for linux-arm-kernel@lists.infradead.org; Wed, 20 May 2020 09:34:01 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 37B6430E; Wed, 20 May 2020 02:33:58 -0700 (PDT) Received: from arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5224D3F68F; Wed, 20 May 2020 02:33:57 -0700 (PDT) Date: Wed, 20 May 2020 10:33:55 +0100 From: Dave Martin To: Will Deacon Subject: Re: [PATCH v2 1/2] arm64: vdso: Don't prefix sigreturn trampoline with a BTI C instruction Message-ID: <20200520093354.GJ5031@arm.com> References: <20200519162821.16857-1-will@kernel.org> <20200519162821.16857-2-will@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200519162821.16857-2-will@kernel.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200520_023358_975949_D57BA11C X-CRM114-Status: GOOD ( 17.82 ) 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: Tamas Zsoldos , Mark Brown , kernel-team@android.com, linux-arm-kernel@lists.infradead.org, Daniel Kiss Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, May 19, 2020 at 05:28:20PM +0100, Will Deacon wrote: > For better or worse, GDB relies on the exact instruction sequence in the > VDSO sigreturn trampoline in order to unwind from signals correctly. > Commit c91db232da48 ("arm64: vdso: Convert to modern assembler annotations") > unfortunately added a BTI C instruction to the start of __kernel_rt_sigreturn, > which breaks this check. Thankfully, it's also not required, since the > trampoline is called from a RET instruction when returning from the signal > handler > > Remove the unnecessary BTI C instruction from __kernel_rt_sigreturn, > and do the same for the 32-bit VDSO as well for good measure. > > Cc: Dave Martin > Cc: Mark Brown > Cc: Daniel Kiss > Cc: Tamas Zsoldos > Fixes: c91db232da48 ("arm64: vdso: Convert to modern assembler annotations") > Signed-off-by: Will Deacon > --- > arch/arm64/kernel/vdso/sigreturn.S | 11 +++++++++-- > arch/arm64/kernel/vdso32/sigreturn.S | 16 ++++++++-------- > 2 files changed, 17 insertions(+), 10 deletions(-) > > diff --git a/arch/arm64/kernel/vdso/sigreturn.S b/arch/arm64/kernel/vdso/sigreturn.S > index 3fb13b81f780..0c921130002a 100644 > --- a/arch/arm64/kernel/vdso/sigreturn.S > +++ b/arch/arm64/kernel/vdso/sigreturn.S > @@ -15,7 +15,14 @@ > .text > > nop > -SYM_FUNC_START(__kernel_rt_sigreturn) > +/* > + * GDB relies on being able to identify the sigreturn instruction sequence to > + * unwind from signal handlers. We cannot, therefore, use SYM_FUNC_START() > + * here, as it will emit a BTI C instruction and break the unwinder. Thankfully, > + * this function is only ever called from a RET and so omitting the landing pad > + * is perfectly fine. > + */ Can we cross-reference or duplicate (perhaps abridged) this comment for vdso32? Can we also fix the comment by the definition of SYM_FUNC_START()? SYM_FUNC_START() supersedes ENTRY only for PCS-conformant function entry points. Any code with a wacky special-case interface should not not be using this. [...] > +SYM_CODE_START(__kernel_rt_sigreturn) > .cfi_startproc > .cfi_signal_frame > .cfi_def_cfa x29, 0 > @@ -24,6 +31,6 @@ SYM_FUNC_START(__kernel_rt_sigreturn) > mov x8, #__NR_rt_sigreturn > svc #0 > .cfi_endproc > -SYM_FUNC_END(__kernel_rt_sigreturn) > +SYM_CODE_END(__kernel_rt_sigreturn) > > emit_aarch64_feature_1_and > diff --git a/arch/arm64/kernel/vdso32/sigreturn.S b/arch/arm64/kernel/vdso32/sigreturn.S > index 620524969696..b36d4e2267a3 100644 > --- a/arch/arm64/kernel/vdso32/sigreturn.S > +++ b/arch/arm64/kernel/vdso32/sigreturn.S > @@ -17,39 +17,39 @@ > .save {r0-r15} > .pad #COMPAT_SIGFRAME_REGS_OFFSET > nop > -SYM_FUNC_START(__kernel_sigreturn_arm) > +SYM_CODE_START(__kernel_sigreturn_arm) ...although do we actually need this? 32-bit doesn't have BTI. But for the reasons given above, this is not a "function" and so SYM_FUNC_START() is trap for future maintenance even if it makes no difference now. [...] Either way, Reviewed-by: Dave Martin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel