Skip to contentSkip to conversation

x86-remove-custom-definition-of-mk_pte.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message May 12, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: x86: remove custom definition of mk_pte()
has been removed from the -mm tree. Its filename was
x86-remove-custom-definition-of-mk_pte.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: x86: remove custom definition of mk_pte()
Date: Wed, 2 Apr 2025 19:16:58 +0100

Move the shadow stack check to pfn_pte() which lets us use the common definition of mk_pte().

Cc Zi Yan <[email protected]>
Cc Alexander Gordeev <[email protected]>
Cc Andreas Larsson <[email protected]>
Cc Anton Ivanov <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Johannes Berg <[email protected]>
Cc Muchun Song <[email protected]>
Cc Richard Weinberger <[email protected]>

---

 arch/x86/include/asm/pgtable.h |   19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)
arch/x86/include/asm/pgtable.h renamed from arch/x86/include/asm/pgtable.h~x86-remove-custom-definition-of-mk_pte +3 -16
@@ -784,6 +784,9 @@ static inline pgprotval_t check_pgprot(p
 static inline pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot)
 {
 	phys_addr_t pfn = (phys_addr_t)page_nr << PAGE_SHIFT;
+	/* This bit combination is used to mark shadow stacks */
+	WARN_ON_ONCE((pgprot_val(pgprot) & (_PAGE_DIRTY | _PAGE_RW)) ==
+			_PAGE_DIRTY);
 	pfn ^= protnone_mask(pgprot_val(pgprot));
 	pfn &= PTE_PFN_MASK;
 	return __pte(pfn | check_pgprot(pgprot));
@@ -1080,22 +1083,6 @@ static inline unsigned long pmd_page_vad
  */
 #define pmd_page(pmd)	pfn_to_page(pmd_pfn(pmd))
 
-/*
- * Conversion functions: convert a page and protection to a page entry,
- * and a page entry and page directory to the page they refer to.
- *
- * (Currently stuck as a macro because of indirect forward reference
- * to linux/mm.h:page_to_nid())
- */
-#define mk_pte(page, pgprot)						  \
-({									  \
-	pgprot_t __pgprot = pgprot;					  \
-									  \
-	WARN_ON_ONCE((pgprot_val(__pgprot) & (_PAGE_DIRTY | _PAGE_RW)) == \
-		    _PAGE_DIRTY);					  \
-	pfn_pte(page_to_pfn(page), __pgprot);				  \
-})
-
 static inline int pmd_bad(pmd_t pmd)
 {
 	return (pmd_flags(pmd) & ~(_PAGE_USER | _PAGE_ACCESSED)) !=

_

Patches currently in -mm which might be from [email protected] are