On 2/13/08, Anant Narayanan <[EMAIL PROTECTED]> wrote:

> Hi,
>
> As a followup to my previous post, my problem would be solved if there
> is some way of copying data from a userspace virtual memory location
> to another userspace location.
>
> I've seen a function called copy_in_user(), but that hasn't been
> implemented for x86 (only for x86-64, arm and mips).
>
> I can't seem to use memcpy(), the kernel crashes with eip=0x0. Not
> surprising though, as I pass raw virtual userspace addresses to the
> function.
>
> Anant,
         you can only use memcpy if you have the source and destination
physical address.
If you don“t know them, you can use access_process_vm to copy from the
process A to a kernel buffer, and finally from this kernel buffer to process
B address space.

You can find the access_process_vm code in the following link:
http://lxr.linux.no/linux/mm/memory.c#L2869
*/**
** Access another process' address space.*
** Source/target buffer must be kernel space,*
** Do not walk the page table directly, use get_user_pages*
**/*
int access_process_vm
<http://lxr.linux.no/linux/+code=access_process_vm>(struct
task_struct <http://lxr.linux.no/linux/+code=task_struct>
*tsk<http://lxr.linux.no/linux/+code=tsk>,
unsigned long addr <http://lxr.linux.no/linux/+code=addr>, void
*buf<http://lxr.linux.no/linux/+code=buf>,
int len <http://lxr.linux.no/linux/+code=len>, int
write<http://lxr.linux.no/linux/+code=write>
)


Best regards,

Reply via email to