LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Accessing kalloc memory from userspace (https://www.linuxquestions.org/questions/linux-kernel-70/accessing-kalloc-memory-from-userspace-4175444695/)

MarkASatterfield 01-08-2013 01:10 PM

Accessing kalloc memory from userspace
 
There are some posts for this item but I can't see any examples. I am trying to kalloc a page in kernel and then mmap it in userspace but I don't believe the memory is mapped correctly. Do I need to allocate userspace memory and then use mmap to map the kernel page to the userspace memory?

sundialsvcs 01-09-2013 04:56 PM

The problem here is that kernel memory is, by design, inaccessible to user-land processes. Whereas it is possible for the kernel to transfer data to-and-from userland memory relatively easily.

What I would do is to create some easy-to-use rendezvous mechanism ... perhaps a virtual-device ... cabbage ideas freely (say...) from the /proc pseudo-filesystem. Something that a user-land process can very easily call and work with, such that when it does so, you're comfortably in kernel-mode and can move the data to/from where it needs to go.

Actum Ne Agas: Do Not Do A Thing Already Done. Find the closest existing well-known kernel facility that's reasonably close to what you require, and unabashedly "cabbage" it.


All times are GMT -5. The time now is 05:53 PM.