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,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 ADC64C8300B for ; Thu, 30 Apr 2020 11:36:31 +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 75A9D20838 for ; Thu, 30 Apr 2020 11:36:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="JaBcBOhW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 75A9D20838 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-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=OWOK4nWvRReNf+U/iarDU7/h1r7sjfInltriX8HE7J8=; b=JaBcBOhWqsRWS+xHFvtpSpC+7 cHAOKvtPRRHC6XHZx7wO5llvkcpVm2Sp3OEJu8K7K1CTUomopuRw8A8ZaDwx3BXPtsoSfWMUY3Rc8 pol6sZIRNIyXqukLTC4BuHiu/9WER3wggZgKqbLu8FJvkh4IUQ1eRD8BgqyaamIr9l+voowrbQGpu suVIPOxu7EbZEF3DEQQVtdFtkTj5wZoI1/4k/dWljVFi6+vOJoFtxEsWMxgfJDYtkSToHntrWWr56 0VzXtDXrxAtux4tcCKmU/gOENFhq6j9PAaiIhLLZiWyPLMkjDOy1h+lBRJvJQbw+38S60hVdzFAYm Y5mtb+LyA==; 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 1jU7UU-0007OP-3P; Thu, 30 Apr 2020 11:36:30 +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 1jU7UM-0007Gh-Sl; Thu, 30 Apr 2020 11:36:24 +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 E175731B; Thu, 30 Apr 2020 04:36:20 -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 D2D153F305; Thu, 30 Apr 2020 04:36:17 -0700 (PDT) Subject: Re: [PATCH v2 1/2] arm64/crash_core: Export KERNELPACMASK in vmcoreinfo To: linux-arm-kernel@lists.infradead.org References: <1587968702-19996-1-git-send-email-amit.kachhap@arm.com> From: Amit Kachhap Message-ID: <36929ba3-3274-6046-9a47-ed403f00fefe@arm.com> Date: Thu, 30 Apr 2020 17:05:55 +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-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200430_043623_015517_EC41EE37 X-CRM114-Status: GOOD ( 21.68 ) 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 , Will Deacon Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Will/Catalin, 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. > > Cc: Catalin Marinas > Cc: Will Deacon > Cc: Mark Rutland > Signed-off-by: Amit Daniel Kachhap 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/msg00099.html > --- > 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); > } > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel