Re: [PATCH v2 2.6.38-rc8-tip 3/20] 3: uprobes: Breakground page replacement.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2011-03-14 at 19:04 +0530, Srikar Dronamraju wrote:
> +/*
> + * Called with tsk->mm->mmap_sem held (either for read or write and
> + * with a reference to tsk->mm.
> + */
> +static int write_opcode(struct task_struct *tsk, struct uprobe * uprobe,
> +                       unsigned long vaddr, uprobe_opcode_t opcode)
> +{
> +       struct page *old_page, *new_page;
> +       void *vaddr_old, *vaddr_new;
> +       struct vm_area_struct *vma;
> +       spinlock_t *ptl;
> +       pte_t *orig_pte;
> +       unsigned long addr;
> +       int ret = -EINVAL;
> +
> +       /* Read the page with vaddr into memory */
> +       ret = get_user_pages(tsk, tsk->mm, vaddr, 1, 1, 1, &old_page, &vma);
> +       if (ret <= 0)
> +               return -EINVAL;
> +       ret = -EINVAL;
> +
> +       /*
> +        * check if the page we are interested is read-only mapped
> +        * Since we are interested in text pages, Our pages of interest
> +        * should be mapped read-only.
> +        */
> +       if ((vma->vm_flags & (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)) ==
> +                                               (VM_READ|VM_EXEC))
> +               goto put_out;
> + 

I'm confused by the above comment and code. You state we are only
interested text pages mapped read-only, but then if the page is mapped
read/exec we exit out? It is fine if it is anything but READ/EXEC.

I'm also curious to why we can't modify text code that is also mapped as
read/write.

-- Steve


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]