简体   繁体   English

从Linux内核/内核模块“附加”用户空间进程

[英]“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.

相关问题 从用户空间进程启用内核模块调试 - Enable debugging of kernel module from user-space process 从进程 VMA 读取的 Linux 内核模块 - Linux kernel module read from process VMA 如何从 Linux kernel 空间模块执行/调用用户空间定义的 function? - How can I Execute/Call a user-space defined function from Linux kernel space module? 如何在用户空间程序和 Linux kernel 模块之间进行通信,以便打印从用户程序发送到 kernel 的消息 - How to make communication between user space program and Linux kernel module in order to print a message sent from user program to the kernel 如何在Linux内核模块的用户空间中创建目录 - How to create a directory in user space in a Linux kernel module 编写Linux内核模块时获取用户进程pid - Getting user process pid when writing Linux Kernel Module 将数据从linux内核空间复制到用户空间 - copy data from linux kernel space to user space 无法打印从用户空间 C 应用程序发送到 linux kernel 模块的消息 - Unable to print the message sent from user space C application to linux kernel module 用户空间和内核空间上的进程执行 - process execution on user space and kernel space 在Linux内核(模块编程)中如何从多线程进程获取线程? - In the Linux kernel (module programming) how to get threadids from a multithreaded process?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM