Is it possible in theory to recover after a process is mistakenly pointed-out to read from a wrong memory address, rather than terminating it?
Let say an error while working with registers lead the processor to read a random place on memory and therefore throwing an illegal instruction exception. At this point, are there any ways to recover to a stable state rather terminating the process?
Are there any processor architecture (specially for Embedded systems), with some extra features to deal with these issue?
Also are there any research papers trying to figure out what are valid return addresses for a function? For example if my function is trying to return to an address that is (virtually) invalid for my program to do its job, have been there any efforts to detect such a violation? Either on the programming language level or on the operating system and memory management?
Note: Illegal Instruction is an exception thrown by the processor.
Would saving last known valid Instruction Pointer somewhere manually help? Maybe in an unused or reserved register, but it should be somehow guaranteed to stay untouched by the rest of the program.