diff options
author | Oleg Nesterov <oleg@redhat.com> | 2014-04-28 14:15:43 -0400 |
---|---|---|
committer | Oleg Nesterov <oleg@redhat.com> | 2014-04-30 13:10:43 -0400 |
commit | 13f59c5e45be59665c11ddde19799b6295543b7d (patch) | |
tree | 86b9999733f0826f2bad3e4d2285d9585f3a9f67 /kernel | |
parent | 927d687480ab7e43d73a003bab58803fc67717d9 (diff) |
uprobes: Refuse to insert a probe into MAP_SHARED vma
valid_vma() rejects the VM_SHARED vmas, but this still allows to insert
a probe into the MAP_SHARED but not VM_MAYWRITE vma.
Currently this is fine, such a mapping doesn't really differ from the
private read-only mmap except mprotect(PROT_WRITE) won't work. However,
get_user_pages(FOLL_WRITE | FOLL_FORCE) doesn't allow to COW in this
case, and it would be safer to follow the same conventions as mm even
if currently this happens to work.
After the recent cda540ace6a1 "mm: get_user_pages(write,force) refuse
to COW in shared areas" only uprobes can insert an anon page into the
shared file-backed area, lets stop this and change valid_vma() to check
VM_MAYSHARE instead.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/events/uprobes.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index d1edc5e6fd03..7716c40f2c50 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c | |||
@@ -127,7 +127,7 @@ struct xol_area { | |||
127 | */ | 127 | */ |
128 | static bool valid_vma(struct vm_area_struct *vma, bool is_register) | 128 | static bool valid_vma(struct vm_area_struct *vma, bool is_register) |
129 | { | 129 | { |
130 | vm_flags_t flags = VM_HUGETLB | VM_MAYEXEC | VM_SHARED; | 130 | vm_flags_t flags = VM_HUGETLB | VM_MAYEXEC | VM_MAYSHARE; |
131 | 131 | ||
132 | if (is_register) | 132 | if (is_register) |
133 | flags |= VM_WRITE; | 133 | flags |= VM_WRITE; |