forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
userfaultfd: wp: add WP pagetable tracking to x86
Accurate userfaultfd WP tracking is possible by tracking exactly which virtual memory ranges were writeprotected by userland. We can't relay only on the RW bit of the mapped pagetable because that information is destroyed by fork() or KSM or swap. If we were to relay on that, we'd need to stay on the safe side and generate false positive wp faults for every swapped out page. [[email protected]: append _PAGE_UFD_WP to _PAGE_CHG_MASK] Signed-off-by: Andrea Arcangeli <[email protected]> Signed-off-by: Peter Xu <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Reviewed-by: Jerome Glisse <[email protected]> Reviewed-by: Mike Rapoport <[email protected]> Cc: Bobby Powers <[email protected]> Cc: Brian Geffon <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Denis Plotnikov <[email protected]> Cc: "Dr . David Alan Gilbert" <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: "Kirill A . Shutemov" <[email protected]> Cc: Martin Cracauer <[email protected]> Cc: Marty McFadden <[email protected]> Cc: Maya Gokhale <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Mike Kravetz <[email protected]> Cc: Pavel Emelyanov <[email protected]> Cc: Rik van Riel <[email protected]> Cc: Shaohua Li <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
- Loading branch information
Showing
7 changed files
with
128 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#ifndef _ASM_GENERIC_PGTABLE_UFFD_H | ||
#define _ASM_GENERIC_PGTABLE_UFFD_H | ||
|
||
#ifndef CONFIG_HAVE_ARCH_USERFAULTFD_WP | ||
static __always_inline int pte_uffd_wp(pte_t pte) | ||
{ | ||
return 0; | ||
} | ||
|
||
static __always_inline int pmd_uffd_wp(pmd_t pmd) | ||
{ | ||
return 0; | ||
} | ||
|
||
static __always_inline pte_t pte_mkuffd_wp(pte_t pte) | ||
{ | ||
return pte; | ||
} | ||
|
||
static __always_inline pmd_t pmd_mkuffd_wp(pmd_t pmd) | ||
{ | ||
return pmd; | ||
} | ||
|
||
static __always_inline pte_t pte_clear_uffd_wp(pte_t pte) | ||
{ | ||
return pte; | ||
} | ||
|
||
static __always_inline pmd_t pmd_clear_uffd_wp(pmd_t pmd) | ||
{ | ||
return pmd; | ||
} | ||
|
||
static __always_inline pte_t pte_swp_mkuffd_wp(pte_t pte) | ||
{ | ||
return pte; | ||
} | ||
|
||
static __always_inline int pte_swp_uffd_wp(pte_t pte) | ||
{ | ||
return 0; | ||
} | ||
|
||
static __always_inline pte_t pte_swp_clear_uffd_wp(pte_t pte) | ||
{ | ||
return pte; | ||
} | ||
#endif /* CONFIG_HAVE_ARCH_USERFAULTFD_WP */ | ||
|
||
#endif /* _ASM_GENERIC_PGTABLE_UFFD_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters