Get a signal on each page fault

爷,独闯天下 提交于 2019-12-22 09:31:54

问题


I want to set a signal handler in my application, so that the kernel sends a signal whenever it handles a page fault trap. Ofcourse I can use the SIGSEGV signal handler, but what I'm really interested in is to catch the page faults which occur on copy-on-write. For example after a fork (not followed by exec), the original process will get a page fault if it tries to write to some page. I want to get notified on such page faults. How can I achieve this?


回答1:


page faults are interrupts handled by do_page_fault()

http://www.stillhq.com/pdfdb/000446/data.pdf

Signals also generate an interrupt. The difference is that the page fault interrupt is vectored to the code. There is an explanation of what the code does. IMO, always generating another interrupt in a an interrupt handler is a bad idea.

Tell us: What are you trying to accomplish? Not how you think it should be done.



来源:https://stackoverflow.com/questions/10253139/get-a-signal-on-each-page-fault

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!