Skip to contentSkip to conversation

x86/pv: Adjust the save_segments() comment regarding MSR_GS_SHADOW

PATCH In review Andrew Cooper 2 participants 2 messages Apr 9

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/pv: Adjust the save_segments() comment regarding MSR_GS_SHADOW

This is slightly stale mentioning SWAPGS and not LKGS. However, take the opportunity to make the comment more general and less likely to bitrot.

It would be a serious vulnerability for operating systems generally if CPL3 could modify GS_SHADOW at all.

No functional change.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Teddy Astie <[email protected]>

---
 xen/arch/x86/domain.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
xen/arch/x86/domain.c +2 -3
index 1151997758c6..592530e53bcc 100644
@@ -1952,9 +1952,8 @@ static void load_segments(struct vcpu *n)
  * changes to bases can also be made with the WR{FS,GS}BASE instructions, when
  * enabled.
  *
- * Guests however cannot use SWAPGS, so there is no mechanism to modify the
- * inactive GS base behind Xen's back.  Therefore, Xen's copy of the inactive
- * GS base is still accurate, and doesn't need reading back from hardware.
+ * Guests cannot modify the inactive GS base behind Xen's back.  Therefore
+ * Xen's copy is still accurate and doesn't need reading back.
  *
  * Under FRED, hardware automatically swaps GS for us, so SHADOW_GS is the
  * active GS from the guest's point of view.
Signature · 1 line
2.39.5
Reviewed-by on v1 1/1
#1 lore raw

Le 09/04/2026 à 11:21, Andrew Cooper a écrit :

Quoted 23 lines

This is slightly stale mentioning SWAPGS and not LKGS. However, take the opportunity to make the comment more general and less likely to bitrot.

It would be a serious vulnerability for operating systems generally if CPL3 could modify GS_SHADOW at all.

No functional change.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Teddy Astie <[email protected]>

---
  xen/arch/x86/domain.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
xen/arch/x86/domain.c +0 -0
index 1151997758c6..592530e53bcc 100644
@@ -1952,9 +1952,8 @@ static void load_segments(struct vcpu *n)
   * changes to bases can also be made with the WR{FS,GS}BASE instructions, when

xen/arch/x86/domain.c static void load_segments(struct vcpu *n) · line 1959

Quoted 10 lines
xen/arch/x86/domain.c +2 -3
   * enabled.
   *
- * Guests however cannot use SWAPGS, so there is no mechanism to modify the
- * inactive GS base behind Xen's back.  Therefore, Xen's copy of the inactive
- * GS base is still accurate, and doesn't need reading back from hardware.
+ * Guests cannot modify the inactive GS base behind Xen's back.  Therefore
+ * Xen's copy is still accurate and doesn't need reading back.
   *
   * Under FRED, hardware automatically swaps GS for us, so SHADOW_GS is the
   * active GS from the guest's point of view.

--
Teddy Astie | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech