Re: [PATCH] x86: setup: extend low identity map to cover whole kernel range

From: Matt Fleming
Date: Thu Oct 15 2015 - 05:45:58 EST


On Wed, 14 Oct, at 02:39:58PM, Andy Lutomirski wrote:
>
> Trivia for your amusement:
>
> AFAICT it's entirely permissible for the GDTR and/or LDT descriptor to
> point to unmapped memory. Any attempt to use them (segment loads,
> interrupts, IRET, etc) will try to access that memory as if the access
> came from CPL 0 and, if the access fails, will generate a valid page
> fault with CR2 pointing into the GDT or LDT.
>
> Xen is nuts^Wclever and actually uses this.
>
> Of course, if your #PF vector references a GDT or LDT descriptor and
> trying to load that descriptor results in a page fault, you get a
> double fault.
>
> I learned this while trying to puzzle out why v1 of my LDT
> synchronization patch caused random faults on Xen.

Ha, interesting! Thanks Andy, it's good to get confirmation.

OK, I think we understand this issue well enough to call this fixed.
I've queued the following patch up in my urgent tree and I'll send a
pull request to the tip folks tomorrow.

---