RE: [PATCH] LDT improvements

From: David Laight
Date: Fri Dec 08 2017 - 11:46:38 EST


From: Andy Lutomirski
> Sent: 08 December 2017 16:34

> #GP on IRET is a failure, and we have disgusting code to handle it.

Is that the trap in kernel space when the on-stack segment registers
are invalid?
Definitely needs horrid code...

> #PF on IRET would not be a failure -- it's a case where IRET should be
> retried. Our crap that fixes up #GP would get that wrong and leave us
> with the wrong GSBASE.

If the user code page isn't present then the fault happens after the
return to user mode, not on the IRET instruction in kernel mode.
So it is not really any different to returning to a NOP at the end
of a resident page when the page following is absent.
(Or any other invalid %ip value.)

SWAPGS is a PITA, should have been SAVEGS, LOAD_KERNEL_GS, and READ_SAVED_GS.

David