Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1793655ybj; Wed, 6 May 2020 05:33:55 -0700 (PDT) X-Google-Smtp-Source: APiQypIphm2zKFCHdEXFTKhJpsfv9mTNmawBANxW7zqz7xlbHC7DN/7DGAe611I+kqxlEZQe+sgN X-Received: by 2002:a17:906:f295:: with SMTP id gu21mr7317297ejb.83.1588768435444; Wed, 06 May 2020 05:33:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588768435; cv=none; d=google.com; s=arc-20160816; b=Fo2re9bq5FjG8Lhs3IyQuAdfGOk+KBd//WFX4fNwvkInugjNNfNLdiKpZasFJmqzHe LpkkeyvK42FruqEggXPzQTV0WMw9ffXxszrlsXGsXXK7fc9oUWi2eu4XaVgmurYj+xC4 6ndx+gcQWf4AeaPL4OXZo9uz34chvaR2F2yjveNWIddNTp5IXwpnqd3wgfc4/kg0jvf9 u7ObplGDwOYpBxpExGQS4OYnSuPZnW/o4xpLq+3cXLjVroSuKx9TxZ3lodz/vQz8jBa/ 6MfKmGsqaTrnFkVxwCWeqF+bdfEIqllr6Beb9i1L86CBsKC03y0Uu2CBB2+bddfnNS7z mPow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=HpM8bVNQrM3y/kAFt7Cvyauvw8cJauQUS8CRRZ3kWlI=; b=o3EYpfYIndrv6Uscrf8OfLMXswxBHDTPyU8rCZMoLW1sQRXEfP5Qh13Dzh+exxGox2 zgxD1tfIXFpY6y/zKspU27C1uNsVuDHTJcUkbtVjMRl2jHB5YpNVLYBOFzrwMhdlLyGw 7gYPxIm+5OUHXNpySms2+PPqkcyUwfXD2aMyyeRXsWAyW4nKY6D22wi1z3QG7BqeZrCW 0EfFmZcQK8IolMhrs+3X/0XSUwXITiXfjvV8I8ydbmD8iaGfftY3dwsx9GM6p6SmNI8l hh/vXO/wt8ee4t3tX01vywuQMQww30ysKhxHyAJKep020IfT1ouaz8Au/K/RzEm+viLP NdrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VY2AeqrD; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o6si979933ejb.97.2020.05.06.05.33.31; Wed, 06 May 2020 05:33:55 -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; dkim=pass header.i=@kernel.org header.s=default header.b=VY2AeqrD; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728083AbgEFMbR (ORCPT + 99 others); Wed, 6 May 2020 08:31:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:45446 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725985AbgEFMbR (ORCPT ); Wed, 6 May 2020 08:31:17 -0400 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 A50FF206D5; Wed, 6 May 2020 12:31:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588768277; bh=O3I3Jq8U9Mm/K4aGuDavCDPQbee/VahNNCbOqVSXyT0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VY2AeqrDHqC376XgYjNf+vNJ9IeFxGVRDFKHxQrDa+tmTkPjKQmXtjoTWbyQUMOF3 thH76ZQCRBAxU2Mf2J0I6tDZSVOBhbjA2CGXsC6O+Znja2F9iXHNb7F6Jo0jC0oo81 vmfG42QBFTaI1SVU8XWH0zt8xvaJ6AkYaxRK/FZA= Date: Wed, 6 May 2020 13:31:12 +0100 From: Will Deacon To: Amit Kachhap Cc: linux-arm-kernel@lists.infradead.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Catalin Marinas , Bhupesh Sharma , Vincenzo Frascino , James Morse , Mark Rutland Subject: Re: [PATCH v2 1/2] arm64/crash_core: Export KERNELPACMASK in vmcoreinfo Message-ID: <20200506123112.GF8043@willie-the-truck> References: <1587968702-19996-1-git-send-email-amit.kachhap@arm.com> <20200504171741.GD1833@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 06, 2020 at 05:32:56PM +0530, Amit Kachhap wrote: > On 5/4/20 10:47 PM, Will Deacon wrote: > > On Mon, Apr 27, 2020 at 11:55:01AM +0530, Amit Daniel Kachhap wrote: > > > 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: > > Yes agree with you here. However the config gaurd is saving some extra > computation for __builtin_return_address. There are some compiler > support being added in __builtin_extract_return_address to mask the PAC. > Hopefully that will improve this code. In the meantime let it be like this. Does the extra computation matter? Isn't it just a couple of instructions? Will