From patchwork Thu Aug 1 12:06:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13750406 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 D9A0AC3DA64 for ; Thu, 1 Aug 2024 13:00:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 65D896B00C0; Thu, 1 Aug 2024 09:00:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E5DD6B00C1; Thu, 1 Aug 2024 09:00:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4389C6B00C2; Thu, 1 Aug 2024 09:00:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 21A556B00C0 for ; Thu, 1 Aug 2024 09:00:26 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id D05F31C40CA for ; Thu, 1 Aug 2024 13:00:25 +0000 (UTC) X-FDA: 82403685210.28.C7ADF1A Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf15.hostedemail.com (Postfix) with ESMTP id D16CEA003A for ; Thu, 1 Aug 2024 13:00:23 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="Zdk/HN3V"; spf=pass (imf15.hostedemail.com: domain of broonie@kernel.org designates 139.178.84.217 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=1722517179; 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=moSjIro1rCziUa1GHcyaGnSJrQya9rKM/lUeW/vDHA8=; b=gnuSzvwCHdoGnaa34BTR+3mUH96E/NiBjQm4WPZNVwHdJ2B7qK+wx0CFfM+oNLCBn+XLzK fY+ZqGPfGATTRH1adIvg/4KMkUQXMrxAK1SVqNdOWFUGfeKixxnVL4Re914T5r5yBLHU6i IZWb8SpAtoWLExPgPRgL8miCBwqcjBk= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="Zdk/HN3V"; spf=pass (imf15.hostedemail.com: domain of broonie@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=broonie@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722517179; a=rsa-sha256; cv=none; b=3kpSXWxsH3Jveo/4Cg05n17L5q6PymQnXdOn7heHri7eYGVGDHr6lDGEKtiPPO6Ij/eVjE RGW3r3gO0Q73R/5hPgpfCqC1stt0vYa1CKHsnrKHF0EzYkwmkXaHMz9p7Chd68wvtKFmH0 10F844rGObORmPDBZCd0KKVb2mS83d8= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 12FE2628A3; Thu, 1 Aug 2024 13:00:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A461EC4AF09; Thu, 1 Aug 2024 13:00:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722517222; bh=jCz9TB/T2gtL+Dj1sBbCVvFYWqxLMS2lgt+ihDoyD98=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Zdk/HN3Vv5MCR9tWdyaa/VEftixl5lcXiTlx9bdPKbc6eaT3FWEIZma95Z+GhffvM EcnEtjxjUMY7BtJNNzPCC7DDT43xLDYiM+AZJdYOlDlAIPK9JiTcxM9ZYM42+e7C+U 9M+FRULwYAKFy9B+Z/awaXXUyELOAV1XBrU0mp4w/mkVPsn/eOz7VKSFLsmAIwwW7B lew6XfI7DwPM58JgIGVw2nkB0gIogzXMI6WGBoekN/T1iW0VC3dDiHWS29AQH9c6VV IV9oIsnZ+4eQBNTMn/6CGQLJ5TBXgVfn0mxsqA1OzKNu7nMhgKP1rnDfsJkBxLzSKi FYf/bx/yCadnw== From: Mark Brown Date: Thu, 01 Aug 2024 13:06:53 +0100 Subject: [PATCH v10 26/40] arm64: Add Kconfig for Guarded Control Stack (GCS) MIME-Version: 1.0 Message-Id: <20240801-arm64-gcs-v10-26-699e2bd2190b@kernel.org> References: <20240801-arm64-gcs-v10-0-699e2bd2190b@kernel.org> In-Reply-To: <20240801-arm64-gcs-v10-0-699e2bd2190b@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.15-dev-37811 X-Developer-Signature: v=1; a=openpgp-sha256; l=1438; i=broonie@kernel.org; h=from:subject:message-id; bh=jCz9TB/T2gtL+Dj1sBbCVvFYWqxLMS2lgt+ihDoyD98=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBmq4YaZfoQpmqEUbybjMAYNvLQbJaJ5ach0jFFKMwt WAXMRf6JATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZquGGgAKCRAk1otyXVSH0GzQB/ 0VUEM5IVaWGWCtsoHGuHQHdtM8+bn0nEmmu8lC+oIKaYCzNy9VMZzgyUqowYnTd7bPlWUz/Y86I44V RwpJj/EKex2ZFhiaMSKwZKk5ZycQwwdhmGqd8wkhELOTAU5tPmelrk1C5oPSDSLU5/cK5yCygjrcBh KSD25yGvlDBzmQwU8A2hU2FXizsVvxQGd/XPIkN4qnQLAWZKEaHYFH8a475LGnHg8uUfsFCToCPjWh 6YUfe9z6iCQUb0w218AdqDzqriKwGOuLBU2jkxLaydWomcfvewT1WWRsu2cMVLqUa0d9CiOZRK5wBg Uww68Gf9sKSJ6c/5O3iLSaPKkTUUYX X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Stat-Signature: ag8iwiyiwo6dmajoxtjdu8tuo5iakqh5 X-Rspam-User: X-Rspamd-Queue-Id: D16CEA003A X-Rspamd-Server: rspam02 X-HE-Tag: 1722517223-478114 X-HE-Meta: U2FsdGVkX1/PwNMOhE+AxVlTJZeH9opTS66sO60WgXLwUv3BPAzAkZNQQmHaywaNeye8iUKNYo6tNFIYvUv4yPEmdEEs3Gekc8AtpjE8ubL0uV0e+nhudCoy0CZxKdXEM3fttZPRg8p4NI592wa2vG6V3VJQozA++cfB+fRqH0UVdMwofK6WKdZjyQ1N95ttOycjyc7GgYxeBrLiN6SL3FufJwSncvQK49M5r0eQCMeGpTgKWSqj4oqA7UQftylbssA5dUzKw1D+RsIa7kqjbl/jsiQOW8cZlaiweOFjJBu9R1WB9Hv2BJ/s/zS6HRm+yirullQ6MDbLEQ1xIciIyFZMiSz7LH3blOZgt46g8WIpoIe0ImmlQShKOppe7yM60Zu5HqM52YXmnq9IsWmhkhcAriXpN7cnJsoOmdrQFghp5wWWbZ5YDn6QgrLD9ocnSSOxNOEOMg6xV3S9E/1iKdQgebG+jO5A4j8fO2eohhIHwBLBsxtKLliNw0yoO9u36e3qGOleD92HqUE7Aoh+J8sb/2UaPBnsdTg0yx6JcN08CHWUtf5Ig++5yWaqA4enYTBN8623ChKFumx7g/EV3w5k6RRqItDsV0Bd4mFTiSPSn6+EFtficR3aoTl8tomHs4ghA2k4TmePBXKQGKVc9rasX6GXYPrFpEFxYR48/8C4e+4MVlmEp28K1ej8K9IPCL4R3/Vc0tzF84Lig0LjUImMPMopKxJcLp2ftEA3QWbPHryW4gKcau3hqz3SAQV+rlOtxjeattkpXi31OzztLPB24+KII1BQhrmpgJKkA5bTIVVHJEckbtexj9lH53/NW8S406ToIeOC8pafmenGthinDPSOW/TmW+3b28G3O62YnOKM+ubYS2TWjPKe8QlV2TZhFDemqZDyTBS+jsUfO0V2G9RhUrXRJ1sY9/RV6jMuEQPZPrHfu9Bjal+vVVVA9ll5F1ad8X4R65WdFww kyeOKV8N OLJ728YZRachr1nAGDPWaWZ9PsE0dTHEe9QxHERA5drG72EIMeKFOvlSBLsGRI4EkXbFypJQieS686D5hJFL9Lu3nrRkToQoeLZrkmvUKxff4tsT6VhIAtoWoEUi/wuNxgfwV5S+W0EPRiAjBDVdh0W8x61d5qBF0fHVPr0sffrDDAwLLfUEGXxIYGqRJgQsBfrIsk24cpBScnp6BHNxeuYkKlb6Pv5dhU/uYklh0PzFFkV28dlADsTGpwY3Fhtc6PIxmqZpREy52KP1TC4xRlB+vtowdclyQtg2cnmaEbXFtwDoUaRy4yaatNWKMOtY938Fcuw3IWHvh2wlxp5p9ZyHvVtiShC7KDCpV2rRQgZHteFQMMOFxntBdSqPTe44YxWUR 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 Reviewed-by: Catalin Marinas --- arch/arm64/Kconfig | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index b3fc891f1544..83e27857bc6a 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -2127,6 +2127,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