Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道如何在内核模式下从用户进程的页面复制数据。我可以访问该进程的 mm_struct 和所有 vm_area_structs。在 vm_ops 我看到了访问方法,但我不确定它是如何工作的。任何帮助,将不胜感激。
它可以通过在 linux/mm.h 中声明的 access_process_vm 方法来完成(我相信我现在不记得了)。这是访问进程内存的安全方法,需要的是进程的task_struct,要写入/读取的数据的缓冲区,进程的vm空间内的大小,地址以及是否是读/写. 这是安全的原因是因为它有所有适当的锁来处理这个问题,并且如果 get_user_pages 失败,它有获取用户空间页面的备份方法。返回值是从 vm 空间读取的字节数。
Possible Duplicate: 1 javascript - 在Javascript中使字符串中的单词可选?