tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Use of the PC value in interrupt/exception handlers

On 2013-08-02 12:46, Piyus Kedia wrote:
Dear all,

We are working on developing a dynamic binary translator for the kernel.
Towards this, we wanted to confirm if the interrupted PC value pushed on
stack by an interrupt/exception is used by the interrupt/exception handlers?
For example, is the PC value compared against a fixed address to determine
the handler behaviour (like Linux's page fault handler compares the faulting
PC against an exception table, to allow functions like copy_from_user to fault).

Basically, we are wondering if it is safe to replace the pushed PC value on
stack by another value. This would be safe if the PC value is only used for
returning from interrupt, or for reading contents at that PC address (e.g.,
to decode the instruction at current PC). It would be unsafe if the value of
the address itself is meaningful to the handler.

We found that in NetBSD only trace-exception-handler checks the trapped PC
value against some fixed kernel PC by looking at the code which is used for
debugging purposes. It would be nice if somebody could also confirm this.

Might depend on the architecture. I seem to remember that the PC value is sometimes checked on VAX for specific address ranges...


Johnny Billquist                  || "I'm on a bus
                                  ||  on a psychedelic trip
email:             ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol

Home | Main Index | Thread Index | Old Index