[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <200810081545.36369.nickpiggin@yahoo.com.au>
Date: Wed, 8 Oct 2008 15:45:36 +1100
From: Nick Piggin <nickpiggin@...oo.com.au>
To: "Thiago Lacerda" <thiagotbl@...il.com>
Cc: "Stefan Richter" <stefanr@...6.in-berlin.de>,
linux-kernel@...r.kernel.org
Subject: Re: Questions about mmap
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists