Re: SIGSEGV handler Question



LaBird wrote:
I'd like to ask if it is possible to write a signal handler to capture
SIGSEGV, and handles the fault by changing the virtual address the program
is accessing instead? For example, if a read to VM address 0x12340000 causes
a SIGSEGV, instead of changing the memory protection of 0x12340000 to
readable or perform a memory mapping on this address inside the signal
handler, is it possible to change the VM address to be accessed to, say
0x56780000 inside the handler (assume 0x56780000 is mapped and is readable)?

It's possible - barely - but it's a really bad idea and would be
fiendishly hard to implement (especially with any significant
generality). What exactly are you trying to accomplish?

GH

.



Relevant Pages

  • Re: SIGSEGV handler Question
    ... the fault must be corrected by the signal handler before the ... SIGSEGV, and handles the fault by changing the virtual address the program ...
    (comp.os.linux.development.apps)
  • SIGSEGV handler Question
    ... the fault must be corrected by the signal handler before the ... changing the memory protection mode or perform a memory mapping on the ... SIGSEGV, and handles the fault by changing the virtual address the program ...
    (comp.os.linux.development.apps)
  • Re: Signal delivery order
    ... the sigsegv handler is invoked when the sigusr1 handler is already ... Because the task deques the private signals first (sent by tkill, ...
    (Linux-Kernel)
  • Re: dh, the daemon helper
    ... Yes, and stderr is unbuffered by default, hence fflushis a ... flushed on exit and the fflush would be useless and - last but not ... least - SIGSEGV is sent by the kernel to a process which attempted an ... type of issues but a signal handler like the one above prevents this ...
    (comp.unix.programmer)
  • Re: signal handling in C
    ... generated to catch the SIGSEGV signal. ... The handler for this signal, ... Is this the expected behaviour? ... "SIGSEGV_handler called with the argument 11" will be repeated forever, ...
    (comp.lang.c)