summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2012-09-16 19:07:41 +0200
committerAnton Arapov <anton@redhat.com>2012-10-29 11:47:44 +0100
commit9eb91bdabf372377516b401bdc8976340abc5f3d (patch)
tree2711363b425f0551c2e0e96a2b951df7dcfd291f
parent547a4bb519bb7fb2a6f139abe1c1c3dd03546f81 (diff)
downloadkernel-uprobes-9eb91bdabf372377516b401bdc8976340abc5f3d.zip
kernel-uprobes-9eb91bdabf372377516b401bdc8976340abc5f3d.tar.gz
kernel-uprobes-9eb91bdabf372377516b401bdc8976340abc5f3d.tar.xz
uprobes: Change valid_vma() to demand VM_MAYEXEC rather than VM_EXEC
uprobe_register() or uprobe_mmap() requires VM_READ | VM_EXEC, this is not right. An apllication can do mprotect(PROT_EXEC) later and execute this code. Change valid_vma(is_register => true) to check VM_MAYEXEC instead. No need to check VM_MAYREAD, it is always set. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
-rw-r--r--kernel/events/uprobes.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 80e8c7b..a9de408 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -106,8 +106,8 @@ static bool valid_vma(struct vm_area_struct *vma, bool is_register)
if (!is_register)
return true;
- if ((vma->vm_flags & (VM_HUGETLB|VM_READ|VM_WRITE|VM_EXEC|VM_SHARED))
- == (VM_READ|VM_EXEC))
+ if ((vma->vm_flags & (VM_HUGETLB | VM_WRITE | VM_MAYEXEC | VM_SHARED))
+ == VM_MAYEXEC)
return true;
return false;