[−][src]Module sunrise_kernel::paging::cross_process
Cross Process Mapping
Provides mechanics for temporarily mirroring a Userland mapping in KernelLand.
When kernel has to access memory in UserLand (for example a user has provided a buffer as an argument of a syscall), it can do it in two ways:
- Either the buffer is mapped in the same page tables that the kernel is currently using, in this case it accesses it directly, through a UserspacePtr.
- Either the buffer is only mapped in the page tables of another process, in which case it has to temporarily map it to KernelLand, make the modifications, and unmap it from KernelLand.
This module covers the second case.
The remapping is represented by a CrossProcessMapping
structure. It is created from a reference
to the mapping being mirrored, and the KernelLand address where it will be remapped.
When this struct is dropped, the frames are unmap'd from KernelLand.
A CrossProcessMapping
shares the ownership of the underlying frames. As such, only refcounted
memory regions can be mirror-mapped. This is rarely a problem, as almost all memory is refcounted.
There is no guarantee that the CrossProcessMapping doesn't outlive the original mapping.
Structs
CrossProcessMapping | A struct representing a UserLand mapping mirrored in KernelSpace. |