Reputation: 39
I need to intercept the exception handling of page fault in Linux kernel, but I'm not allowed to modify the kernel source and compile the kernel. I have to do this in a kernel module. I now have several approach.
callq *0x2b0a07(%rip) # ffffffff81620100 <pv_irq_ops+0x30>
.do_page_fault
, but not all kernel are configured with kprobe enabled.do_page_fault
with a jump instruction which jumps to my code. However, I need to use do_page_fault
latter in my code. I have to put the replaced instructions to another place, but the size of x86 code is hard to determin, and if one of the replaced instructions is jump, things will get more complicated.Do you guys have any idea to solve the problem?
Upvotes: 1
Views: 984
Reputation: 62106
Change the IDT entry to point to your handler. Call the original handler from there if/when needed. No need to copy the IDT or patch the existing code.
Upvotes: 4