Re: read contents from user memory area from a module

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

 



Thank you, Sangman.

Reimplement access_process_vm() or get_user_pages seems to be impractical...

What I am thinking is to use system call like ptrace, but can a module
call ptrace?? That also sounds strange...

Fangkai

On Wed, Apr 28, 2010 at 7:47 PM, Sangman Kim <nemonemo@xxxxxxxxxxxxx> wrote:
> Hi Fangkai,
>
> Ah, that function is not exported, which means you should look for some
> other function or you can implement something similar by yourself (or you
> can illegally use it with a direct address to access_process_vm().)
>
> I don't know about any exported function for similar purpose, but probably
> others would know.
>
> On Wed, Apr 28, 2010 at 7:38 PM, Yang Fangkai <wolfgang.yang@xxxxxxxxx>
> wrote:
>>
>> Hi, Sangman,
>>
>>       Thanks for your reply!  I have tried this access_process_vm().
>> It reports error when I include <../mm/memory.c>, saying redefinition
>> of __init_module and __init_module...
>>
>> Fangkai
>>
>> On Wed, Apr 28, 2010 at 7:35 PM, Sangman Kim <nemonemo@xxxxxxxxxxxxx>
>> wrote:
>> > Hi,
>> >
>> > You might want to look at access_process_vm() in mm/memory.c.
>> > If you know the pid of the target process, you can use it to search the
>> > corresponding task_struct using find_task_by_pid_ns() with init_pid_ns.
>> >
>> > Good luck :)
>> >
>> > Sangman
>> >
>> > On Wed, Apr 28, 2010 at 7:21 PM, Yang Fangkai <wolfgang.yang@xxxxxxxxx>
>> > wrote:
>> >>
>> >> Dear List,
>> >>
>> >>        I am developing a virtual device driver such that the user can
>> >> write to the driver a process' pid and a virtual address, and the
>> >> module will use these two values to get the memory contents of the
>> >> target process. I am wondering if there is any easy functions that can
>> >> fetch user page's data at this virtual address. Thank you!
>> >>
>> >>        I have tried get_user but this is not possible because the
>> >> modules executing get_user at another process's context. I also tried
>> >> to use ptrace_readdata, however, it seems that the file at
>> >> /kernel/ptrace.c leaves a function access_process_vm undefined and
>> >> also I don't know how to compile the source code of my module with
>> >> this file (the linker seaches file in /linux/include by default). I am
>> >> wondering if there are any other solutions...
>> >>
>> >> Best,
>> >>
>> >> Fangkai
>> >>
>> >> --
>> >> To unsubscribe from this list: send an email with
>> >> "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
>> >> Please read the FAQ at http://kernelnewbies.org/FAQ
>> >>
>> >
>> >
>
>

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux