uprobes: No need to re-check vma_address() in write_opcode()
authorOleg Nesterov <[email protected]>
Fri, 15 Jun 2012 15:43:47 +0000 (17:43 +0200)
committerIngo Molnar <[email protected]>
Sat, 16 Jun 2012 07:10:47 +0000 (09:10 +0200)
write_opcode() is called by register_for_each_vma() and
uprobe_mmap() paths. In both cases the caller has already
verified this vaddr under mmap_sem, no need to re-check.

Note also that this check is wrong anyway, we should not
truncate loff_t returned by vma_address() if we do not trust
this mapping.

Signed-off-by: Oleg Nesterov <[email protected]>
Acked-by: Srikar Dronamraju <[email protected]>
Acked-by: Ananth N Mavinakayanahalli <[email protected]>
Cc: Anton Arapov <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
kernel/events/uprobes.c

index 2db1d94d7dfc90686760b2d1d4eea96a831e7558..14c71a2aadad07208c6d6edaf8ba386c29d475be 100644 (file)
@@ -211,7 +211,6 @@ static int write_opcode(struct arch_uprobe *auprobe, struct mm_struct *mm,
        struct vm_area_struct *vma;
        struct uprobe *uprobe;
        unsigned long pgoff;
-       loff_t addr;
        int ret;
 retry:
        /* Read the page with vaddr into memory */
@@ -235,10 +234,6 @@ retry:
        if (mapping != vma->vm_file->f_mapping)
                goto put_out;
 
-       addr = vma_address(vma, uprobe->offset);
-       if (vaddr != (unsigned long)addr)
-               goto put_out;
-
        ret = -ENOMEM;
        new_page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, vaddr);
        if (!new_page)