userfaultfd.c (cecdd52a3dd312564f81a39df08378b7b39a2654) | userfaultfd.c (2bad466cc9d9b4c3b4b16eb9c03c919b59561316) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * fs/userfaultfd.c 4 * 5 * Copyright (C) 2007 Davide Libenzi <davidel@xmailserver.org> 6 * Copyright (C) 2008-2009 Red Hat, Inc. 7 * Copyright (C) 2015 Red Hat, Inc. 8 * --- 94 unchanged lines hidden (view full) --- 103/* internal indication that UFFD_API ioctl was successfully executed */ 104#define UFFD_FEATURE_INITIALIZED (1u << 31) 105 106static bool userfaultfd_is_initialized(struct userfaultfd_ctx *ctx) 107{ 108 return ctx->features & UFFD_FEATURE_INITIALIZED; 109} 110 | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * fs/userfaultfd.c 4 * 5 * Copyright (C) 2007 Davide Libenzi <davidel@xmailserver.org> 6 * Copyright (C) 2008-2009 Red Hat, Inc. 7 * Copyright (C) 2015 Red Hat, Inc. 8 * --- 94 unchanged lines hidden (view full) --- 103/* internal indication that UFFD_API ioctl was successfully executed */ 104#define UFFD_FEATURE_INITIALIZED (1u << 31) 105 106static bool userfaultfd_is_initialized(struct userfaultfd_ctx *ctx) 107{ 108 return ctx->features & UFFD_FEATURE_INITIALIZED; 109} 110 |
111/* 112 * Whether WP_UNPOPULATED is enabled on the uffd context. It is only 113 * meaningful when userfaultfd_wp()==true on the vma and when it's 114 * anonymous. 115 */ 116bool userfaultfd_wp_unpopulated(struct vm_area_struct *vma) 117{ 118 struct userfaultfd_ctx *ctx = vma->vm_userfaultfd_ctx.ctx; 119 120 if (!ctx) 121 return false; 122 123 return ctx->features & UFFD_FEATURE_WP_UNPOPULATED; 124} 125 |
|
111static void userfaultfd_set_vm_flags(struct vm_area_struct *vma, 112 vm_flags_t flags) 113{ 114 const bool uffd_wp_changed = (vma->vm_flags ^ flags) & VM_UFFD_WP; 115 116 vm_flags_reset(vma, flags); 117 /* 118 * For shared mappings, we want to enable writenotify while --- 1847 unchanged lines hidden (view full) --- 1966 uffdio_api.features &= 1967 ~(UFFD_FEATURE_MINOR_HUGETLBFS | UFFD_FEATURE_MINOR_SHMEM); 1968#endif 1969#ifndef CONFIG_HAVE_ARCH_USERFAULTFD_WP 1970 uffdio_api.features &= ~UFFD_FEATURE_PAGEFAULT_FLAG_WP; 1971#endif 1972#ifndef CONFIG_PTE_MARKER_UFFD_WP 1973 uffdio_api.features &= ~UFFD_FEATURE_WP_HUGETLBFS_SHMEM; | 126static void userfaultfd_set_vm_flags(struct vm_area_struct *vma, 127 vm_flags_t flags) 128{ 129 const bool uffd_wp_changed = (vma->vm_flags ^ flags) & VM_UFFD_WP; 130 131 vm_flags_reset(vma, flags); 132 /* 133 * For shared mappings, we want to enable writenotify while --- 1847 unchanged lines hidden (view full) --- 1981 uffdio_api.features &= 1982 ~(UFFD_FEATURE_MINOR_HUGETLBFS | UFFD_FEATURE_MINOR_SHMEM); 1983#endif 1984#ifndef CONFIG_HAVE_ARCH_USERFAULTFD_WP 1985 uffdio_api.features &= ~UFFD_FEATURE_PAGEFAULT_FLAG_WP; 1986#endif 1987#ifndef CONFIG_PTE_MARKER_UFFD_WP 1988 uffdio_api.features &= ~UFFD_FEATURE_WP_HUGETLBFS_SHMEM; |
1989 uffdio_api.features &= ~UFFD_FEATURE_WP_UNPOPULATED; |
|
1974#endif 1975 uffdio_api.ioctls = UFFD_API_IOCTLS; 1976 ret = -EFAULT; 1977 if (copy_to_user(buf, &uffdio_api, sizeof(uffdio_api))) 1978 goto out; 1979 1980 /* only enable the requested features for this uffd context */ 1981 ctx_features = uffd_ctx_features(features); --- 202 unchanged lines hidden --- | 1990#endif 1991 uffdio_api.ioctls = UFFD_API_IOCTLS; 1992 ret = -EFAULT; 1993 if (copy_to_user(buf, &uffdio_api, sizeof(uffdio_api))) 1994 goto out; 1995 1996 /* only enable the requested features for this uffd context */ 1997 ctx_features = uffd_ctx_features(features); --- 202 unchanged lines hidden --- |