Re: [PATCH 3/4] [mm/nommu]: use copy_to_user_page to call flush icache for [#811] toolchain old bug

From: Bryan Wu
Date: Thu May 15 2008 - 02:24:25 EST


Is this patch OK for the nommu, David?

Thanks
-Bryan

On Mon, May 12, 2008 at 6:32 PM, Bryan Wu <cooloney@xxxxxxxxxx> wrote:
> From: Jie Zhang <jie.zhang@xxxxxxxxxx>
>
> access_process_vm in mm/memory.c uses copy_to_user_page and
> copy_from_user_page. So for !MMU we'd better do the same thing.
> Other archs with mmu do the cache flush in copy_to_user_page.
> It gives me hint that copy_to_user_page is designed to flush
> the cache. On other side, no archs do the cache flush ptrace.
>
> Signed-off-by: Jie Zhang <jie.zhang@xxxxxxxxxx>
> Signed-off-by: Bryan Wu <cooloney@xxxxxxxxxx>
> ---
> mm/nommu.c | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/mm/nommu.c b/mm/nommu.c
> index c11e5cc..56bb447 100644
> --- a/mm/nommu.c
> +++ b/mm/nommu.c
> @@ -1458,9 +1458,11 @@ int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, in
>
> /* only read or write mappings where it is permitted */
> if (write && vma->vm_flags & VM_MAYWRITE)
> - len -= copy_to_user((void *) addr, buf, len);
> + copy_to_user_page(vma, NULL, NULL,
> + (void *) addr, buf, len);
> else if (!write && vma->vm_flags & VM_MAYREAD)
> - len -= copy_from_user(buf, (void *) addr, len);
> + copy_from_user_page(vma, NULL, NULL,
> + buf, (void *) addr, len);
> else
> len = 0;
> } else {
> --
> 1.5.5
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/