mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-07 18:10:03 +01:00
mm/pagemap: export uffd-wp protection information
Export the PTE/PMD status of uffd-wp to pagemap too. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Peter Xu <[email protected]> Cc: Alexander Viro <[email protected]> Cc: Andrea Arcangeli <[email protected]> Cc: Axel Rasmussen <[email protected]> Cc: Brian Geffon <[email protected]> Cc: "Dr . David Alan Gilbert" <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Jerome Glisse <[email protected]> Cc: Joe Perches <[email protected]> Cc: Kirill A. Shutemov <[email protected]> Cc: Lokesh Gidra <[email protected]> Cc: Mike Kravetz <[email protected]> Cc: Mike Rapoport <[email protected]> Cc: Mina Almasry <[email protected]> Cc: Oliver Upton <[email protected]> Cc: Shaohua Li <[email protected]> Cc: Shuah Khan <[email protected]> Cc: Stephen Rothwell <[email protected]> Cc: Wang Qing <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
1 parent
00b151f21f
commit
fb8e37f35a
2 files changed
+11
No files matched your search
@@ -21,6 +21,8 @@ There are four components to pagemap:
|
||||
* Bit 55 pte is soft-dirty (see
|
||||
:ref:`Documentation/admin-guide/mm/soft-dirty.rst <soft_dirty>`)
|
||||
* Bit 56 page exclusively mapped (since 4.2)
|
||||
* Bit 57 pte is uffd-wp write-protected (since 5.13) (see
|
||||
:ref:`Documentation/admin-guide/mm/userfaultfd.rst <userfaultfd>`)
|
||||
* Bits 57-60 zero
|
||||
* Bit 61 page is file-page or shared-anon (since 3.5)
|
||||
* Bit 62 page swapped
|
||||
|
||||
@@ -1302,6 +1302,7 @@ struct pagemapread {
|
||||
#define PM_PFRAME_MASK GENMASK_ULL(PM_PFRAME_BITS - 1, 0)
|
||||
#define PM_SOFT_DIRTY BIT_ULL(55)
|
||||
#define PM_MMAP_EXCLUSIVE BIT_ULL(56)
|
||||
#define PM_UFFD_WP BIT_ULL(57)
|
||||
#define PM_FILE BIT_ULL(61)
|
||||
#define PM_SWAP BIT_ULL(62)
|
||||
#define PM_PRESENT BIT_ULL(63)
|
||||
@@ -1375,10 +1376,14 @@ static pagemap_entry_t pte_to_pagemap_entry(struct pagemapread *pm,
|
||||
page = vm_normal_page(vma, addr, pte);
|
||||
if (pte_soft_dirty(pte))
|
||||
flags |= PM_SOFT_DIRTY;
|
||||
if (pte_uffd_wp(pte))
|
||||
flags |= PM_UFFD_WP;
|
||||
} else if (is_swap_pte(pte)) {
|
||||
swp_entry_t entry;
|
||||
if (pte_swp_soft_dirty(pte))
|
||||
flags |= PM_SOFT_DIRTY;
|
||||
if (pte_swp_uffd_wp(pte))
|
||||
flags |= PM_UFFD_WP;
|
||||
entry = pte_to_swp_entry(pte);
|
||||
if (pm->show_pfn)
|
||||
frame = swp_type(entry) |
|
||||
@@ -1426,6 +1431,8 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end,
|
||||
flags |= PM_PRESENT;
|
||||
if (pmd_soft_dirty(pmd))
|
||||
flags |= PM_SOFT_DIRTY;
|
||||
if (pmd_uffd_wp(pmd))
|
||||
flags |= PM_UFFD_WP;
|
||||
if (pm->show_pfn)
|
||||
frame = pmd_pfn(pmd) +
|
||||
((addr & ~PMD_MASK) >> PAGE_SHIFT);
|
||||
@@ -1444,6 +1451,8 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end,
|
||||
flags |= PM_SWAP;
|
||||
if (pmd_swp_soft_dirty(pmd))
|
||||
flags |= PM_SOFT_DIRTY;
|
||||
if (pmd_swp_uffd_wp(pmd))
|
||||
flags |= PM_UFFD_WP;
|
||||
VM_BUG_ON(!is_pmd_migration_entry(pmd));
|
||||
page = migration_entry_to_page(entry);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user