On Fri, Dec 8, 2017 at 8:46 AM, David Laight <david.lai...@aculab.com> wrote: > 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.)
I mean: if the user CS or SS is not accessed and the LDT is RO, then we get #PF on the IRET instruction, I think. Dealing with that is truly awful.