Re: Save a WRMSR GS.base?

From: Borislav Petkov

Date: Mon Jun 08 2026 - 16:17:30 EST


On Mon, Jun 08, 2026 at 10:30:36AM -0700, H. Peter Anvin wrote:
> Without REX.W (e.g. wrgsbase %eax as opposed to wrgsbase %rax).

I see.

> It means that in kernel mode, it is the currently active GS.base that is
> written (or read with rdgsbase), that is, the one that belongs to kernel,
> not the user space one in what is confusingly enough called
> MSR_KERNEL_GS_BASE.
>
> In other words, not the one we want to task switch, *unless* you are in IDT
> mode and can surround it with SWAPGS.

Uff, what a mess this stuff is. Brain is in a knot.

I think this is begging to be written down somewhere. Lemme point AI to it and
see what it would generate.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette