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.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 82079C4724C for ; Mon, 4 May 2020 17:17:52 +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 57C862073E for ; Mon, 4 May 2020 17:17:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ieTBZWmq"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="jYVlkD3k" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 57C862073E 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+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=xke7azYaBVhPymx2g/sueolCxmrakUBqFphiedjXmAM=; b=ieTBZWmqnvlu4l QeAa+eo99bW8j/nA6wtIzmFmTCkctFV9w7urtaxnViHhAAutKt+56nyTrybcVYsuC2uyaA7OsH4zC PmIjfqlbHr3RTQ+tMEpFYYdUWRl7bsGX7KsbtEt0ikHezmBHidQ8InKlNZMvqYpBgdog8HECB+2go PI5vZ3oleI5gGeYy7dyMFF7PS6cQeVeaVkXft7Kgi6iYwB7DyNTO1wRi4a+K6VrqS2RSgrNczovib qY+R31jpLx57P0K4Oztm3dAba3rVejwlGmMkUPjiFqpxa4SVKeP6lu4hGvkGRO9OBtqyxHQmdtdEO hVxo2r8SQqjnA7nrtgNQ==; 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 1jVej1-0003XT-Mp; Mon, 04 May 2020 17:17:51 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVeix-0003W1-Kr; Mon, 04 May 2020 17:17:49 +0000 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CAC9D24965; Mon, 4 May 2020 17:17:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588612667; bh=dCSwoURg/C8WuYz953nT1u1P7ci5+Iuywwfdq+8bQsw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jYVlkD3ky0vhySQ+he8eMrpB+9oRA0f7K691tEJQupuZthAvJ8Zf3avLOWd395wAG nzQgQKVBg6zolaNUp9QQHR2ZiuBG0enaXitVX3UwKT8Kijgua5bz2MUTXPQ/rPhqWD hTWVxPtsWyRqrrmGHWCr7fQSRMpwX4v3Bogk3asg= Date: Mon, 4 May 2020 18:17:42 +0100 From: Will Deacon To: Amit Daniel Kachhap Subject: Re: [PATCH v2 1/2] arm64/crash_core: Export KERNELPACMASK in vmcoreinfo Message-ID: <20200504171741.GD1833@willie-the-truck> References: <1587968702-19996-1-git-send-email-amit.kachhap@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1587968702-19996-1-git-send-email-amit.kachhap@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200504_101747_724124_A130CD48 X-CRM114-Status: GOOD ( 20.84 ) 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: Mark Rutland , Catalin Marinas , Bhupesh Sharma , kexec@lists.infradead.org, linux-kernel@vger.kernel.org, James Morse , Vincenzo Frascino , linux-arm-kernel@lists.infradead.org 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 Mon, Apr 27, 2020 at 11:55:01AM +0530, Amit Daniel Kachhap wrote: > Recently arm64 linux kernel added support for Armv8.3-A Pointer > Authentication feature. If this feature is enabled in the kernel and the > hardware supports address authentication then the return addresses are > signed and stored in the stack to prevent ROP kind of attack. Kdump tool > will now dump the kernel with signed lr values in the stack. > > Any user analysis tool for this kernel dump may need the kernel pac mask > information in vmcoreinfo to generate the correct return address for > stacktrace purpose as well as to resolve the symbol name. > > This patch is similar to commit ec6e822d1a22d0eef ("arm64: expose user PAC > bit positions via ptrace") which exposes pac mask information via ptrace > interfaces. > > Cc: Catalin Marinas > Cc: Will Deacon > Cc: Mark Rutland > Signed-off-by: Amit Daniel Kachhap > --- > Changes since v1: > * Rebased to kernel 5.7-rc3. > * commit log change. > > An implementation of this new KERNELPACMASK vmcoreinfo field used by crash > tool can be found here[1]. This change is accepted by crash utility > maintainer [2]. > > [1]: https://www.redhat.com/archives/crash-utility/2020-April/msg00095.html > [2]: https://www.redhat.com/archives/crash-utility/2020-April/msg00099.html > > arch/arm64/include/asm/compiler.h | 3 +++ > arch/arm64/kernel/crash_core.c | 4 ++++ > 2 files changed, 7 insertions(+) > > diff --git a/arch/arm64/include/asm/compiler.h b/arch/arm64/include/asm/compiler.h > index eece20d..32d5900 100644 > --- a/arch/arm64/include/asm/compiler.h > +++ b/arch/arm64/include/asm/compiler.h > @@ -19,6 +19,9 @@ > #define __builtin_return_address(val) \ > (void *)(ptrauth_clear_pac((unsigned long)__builtin_return_address(val))) > > +#else /* !CONFIG_ARM64_PTR_AUTH */ > +#define ptrauth_user_pac_mask() 0ULL > +#define ptrauth_kernel_pac_mask() 0ULL This doesn't look quite right to me, since you still have to take into account the case where CONFIG_ARM64_PTR_AUTH=y but the feature is not available at runtime: > @@ -16,4 +17,7 @@ void arch_crash_save_vmcoreinfo(void) > vmcoreinfo_append_str("NUMBER(PHYS_OFFSET)=0x%llx\n", > PHYS_OFFSET); > vmcoreinfo_append_str("KERNELOFFSET=%lx\n", kaslr_offset()); > + vmcoreinfo_append_str("NUMBER(KERNELPACMASK)=0x%llx\n", > + system_supports_address_auth() ? > + ptrauth_kernel_pac_mask() : 0); In which case, would it make more sense to define ptrauth_{kernel,user}_pac_mask() unconditionally? In fact, I'd probably just remove the guards completely from asm/compiler.h because I think they're misleading. Will --->8 diff --git a/arch/arm64/include/asm/compiler.h b/arch/arm64/include/asm/compiler.h index eece20d2c55f..51a7ce87cdfe 100644 --- a/arch/arm64/include/asm/compiler.h +++ b/arch/arm64/include/asm/compiler.h @@ -2,8 +2,6 @@ #ifndef __ASM_COMPILER_H #define __ASM_COMPILER_H -#if defined(CONFIG_ARM64_PTR_AUTH) - /* * The EL0/EL1 pointer bits used by a pointer authentication code. * This is dependent on TBI0/TBI1 being enabled, or bits 63:56 would also apply. @@ -19,6 +17,4 @@ #define __builtin_return_address(val) \ (void *)(ptrauth_clear_pac((unsigned long)__builtin_return_address(val))) -#endif /* CONFIG_ARM64_PTR_AUTH */ - #endif /* __ASM_COMPILER_H */ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel