Mapping two KVAs to the same page

Derrick McKee derrick.mckee at gmail.com
Tue Sep 22 10:07:33 EDT 2020


Hi,

I am trying to make a research prototype that compartmentalizes kernel
modules.  Part of my design involves embedding an ID number in a
kernel address, which I extract when I need to check for proper
pointer access.  I've modified the module loader to place the module
in an address that contains the ID.  However, when the kernel invokes
one of the kernel API functions the module implements (e.g.,
inet6_create), I'd also like any pointer input arguments to also have
the ID embedded.  Instead of doing a deep copy of objects to an
address that I allocate, my thought is that I find a page aligned
address that contains my ID, and have that address map to the same
page as the input pointer uses.  I then can use the new address as
input to the API function.  Is this possible, and if so, how?

I have tried using __get_vm_area_caller() to get a free address in a
location I want, and then map_kernel_range() to tie the input pointer
page to the new address.  This results in a segfault in
mte_sync_tags() (called by vmap_pte_range()).  I also tried
__vmalloc_node_range() along with map_kernel_range(), but this
triggers the warning on mm/vmalloc.c:211.

Any insight is appreciated, thanks!


-- 
Derrick McKee
Phone: (703) 957-9362
Email: derrick.mckee at gmail.com



More information about the linux-arm-kernel mailing list