Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6334

How to map a user page to kernel space

$
0
0

I'm trying to understand what I need to do in order to map a user's page to kernel space.

Now, I know that the user memory can already be accessed from the kernel using get_user and put_user. This is not what I'm after. In my scenario, the user's page has r/o permissions and I want to write to it. I have not tried (and maybe I should) writing to it, since I guess it would result in a page fault.

As far as I can tell, what I need to do is this:

  1. Find the physical address of the user page
  2. Find (and reserve) a virtual address in the kernel space
  3. Add a PTE under the kernel's PGD (current->mm->pgd???) that points to said physical address with desired permissions

So my question is actually twofold - are my intuition and steps correct, and how do I implement those steps?


Viewing all articles
Browse latest Browse all 6334

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>