1
votes

I want to modify the virtual-to-physical address mapping (i.e. page table) of a particular process for every 60 seconds. I do know how to modify the page table, how to flush the cache and TLB accordingly, and how to leverage workqueue to invoke my function every 60 seconds. However, I am not sure how to "attach" to the target process from kernel or kernel module, assuming that the target process does not initiate any system call. By "attach", I mean the target process will behave similar as when it encountered an interrupt (e.g. a page fault) and the execution goes to the kernel immediately with the context being saved. So is it possible to do this?

Pointers to any similar usage in the kernel code or other hints are also appreciated.

1
You may get a better answer than a direct answer to your question if you explain what the end objective is. Maybe there is already a facility to do what you want to accomplish.wallyk
You can attach a process from kernel but it is not straightforward to do.as @wallyk mentioned if you can tell your end objective it might help.Sasi V
Thanks @wallyk and @Sasi! I am exploring a research idea to give a set of pages dynamic virtual addresses. For example, at time T, the virtual-to-physical mapping is {V1-P1, V2-P2,...}; at time T+60s, the mapping becomes {V1-P2, V2-P1,...}. Is that clear enough?junwang
@WoodBunny: That is a bit fuzzy, but seemingly clear enough. Why would anyone want that done? What's the advantage?wallyk

1 Answers

0
votes

Your best bet is to have the process you are interested in applying dynamic virtual address, call in to the module via IOCTL or any other call that ends up in the driver, sleep in process context using wait_* functions and then wake it up every 60 seconds to modify the page table in that thread. You should have assured context then.