Commit f0cbc301 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

mm: mark VM_IO and VM_PFNMAP VMA-s as unsupported

vmsplice doesn't work for such VMA-s.

This flags is set in a kernel function remap_pfn_range()
(remap kernel memory to userspace), which is widely used by device
drivers to provide direct access to a device memory.
Reported-by: 's avatarJ F <jgmb45@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Acked-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 19906f91
...@@ -52,6 +52,8 @@ ...@@ -52,6 +52,8 @@
#define VMA_AREA_SYSVIPC (1 << 10) #define VMA_AREA_SYSVIPC (1 << 10)
#define VMA_AREA_SOCKET (1 << 11) #define VMA_AREA_SOCKET (1 << 11)
#define VMA_UNSUPP (1 << 12) /* Unsupported VMA */
#define CR_CAP_SIZE 2 #define CR_CAP_SIZE 2
#define TASK_COMM_LEN 16 #define TASK_COMM_LEN 16
......
...@@ -137,6 +137,10 @@ static int parse_vmflags(char *buf, struct vma_area *vma_area) ...@@ -137,6 +137,10 @@ static int parse_vmflags(char *buf, struct vma_area *vma_area)
else if (_vmflag_match(tok, "nh")) else if (_vmflag_match(tok, "nh"))
vma_area->e->madv |= (1ul << MADV_NOHUGEPAGE); vma_area->e->madv |= (1ul << MADV_NOHUGEPAGE);
/* vmsplice doesn't work for VM_IO and VM_PFNMAP mappings. */
if (_vmflag_match(tok, "io") || _vmflag_match(tok, "pf"))
vma_area->e->status |= VMA_UNSUPP;
/* /*
* Anything else is just ignored. * Anything else is just ignored.
*/ */
...@@ -326,6 +330,12 @@ int parse_smaps(pid_t pid, struct vm_area_list *vma_area_list, bool use_map_file ...@@ -326,6 +330,12 @@ int parse_smaps(pid_t pid, struct vm_area_list *vma_area_list, bool use_map_file
} }
if (vma_area) { if (vma_area) {
if (vma_area->e->status & VMA_UNSUPP) {
pr_err("Unsupported mapping found %016"PRIx64"-%016"PRIx64"\n",
vma_area->e->start, vma_area->e->end);
goto err;
}
/* Add a guard page only if here is enough space for it */ /* Add a guard page only if here is enough space for it */
if ((vma_area->e->flags & MAP_GROWSDOWN) && if ((vma_area->e->flags & MAP_GROWSDOWN) &&
prev_end < vma_area->e->start) prev_end < vma_area->e->start)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment