Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamically loaded code and W^X #60

Open
anttikantee opened this issue Jan 4, 2014 · 0 comments
Open

Dynamically loaded code and W^X #60

anttikantee opened this issue Jan 4, 2014 · 0 comments

Comments

@anttikantee
Copy link
Member

Per discussion on irc with @justincormack (cc Alex @alnsn):

There is currently no way to dynamically load code into the rump kernel and keep the W^X invariant. You can allocate executable memory using the rumpuser_anonmmap() hypercall, but you can't make it !executable.

A few options:

  1. don't care (easy)
  2. implement sufficient parts of pmap in rump kernels to allow to change page protection. However, this breaks the rump kernel paradigm where memory is completely managed by the host. Also, we'll have to change protection for every single pmap_protect() call and/or implement a convoluted caching mechanism (a la the kernel pmaps)
  3. add interfaces to the NetBSD kernel to explicitly state that code is being loaded to some address, and that loading is done. e.g. uvm_codeload_alloc(size), uvm_codeload_start(sva, eva), uvm_codeload_done(sva, eva), uvm_codeload_free(va, size) (but with better names). We could then pass this info directly to a rump kernel hypercall, which could not only handle protection, but also any necessary icache flushing (if any).
  4. something else, what?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant