Re: RFC: userspace exception fixups
From: Dave Hansen
Date: Fri Nov 02 2018 - 12:56:48 EST
On 11/2/18 9:30 AM, Sean Christopherson wrote:
> What if rather than having userspace register an address for fixup, the
> kernel instead unconditionally does fixup on the ENCLU opcode?
The problem is knowing what to do for the fixup. If we have a simple
action to take that's universal, like backing up %RIP, or setting some
other register state, it's not bad.
Think of our prefetch fixups in the page fault code. We do some
instruction decoding to look for them, and then largely return from the
fault and let the CPU retry. We know *exactly* what to do for these.
But, if we need to call arbitrary code, or switch stacks, we need an
explicit ABI around it *anyway*, because the action to take isn't clear.
For an enclave exit that's because of a hardware interrupt or page
fault, life is good. We really *could* just set %RIP to let ERESUME run
again, kinda like we do for (some) syscall situations. But the
situations for which we can't just call ERESUME, like the out-calls make
this more challenging. I think we'd need some explicit new interfaces
for those.