From patchwork Tue Jun 13 00:10:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgecombe, Rick P" X-Patchwork-Id: 13277720 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 50E3FC88CBB for ; Tue, 13 Jun 2023 00:12:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B33F58E0002; Mon, 12 Jun 2023 20:12:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AB2D68E0007; Mon, 12 Jun 2023 20:12:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 77FC38E0002; Mon, 12 Jun 2023 20:12:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 590688E0003 for ; Mon, 12 Jun 2023 20:12:16 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 3214B80350 for ; Tue, 13 Jun 2023 00:12:16 +0000 (UTC) X-FDA: 80895797472.01.A31B464 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by imf01.hostedemail.com (Postfix) with ESMTP id 13E8640008 for ; Tue, 13 Jun 2023 00:12:13 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=atX2Nv1m; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf01.hostedemail.com: domain of rick.p.edgecombe@intel.com designates 134.134.136.65 as permitted sender) smtp.mailfrom=rick.p.edgecombe@intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1686615134; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=GGsLCpG/NjQKTNutKZQhh/vSRH0Qv1WXqoRX0znCIbQ=; b=qo9tMvSfiqTNxCbhR13urYT/Go0Ci0DCAhnIGFFVO/SrAtHKMm+6k4vPjg5TxdpADd24fv gCymVeK1FcKOkCUHxHPzhVtJ39Xek5Su6RMV4CVz3sZHNE00Z8HW/TDeIrSkZpYtwmFf6C 5ZE1GTzHP+v2/iAvugeeaY9ptsD3rX4= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=atX2Nv1m; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf01.hostedemail.com: domain of rick.p.edgecombe@intel.com designates 134.134.136.65 as permitted sender) smtp.mailfrom=rick.p.edgecombe@intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686615134; a=rsa-sha256; cv=none; b=5SH8k6970I9oRn4Vb/TAx16uOE2RdNDv0qYltFDTLIlaHC4pRWDqe+qPzRRHOgvXOL+IoN nNpw71OFUeVy3E7y4HhyesW63SPBRHYUn2EPcai0CJqewWVAiVq8EXcdvusneB6DvpduYH iRlSPz0vxWvGBTp7obDOOHOb3tc0Js0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686615134; x=1718151134; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HsIyEUzZjyBgsbaXIFC6qpwhsPOWh1g+KPlkVPDuH8M=; b=atX2Nv1mobs5wD5eAK+12w44TXU+5M51yyF23d0LfN9xBpHXu3y8izMR /ZsmPfds9BPvpuaMc5T8XByMJroE9Pzd3meNdi3tDyvfUqmqq5F9tqrGr CIjZmeOEPICzmo5TwjFm+UvIbFlmcYTnY819CsI6OZwesvw6DRQNuyXR9 XMTFm46NMZtPUq0vSI+PFdVXhjJWd+V2ih7wjccZkKxXOIysc0pk/4VN4 HEZsg89wW3DY0UVZ4e/4p2T/lc8LbgE0FckiyLutW5P/ulUH8Kl6tLt1t 1/VfZCQl7tVJCXgSjIQdXbBdlNiJ1tcrCE0pBlEy3VEp7wVCJ8OsiZ9AH g==; X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="361556763" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="361556763" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 17:12:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="835670984" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="835670984" Received: from almeisch-mobl1.amr.corp.intel.com (HELO rpedgeco-desk4.amr.corp.intel.com) ([10.209.42.242]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 17:12:09 -0700 From: Rick Edgecombe To: x86@kernel.org, "H . Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H . J . Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , Weijiang Yang , "Kirill A . Shutemov" , John Allen , kcc@google.com, eranian@google.com, rppt@kernel.org, jamorris@linux.microsoft.com, dethoma@microsoft.com, akpm@linux-foundation.org, Andrew.Cooper3@citrix.com, christina.schimpe@intel.com, david@redhat.com, debug@rivosinc.com, szabolcs.nagy@arm.com, torvalds@linux-foundation.org, broonie@kernel.org Cc: rick.p.edgecombe@intel.com, Yu-cheng Yu , Axel Rasmussen , Peter Xu , Pengfei Xu Subject: [PATCH v9 05/42] mm: Move VM_UFFD_MINOR_BIT from 37 to 38 Date: Mon, 12 Jun 2023 17:10:31 -0700 Message-Id: <20230613001108.3040476-6-rick.p.edgecombe@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230613001108.3040476-1-rick.p.edgecombe@intel.com> References: <20230613001108.3040476-1-rick.p.edgecombe@intel.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 13E8640008 X-Stat-Signature: g7usgsa78xgyp4jf7j5gtq9y976ogi7q X-Rspam-User: X-HE-Tag: 1686615133-397918 X-HE-Meta: U2FsdGVkX18BYLRzdyhjtt27DfyGjR0XGVRPVI4JQT4lZhRsJTvh7yNhhodVrKRzlHsKZg9AdyOxBkdGjFW1al+cFvHNFkCQCdUCVQuB31SDqM0x/bTjQmeF65bn2YX1l50ijA9JnJbPskl8TXKESkRCLz9miEPKdnUsWYMx2OCy4zZ6EZYd2ZmSuqmNAUbYXpsNmrYZqJfB8bcG4XiRE52br3am3G29xf/AwVjzhM2Nz4+zPUywRnzoVvcWrRkifqwWyp9aYbemm68o2/HxRCxzfdE6pYDy2iYqybj4MeVnmGyDSM79aOtlKh6mSPXgIzjzpmvhD7A0UOGVy48Uvs2wW0rW8FNW6h0CE7BUoJnp+/dTE8M3PhVU1KqFuKEDWOkdtMPPtkHbnIXKXqckxa4bSZdhY+zkD6kriyTNEjyCrzlUdMfit9b4+C/o7hDd8TvrMRy68JJmpf+iwmoc9EgaWekiLubMw25/65d+5f5UjO6wdAkX6q+LgItKMW2Qz/x+AgSHgJfXXX0FLRMFDO2mX4M+k/yNTQ5QG9ns4OFuhT5oPGlIQCUCSv3HJtl9XU+PXUycQx3F8WefnHioL8ySTjKbeE/vGS/xYHloZ5a8Q4es1pQqWJUk7bKWFLzjXXssfgOQ39mYTT7mPYHk2N3sZZ5eLBYR5G/wimMY1i0ce4ejsHreQzRMupOrL8P+tShZwjvhO7Oz9VXLHhI05vZIrhVB9hjKxTqviWVy521AX5zXxv6IyvpzZIC5nQuxG1A6lT2DPy5UUyW1l/yqEBcRsmjADORmccHCEFNR6bxlhQcVNOuL0Cts+GWE2H1s1C5Gt/eU3J+HgGvHFiBaOYES28tTcvwDqoPfC5Sglo70SFLQb9vlwY5DenIUcjBwmkCYf+M5vRl4GTzGtErF7xoWuqlzQNxyiKS+DmJbqhfsteSj7UWGHN/EKHRorYD4pDY04KP2sC5LBqgLI9c YyvU9XNs c56xsaj0vpk9ZJsCtIJdS3JYizJp/RqbOoqhQSlnRRxsfqkPAIkXmbXX+BiCWt+kDMCKGZ/T10xVUOiAnR2isE4QNw+KO3dkK2tafA4vuYTtcBcooZaLRPiA12v2SaHypp1bMFnm+IManUGrxpeZFJgiWgN1HsusmL51FXyEq3HbX+vcbg5zaqNPTm8Pu+mFdUdGih9lVZ6FRoZ7q3806byYRWafHP2gdnIsusZai+zeDTLoyNyQnL8Gpiv6E/gjdr8HHeu+UF+VxiyEy20nq7/EJWQ/iPgIk84M3kpXJ9iZnwEQpzvLtJ0Q8PdywvhBCNLo0mxlLnRXJEL56B4zfafBQ96BvxQS10U7C0NZU0c9vVoxnqD8AfKkpQRlyMgdQsxmspSYE2oyNYfFO7trFkR89T7rw/+O/kysRB8UjehYLxrMOKZ2nRg6+qTYUUPS8d/plBHltaASINgOEAyPMg6csBw== 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: From: Yu-cheng Yu The x86 Control-flow Enforcement Technology (CET) feature includes a new type of memory called shadow stack. This shadow stack memory has some unusual properties, which requires some core mm changes to function properly. Future patches will introduce a new VM flag VM_SHADOW_STACK that will be VM_HIGH_ARCH_BIT_5. VM_HIGH_ARCH_BIT_1 through VM_HIGH_ARCH_BIT_4 are bits 32-36, and bit 37 is the unrelated VM_UFFD_MINOR_BIT. For the sake of order, make all VM_HIGH_ARCH_BITs stay together by moving VM_UFFD_MINOR_BIT from 37 to 38. This will allow VM_SHADOW_STACK to be introduced as 37. Signed-off-by: Yu-cheng Yu Co-developed-by: Rick Edgecombe Signed-off-by: Rick Edgecombe Reviewed-by: Borislav Petkov (AMD) Reviewed-by: Kees Cook Reviewed-by: Axel Rasmussen Acked-by: Mike Rapoport (IBM) Acked-by: Peter Xu Tested-by: Pengfei Xu Tested-by: John Allen Tested-by: Kees Cook Reviewed-by: David Hildenbrand --- include/linux/mm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 9ec20cbb20c1..6f52c1e7c640 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -370,7 +370,7 @@ extern unsigned int kobjsize(const void *objp); #endif #ifdef CONFIG_HAVE_ARCH_USERFAULTFD_MINOR -# define VM_UFFD_MINOR_BIT 37 +# define VM_UFFD_MINOR_BIT 38 # define VM_UFFD_MINOR BIT(VM_UFFD_MINOR_BIT) /* UFFD minor faults */ #else /* !CONFIG_HAVE_ARCH_USERFAULTFD_MINOR */ # define VM_UFFD_MINOR VM_NONE