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=-15.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,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 96564C433DB for ; Mon, 29 Mar 2021 22:59:51 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 2EFA861987 for ; Mon, 29 Mar 2021 22:59:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2EFA861987 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+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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc: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=IFHQMND9ugwzHdTsf8EhgFJAGoZ43jS82QgTgsZzcmU=; b=AZ1b0n2LHD94tR9jh7wmwRIPT RVde0rE3MYa47yLPwbUPHWNgZlOIP21rdVfmUS6Yp81bO1xkFVdk7wr3l9XsmapZ/G5DuVMoHuYG6 pghfKY46eCkJE+BoOZvWBCqNr3qoPdXIt8OyeRG2bHWLZNphzB6EwHMjNYcmXAP2RTY5ArOOiPx9y OGYEdCHGctDMvuHBe7C+YdfcSko56voIIkFGd5AdBFIYKzD+zMUY+JvepVaI22qKqUrfjus8g0Qqq XCfwJqolqS8k7X83qd3X1XbIvSFHLcS5KK5H83jbpBIKpkNDEC9gL4NBuRLN5Bpwz1kpSfRa85YGx WxFGuQRKQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lR0of-001nJ2-N8; Mon, 29 Mar 2021 22:57:02 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lQtF2-000im8-2p for linux-arm-kernel@lists.infradead.org; Mon, 29 Mar 2021 14:51:53 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7F6A061968; Mon, 29 Mar 2021 14:51:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617029502; bh=mkipavxxqIUv1uQ7hMvexX3twXM7jio6P2KNrpGlstY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WZkAtqVDhFYh/EmG1pcMF38D2d0stoEXE0U8EQRmBKpoBIPn9St3uiopqRkI//o4S 2ivHjSgNhthEIOSWs8dDzt84lnFI70LaOOOZepRnI1xUfbAo8y+uJJHpFqalv3HYxA tSd/JuINGf311PBE14Bp9D7LAMcQNY4Mt39u4oJN7XyDjS6xKSeK9UoDs6uTTvvOwJ DszC7FDmdDCnnNmw/4PSd3UW1nQ9dqA38uKaA6OYOsGEvU/k1hQNiQu7nzje7C2OJE IvINpm98AzwwxqYMMfMmvjLb1PfJ0oySm9QSd3nmz6UglhzvRk7K/6ueMInLo7v39X WCyX2oo9ook/Q== Date: Mon, 29 Mar 2021 15:51:38 +0100 From: Will Deacon To: Daniel Kiss Cc: linux-arm-kernel@lists.infradead.org, Ard.Biesheuvel@arm.com, Catalin.Marinas@arm.com, pcc@google.com Subject: Re: [PATCH v3 2/2] arm64: Conditionally configure PTR_AUTH key of the kernel. Message-ID: <20210329145137.GE4203@willie-the-truck> References: <20210208145554.2164638-1-daniel.kiss@arm.com> <20210208145554.2164638-3-daniel.kiss@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210208145554.2164638-3-daniel.kiss@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-20210329_155151_876873_4B6A8C50 X-CRM114-Status: GOOD ( 19.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Feb 08, 2021 at 03:55:54PM +0100, Daniel Kiss wrote: > If the kernel is not compiled with CONFIG_ARM64_PTR_AUTH_KERNEL=y, > then no PACI/AUTI instructions are expected while the kernel is running > so the kernel's key will not be used. Write of a system regiters > is expensive therefore avoid it not required. What happens if somebody tries to load a module built with PAC into a kernel where CONFIG_ARM64_PTR_AUTH_KERNEL=n? Do we reject the module? I'm not sure how much we care, but I'm a bit worried that it might not go "obviously" wrong. > Signed-off-by: Daniel Kiss > --- > arch/arm64/include/asm/asm_pointer_auth.h | 63 +++++++++++++---------- > arch/arm64/include/asm/pointer_auth.h | 20 +++++-- > arch/arm64/include/asm/processor.h | 2 + > arch/arm64/kernel/asm-offsets.c | 2 + > 4 files changed, 54 insertions(+), 33 deletions(-) [...] > diff --git a/arch/arm64/include/asm/pointer_auth.h b/arch/arm64/include/asm/pointer_auth.h > index c6b4f0603024..b34aebb95757 100644 > --- a/arch/arm64/include/asm/pointer_auth.h > +++ b/arch/arm64/include/asm/pointer_auth.h > @@ -30,9 +30,11 @@ struct ptrauth_keys_user { > struct ptrauth_key apga; > }; > > +#ifdef CONFIG_ARM64_PTR_AUTH_KERNEL > struct ptrauth_keys_kernel { > struct ptrauth_key apia; > }; > +#endif > > static inline void ptrauth_keys_init_user(struct ptrauth_keys_user *keys) > { > @@ -54,6 +56,8 @@ do { \ > write_sysreg_s(__pki_v.hi, SYS_ ## k ## KEYHI_EL1); \ > } while (0) > > +#ifdef CONFIG_ARM64_PTR_AUTH_KERNEL > + > static __always_inline void ptrauth_keys_init_kernel(struct ptrauth_keys_kernel *keys) > { > if (system_supports_address_auth()) > @@ -69,6 +73,8 @@ static __always_inline void ptrauth_keys_switch_kernel(struct ptrauth_keys_kerne > isb(); > } > > +#endif /* CONFIG_ARM64_PTR_AUTH_KERNEL */ Can you group this with the struct and avoid having two #ifdef blocks? Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel