can I input a gate service to kernel to get kernel data to user ?

Matthias Brugger matthias.bgg at gmail.com
Fri Dec 14 04:28:35 EST 2012


Hi,

On 12/14/2012 01:53 AM, horse_rivers wrote:
> At 2012-12-13 18:52:53,"Matthias Brugger" <matthias.bgg at gmail.com> wrote:
>> On 12/13/2012 04:17 AM, horse_rivers wrote:
>>>   is there method for doing this work? take kernel data to user?
>>
>> I think copy_to_user is what you are looking for:
>> http://lxr.free-electrons.com/source/include/asm-generic/uaccess.h#L253
>>
>
> thanks !
>
> can this function run at user level ?
>
> when programme is   at user level , can  I use this function to get kernel text segment data ,and then analysis it ?

no you can't. Userspace programs can only access the kernel trough a 
systemcall, otherwise userspace could read memory from other programs 
which would be dangerous (think of passwords etc).

If you want to read certain parts of kernel memory from userspace, you 
need a kernel module which uses copy_to_user, for example a character 
driver using the read or ioctl function to call copy_to_user.

The userspace then would use that character device to invoke systemcalls.

Please refer to http://lwn.net/Kernel/LDD3/ about device driver 
programing. Although the book is outdated it is a perfect point to start 
understanding the concepts.

Best regards,
Matthias

>
> BestRegards!
>
>> Cheers,
>> Matthias
>>
>>>
>>>
>>>   thanks!
>>>
>>>   _______________________________________________
>>>   Kernelnewbies mailing list
>>>   Kernelnewbies at kernelnewbies.org
>>>   http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>>
>>
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>




More information about the Kernelnewbies mailing list