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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 40A89C624D3 for ; Tue, 1 Sep 2026 14:43:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=PyIEf+L5wpgMc9pVz0HpDIzIC04Zw4Z63bkTn3LXy6M=; b=USpHdZCjGadzur6dutqJ3Kyn06 8oQv9PnYngDnioWNfLnBiHTOj4FC/4Xnlf4WFerxLdld40qIVZd2yi7ggSY5TWCkdNLly3p8/Z2SI E8tyz5pYv7kVpAe32Vk4ELAfw3CLV+cZQ1e7+NgJHtEKS+CrlfDl4+TCJerayGIKWZdfiHH2RBM7m 3nj4zpXV+yTfU2UASpo3QrsSF4UaRnLTiyUO0RdQvcQn/H1waHyhFDuRTS7iKmUmoiuyZHtsa4FGR isUnIuLo67I13DKRoWi/M6htZUINXAdIvs5wzVQ6cIqttiB1Mbl1ncwP6qScLiwd7JFRdrcCpOCoo ROnwapHg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x1PhT-0000000CNFJ-1x4f; Tue, 01 Sep 2026 14:42:59 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x1PhR-0000000CNEx-3HNn for linux-arm-kernel@lists.infradead.org; Tue, 01 Sep 2026 14:42:58 +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 DE2BD1756; Tue, 1 Sep 2026 07:42:51 -0700 (PDT) Received: from localhost (a079125.arm.com [10.164.21.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E20CA3F882; Tue, 1 Sep 2026 07:42:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1788273775; bh=NZvEgAQVOI7lQrreQcbXEtrWMnYe52kjfKk59Vp8xtY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fSf+J4UnW13FN1pFvQV4UEn0YkoWj8JEfy5U3rKMvbTohcXug4Ea3BWkGSt+8ZqZS o5+uj/rcTvrdP0ExVcQ1IlNYH9v/rqsXHNIAm4jVX3qI4omAM3yFbz2Xqd0PButF3W pPrGdJqssc1yVvF6PH0iCjeXSJCJwq2wSyeOvLJ4= Date: Tue, 1 Sep 2026 20:12:52 +0530 From: Linu Cherian To: Kevin Brodsky Cc: linux-hardening@vger.kernel.org, Andrew Morton , Andy Lutomirski , Catalin Marinas , Dave Hansen , "David Hildenbrand (Arm)" , Jann Horn , Jeff Xu , Joey Gouly , Kees Cook , Linus Walleij , Marc Zyngier , Mark Brown , Matthew Wilcox , Maxwell Bland , "Mike Rapoport (IBM)" , Peter Zijlstra , Pierre Langlois , =?iso-8859-1?Q?Pierre-Cl=E9ment?= Tosi , Quentin Perret , Rick Edgecombe , Ryan Roberts , Vlastimil Babka , Will Deacon , Yang Shi , Yeoreum Yun , linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, x86@kernel.org, Ira Weiny , Lorenzo Stoakes , Thomas Gleixner Subject: Re: [PATCH RFC v9 04/25] arm64: Introduce por_elx_set_pkey_perms() helper Message-ID: References: <20260818-kpkeys-v9-0-743ad31b2c8f@arm.com> <20260818-kpkeys-v9-4-743ad31b2c8f@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260818-kpkeys-v9-4-743ad31b2c8f@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260901_074257_878688_AFE9BA51 X-CRM114-Status: GOOD ( 18.15 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Kevin, On Tue, Aug 18, 2026 at 03:08:46PM +0100, Kevin Brodsky wrote: > Introduce a helper that sets the permissions of a given pkey > (POIndex) in the POR_ELx format, and make use of it in > arch_set_user_pkey_access(). > > new_por now represents the permissions of a single pkey, so rename > it to new_perms and change its type accordingly. > > Reviewed-by: David Hildenbrand (Arm) > Signed-off-by: Kevin Brodsky > --- > arch/arm64/include/asm/por.h | 7 +++++++ > arch/arm64/mm/mmu.c | 26 ++++++++++---------------- > 2 files changed, 17 insertions(+), 16 deletions(-) > > diff --git a/arch/arm64/include/asm/por.h b/arch/arm64/include/asm/por.h > index d913d5b529e4..19b3dd1d43a0 100644 > --- a/arch/arm64/include/asm/por.h > +++ b/arch/arm64/include/asm/por.h > @@ -31,4 +31,11 @@ static inline bool por_elx_allows_exec(u64 por, u8 pkey) > return perm & POE_X; > } > > +static inline u64 por_elx_set_pkey_perms(u64 por, u8 pkey, u8 perms) > +{ > + u64 shift = POR_ELx_PERM_SHIFT(pkey); > + > + return (por & ~(POE_MASK << shift)) | ((u64)perms << shift); We could use standard bit field access macros here ? -- Linu Cherian