[英]“Attach” a user space process from Linux kernel/kernel module
I want to modify the virtual-to-physical address mapping (ie page table) of a particular process for every 60 seconds. 我想每60秒修改一次特定进程的虚拟地址到物理地址的映射(即页表)。 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. 我确实知道如何修改页表,如何相应地刷新缓存和TLB,以及如何利用工作队列每60秒调用一次函数。 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 (eg 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. 还应指出指向内核代码或其他提示中任何类似用法的指针。
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. 最好的选择是让您对应用动态虚拟地址感兴趣的进程,通过IOCTL或以驱动程序结尾的任何其他调用进入模块,使用wait_ *函数在进程上下文中休眠,然后每60个唤醒一次秒修改该线程中的页表。 You should have assured context then. 那么您应该确定上下文。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.