lkml.org 
[lkml]   [2008]   [Oct]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Questions about mmap
Date
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.


\
 
 \ /
  Last update: 2008-10-08 06:49    [W:0.027 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site