From patchwork Sat Feb 18 21:14:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rick Edgecombe X-Patchwork-Id: 13145655 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 8C65AC64ED9 for ; Sat, 18 Feb 2023 21:16:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 88D10280010; Sat, 18 Feb 2023 16:16:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7DEA328000F; Sat, 18 Feb 2023 16:16:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 67D7D28000E; Sat, 18 Feb 2023 16:16:17 -0500 (EST) 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 555DA28000D for ; Sat, 18 Feb 2023 16:16:17 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 18882140338 for ; Sat, 18 Feb 2023 21:16:17 +0000 (UTC) X-FDA: 80481670794.06.3A408EF Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by imf12.hostedemail.com (Postfix) with ESMTP id 2B8BB40009 for ; Sat, 18 Feb 2023 21:16:13 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=Bc50K8GD; spf=pass (imf12.hostedemail.com: domain of rick.p.edgecombe@intel.com designates 192.55.52.43 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=1676754975; 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=1K7hWixcu0DRP0TOxVYSNvsFGJbVf7pw+XfQxdSR7lc=; b=5aTb4PPGUGXc8gANuds7EIjeWNQn0oNibNyZhSjAVYkKsFjUlDNCeB6o5BHrpY+FX/0oql oY/lXahj3FZ9QAnlgCR/M5x2i4yQZ8//xh1+bFB0w/MMqwtTlEKeTD/AqQbGndWKKZyOVs UyZz98IQXIzl2WFIAVIb0/B/X6OFEcE= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=Bc50K8GD; spf=pass (imf12.hostedemail.com: domain of rick.p.edgecombe@intel.com designates 192.55.52.43 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=1676754975; a=rsa-sha256; cv=none; b=2AxzjJ/wyPirl0vcUR7aH3Qrm8DDeLA/jZL2DlYwIfFiMZcaZJpbN5BRZScj9Y5ikmBzYH dtM63YOVb4hGoyLfwz+TQ05/EMu9YC2rpIxW7jQJFc0f9FMPGDdktafqd6KcrOcn7GhqI2 znzVi9ERbwwLN4aUdvl6Rc6R2XV7P6g= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676754975; x=1708290975; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=o/D1WjgTvHa+RZFY0t2cOsdLZJ4ujw/CAZDldCJEJW8=; b=Bc50K8GDOo5yzkytzLEAWoLidTInIOtKzb4ComyvRtviZKJhPm+ejKQF rK3rwFNtndn3g/+nqr6vmmL/8LLgv/W72o+x5H+INqR9MYfAjEMMIs/d8 3/upAP05Iriqn89qgIbTfufQ1NW7EtZB8A/OlId1YEMC2bmzNY+fHtjB9 XZ/FaUGx8mIRR6Um/0lCJRjeVHm+RjRuPdBRhZJqCFoapeLxTs9qYnw82 7nu0mtEElC3EyjpL/yGQQsaCIB3aRrUi2EX2BjJ1NvpBgJPNgcU1rdca7 TxhfPxuJ/Nt8SCx7Ao8bVUkmLSXO6sfpInKuWFy0R3BE1sGl2qNnMC2Pu A==; X-IronPort-AV: E=McAfee;i="6500,9779,10625"; a="418427464" X-IronPort-AV: E=Sophos;i="5.97,309,1669104000"; d="scan'208";a="418427464" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Feb 2023 13:16:11 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10625"; a="664241653" X-IronPort-AV: E=Sophos;i="5.97,309,1669104000"; d="scan'208";a="664241653" Received: from adityava-mobl1.amr.corp.intel.com (HELO rpedgeco-desk.amr.corp.intel.com) ([10.209.80.223]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Feb 2023 13:16:10 -0800 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 Cc: rick.p.edgecombe@intel.com, Yu-cheng Yu , Peter Xu Subject: [PATCH v6 17/41] mm: Move VM_UFFD_MINOR_BIT from 37 to 38 Date: Sat, 18 Feb 2023 13:14:09 -0800 Message-Id: <20230218211433.26859-18-rick.p.edgecombe@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230218211433.26859-1-rick.p.edgecombe@intel.com> References: <20230218211433.26859-1-rick.p.edgecombe@intel.com> X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: wi4koqc6n14pdota8oieffg6uoyfs7eg X-Rspamd-Queue-Id: 2B8BB40009 X-HE-Tag: 1676754973-577970 X-HE-Meta: U2FsdGVkX18qkC9Gm7Y3v8qAT47Eq4cAzkeY9INyl4EDvs5aTPV1Kb1hgHhhyHkDALc7QHSr1/DUSqvgPLz+GTP36E3CjKOF3tfKsK/YFPTi7DIUfAtGwB17ycANwkyd1R5CPsuFH+RhUuo83fu4kTy0L1oqlnwQAGBl1XezlAHYkpFbCuav+TpVCuqS8QqstuePI4goq4cFUI7urUQkYGmBwQIDF/lF9uok5/aX7OtmGZHtfsL8fQPN8d63Woj2OE2IRSdKE8joKyMQnCvP/Sj3toNtF2tue5442+0PjXp6MFxSkcvqa+BXxd+yqfoyReon4WcUM/OV0z1Wo2iLN+Ozn/jcVLXkvV/ylIVT4LGQQZ93X/9vN3p5pPHMT4McYRyTyGOUG4ToQd0/5JvTUrS3jqTdjgedHB1+wUOsm8JrxxeS109cqugEO4zihiLu23PdUHc0h8zlS0RrYhoHm8cTSuBqIdfLbBT+W75B6qe9ie5QhMu/+TaauwEZytBZxGUNCWQsEhx2QqhA1WbZKiwrKoPAlLC2cPrL37KJ/9TzKoQRaBEFxWFJZfiVSJuusAsRfDn1EOvYIhoKR0++CAc4xFrmO+gTa0m8u823B2iwSYSQamAZ8jOwgHUZBh53F7A+sZOqCOVlMpwFf0tux0XkqY/WcIhkTsygyL/+PNh6vCo2LmIp5tzC+AEMGisldjLxj5LzVEISs0SD8/0nVaWPN4I8xTUW/bQpc2sRzbtleWjvEH9vTKsMZ/g6Az7VF9vxPgOD88iACWPYyT/bB1vx5dOAtRSvBBMLHpZ4AaIWnceHRmaxWJRgUAD6+LH76b5THT0SiKinP9uhDg3eBYTCCp8wS28E6xmQ24ST5xgGtpCt/8eUJG8Gokc5OQK83Jdcd9yeSt+smhBZPKNA54L9IWlKwLTUpX69ph+NpPk0H3DhkVIeCabAmB9ikugO6mgPdCFJ+wFXmodGIy8 yn4jZSC9 Bj/ieDo5ZApOtuRNvgHe/LgAuRvrY3xr8XbqrnmbbM7zUPHvLgAHrrOZhf12Ebd4GtJWdLQhtkWgfikH4Fuc1gOtu+ru3nHDnquJZasaQgJACpUQ2zQrcefiSxWunu4qvFSDRE+4IWE0+JxFBUpydyWhctWrXCyrbHPK3hKDv2WxQ5+lXWUa8zOwTu4qSJz0sN47zgcoLkoDAMDfRuRgWZzExV+lwlWNyxFNry0npcCb3PMhClJeFNzuVKzKMT4MBdV5x9nbwGI/pZJ2atJnPQ9jKymzO0eurhXOu4VZUnmqf7njcOBODL3Fb7EdULw1C3R4uUL+FyUnPbF+C0mmeCFebMvT4Co6etwCajIRtduFcuPguIgEbfQ/5qlq9jwk4SG8hg9vX5arK4iw2pR4oVrhVcQ== 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. Tested-by: Pengfei Xu Tested-by: John Allen Reviewed-by: Kees Cook Acked-by: Peter Xu Signed-off-by: Yu-cheng Yu Reviewed-by: Axel Rasmussen Signed-off-by: Rick Edgecombe Cc: Peter Xu Cc: Mike Kravetz --- 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 4650e2580d60..e6f1789c8e69 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -366,7 +366,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