From patchwork Mon Oct 9 12:09:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13413528 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 BCE1EE95A96 for ; Mon, 9 Oct 2023 12:13:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 58A6D8D0065; Mon, 9 Oct 2023 08:13:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 513618D0031; Mon, 9 Oct 2023 08:13:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3B6C68D0065; Mon, 9 Oct 2023 08:13:51 -0400 (EDT) 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 2643D8D0031 for ; Mon, 9 Oct 2023 08:13:51 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 0166D140238 for ; Mon, 9 Oct 2023 12:13:50 +0000 (UTC) X-FDA: 81325814262.03.699F9A4 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf20.hostedemail.com (Postfix) with ESMTP id 094B91C0004 for ; Mon, 9 Oct 2023 12:13:48 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="H39Ysk/j"; spf=pass (imf20.hostedemail.com: domain of broonie@kernel.org designates 145.40.68.75 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=1696853629; 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=yOQWM6K2oy2f4KPesiHRdEf+sIDTbKOcJgw5i/59vok=; b=FrosnesnlFYOOBLDokWuFORpQLzITSOy+lkDt9mZxyueSH7ZwpFh3HUVLIQksk6GCkGkDQ wIhFBZ/319yPNufQ3yXEuIlZaMU3hpRe/hgN/dqdggF0dY9mIcsVbTWPzCxAP9kRIp3cX7 xLUPVbpeI2Ikw33TlftgtLUCWW0jy0Y= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696853629; a=rsa-sha256; cv=none; b=ZUAYozTJq5aovpqGWiWwZOYmVFKZ/C+y+9taC66+ScSXb6VapdOualONy19izwUkGJ+H5R i3ImqupJp/hUSxRhkzaeOJJmfqcXGVnaD6qpjeJ0ebUxGRks0UYbD8xfbYYf+aAv50+Aoj tHR8QAyExBSobc/lpfsaLsA38liECeg= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="H39Ysk/j"; spf=pass (imf20.hostedemail.com: domain of broonie@kernel.org designates 145.40.68.75 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 ams.source.kernel.org (Postfix) with ESMTP id 65D05B81183; Mon, 9 Oct 2023 12:13:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 922A0C433C9; Mon, 9 Oct 2023 12:13:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696853626; bh=HKr5dcgoD1HRE8Dfu3M7S45WXlztyGX1cPv4uDvvFRM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=H39Ysk/jv3RNdJhL+Jsv7sBxcXZHRih+ROezijJvWx9EN4JvZ8YLVnCFWuh5eiiAl J3BcFT9L59aj2K0HyS0TQb5id7+eKSVp9IjZACZ4PEq4aEUJjOSP7GkJfDBzcp2Jrb u93V6DlJLKNe93rxNaei3Ow4LXKe+OKHKlwDOxFWm1SDJ76Ri39wH5qX2/YhNNY5DJ oZm3ml3SR7XSkXmMZ2NeCqJMYBJ305rEf0L35tZkyRCWXvoBdQFqFuMqNZgytHtcPR nvWKeRmVjuWn6bsz71J5LB+/nVGpBcBAqwMVSDG3VYjbyzwNtsmi2AWTk0W5qcRWwU zkc7oXD/SsHuA== From: Mark Brown Date: Mon, 09 Oct 2023 13:09:01 +0100 Subject: [PATCH v6 27/38] arm64: Add Kconfig for Guarded Control Stack (GCS) MIME-Version: 1.0 Message-Id: <20231009-arm64-gcs-v6-27-78e55deaa4dd@kernel.org> References: <20231009-arm64-gcs-v6-0-78e55deaa4dd@kernel.org> In-Reply-To: <20231009-arm64-gcs-v6-0-78e55deaa4dd@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 , 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-0438c X-Developer-Signature: v=1; a=openpgp-sha256; l=1334; i=broonie@kernel.org; h=from:subject:message-id; bh=HKr5dcgoD1HRE8Dfu3M7S45WXlztyGX1cPv4uDvvFRM=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBlI+2m6LbrIKImLz43AhLYkdJ+mn8/n/WtjdVAC+Y3 I5cZkuiJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZSPtpgAKCRAk1otyXVSH0C9JB/ 9PeuQ7odFNzac2es7G1H21MYtcjVH9+a2Xh/QADOSwBO/AZwG1T+Q4oNOVnGIYZhsMy5AUgOtQDFOg zDd8RXL2Yzchc4BhE4Ekw1h1A8Fde16BC4U8J5YyfbQTWzzV5ZjYMZRgWLWLEmJ82HR2bI/yfKju2O yiag57d6zPB3jBl31kU7tVUGxpZ+W2N3e3w0Lsn0dB/LatGzkRPssH45VRWQSLCiWocphZV2S0FttF 8NdpTgTettJANn4cQtR8Ybduqa7BR2LVBS9TWMxRVAdrv8KMfeizfOEaa1rfjudAGqmDa9T2OYofSN a9bEGUta99nzCir41mnHoSZ0Cwo785 X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Rspamd-Queue-Id: 094B91C0004 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: qw84qkx53zu8km1ita5zan41s95p1xam X-HE-Tag: 1696853628-779337 X-HE-Meta: U2FsdGVkX1/ahjbNcc+46yiR0zDdX3RoXgOb+b51P7mtpGoh4sIjSEdz5VxvBjyMQpS9lsMhriWNcrKAWIoZY1kGwET5JZXV2KHY0p8G75p2kr5bMMvL8Gunhku6ZkwsTw7tJfvb9aMzFyn4TGcChAWcEVAbrurEo6yXDN+HYkMqbtamMyvuuRqpBZ23lbb1uDhlniny9+v/T37fPVM9l0h41ZmJwQWkzrbdVWJjMQHwpfG8dMNgJLCMeYtavY20oJxkYADg+bH9MRkYK8PU4G9k7Yg8z0q9ZR1JaqhEne8gd3OidyiQiCPxOhOMKkJcHdQqTjalJRQofayFva7pNNLN78U8HEyFJxAtkHBrbk+j6R7hki15KTvfnSew6TUrTjzmnKf+gx/fY+Qy4dVIsBoK0C/V3mKDubqAlK7GhjjRFRR0gULOQ9X1RRQHgseyoEtIVJ6Iecap/5FwEJbqF/Dw4oz1td3o2F1XlDD0GKhdkMPNd8r6hVt1So51x9lqUNobliXDvIcUq6wKqRVeNryiZw80ct9xCLXAqHuPAOmn6IGovLVT2mfUvVsyPxUfPR1ItFwxatLYsEMX0qmtz3Lee8RrPYuFqI98pV1Zia2/g69cnGnM01fROxNFyQKdfRpxbJ9tHZEoRUeT/RAUOnXicQxVuJYAA7UbpveJhPJES/ac5wUfZ0Kmaosd+3RLkANPIWNYMKNo63CfWB/J1EMzINIgtmqeP19fDhVSrKTzKroxrYbAuL4Xtfu2Ns5TXXeS1DQ6mQql/mUN4fg3HvPcQQyBhhVVOH37k0FnuObbOuVr0uqlXuhvS3OY85/c919xCcllVd1v8Ug12qp9GGEnjQH+TB4nxWNQwu3tztOsWyxZiowWhrgpDIX7rCgDX1jNn4cctqz2Cpft+kDqSl7qt4+Jh6u2m8mSTVnwsLJCxFJpXh5NFwVw0bYlqivEIEWCSf+5r3NdnpsuYrb Q7zBR3ap 3d0KJYl3H5T5T+Yw6LM5x9sspZf3jxDMe0PYIudHjQV19DXLXUipdvQdKprqw2I1LF+eI2LqO4Q9xYkZPpEGMhlJ3QgPYxTkyDP/FXUzztFDHghW2xMvoTe9bFHQ8FGjk+LCwamLCmykEAmmLlzeKqR4mhMxWQwmYW9WV88WCOPsATZA6bTzCyUmbJ+whpX9ANfNtwmS5K8itDGn0OqVFFt5OTr6iY3pY2jLdm8pPPVcWxcr4Mm7/lb44gdUOdrqZ0R8K/pOlUumYEvSzP83HYWNOgxbYEsPw4ZuaggyPeN0pXyVGdY+LlMVkHdA1eBw9AgpafOLVRpQRmjw= 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: 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 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index b10515c0200b..d235e725177b 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -2060,6 +2060,25 @@ 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_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