From patchwork Tue Jun 25 14:57:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13711452 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BE43C2BBCA for ; Tue, 25 Jun 2024 15:04:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EAD446B00C0; Tue, 25 Jun 2024 11:04:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E5A666B00C1; Tue, 25 Jun 2024 11:04:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CD5FA6B00C2; Tue, 25 Jun 2024 11:04:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id ACA946B00C0 for ; Tue, 25 Jun 2024 11:04:02 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 0025740198 for ; Tue, 25 Jun 2024 15:04:01 +0000 (UTC) X-FDA: 82269731124.09.9CC7901 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf20.hostedemail.com (Postfix) with ESMTP id 365B91C003A for ; Tue, 25 Jun 2024 15:03:49 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=l2xsFbIE; spf=pass (imf20.hostedemail.com: domain of broonie@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=broonie@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719327816; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=XBy8WpEO2hCs8De6t4VdyvNFeHmJPwaymnVsPFsEc38=; b=lLS42kwLE9XQ2WgcDCIbDoaigr3JtHgtCXkJufCQce6MoYU58IkosuRKU2g8l+++mKkKCe pjrfNFZa3KSTVWh2oan2DYrrQ43pbg8NWaZEGVhokCKuu4/62dBUCxraUODPDtKfUMuFbD nfM/qb5BQctNnJBkKiTLiVt1JNystGI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719327816; a=rsa-sha256; cv=none; b=VuVtxy2v3wXdg5xlo7qZvPCkP/j6khytyUgLxNAyRnAooB3WWkoWyrO6s1pBsLEfXnKG2F 4aZxtAsmL3qxp32GWvyDmBFAD6AipLhTdjvhg1ay6bPilOr9qrwZHyBYLNScVufOdaS2pG S4sKOG6QelPoF7FKQtC7AkY0yx0NuDw= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=l2xsFbIE; spf=pass (imf20.hostedemail.com: domain of broonie@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=broonie@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 76A6ECE1B7C; Tue, 25 Jun 2024 15:03:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F6C7C4AF0A; Tue, 25 Jun 2024 15:03:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719327826; bh=fjC2QiGsrbMcCkXrGFM5RiSenF/23moS6IQnQJ7tLdI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=l2xsFbIETEPKGbR69SWsfYufg6rpbRn4aaptp5DtVcbSm+gRqRmpD2995e2y8WGim eCRcbHiIQJ9pqY5hWpsMfCcDmmgdUqN5aJjCIFdPU70s2FqZgkpUwl0vGFg4JvUhqM 4R47oEbqzTI/WIzPgeKJ8EyaVVlcSIGP6vCKjtr9UfEomWTHc7ivJggF+Wsk89OTlh wFjrot6UoGGCjUc+BQcPE4Hcrd/4lr2FjzLykKDT4Ars+AhqTtk0YUxWBXmBDuNa20 LK4zLQdD2O4gn8+MU+yZ3cskmZeebN965PyinB6Im0jRSXCXTS6IHMl5u/aRBwe8kH 3kXJHBn/ECzmQ== From: Mark Brown Date: Tue, 25 Jun 2024 15:57:54 +0100 Subject: [PATCH v9 26/39] arm64: Add Kconfig for Guarded Control Stack (GCS) MIME-Version: 1.0 Message-Id: <20240625-arm64-gcs-v9-26-0f634469b8f0@kernel.org> References: <20240625-arm64-gcs-v9-0-0f634469b8f0@kernel.org> In-Reply-To: <20240625-arm64-gcs-v9-0-0f634469b8f0@kernel.org> To: Catalin Marinas , Will Deacon , Jonathan Corbet , Andrew Morton , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Arnd Bergmann , Oleg Nesterov , Eric Biederman , Shuah Khan , "Rick P. Edgecombe" , Deepak Gupta , Ard Biesheuvel , Szabolcs Nagy , Kees Cook Cc: "H.J. Lu" , Paul Walmsley , Palmer Dabbelt , Albert Ou , Florian Weimer , Christian Brauner , Thiago Jung Bauermann , Ross Burton , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, kvmarm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Mark Brown X-Mailer: b4 0.14-dev-d4707 X-Developer-Signature: v=1; a=openpgp-sha256; l=1438; i=broonie@kernel.org; h=from:subject:message-id; bh=fjC2QiGsrbMcCkXrGFM5RiSenF/23moS6IQnQJ7tLdI=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBmetuGg1xlcnXPlN04dXEBbnUnfgQS+G3jS350+dWn /izc6wKJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZnrbhgAKCRAk1otyXVSH0KfjB/ 9KWonE6xeKtgOTtQX2JO7awYH9lQ6LkvpJLYKruT/tw3b5S8asSEMPcfTcPyEneVXId/HNouOKa9RN wGGAWeR7McyjYD95XpmwDqTx4zPmmme9t2V0A6LxKTGf8/Zw3LuK9L9WP/4FiItiDYbKXFHHbR1MmS YrBnyYjZm0vjLZMMdI2vobtYQ2xicVgK00Qyr/80i1MP6FhmpFoNNYpYplfFJ9JcDJTl6SKx0ZVoTu +skJQfsafa6R60XpkYGtVyB3Och3vSkyNhNc/dLNxh/JH/oW7Sp0pYRTESkaxSdnQLoMFTzY5D5H+a 7eWD6b20Ne30nkS0CHcIRuEvSi2DB8 X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 365B91C003A X-Stat-Signature: 5tjh8w9k7xif4ncuumbtmtfgemoo8xim X-HE-Tag: 1719327829-313598 X-HE-Meta: U2FsdGVkX19ncQftZlk+PaPjQzDTICmTtc+pOJqYjrb7FIKNSZKJUeOo6gt4BQ3qtPqFPSmbNyxjYWu1Z/yR4AXHWdGh2CZfCi/xDcZKGQax0penSzh/EMI+AyW2Y8OH7Et9UtZXQYeTsqN+Sx+zn5QDEj6IzAP89UV420c3stajzpuO+DP8WgnSchLZF/ysAKytvLTTC4fHJYkfE7pwjajUkDjt2ZUqOk03n68O1CBKGlPrCx5TbxAoSXebmmtaTWNHAryt6gp9gJ+Etyhh8v2qqfc8duuB8WZ1r3vg99yyzm6DIxR4oCjVJYLKmnyFFlZcL+GNm2SX5rycRhV7dNnJiRi98rHTQ+MaGfjBsHqAKTtsH/zQDYCo8xl/39d2aDDE4N3CK04HzRAAsfnvU3UhsTgeFEYOVvkz6A3z8NXOqlRy4IF/7EHWtUZMKXbciQqQTQomMr/tHeRiz3SSbQ7A0EOrfoaD58QdcEoRS+VeN44/bL6ZBB2/LgPRoZV/XJosGXbnCZjV9LJbjw7mzT+1JpJJH7X1MvP/ZDxpgQFtWfxRAKDT8fgnwvsOAUhTkzMVlhM2eRWGHRwK8vbn6cCNJ+YuGuUNWJyp1IPURUxsYZwhhD25nSoWzYxgpCIlozpDuTdLz074cRpHWA+rQ42Q9G0lb0HA342f2m/9DGP8lAWyBBVj0J6Z65GPBR23BMlncKxIaQTY5uwwWZeIfeElav2DHKXXoyM1df9JBKgZAcC+yZuMzy2Aun6QIbkeykJAAETfLJ3q7hK+1DP9LlfaZ5XYnLPyViN2cxuqUa3CmhoUDs0nHXzrNFwBUDhIRsVelThBRA5r7boHQmYjGKPcoQk5qR9C+rs2J+SCWu6MV4w0uqBQ+9659hGn3LsNqpuaZtadOpCghcSrqk1au0yL3JgO711L7EEDKCLvXOIARWhOSEUHjkrJxehRnefTnwMLVKNgeEC/ErqAEyE ArXBsayY quycSSKdrFXqfzUsEOTjdjXTnMlaG0eVys2bHq+CmwTf5QpT7OjnxGh/aV8UlcrTbfFNo/5BXU5oXmmVbMGxD/JPM5Cw0MabUu3ZMJDbgr/J9B1llIPIyiLQze8mKyLbuvKxHExGKKN4mMjIqHqyLp9KxFkfSFcjDMFb0hYWeVT1lcpoBxTaoVaInhiZ3m8aebldnF4tJeaCidVCtHaMwb2OLPUQjtWpmAoirb2/xCwDCFZjEfG2Org9K57r4YiJMsxDEtJc/rg6cUbHivOLEbJR7GTObqa9GHoteatW8PF027lmcQlmjplYvkkp825c8adyR4/QwhpfQedA2htXzJB0mWh48qOazzRltysHrBgyh9d2/9SF1mfULLg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Provide a Kconfig option allowing the user to select if GCS support is built into the kernel. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown --- arch/arm64/Kconfig | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 5d91259ee7b5..248697a29d78 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -2140,6 +2140,26 @@ config ARM64_EPAN if the cpu does not implement the feature. endmenu # "ARMv8.7 architectural features" +menu "v9.4 architectural features" + +config ARM64_GCS + bool "Enable support for Guarded Control Stack (GCS)" + default y + select ARCH_HAS_USER_SHADOW_STACK + select ARCH_USES_HIGH_VMA_FLAGS + help + Guarded Control Stack (GCS) provides support for a separate + stack with restricted access which contains only return + addresses. This can be used to harden against some attacks + by comparing return address used by the program with what is + stored in the GCS, and may also be used to efficiently obtain + the call stack for applications such as profiling. + + The feature is detected at runtime, and will remain disabled + if the system does not implement the feature. + +endmenu # "v9.4 architectural features" + config ARM64_SVE bool "ARM Scalable Vector Extension support" default y