On 2/13/08, Anant Narayanan <anant@xxxxxx> 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:
/*
* 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(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write)
* 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(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write)
Best regards,