劫持页面错误处理程序
我有一个进程 PID 访问了不允许访问的内存区域,CPU 在内核中创建了一个陷阱,该陷阱调用 do_page_fault() ,它将向用户进程发送 SIGSEGV。用户进程有一个自定义信号处理程序,该处理程序具有一些逻辑并且恢复错误指令。我想要做的是将这个信号处理程序逻辑移至内核空间并防止发送 SIGSEGV。 为此,我可以编写一个内核模块来劫持该 PID 的故障处理程序或其他东西吗?或者我是否必须将逻辑添加到 do_page_fault() 中?一些指导会有所帮助。
I have a process PID that access a memory region that it's not allowed to, the CPU creates a trap into the kernel which calls do_page_fault() which will send SIGSEGV to the user process. The user process has a custom signal handler that has some logic and the faulting instruction is resumed. What I want to do is to move this signal handler logic to kernel space and prevent SIGSEGV from being sent.
For that could I write a kernel module that hijacks the fault handler for this PID or something? or do I have to add my logic to do_page_fault()? Some guidance would be helpful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
userfaultfd() 可能对您有用。它可以让你处理
用户模式下的页面错误。
userfaultfd() could be useful to you. It allows you to handle
page faults in usermode.