Message ID | 20240203-arm64-gcs-v8-11-c9fec77673ef@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-51053-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp993454dyc; Sat, 3 Feb 2024 04:35:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IFvhtQzrP0jCTMMOdIQzwkpZdLKKPaKZBvv7XaxZLJoFjRZqvCTwk0hm+2fOL14BQ6/8Uvx X-Received: by 2002:a05:6870:e2ca:b0:219:476a:c1a8 with SMTP id w10-20020a056870e2ca00b00219476ac1a8mr1697490oad.6.1706963718729; Sat, 03 Feb 2024 04:35:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706963718; cv=pass; d=google.com; s=arc-20160816; b=kxSZXzKKZ/0OsU9O9FyHoGB4xKPHN4exa8OkEFrGfef8pocD2DJqJTGEvmMx9+MgAx KNJ6Vqp5765NZi2eWcVVLVTi02aPaGpbbByneMwYF+OPjP74l0U05oQztI2DUNEysn4I hHisLQ3x0Wb6AVk4FlHRpVOhcGiKhZY4hmlWKWyrZWgd5Me62gW0MkPDlZXOMtrDEcFD 2pNfuo7xMiRyyoW3F8U3r3CpPohK89llZQp4Ww9PVEGcnsZ8oDGXs40ueFZ2WeQAzdDx epI3wq74nyEq4DQMCIXDoTXZKxOhsJVkUqk9Q2zOSarX2hFsMXYBLKqJZ9pE9t8OP9iY UISw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=uI8doFRdMNxyLZ96w6OPYHbxPBJXwa5V9eJEB7Z5WuQ=; fh=OE3EABV4QOKSOEEOxwA9Ma10EyTbIpYes86IShLOTes=; b=ZWnDnN5jokWqOZxNzZF+M896P+LKjsAxk9hp3KfukFPfJF71DJ1qHGl7HjrqCWjdZl o9QJzonI7nsqJpGZD/W8w/jwm/gDKcE+yuOIuljcmbixTuo8DncUdsJw4pAqxPtoEogj nHBuE/X2FvujcgtYSxOKFyvBo417FxFImYICWSXUW/APxs5NoCHqZOUzqKykB5PRABJ/ 0SHsAw1p6CG7AHVNjPc0BC2EoVeaxkOasE2M+v1QSQpZfAMmmctt/g7Gbog4+3QHo4y3 toCi6KtsqyVke6zKLjXaLaamPdGAV4DqKJLZTTKL+uLO64QcDl6PK2wdClA+JPe0nmn0 Gn/A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nZ+FVrta; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-51053-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51053-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCVVMvwl10zO2n8oMpEjFN57x+3d/0EEzcEdGQEgC6pTzw8f2VyVclScluYk3kD/wZeSofeFTI4zqVZccuIn+CIW1bEOjQ== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id z3-20020a656643000000b005cecd95b6besi3178917pgv.685.2024.02.03.04.35.18 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 04:35:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51053-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nZ+FVrta; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-51053-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51053-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7B8F6284020 for <ouuuleilei@gmail.com>; Sat, 3 Feb 2024 12:35:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CEF71605BB; Sat, 3 Feb 2024 12:30:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nZ+FVrta" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D7A315E5B5; Sat, 3 Feb 2024 12:30:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706963455; cv=none; b=BgLUkyZbeu0TYYGFR1n6Wh9+u9JNNRQPtE+mjvUSHy3O8nuK5zGcB/9YnlMKH+USWgyHS3JnmrhYwSwsr9rm/cr8UuYEgWQxk2ulyzVXzOAureaTLgk6zviplRJiKte87NqBh0pmUgm85+a5CmNPjqiDzIQfmSxQ7a8nhXJZQYQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706963455; c=relaxed/simple; bh=noIMiNXXaRbZmSrB1LMm4LQSI3w8gaJJhGiAy9NbIgk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XN7FcJzNfKYDK2SxHJozTdfUtwYbYhtIqFnosku5tTOnVXmVnRZpV3yHxQIqpITmdjr++/HOSGRG5I7yDaWk124XQDcByVlsWNoXij2S2imXfZ8Ou5/ilHgObvo4VwbAVQztbzBmPOr+hCqe04U5RsFXyfcWVjbnINCMWWxr8+k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nZ+FVrta; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EBDEC433F1; Sat, 3 Feb 2024 12:30:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706963454; bh=noIMiNXXaRbZmSrB1LMm4LQSI3w8gaJJhGiAy9NbIgk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=nZ+FVrtarYuPfV2QgPHzVDN1mdXXrUA/eCIkI0+jD+9lmq8AK1SrIHQkP+okJ5xIf Nrtap97nj/w0mCOq2XBkzeEft1WmagOP1qx9TFRd7EBruLsj53cPf7oLI70WJMf2MQ dMWZcj6emLEFTlJCV/Yxh7bjw5A6lQLRrkdBfnfN/U4F2NkeGs3HNfZoP1yPp8rSJL VlptsEVCXxOwPpctcB+HH0ogyB4/oAE/pVEWNyqU0lHP8t821iVQKCaDfz3W3uU9m5 AOL2G84ZrXkvUQOBBwDNufzWgILEjqVWtfYDLJgzCbrfg21DlUhhzOPjJVMkEgy4Fh 1cwCvG9ZSMVbQ== From: Mark Brown <broonie@kernel.org> Date: Sat, 03 Feb 2024 12:25:37 +0000 Subject: [PATCH v8 11/38] mm: Define VM_SHADOW_STACK for arm64 when we support GCS Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240203-arm64-gcs-v8-11-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 <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>, Jonathan Corbet <corbet@lwn.net>, Andrew Morton <akpm@linux-foundation.org>, Marc Zyngier <maz@kernel.org>, Oliver Upton <oliver.upton@linux.dev>, James Morse <james.morse@arm.com>, Suzuki K Poulose <suzuki.poulose@arm.com>, Arnd Bergmann <arnd@arndb.de>, Oleg Nesterov <oleg@redhat.com>, Eric Biederman <ebiederm@xmission.com>, Kees Cook <keescook@chromium.org>, Shuah Khan <shuah@kernel.org>, "Rick P. Edgecombe" <rick.p.edgecombe@intel.com>, Deepak Gupta <debug@rivosinc.com>, Ard Biesheuvel <ardb@kernel.org>, Szabolcs Nagy <Szabolcs.Nagy@arm.com> Cc: "H.J. Lu" <hjl.tools@gmail.com>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Florian Weimer <fweimer@redhat.com>, Christian Brauner <brauner@kernel.org>, Thiago Jung Bauermann <thiago.bauermann@linaro.org>, 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 <broonie@kernel.org> X-Mailer: b4 0.13-dev-a684c X-Developer-Signature: v=1; a=openpgp-sha256; l=2038; i=broonie@kernel.org; h=from:subject:message-id; bh=noIMiNXXaRbZmSrB1LMm4LQSI3w8gaJJhGiAy9NbIgk=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBlvjDZ2Io6GgPo7IKBDhinOWnY04tvqYzF/2M4PbR8 tBVQvoaJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZb4w2QAKCRAk1otyXVSH0FoMB/ 489Ce9yGOrMf8qmH57w0iu49g2q5ScfPLlvHIGHqIG2PImWln+Xihqvl1m9KbzdISpWJxeNsTTO2XF aJDD06/nq2t7tQverEzEP7/LK2GVlDIYoue95rUKVV2+43+ztP2j03uGGCbBzlhTZphrchLv+3O2ul +HEP0ncnuw1ybRxXFNlo3BHi/OXXeFTRf3CYFPyr+vcf1TxJd/SCdsXeogobq3zH+dHSWskU+6/doU tTsPKvaiitj/K4V2ScTqfmaf40lD8CCSQszd9G5pPMgQYd9N2FC6aVOoLa9MLanU9pHtBoiWh4Tnew iIOq6LPE9HIfe5k2+L9fZIvT/kWhuG X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789881188361839300 X-GMAIL-MSGID: 1789881188361839300 |
Series |
arm64/gcs: Provide support for GCS in userspace
|
|
Commit Message
Mark Brown
Feb. 3, 2024, 12:25 p.m. UTC
Use VM_HIGH_ARCH_5 for guarded control stack pages.
Signed-off-by: Mark Brown <broonie@kernel.org>
---
Documentation/filesystems/proc.rst | 2 +-
fs/proc/task_mmu.c | 3 +++
include/linux/mm.h | 12 +++++++++++-
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/Documentation/filesystems/proc.rst b/Documentation/filesystems/proc.rst index 104c6d047d9b..0392c3b74650 100644 --- a/Documentation/filesystems/proc.rst +++ b/Documentation/filesystems/proc.rst @@ -570,7 +570,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 == ======================================= Note that there is no guarantee that every flag and associated mnemonic will diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index ff2c601f7d1c..fb0633d8e309 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -702,6 +702,9 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma) #endif /* CONFIG_HAVE_ARCH_USERFAULTFD_MINOR */ #ifdef CONFIG_ARCH_HAS_USER_SHADOW_STACK [ilog2(VM_SHADOW_STACK)] = "ss", +#endif +#ifdef CONFIG_ARM64_GCS + [ilog2(VM_SHADOW_STACK)] = "ss", #endif }; size_t i; diff --git a/include/linux/mm.h b/include/linux/mm.h index 0b1139c5df60..6cc304c90c63 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -352,7 +352,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