Message ID | 20221104223604.29615-10-rick.p.edgecombe@intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp678483wru; Fri, 4 Nov 2022 15:41:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5P3h3tbQU8rUituufienDC2MUR/XN0KotMFIrrmDQzd95mAu2lH3baIhELTB6XQqSDGBfB X-Received: by 2002:a63:5c21:0:b0:46f:cbcb:7617 with SMTP id q33-20020a635c21000000b0046fcbcb7617mr23422545pgb.199.1667601673173; Fri, 04 Nov 2022 15:41:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667601673; cv=none; d=google.com; s=arc-20160816; b=q7IdwQ30rHnwfd1fLKWRurf2UdHVgRMOwnzDEV0pTLOUdhH24DMqOpKDKWv7oxgqRs VGxvel7Zzy2TqTs8iK3D6FDRRLZ1MNMN5/w/WpXh7qbDNVfT9eS5CcXfgsaeIyOe9wsb rNOxsoo8vvog6ASenrrD93kf5if+5ntuKWZBiZw1sRIYURsFapEP+ZUaWmneZvtfHhty xxS6GRFWupMpXb5Kt0fxt3/yJP/ENidh+YiccMA/ADYlCxbofSsq1Nrx+M345EuuB646 yXxHcoLNcktm4xeJDHrOZBn/fsIQb/q53vXyW7g0R6MgEIBGMbSP1RST9s1V7qV4Yaii 6S5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=u+P+qa8kKTWg8AnGQCR7FIL5mFISVmI7FR/YQkztV68=; b=zpw1OHGcZQhS/HJIBs/aq0LhGbIqlc1dNM/NIGvLLGgeidSK4ELebAR6hnlJZScxuK jLbuIzCtNrRGTJ/BDSdei7lKvVZQd6D86+75L3QXyFUJ4nW5CEDLwRfOLJiQwuaGsBSp RxNS9r60S4T0g37WolT8rCgC6O0r1rWjl5aNHnLkfPWfYeUZ+xTTtH1WBzqsUr7K9JF/ YRxf19YAaOLb0uA7kOyNIviD1PyFVfd52RW5p0ijlKXTtpyXdxjzRMFEqMN/cBfCjQhz XxutSDXmJk8LdEPMIcPLN+36JeJEp4HLZS9WRixdHXry04SnnJ/AYy9K9qboEm9oUFNm lUsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UtajLHmc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g15-20020a63f40f000000b0046f41385afdsi929478pgi.118.2022.11.04.15.40.58; Fri, 04 Nov 2022 15:41:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UtajLHmc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229703AbiKDWkV (ORCPT <rfc822;hjfbswb@gmail.com> + 99 others); Fri, 4 Nov 2022 18:40:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229492AbiKDWj6 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 4 Nov 2022 18:39:58 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1646E41985; Fri, 4 Nov 2022 15:39:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667601571; x=1699137571; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=poplwKY6u8XD6c+b4FqOVfxOhvQPYQQiQgDKo7YigJ8=; b=UtajLHmcYYmrIISyZVlFrFI6GpzOeK5R4Y5PuWZKMT74+P1uxt7QoewO qc7KZl4z0XWZhySG58qrnB66JLMUPOORFOaQhPZpyWAqP0q9QgOf6Uf56 NiXW8wSQK5Yynwdq73qBN97aIeYxAQZYgfliRmvy+vJuW20Zr6IpS33fV Whm7tpD6n3n2gDuxU5clwwFlMQrYsuZu/fwBfS8SpYqLk8/1Gwf0Fb1Oj ex+ExoDj7ZYAdRCb+wrA1kI6U469ZIa9e+3+0YF7sGwtZAKTbRYcDcKqz 7WUG9e45XIf+1qQTIilkWkgZLjGFVhMC135CbGfb6fW3ilL0Ilfxf2ZjH A==; X-IronPort-AV: E=McAfee;i="6500,9779,10521"; a="311840510" X-IronPort-AV: E=Sophos;i="5.96,138,1665471600"; d="scan'208";a="311840510" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2022 15:39:30 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10521"; a="668514015" X-IronPort-AV: E=Sophos;i="5.96,138,1665471600"; d="scan'208";a="668514015" Received: from adhjerms-mobl1.amr.corp.intel.com (HELO rpedgeco-desk.amr.corp.intel.com) ([10.212.227.68]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2022 15:39:29 -0700 From: Rick Edgecombe <rick.p.edgecombe@intel.com> To: x86@kernel.org, "H . Peter Anvin" <hpa@zytor.com>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, 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 <arnd@arndb.de>, Andy Lutomirski <luto@kernel.org>, Balbir Singh <bsingharora@gmail.com>, Borislav Petkov <bp@alien8.de>, Cyrill Gorcunov <gorcunov@gmail.com>, Dave Hansen <dave.hansen@linux.intel.com>, Eugene Syromiatnikov <esyr@redhat.com>, Florian Weimer <fweimer@redhat.com>, "H . J . Lu" <hjl.tools@gmail.com>, Jann Horn <jannh@google.com>, Jonathan Corbet <corbet@lwn.net>, Kees Cook <keescook@chromium.org>, Mike Kravetz <mike.kravetz@oracle.com>, Nadav Amit <nadav.amit@gmail.com>, Oleg Nesterov <oleg@redhat.com>, Pavel Machek <pavel@ucw.cz>, Peter Zijlstra <peterz@infradead.org>, Randy Dunlap <rdunlap@infradead.org>, "Ravi V . Shankar" <ravi.v.shankar@intel.com>, Weijiang Yang <weijiang.yang@intel.com>, "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>, John Allen <john.allen@amd.com>, kcc@google.com, eranian@google.com, rppt@kernel.org, jamorris@linux.microsoft.com, dethoma@microsoft.com, akpm@linux-foundation.org Cc: rick.p.edgecombe@intel.com, Yu-cheng Yu <yu-cheng.yu@intel.com> Subject: [PATCH v3 09/37] x86/mm: Move pmd_write(), pud_write() up in the file Date: Fri, 4 Nov 2022 15:35:36 -0700 Message-Id: <20221104223604.29615-10-rick.p.edgecombe@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221104223604.29615-1-rick.p.edgecombe@intel.com> References: <20221104223604.29615-1-rick.p.edgecombe@intel.com> X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748607091774642535?= X-GMAIL-MSGID: =?utf-8?q?1748607091774642535?= |
Series |
Shadow stacks for userspace
|
|
Commit Message
Edgecombe, Rick P
Nov. 4, 2022, 10:35 p.m. UTC
From: Yu-cheng Yu <yu-cheng.yu@intel.com> To prepare the introduction of _PAGE_COW, move pmd_write() and pud_write() up in the file, so that they can be used by other helpers below. No functional changes. Tested-by: Pengfei Xu <pengfei.xu@intel.com> Tested-by: John Allen <john.allen@amd.com> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Yu-cheng Yu <yu-cheng.yu@intel.com> Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com> --- arch/x86/include/asm/pgtable.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 5059799bebe3..a1d6f121ee35 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -159,6 +159,18 @@ static inline int pte_write(pte_t pte) return pte_flags(pte) & _PAGE_RW; } +#define pmd_write pmd_write +static inline int pmd_write(pmd_t pmd) +{ + return pmd_flags(pmd) & _PAGE_RW; +} + +#define pud_write pud_write +static inline int pud_write(pud_t pud) +{ + return pud_flags(pud) & _PAGE_RW; +} + static inline int pte_huge(pte_t pte) { return pte_flags(pte) & _PAGE_PSE; @@ -1103,12 +1115,6 @@ extern int pmdp_clear_flush_young(struct vm_area_struct *vma, unsigned long address, pmd_t *pmdp); -#define pmd_write pmd_write -static inline int pmd_write(pmd_t pmd) -{ - return pmd_flags(pmd) & _PAGE_RW; -} - #define __HAVE_ARCH_PMDP_HUGE_GET_AND_CLEAR static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp) @@ -1138,12 +1144,6 @@ static inline void pmdp_set_wrprotect(struct mm_struct *mm, clear_bit(_PAGE_BIT_RW, (unsigned long *)pmdp); } -#define pud_write pud_write -static inline int pud_write(pud_t pud) -{ - return pud_flags(pud) & _PAGE_RW; -} - #ifndef pmdp_establish #define pmdp_establish pmdp_establish static inline pmd_t pmdp_establish(struct vm_area_struct *vma,