From patchwork Sat Feb 3 12:25:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13544152 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 3BE89C4828D for ; Sat, 3 Feb 2024 12:32:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C27DE6B00B5; Sat, 3 Feb 2024 07:32:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BD9296B00B7; Sat, 3 Feb 2024 07:32:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AC8596B00B8; Sat, 3 Feb 2024 07:32:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 9CB596B00B5 for ; Sat, 3 Feb 2024 07:32:43 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 81E0DA0776 for ; Sat, 3 Feb 2024 12:32:43 +0000 (UTC) X-FDA: 81750431406.25.9D22FF3 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf21.hostedemail.com (Postfix) with ESMTP id 185671C0015 for ; Sat, 3 Feb 2024 12:32:40 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Rr0NlCUf; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf21.hostedemail.com: domain of broonie@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=broonie@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706963561; 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=KfEVhTOvR2NDwccNnzlCGckXv+scQ1CsuWB1eGX+74c=; b=mQE4tBUM57B8PuIXCcpJA5IrAC+nT6FORxyr6fWTz6wJPbTzHl1pHkvGafnkqv7N8cTQbE bFd9T4DL0Z5HP0MDHtFUHOxNbLK3JygrDR2XSSlWKiz10cD+eB74e00opAdL26fFSfleBe 30DV6+0NybR/UhqrRutW3WciVmfhblA= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Rr0NlCUf; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf21.hostedemail.com: domain of broonie@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=broonie@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706963561; a=rsa-sha256; cv=none; b=iM7S5zJ1tg6dZdsViMpTr6qfWJxX/Mnm4wJHtpIEr4uP3Xj5aAXI/CGSsF9r+NqeDLJtoQ +Mf4M9SHUiQa2FErchpdHndxDKJpw2gbKFNtHZdVKH1CDfMdr8CObWgqgeySkIH79C+glc 0fZc7SY3NgM9z9crkcOd+LWYbbFFOuw= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 7963DCE1F0C; Sat, 3 Feb 2024 12:32:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76DADC433F1; Sat, 3 Feb 2024 12:32:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706963556; bh=RGzSIrmEW7Jf6evuT6565KZp1tpVwBC25PeiKV/XCIM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Rr0NlCUfUX2j3myBULSLJPalVM826rFJl0vTY3fYPNIAoGjsaWyYKxtBifaNm6sDv R3k3Z+e3/jgWq5+5PInC1Osi52ku2mCr6D9o1aURAOeLt+R2Zkk5U6R2wCML7xz6zk PG81g8AMxl2rVOrJUNnz2N35u5ho9Xg89aJIJj9OoWN9wFUIZ/qvSjm3ZM8I4h9hFC AbMSyA++bvK+sdEPPG3qzzEnAj62MLnGKSS32CcHHeeK/jUMKkKjE6RdyAZ+tvsviN dDdf/wFFm15nQghsG5q3BA7MRI+OHsHHN8xmcmlC7HDsvlRem/d2ChYl+uIz2gqkTZ rhMiIq5b7EusQ== From: Mark Brown Date: Sat, 03 Feb 2024 12:25:52 +0000 Subject: [PATCH v8 26/38] arm64: Add Kconfig for Guarded Control Stack (GCS) MIME-Version: 1.0 Message-Id: <20240203-arm64-gcs-v8-26-c9fec77673ef@kernel.org> References: <20240203-arm64-gcs-v8-0-c9fec77673ef@kernel.org> In-Reply-To: <20240203-arm64-gcs-v8-0-c9fec77673ef@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 , Kees Cook , Shuah Khan , "Rick P. Edgecombe" , Deepak Gupta , Ard Biesheuvel , Szabolcs Nagy Cc: "H.J. Lu" , Paul Walmsley , Palmer Dabbelt , Albert Ou , Florian Weimer , Christian Brauner , Thiago Jung Bauermann , 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.13-dev-a684c X-Developer-Signature: v=1; a=openpgp-sha256; l=1372; i=broonie@kernel.org; h=from:subject:message-id; bh=RGzSIrmEW7Jf6evuT6565KZp1tpVwBC25PeiKV/XCIM=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBlvjDlwn8OBL1okRa937HDPu7LnBF8+tPg3W5TVRmQ TyRiYLiJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZb4w5QAKCRAk1otyXVSH0GddB/ 94PnXcnxhx9d3Igx3+8wyrY4sdF5KYIjmDuj3squkXqrrZ2tiirA6Q62mQp8vp+ezqY1jRXa4sYuJ6 S4br3364VBFwZURGrMoqdURAvnmTRIVSNGGYe6TRIoFURRVmXmsSb1Zx9GeUJE+887P2YThSn1hX4u UYhHuNxxIuI+/hGpYdkS35l+885fx4nMPUte+GNr+FvdEa6vqVjtRScIfSuKLmDgZ/N4wSajZL/k1q rBPuJY2ifU59ibgG/D9dxZieNsgex3LyQf29V2Ibhl6yWuOIeyY9K15eIuhbvVWh0jnwxw8K8dMwt4 yP307QaPCE4iW0R2nFKNxCYMzLGxW/ X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Rspam-User: X-Stat-Signature: e9p4znetq5gaasje8yffubiuagznm5ei X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 185671C0015 X-HE-Tag: 1706963560-260602 X-HE-Meta: U2FsdGVkX1/GyqygKJAIXUsr6ZUuPIHPprME+mn3UxpihczP4JyHoiHmASzZt+/oVK4mk/RPI3fnSEi6Je+EfPAKeTQJmIiaSkpBlrPmuL3Ua37NArh/gueukcrtSLlNyL8vQWMBAvtc7R24YITJRfd6q4o09w4b4zaDyxMGOny41SHOxsNNutiUxNNt+i5FTCnbqzadcm5bhlVpT1MugBUQpUfByCzgsPKdvInq81zmSZLrMuIj85L5Wq7RpznkZjC/tc8X4BFL+sm3YVtn1PxArMrBeSRt/mRM817OSFazI4Sfu8w+SA58+0W0udABtfJi/yx2okkneAhdn+hqnOW0rqgt+QGV8kban0ZUhM6+7ZSsYJ3Z7dYehbEgcnHdMKchZoM0K7PSHcFS+KpgckbGuRG1Q5V2hzEa+woCoFPu3CCwDnuQS+ZyGVN11RXaNzQ7CDSZG68J9087cNuQuBA/P6gGxcwphUFwZAD15Fh7niYcJhtmuNEF1dZPm5yQNvQutCDEeoJ6ffY6KFESYYksDQkZEGUZ86+TRmInZREPtpXnDm94P2kwP9J8ghsWPjNwR8Tfl7PvFN/nXJR6cIoVKBcbmpesRylI7PQsPbjW4ndP5dn0mkoq8MdQUhMC7CXr1nyrGttWRYNHcWIZbwE/okjoKkKi4FxEBgMdobRk0RMBdP1HjzEhNUfa54/PonbZnn0LTtetoQGnfTsZdvFGvCtnsIV0RtsFEdrp+OdIsOjVDWXjUjOuZ4oGjfOcBZzFw7ijmM7Ybs8b17+wK0ZCB7OWu+BcYFMJqCIq6tKTWO+Ke+DbxCfDLOLXYSudYC+QNvq1Qg8bGY/YkxSzwkrdfAzCa6QRSd5CSe6SCULND1Ps9ChIImPtlEbv0dV15x11X2+6KXP/Aivse03chIF2Arjt1z3pZPJCsw67ed1AEzInPzYPlE+ORDhJcN9aTjGP2pkJWo+QvFBJsU4 TgPG338b PRs/00O23rg/hzQJ6bh9TwQfd50obqt94BlDteqLvEUqnrMBJ1J22nTiLIMp3iQ2X8BMx2VxqIRg7gcwexoIkqQDlbKGtuDcyC58InL3TtOrSjzg1iERHjqqio5ZIbCkYZUV3nEbyrxysXQVjPufm4ZMd7PPxH5v9B4HCk2t+hF+820dg2/pa1PT9gkoIXpHeklb1UZSqg+rrQGSSyUe8rJmMHS41/01ip/5HzcxDl2/CLNjKQqKlLhkGlG4jXkZRSo3/MevAVDT/SwwlbJ77UH8jm2an9kzxYqdNwe+FjE1cNjexiUSX075uE59wDHMA3p7R 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. 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 aa7c1d435139..e0048e4660cf 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -2098,6 +2098,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