mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: "Thiago Lacerda" <thiagotbl@gmail.com>
Cc: "Stefan Richter" <stefanr@s5r6.in-berlin.de>,
	linux-kernel@vger.kernel.org
Subject: Re: Questions about mmap
Date: Wed, 8 Oct 2008 15:45:36 +1100	[thread overview]
Message-ID: <200810081545.36369.nickpiggin@yahoo.com.au> (raw)
In-Reply-To: <3fedcc3b0810071009v68e5811ev11e9d512c58d371f@mail.gmail.com>

On Wednesday 08 October 2008 04:09, Thiago Lacerda wrote:
> Thank you people.
>
> When I try to dereference those pointers in user space I get a segfault :(

Dereference the pointer returned from mmap? Or dereference the pointers
referenced by that pointer?

The first should be possible, and will give you an array of kernel pointers.
If you try to dereference those kernel pointers, yes you should get a segfault
because kernel memory is always mapped in the page tables as privileged.

If you're on x86, you could try adding _PAGE_USER to __PAGE_KERNEL_EXEC. That
would be a fairly wild ride :)

Hmm, you might be able vmap the kernel memory with
__pgprot(__PAGE_KERNEL | _PAGE_USER), and use that mapping from both user and
kernel space. Not guaranteed to be portable or even correct.

Best would be to rethink what exactly you are trying to do, and achieve it
some other way.

  reply	other threads:[~2008-10-08  4:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3fedcc3b0810050621y3f44417ag605ee75dd0389100@mail.gmail.com>
2008-10-05 13:24 ` Thiago Lacerda
2008-10-05 14:01   ` Stefan Richter
     [not found]     ` <3fedcc3b0810070638u60681b6do8a7e94c4919f4a40@mail.gmail.com>
2008-10-07 13:40       ` Thiago Lacerda
2008-10-07 16:02         ` Nick Piggin
2008-10-07 16:06         ` Stefan Richter
2008-10-07 17:09           ` Thiago Lacerda
2008-10-08  4:45             ` Nick Piggin [this message]
2008-10-07 20:43         ` linux-os (Dick Johnson)
2008-10-07 20:56           ` Chris Friesen

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=200810081545.36369.nickpiggin@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stefanr@s5r6.in-berlin.de \
    --cc=thiagotbl@gmail.com \
    /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

Powered by JetHome