kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: matthias.bgg@gmail.com (Matthias Brugger)
To: kernelnewbies@lists.kernelnewbies.org
Subject: can I input a gate service to kernel to get kernel data to user ?
Date: Fri, 14 Dec 2012 10:28:35 +0100	[thread overview]
Message-ID: <50CAF143.6060604@gmail.com> (raw)
In-Reply-To: <1b46c269.bc6.13b96e666c5.Coremail.horse_rivers@126.com>

Hi,

On 12/14/2012 01:53 AM, horse_rivers wrote:
> At 2012-12-13 18:52:53,"Matthias Brugger" <matthias.bgg@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
>

  reply	other threads:[~2012-12-14  9:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-13  3:17 can I input a gate service to kernel to get kernel data to user ? horse_rivers
2012-12-13 10:11 ` Daniel Baluta
2012-12-14  0:59   ` horse_rivers
2012-12-13 10:52 ` Matthias Brugger
2012-12-14  0:53   ` horse_rivers
2012-12-14  9:28     ` Matthias Brugger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-12-14  1:50 jeshkumar555

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50CAF143.6060604@gmail.com \
    --to=matthias.bgg@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).