From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A689A3C5838 for ; Tue, 26 May 2026 11:17:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779794231; cv=none; b=ryWPKFT6fDCT4H2kSZyGQMz10+OWGduwmy2Ha+UmXWCyYCTYEh+VUQXVPACv7HBFzYFKW/SBpdUGpQyXmBkK1ogdFMVbBHN0P8wYYWIrHUOxLeYjEcjgYJ/8lk6N3qtRrz2/y9asqjMfAl47UGSZ7B0UPXobwt6HRwoXhNy0CZc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779794231; c=relaxed/simple; bh=+OGpwgzVEkFFPsMOgL6J2ZFY9bOrw4hijWLmgpJn7uk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=joJZzPRHmETsrzOZ/1sSOuPtHfS/XuXvFVqXk+LoPbJwLBRHUtsIcBOfFBetUdkJTGVWLPZuW7LM0uP5ukr/cveCPUraPP/0xaqCNYnPkicsZtB8Z53kmStQrRlQfWxpLzVIqs02K7FRbnZqHQwzQmSzJLcdXxZO1VMPI5GLPJI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=NXGgiha6; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="NXGgiha6" 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 92E32169C; Tue, 26 May 2026 04:17:03 -0700 (PDT) Received: from localhost.localdomain (e123572-lin.cambridge.arm.com [10.1.194.54]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 24E033F7D8; Tue, 26 May 2026 04:17:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1779794228; bh=+OGpwgzVEkFFPsMOgL6J2ZFY9bOrw4hijWLmgpJn7uk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=NXGgiha6GINynS7xkcX0uVVxHjHvcpyuF7Tk/QpU/L1V6x4CHZsHCvSUYs0ET6+nz ogt+V9rf6M9baMkmmGSc1m8ROeEoXFuS/FC+MHYGVrDhkuB8nXX/P96j8D/2/W9dzY pEnZJ1K4rGcr6qUXdyJ80DfLZxP3qa6AGXOOPeTE= From: Kevin Brodsky Date: Tue, 26 May 2026 12:15:51 +0100 Subject: [PATCH RFC v8 02/24] set_memory: Introduce set_memory_pkey() stub Precedence: bulk X-Mailing-List: linux-hardening@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260526-kpkeys-v8-2-eaaacdacc67c@arm.com> References: <20260526-kpkeys-v8-0-eaaacdacc67c@arm.com> In-Reply-To: <20260526-kpkeys-v8-0-eaaacdacc67c@arm.com> To: linux-hardening@vger.kernel.org Cc: Kevin Brodsky , Andrew Morton , Andy Lutomirski , Catalin Marinas , Dave Hansen , "David Hildenbrand (Arm)" , Ira Weiny , 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 , 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, Lorenzo Stoakes , Thomas Gleixner X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779794211; l=917; i=kevin.brodsky@arm.com; s=20260427; h=from:subject:message-id; bh=+OGpwgzVEkFFPsMOgL6J2ZFY9bOrw4hijWLmgpJn7uk=; b=8De/kV8sEljigJjiEvqeCIMnPh9ZNqCIUniOyYuqA+vqWE1URz0rwYAePpTlekHMqoi9dpv9D +dX7ogRAjKbAfS1LyoNEllngretraN0QIiB7BLwfLTbt1YABdnxPt1a X-Developer-Key: i=kevin.brodsky@arm.com; a=ed25519; pk=N2QG+eJKrvkNovwhhwJhnJ4+ScVfsGCHldmqLfcMTFs= Introduce a new function, set_memory_pkey(), which sets the protection key (pkey) of pages in the specified linear mapping range. Architectures implementing kernel pkeys (kpkeys) must provide a suitable implementation; an empty stub is added as fallback. Signed-off-by: Kevin Brodsky --- include/linux/set_memory.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/linux/set_memory.h b/include/linux/set_memory.h index 3030d9245f5a..7b3a8bfde3c6 100644 --- a/include/linux/set_memory.h +++ b/include/linux/set_memory.h @@ -84,4 +84,11 @@ static inline int set_memory_decrypted(unsigned long addr, int numpages) } #endif /* CONFIG_ARCH_HAS_MEM_ENCRYPT */ +#ifndef CONFIG_ARCH_HAS_KPKEYS +static inline int set_memory_pkey(unsigned long addr, int numpages, int pkey) +{ + return 0; +} +#endif + #endif /* _LINUX_SET_MEMORY_H_ */ -- 2.51.2