From patchwork Sun Mar 19 00:15:12 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: 13180145 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 44F9FC76196 for ; Sun, 19 Mar 2023 00:16:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A103628000F; Sat, 18 Mar 2023 20:16:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 92381280001; Sat, 18 Mar 2023 20:16:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7755728000F; Sat, 18 Mar 2023 20:16:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 5FCA7280001 for ; Sat, 18 Mar 2023 20:16:26 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 3AF62140B78 for ; Sun, 19 Mar 2023 00:16:26 +0000 (UTC) X-FDA: 80583731172.16.548D897 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by imf21.hostedemail.com (Postfix) with ESMTP id 2FBA21C0012 for ; Sun, 19 Mar 2023 00:16:24 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=cq+JFaCR; spf=pass (imf21.hostedemail.com: domain of rick.p.edgecombe@intel.com designates 192.55.52.115 as permitted sender) smtp.mailfrom=rick.p.edgecombe@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1679184984; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references:dkim-signature; bh=Pwhy/M47BV1NmQ8E1swDHEJVYRiFTE7CnNQ7FqeGg+g=; b=aRjyy6gBG38uuq6oboNStWkprVOOpzd1EtFJzA5PtLVDFekeNmAvjzdRaPOf+JZ98kV82N Kh1o63pLgsyYBeJNLlvb5ubFki0WTezmRc34SdPNZfM7IYmxub+8XYnp2Hq8n4Mh2xWhsR RucGCxG0+c1KJz69vwLGPJNiiIyMNfA= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=cq+JFaCR; spf=pass (imf21.hostedemail.com: domain of rick.p.edgecombe@intel.com designates 192.55.52.115 as permitted sender) smtp.mailfrom=rick.p.edgecombe@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1679184984; a=rsa-sha256; cv=none; b=ehgiguW65c5qDu5Pn4fdW4Qz2ZTKQfvRHgtv15ZPaGFI43e0anUXAelY60/YhZ/D97jWL1 mCfTym8zGfo0sxYACbY4v7NA5x7K5xiM+CujQ57XDp/LTPBJQGCcRIDitXrnIJ6bdxO9KU ofdy/4lUtyc6JAC1frbY59116rqDQ0k= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679184984; x=1710720984; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=Za8k1YHP/NKzL9PLFScEe9Ide1J8X/tcTz7SUA3IT3Y=; b=cq+JFaCRDbkB63G78+4EFbff8iH9Px2yc0mpjgkM3LRTzCNCNPrWORmG xPqwD/m2R1j31oesgz7yNQmFRzR3A+431ca+9s9NsBM18rbf8EjrKjnur v8Z4/j8yfngiaKLt1tvmgBf7tfYQx5FIRToToVFpGYTwH/3+gLxxvGn7q yXRIU/laLV7eEV2zNuQmyGJjV/5DKXt5s4yslxrRcS19Njgd7OAemmHV5 5uELI7EreKawLhEbReLvQZx56kZhC0XZXFbytH52jx2wfrIsBMagQHfth FhhVnNPCTIARHLy+FnBzzAvem5qe+fjMZqWw4RK46SbnSbfhrHn+gazwz w==; X-IronPort-AV: E=McAfee;i="6600,9927,10653"; a="338491107" X-IronPort-AV: E=Sophos;i="5.98,272,1673942400"; d="scan'208";a="338491107" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2023 17:16:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10653"; a="749672849" X-IronPort-AV: E=Sophos;i="5.98,272,1673942400"; d="scan'208";a="749672849" Received: from bmahatwo-mobl1.gar.corp.intel.com (HELO rpedgeco-desk.amr.corp.intel.com) ([10.135.34.5]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2023 17:16:21 -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 Cc: rick.p.edgecombe@intel.com, Yu-cheng Yu Subject: [PATCH v8 17/40] mm: Move VM_UFFD_MINOR_BIT from 37 to 38 Date: Sat, 18 Mar 2023 17:15:12 -0700 Message-Id: <20230319001535.23210-18-rick.p.edgecombe@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230319001535.23210-1-rick.p.edgecombe@intel.com> References: <20230319001535.23210-1-rick.p.edgecombe@intel.com> X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 2FBA21C0012 X-Rspam-User: X-Stat-Signature: qdgxs4gqbn6neccis167coarojmhgmeo X-HE-Tag: 1679184984-383442 X-HE-Meta: U2FsdGVkX18t7CpQ3KnR+g0rr2WcvFGjKaFG+Xzb9xlHkOuygym76wBx4NY1NIxvwZYQN0t82FSd5t/RTzLE8WFHRS9fs1SaG7L5tpCunekzWciRh6RIzFKwJ0UmPwbYo238DacrAoHY4cB4lewK3a88KyUJCSSYB/NBG2vESlkPX5isHVI21X9MzeYVtvyNLfgNyf55UvS/P2NbTpKTZDJCoFF0myvbNA4SLIQBlRcfXNsN3y00p82UMq2ksltQ4OSAS+jEKUwgo4WkA/OsbjuIpYUmme7faYJhuEgfIZotCjVl0IrQ2O40R3P2tXymjD693jGrIIR4AIA3hfuj575Oh/9tzuGYVvqxtsgswfdGBEMVU3/fH6PoDTuReifai4yIx3HIKNCmbcxXrWtIA2jzsehYd+Qzz0u3t/IFm2qw/7hyfUfDw7rlQPlCDd7dqyVJurtgJKmvyHp2W4rXtm60pCNttGDcfARnN6cEK+bFPnYfwc/FdJaos5h99pC+Yx+AqAnl8YaA64mNXRGR+Ve3UcD9pAgmkDl0mp3oD59XdkRKqDbxYPu0YyJJ2IviGl2w8vwFPcDqfWv1JEos0hlE0YynXryRPMwpLUpgURNdijl8GLyBGvTz5vF8Z8qawta+JYyuzxXpCZoJyfO6VIVhtKv5/gK6+UmAO760E1oavmuIvZs5tHcBJ8Sw8u/5Knz9s3gH7fKlVIkLF5cEHFM0uPG6QNtQq+nosxUiIxiZ/a5YeN7FEJLwjAE8I3P07DxfWoBNeDlKSaGxxMMrmnZWJH/4yS8/Qanl3++CvMCg6hHik3r5dG5fl3ep2wYMI49qv5PxHd2Gf/mIIpIgldVVz0DWm0a14XnZtGMCwj+VnwMv7Fn1eYIPqoN8FMxumKxtJw3i5dgOEq/Ga7oREYKvnJeKYRHd4JgFUbaRxRRnFiRT/3aQ3kK+TOgEsPCDvkGrXGKxe1l9bjN4/lB +qwFFtM+ 416X+JNAlxncbY7DiOc7VAISugZ1f1gymynZHy20GvxfCOf/MROtsvV9SPiFJFAdZormuuN59kTGRaeB5H9gW5SwVBteVG7X8xH7NTy1/z5hX0OTnjy8qXJG42EozBxSsH9CkUKBFjfz9ZsB2bWTGMmg6748zC2ygNbFPbL2xpE74/00NG+YTDETh7GJ7E0F9URB5iK0owuLhHXWW02nWPTYk0m3ldcdgoyqRuJuemQZ9Uu+8BO3uN3XbSIzKpNJz9M7ICIrh2P4p1+eSHDOSqbVbwvipXhU9iqqFbN/UEr/VLK+aYopmvHzqBOAfQQtOsKUuBgtwnVW55reZEU73XrXeExQRYXxPorV6nAPCpSU+H8UypS83G7pMMBgFSORimRMOUnR1zXWpwVrD+JOVw6Orf0UnDwOdtrorBhYhJCqgVA0Pmn34GGhtQgmUZHAaJMic 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. Co-developed-by: Rick Edgecombe Signed-off-by: Yu-cheng Yu Signed-off-by: Rick Edgecombe 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 af652444fbba..a1b31caae013 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -377,7 +377,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