Re: X86: Question about GDT loading

From: H. Peter Anvin

Date: Sun Aug 16 2026 - 17:16:18 EST


On 2026-08-16 14:12, H. Peter Anvin wrote:
>
> For 32 bits that is perfectly safe. On 64 bits, it ends up taking up slot 1 as
> well; this is *not* safe for a kernel address as it would be interpreted as a
> user-space code descriptor for a single-byte code segment somewhere in the low
> 16 MB of memory, addressable as 0x13:0. This could be used to derive bits
> [55:32] of the kernel GDT base from user space.

Corrected: addressable as 0xb:0.

> Therefore this must NOT be done in 64-bit mode.

Formally speaking: long mode.

-hpa