Messages in this thread | | | From | Nick Piggin <> | Subject | Re: Questions about mmap | Date | Wed, 8 Oct 2008 15:45:36 +1100 |
| |
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.
| |