Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1740280ybz; Thu, 30 Apr 2020 04:47:52 -0700 (PDT) X-Google-Smtp-Source: APiQypJ+0QScNXPuCVQ3IaIHyxxBrwMtecRqRjXf1yCNJunhQAuigMQ4cNz2BPS2Pm84AOHHhl25 X-Received: by 2002:a17:907:b11:: with SMTP id h17mr2318735ejl.371.1588247272276; Thu, 30 Apr 2020 04:47:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588247272; cv=none; d=google.com; s=arc-20160816; b=wqx37fXBK8O18wHo+e6St4XWQbQzO4alFMpgeG/VuACJmqOLBKuuu4qhrg6m2HH9G5 SlvaSVENkcE1I6nQmPBY85ZpCkGf6NJSFlTdnkKAUKTbkw3eRdMmoZLBynVbQmQeJv8k uTprP/IqiSMa47vDOEjax+kIKvpRbn39ae9okUDEOAGk40DRoP5ClUotpDEaC9r51t5U +Lvwzzj7tHunIS3XPZNVv2gQbpsT6QzqB+R8MDdtIkPbh4eZcUvMoJs++A35Y57pWPvl 82b23HhbiE5a0RI72vb1l64HgzgEfrrSQXctpYl8D8ukBMpNM9tOMdRqT8RRudDs01nQ 2LuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=KA3xk7vppLEjbIvNp146ZWX4U/v9mpYbw6hAwmRHGC8=; b=ssjRfQfx78L3z257wB4mdH/uMIS9iu1mYlBtaw2FS94tV363idZjxx6SN3q17/+Crt cmxBM7RDz6SLz4XVWQwtkO7ccgrtiUjxp5S6WM/VTQjc9NQu0FWYA3BKjKpXre7DF8oV 83wIWciDVOOYoUnghw+K/EcKlQaXNwg0BosVv2pL6MnDTOjGSH320kxo2AAwdLsbacq4 rgLmQEXa1CdnX4R7icdKuGMlqTnSaJKVINLlkBGjkHMxqUsLNaexIsi0KeNmiIuG9mlP 5T6UWcGZOFIEn7l6xFtgvMX9EkgFVFaRhcarjDH0JS410lxD2Dq3aGa6AP6m2fCvLpFg UMwA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j23si5804895ejm.361.2020.04.30.04.47.29; Thu, 30 Apr 2020 04:47:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726770AbgD3LpH (ORCPT + 99 others); Thu, 30 Apr 2020 07:45:07 -0400 Received: from foss.arm.com ([217.140.110.172]:53078 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726053AbgD3LpH (ORCPT ); Thu, 30 Apr 2020 07:45:07 -0400 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 A194931B; Thu, 30 Apr 2020 04:45:06 -0700 (PDT) Received: from [10.57.27.210] (unknown [10.57.27.210]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 851183F305; Thu, 30 Apr 2020 04:44:59 -0700 (PDT) Subject: Re: [PATCH v2 1/2] arm64/crash_core: Export KERNELPACMASK in vmcoreinfo To: linux-arm-kernel@lists.infradead.org, Catalin Marinas , Will Deacon Cc: kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Bhupesh Sharma , Vincenzo Frascino , James Morse , Mark Rutland References: <1587968702-19996-1-git-send-email-amit.kachhap@arm.com> From: Amit Kachhap Message-ID: Date: Thu, 30 Apr 2020 17:14:34 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <1587968702-19996-1-git-send-email-amit.kachhap@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Will/Catalin, Sorry: Resending with correct To list. On 4/27/20 11:55 AM, 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. This patch user side changes are accepted by crash-utility maintainer [1] so I think this is in a good shape to go in. Thanks, Amit Daniel [1]: https://www.redhat.com/archives/crash-utility/2020-April/msg00095.html > > 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 > #endif /* CONFIG_ARM64_PTR_AUTH */ > > #endif /* __ASM_COMPILER_H */ > diff --git a/arch/arm64/kernel/crash_core.c b/arch/arm64/kernel/crash_core.c > index ca4c3e1..25cf2ce 100644 > --- a/arch/arm64/kernel/crash_core.c > +++ b/arch/arm64/kernel/crash_core.c > @@ -6,6 +6,7 @@ > > #include > #include > +#include > > void arch_crash_save_vmcoreinfo(void) > { > @@ -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); > } >