From patchwork Thu Aug 1 12:06:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13750391 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 A8054C3DA4A for ; Thu, 1 Aug 2024 12:58:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F0EA76B00AB; Thu, 1 Aug 2024 08:58:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E70EC6B00AC; Thu, 1 Aug 2024 08:58:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CEB256B00AE; Thu, 1 Aug 2024 08:58:45 -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 3AE716B00AC for ; Thu, 1 Aug 2024 08:58:45 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id D822AA741E for ; Thu, 1 Aug 2024 12:58:44 +0000 (UTC) X-FDA: 82403680968.27.8A72214 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf24.hostedemail.com (Postfix) with ESMTP id 19A5318000C for ; Thu, 1 Aug 2024 12:58:42 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=OMtPH0QQ; spf=pass (imf24.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=1722517094; a=rsa-sha256; cv=none; b=nl6XmewAhGsLVmjo8T6HnPcPZ9dpa0OgYBglTUG16jQ2Jn8cqXFDCVLL26F8bCkA38YAwX b8mIVRNmf0XJlFhvH2AyDTi6luWZe0h5pUewOrbLC/aOrelGo1vQr0+CUQEaV6HWnYX9c0 vS2HUaGVGcLeXDor4XSUfbEsc+swRf0= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=OMtPH0QQ; spf=pass (imf24.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=1722517094; 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=rduCnP/qJ6ZTgC132xa6OYShmwb48ROC/5R9Zzk0HAE=; b=mKlPLg20+rWgjNdMrWYqvxK6Qz+1c1MaCQtM/Pw+89wOggiGIvVgSr+XsnfwYT34oNHX8J opBXTEbQNqs7lvKPGlbNRP58q+gKzjtpqyH4Ve4pvWHz4p41et7KIOBhsqhytxa9m/1Z+d oFUoPmbbIzkhTeKdyCe0BeMCB/vixLo= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 3BD716288E; Thu, 1 Aug 2024 12:58:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AC6DC32786; Thu, 1 Aug 2024 12:58:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722517121; bh=yrclwp0293yC9GB/YqBAfQERM0nqbhUl6FyE+eoviK4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=OMtPH0QQtyjuzyGFLmvxodnUhI1RcowGJgcVcqpXjp4OIMCKEYXxKeS0Zloiu6ACe 7Y0zfhO07G3VFrL/o+SIq6MmOl0CJLDz3Wt6U0/2E55zxehJVMzg68p8qQVBCwdKiZ anTd5o27Tlj8IjZenRvzKlL3K8DnhbnStCp2mm7Aj+m14jz3gCWAaY0P1ghrYK8ThN sZ0TjouWrlUahzC6QOq8d3RjUdUdVoo6Dt9TxzB077E65bzGk5bzRo6b5CF553uAV/ 6ys2f9aLFBLXha2iCi5+SRM03qQNBGQHs4Y6nVLW37PCjew/gusoTL2CruWyy1GzK8 6+IyQV6Ac1uTQ== From: Mark Brown Date: Thu, 01 Aug 2024 13:06:39 +0100 Subject: [PATCH v10 12/40] mm: Define VM_SHADOW_STACK for arm64 when we support GCS MIME-Version: 1.0 Message-Id: <20240801-arm64-gcs-v10-12-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=1520; i=broonie@kernel.org; h=from:subject:message-id; bh=yrclwp0293yC9GB/YqBAfQERM0nqbhUl6FyE+eoviK4=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBmq4YPVQ6/NKZ2FgJD9BDBgenwO3uVt2vwx+JEk7wS a+dSp5eJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZquGDwAKCRAk1otyXVSH0PO9B/ 9FjPI6PZJke3DvcVt+TVF5+jjcO2FhunyyoZQBXwVwx0e14Z0TzTQv+M+eqDtAdVaXxEw+nVpGUhKj Rzyuud84uh5DfziIcGXe0HGokGGysRLk9OSG+dbJcWvI929qOFL/U5T2T/nCAnz61Mop8929qqKQFV W6vCejrk+xyxch2pG67qESCQw8vVyb6VAx2Z4PRuLxokX1bbhCX6+vRKt8Fv1dw01bV0RUfa8/6NsL vrLpbU65aCMhK4yG3IA5211146YV98aCoLl9L2ka2dgkMxupbf+n9aISI9eXd5SlWhJZBx2craAReK S2fhv2FZ2s1iixEVEAAABxmUNJ0aCK X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Stat-Signature: 816647rekaw74q9et4jmjprfshge6srg X-Rspamd-Queue-Id: 19A5318000C X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1722517122-659656 X-HE-Meta: U2FsdGVkX19xUx2mdQbkj0yoq4bsGykbRyEjavUzKrnu6ZY79qqA2P0HgLkPoizmLJx8HETmu0YzZtnLgCAaKiS6vIhVAysCT0A08v7MPYHqt2ryhbVDUrip7huqDq8uTTQ3cAs3r+FYjo1/Y5D2ksnHZkDtMqlmfyCqjVlewZU58RzHcQ5FxBbFwneZrsvLvJUtkIeonoe5Ak70p427zQO/4rOu8IrpcW8RFRoP42OmacNLrMYL2S30BMiY7JUPnAbRWAiaO9XKLd09cqDcxYPCrYRf7UbuuKYLIt9OoVqar93dnZOipaj68wSl/POWF1mXuAa3S/UotvAwQRAZComz62FtQTEcRl0GvMb07vz6ejBNizo8rFg7NbMky+xmF/b+/5rI8dHP+jNFncdVLujWhshO0NvODoARtiFk+/T/LNb9BqTyFAo2On/WRuft63wuOaws9V8rsG9KkyJLWM8P+VGedLCy0yhUprJ3BqAHF+WWJPG5jI5zaI226FYFEfKaz6JbKTaBold6LQ3wITqdNy4mZ+7xC5lFAr4K053WAiAYyUWRQL8ZRX9+VELoe6ma/jy2wux2kftVCwz2RiVXoDsu9uti6Fdrh2nV/Oz66b6eh/+csb4mnTEt0M3eLgfKIshfTiFDMVUiGi91OMBlitRUASc1gr3CbVCnA1Jd+wWDrJWlm8WdoJ8UaCY0K52s4eta3oH46/rvcMc7DM37HU6DT/Bp1xctWlPVrd2Ah4JPJUO04hsjCV1RNL7zQxfv/JduYrYLnZZKBqFQ7cNlE0w8b0hwUYGSmbLN5si/hEdfzP+hnWIm6jHiS0/XS+QJT59Uf33gNU6+1dgt/dxmBmnIelHswAmsXf8fFwznrsa/zIrFrk+Sso7xMtMTncZNrCeud7TfHFkPJc2XCEq5asj9xDZGLtK+aORkKFp+FzgvTw2vn15OSRANqn5idsl1FuVxxSXUh1yVFcp yYilw2ec I9eVRO2WIvifg0N1TqcvXIoOLk3UuLzCAMXsmjeFu3nvYPU3DaIwXoBqaUhYlAZzIGquscUBnTUFBX13mBP21UvQZNqgYsUveE9WXgptlF2uYCpTOmL8v4A2r5rkiEyUpdx7mAOLPMrOWqZ3Tjp567ptCQhu7/jQqsaFvCBm6TRYfAxZJ/c2ScUwzuTncjtGNh58F6FokMJdA8xHFQ38Czlc5qVG5OG7jZaRwFdwEs4ZtA6GupwJQB8csMPgDBPySJ2ilpJg/NHk/io0IxdkERPxBkbgYblZ5BynGqCGET9ZKjciFz2WO4KZOsGQC0xuIPp0MlktAgjhUzh7Cogis+MrRBlYJDrOqHnE7B6QzGagcnA+XuYyR1JywGSTtMGrHeuXyS359OdK/nXOWpuTj1Vh6f7dMW/yH97PFktER/mCzeAA= 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: Use VM_HIGH_ARCH_5 for guarded control stack pages. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown Reviewed-by: Catalin Marinas --- Documentation/filesystems/proc.rst | 2 +- include/linux/mm.h | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Documentation/filesystems/proc.rst b/Documentation/filesystems/proc.rst index e834779d9611..6a882c57a7e7 100644 --- a/Documentation/filesystems/proc.rst +++ b/Documentation/filesystems/proc.rst @@ -579,7 +579,7 @@ encoded manner. The codes are the following: mt arm64 MTE allocation tags are enabled um userfaultfd missing tracking uw userfaultfd wr-protect tracking - ss shadow stack page + ss shadow/guarded control stack page sl sealed == ======================================= diff --git a/include/linux/mm.h b/include/linux/mm.h index 96faf26b6083..c6c7454ce4e0 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -353,7 +353,17 @@ extern unsigned int kobjsize(const void *objp); * for more details on the guard size. */ # define VM_SHADOW_STACK VM_HIGH_ARCH_5 -#else +#endif + +#if defined(CONFIG_ARM64_GCS) +/* + * arm64's Guarded Control Stack implements similar functionality and + * has similar constraints to shadow stacks. + */ +# define VM_SHADOW_STACK VM_HIGH_ARCH_5 +#endif + +#ifndef VM_SHADOW_STACK # define VM_SHADOW_STACK VM_NONE #endif