In our Systems course here at Northeastern, we’re working with Prex as our experimental platform this semester. A recent assignment called for the implementation of some virtual-memory-like features, using Prex’s exceptions to deliver information about faulting memory accesses to the faulting process, which is thereby given an opportunity to arrange for some memory to back the accessed address.
The problem is in the x86 code implementing system call handling for
exception_return() system call. The logic for detecting that an
exception_return() has occurred neglects to take into account the
fact that returning from an exception replaces the active context. The
fix is to check
%eax before calling
Without the patch below,
%eax will be smashed in the context of the
code that was interrupted by the exception.
I emailed this patch to the Prex list, but something about my message triggered Sourceforge’s spam detection software, or something equally tedious and annoying, and it hasn’t made its way through yet; so I’m posting this here in the hopes that those in need of it might find it.
Here’s the required change: