mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-24 05:01:03 +02:00
mm/uffd: enable write protection for shmem & hugetlbfs
We've had all the necessary changes ready for both shmem and hugetlbfs. Turn on all the shmem/hugetlbfs switches for userfaultfd-wp. We can expand UFFD_API_RANGE_IOCTLS_BASIC with _UFFDIO_WRITEPROTECT too because all existing types now support write protection mode. Since vma_can_userfault() will be used elsewhere, move into userfaultfd_k.h. Link: https://lkml.kernel.org/r/20220405014926.15101-1-peterx@redhat.com Signed-off-by: Peter Xu <peterx@redhat.com> Cc: Alistair Popple <apopple@nvidia.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Axel Rasmussen <axelrasmussen@google.com> Cc: David Hildenbrand <david@redhat.com> Cc: Hugh Dickins <hughd@google.com> Cc: Jerome Glisse <jglisse@redhat.com> Cc: "Kirill A . Shutemov" <kirill@shutemov.name> Cc: Matthew Wilcox <willy@infradead.org> Cc: Mike Kravetz <mike.kravetz@oracle.com> Cc: Mike Rapoport <rppt@linux.vnet.ibm.com> Cc: Nadav Amit <nadav.amit@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
@@ -33,7 +33,8 @@
|
||||
UFFD_FEATURE_THREAD_ID | \
|
||||
UFFD_FEATURE_MINOR_HUGETLBFS | \
|
||||
UFFD_FEATURE_MINOR_SHMEM | \
|
||||
UFFD_FEATURE_EXACT_ADDRESS)
|
||||
UFFD_FEATURE_EXACT_ADDRESS | \
|
||||
UFFD_FEATURE_WP_HUGETLBFS_SHMEM)
|
||||
#define UFFD_API_IOCTLS \
|
||||
((__u64)1 << _UFFDIO_REGISTER | \
|
||||
(__u64)1 << _UFFDIO_UNREGISTER | \
|
||||
@@ -47,7 +48,8 @@
|
||||
#define UFFD_API_RANGE_IOCTLS_BASIC \
|
||||
((__u64)1 << _UFFDIO_WAKE | \
|
||||
(__u64)1 << _UFFDIO_COPY | \
|
||||
(__u64)1 << _UFFDIO_CONTINUE)
|
||||
(__u64)1 << _UFFDIO_CONTINUE | \
|
||||
(__u64)1 << _UFFDIO_WRITEPROTECT)
|
||||
|
||||
/*
|
||||
* Valid ioctl command number range with this API is from 0x00 to
|
||||
@@ -194,6 +196,9 @@ struct uffdio_api {
|
||||
* UFFD_FEATURE_EXACT_ADDRESS indicates that the exact address of page
|
||||
* faults would be provided and the offset within the page would not be
|
||||
* masked.
|
||||
*
|
||||
* UFFD_FEATURE_WP_HUGETLBFS_SHMEM indicates that userfaultfd
|
||||
* write-protection mode is supported on both shmem and hugetlbfs.
|
||||
*/
|
||||
#define UFFD_FEATURE_PAGEFAULT_FLAG_WP (1<<0)
|
||||
#define UFFD_FEATURE_EVENT_FORK (1<<1)
|
||||
@@ -207,6 +212,7 @@ struct uffdio_api {
|
||||
#define UFFD_FEATURE_MINOR_HUGETLBFS (1<<9)
|
||||
#define UFFD_FEATURE_MINOR_SHMEM (1<<10)
|
||||
#define UFFD_FEATURE_EXACT_ADDRESS (1<<11)
|
||||
#define UFFD_FEATURE_WP_HUGETLBFS_SHMEM (1<<12)
|
||||
__u64 features;
|
||||
|
||||
__u64 ioctls;
|
||||
|
Reference in New Issue
Block a user