Skip to contentSkip to conversation

x86/pv: Fix up erroneous segments for 32bit syscall entry

PATCH In review Andrew Cooper 4 participants 8 messages Apr 9, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/pv: Fix up erroneous segments for 32bit syscall entry

The existing FLAT_KERNEL_SS expands to the correct value, 0xe02b, but is the wrong constant to use. Switch to FLAT_USER_SS32.

For compat domains however, the reported values are entirely bogus. FLAT_USER_SS32 (value 0xe02b) is FLAT_RING3_CS in the 32bit ABI, while FLAT_USER_CS32 (value 0xe023) is FLAT_RING1_DS with an RPL of 3.

The guests SYSCALL callback is invoked with a broken iret frame, and if left unmodified by the guest, will fail on the way back out when Xen's iret tries to load a code segment into %ss.

In practice, this is only a problem for 32bit PV guests on AMD hardware, as Intel hardware doesn't permit the SYSCALL instruction outside of 64bit mode.

This appears to have been broken ever since 64bit support was added to Xen, and has gone unnoticed because Linux doesn't use SYSCALL in 32bit builds.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>
CC: Juergen Gross <[email protected]>

This wants backporting basically everywhere, and as such, also wants to be considered for 4.11 at this point.

---
 xen/arch/x86/x86_64/compat/entry.S | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
xen/arch/x86/x86_64/compat/entry.S +6 -1
index 6c7fcf9..2bc046c 100644
@@ -197,7 +197,7 @@ ENTRY(cstar_enter)
         /* sti could live here when we don't switch page tables below. */
         CR4_PV32_RESTORE
         movq  8(%rsp),%rax /* Restore %rax. */
-        movq  $FLAT_KERNEL_SS,8(%rsp)
+        movq  $FLAT_USER_SS32, 8(%rsp) /* Assume a 64bit domain.  Compat handled lower. */
         pushq %r11
         pushq $FLAT_USER_CS32
         pushq %rcx
@@ -223,6 +223,11 @@ ENTRY(cstar_enter)
         movq  VCPU_domain(%rbx),%rcx
         cmpb  $0,DOMAIN_is_32bit_pv(%rcx)
         je    switch_to_kernel
+
+        /* Fix up reported %cs/%ss for compat domains. */
+        movl  $0xe033, UREGS_ss(%rsp) /* Compat FLAT_RING3_SS */
+        movl  $0xe02b, UREGS_cs(%rsp) /* Compat FLAT_RING3_CS */
+
         cmpb  $0,VCPU_syscall32_disables_events(%rbx)
         movzwl VCPU_syscall32_sel(%rbx),%esi
         movq  VCPU_syscall32_addr(%rbx),%rax
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 44 lines · Andrew Cooper

The existing FLAT_KERNEL_SS expands to the correct value, 0xe02b, but is the wrong constant to use. Switch to FLAT_USER_SS32.

For compat domains however, the reported values are entirely bogus. FLAT_USER_SS32 (value 0xe02b) is FLAT_RING3_CS in the 32bit ABI, while FLAT_USER_CS32 (value 0xe023) is FLAT_RING1_DS with an RPL of 3.

The guests SYSCALL callback is invoked with a broken iret frame, and if left unmodified by the guest, will fail on the way back out when Xen's iret tries to load a code segment into %ss.

In practice, this is only a problem for 32bit PV guests on AMD hardware, as Intel hardware doesn't permit the SYSCALL instruction outside of 64bit mode.

This appears to have been broken ever since 64bit support was added to Xen, and has gone unnoticed because Linux doesn't use SYSCALL in 32bit builds.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>
CC: Juergen Gross <[email protected]>

This wants backporting basically everywhere, and as such, also wants to be considered for 4.11 at this point.

---
 xen/arch/x86/x86_64/compat/entry.S | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
xen/arch/x86/x86_64/compat/entry.S +1 -1
index 6c7fcf9..2bc046c 100644
@@ -197,7 +197,7 @@ ENTRY(cstar_enter)
         /* sti could live here when we don't switch page tables below. */
         CR4_PV32_RESTORE
         movq  8(%rsp),%rax /* Restore %rax. */
-        movq  $FLAT_KERNEL_SS,8(%rsp)
+        movq  $FLAT_USER_SS32, 8(%rsp) /* Assume a 64bit domain.  Compat handled lower. */
         pushq %r11
         pushq $FLAT_USER_CS32
         pushq %rcx

xen/arch/x86/x86_64/compat/entry.S ENTRY(cstar_enter) · line 229

Quoted 7 lines
xen/arch/x86/x86_64/compat/entry.S +4 -0
@@ -223,6 +223,11 @@ ENTRY(cstar_enter)
         movq  VCPU_domain(%rbx),%rcx
         cmpb  $0,DOMAIN_is_32bit_pv(%rcx)
         je    switch_to_kernel
+
+        /* Fix up reported %cs/%ss for compat domains. */
+        movl  $0xe033, UREGS_ss(%rsp) /* Compat FLAT_RING3_SS */
+        movl  $0xe02b, UREGS_cs(%rsp) /* Compat FLAT_RING3_CS */

I wonder if it would be better to introduce COMPAT_FLAT_RING3_* in xen-x86_64.h?

In any case, the reasoning and code looks correct to me:

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
Quoted 55 lines · Wei Liu
Quoted 44 lines · Andrew Cooper

The existing FLAT_KERNEL_SS expands to the correct value, 0xe02b, but is the wrong constant to use. Switch to FLAT_USER_SS32.

For compat domains however, the reported values are entirely bogus. FLAT_USER_SS32 (value 0xe02b) is FLAT_RING3_CS in the 32bit ABI, while FLAT_USER_CS32 (value 0xe023) is FLAT_RING1_DS with an RPL of 3.

The guests SYSCALL callback is invoked with a broken iret frame, and if left unmodified by the guest, will fail on the way back out when Xen's iret tries to load a code segment into %ss.

In practice, this is only a problem for 32bit PV guests on AMD hardware, as Intel hardware doesn't permit the SYSCALL instruction outside of 64bit mode.

This appears to have been broken ever since 64bit support was added to Xen, and has gone unnoticed because Linux doesn't use SYSCALL in 32bit builds.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>
CC: Juergen Gross <[email protected]>

This wants backporting basically everywhere, and as such, also wants to be considered for 4.11 at this point.

---
 xen/arch/x86/x86_64/compat/entry.S | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
xen/arch/x86/x86_64/compat/entry.S +1 -1
index 6c7fcf9..2bc046c 100644
@@ -197,7 +197,7 @@ ENTRY(cstar_enter)
         /* sti could live here when we don't switch page tables below. */
         CR4_PV32_RESTORE
         movq  8(%rsp),%rax /* Restore %rax. */
-        movq  $FLAT_KERNEL_SS,8(%rsp)
+        movq  $FLAT_USER_SS32, 8(%rsp) /* Assume a 64bit domain.  Compat handled lower. */
         pushq %r11
         pushq $FLAT_USER_CS32
         pushq %rcx

xen/arch/x86/x86_64/compat/entry.S ENTRY(cstar_enter) · line 229

Quoted 7 lines
xen/arch/x86/x86_64/compat/entry.S +4 -0
@@ -223,6 +223,11 @@ ENTRY(cstar_enter)
         movq  VCPU_domain(%rbx),%rcx
         cmpb  $0,DOMAIN_is_32bit_pv(%rcx)
         je    switch_to_kernel
+
+        /* Fix up reported %cs/%ss for compat domains. */
+        movl  $0xe033, UREGS_ss(%rsp) /* Compat FLAT_RING3_SS */
+        movl  $0xe02b, UREGS_cs(%rsp) /* Compat FLAT_RING3_CS */

I wonder if it would be better to introduce COMPAT_FLAT_RING3_* in xen-x86_64.h?

Quoted 3 lines

In any case, the reasoning and code looks correct to me:

I considered that, and am open to suggestions.  The problem is that we don't want to put COMPAT definitions in that header file, because they are inapplicable to 64bit PV guests, who are intended consumers.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw
Quoted 56 lines · Andrew Cooper
Quoted 55 lines · Wei Liu
Quoted 44 lines · Andrew Cooper

The existing FLAT_KERNEL_SS expands to the correct value, 0xe02b, but is the wrong constant to use. Switch to FLAT_USER_SS32.

For compat domains however, the reported values are entirely bogus. FLAT_USER_SS32 (value 0xe02b) is FLAT_RING3_CS in the 32bit ABI, while FLAT_USER_CS32 (value 0xe023) is FLAT_RING1_DS with an RPL of 3.

The guests SYSCALL callback is invoked with a broken iret frame, and if left unmodified by the guest, will fail on the way back out when Xen's iret tries to load a code segment into %ss.

In practice, this is only a problem for 32bit PV guests on AMD hardware, as Intel hardware doesn't permit the SYSCALL instruction outside of 64bit mode.

This appears to have been broken ever since 64bit support was added to Xen, and has gone unnoticed because Linux doesn't use SYSCALL in 32bit builds.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>
CC: Juergen Gross <[email protected]>

This wants backporting basically everywhere, and as such, also wants to be considered for 4.11 at this point.

---
 xen/arch/x86/x86_64/compat/entry.S | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
xen/arch/x86/x86_64/compat/entry.S +1 -1
index 6c7fcf9..2bc046c 100644
@@ -197,7 +197,7 @@ ENTRY(cstar_enter)
         /* sti could live here when we don't switch page tables below. */
         CR4_PV32_RESTORE
         movq  8(%rsp),%rax /* Restore %rax. */
-        movq  $FLAT_KERNEL_SS,8(%rsp)
+        movq  $FLAT_USER_SS32, 8(%rsp) /* Assume a 64bit domain.  Compat handled lower. */
         pushq %r11
         pushq $FLAT_USER_CS32
         pushq %rcx

xen/arch/x86/x86_64/compat/entry.S ENTRY(cstar_enter) · line 229

Quoted 7 lines
xen/arch/x86/x86_64/compat/entry.S +4 -0
@@ -223,6 +223,11 @@ ENTRY(cstar_enter)
         movq  VCPU_domain(%rbx),%rcx
         cmpb  $0,DOMAIN_is_32bit_pv(%rcx)
         je    switch_to_kernel
+
+        /* Fix up reported %cs/%ss for compat domains. */
+        movl  $0xe033, UREGS_ss(%rsp) /* Compat FLAT_RING3_SS */
+        movl  $0xe02b, UREGS_cs(%rsp) /* Compat FLAT_RING3_CS */

I wonder if it would be better to introduce COMPAT_FLAT_RING3_* in xen-x86_64.h?

Quoted 7 lines
Quoted 3 lines

In any case, the reasoning and code looks correct to me:

I considered that, and am open to suggestions.  The problem is that we don't want to put COMPAT definitions in that header file, because they are inapplicable to 64bit PV guests, who are intended consumers.

Add a way to include x86_32.h defining the needed COMPAT_* macros only?

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw
Quoted 57 lines · Juergen Gross
Quoted 56 lines · Andrew Cooper
Quoted 55 lines · Wei Liu
Quoted 44 lines · Andrew Cooper

The existing FLAT_KERNEL_SS expands to the correct value, 0xe02b, but is the wrong constant to use. Switch to FLAT_USER_SS32.

For compat domains however, the reported values are entirely bogus. FLAT_USER_SS32 (value 0xe02b) is FLAT_RING3_CS in the 32bit ABI, while FLAT_USER_CS32 (value 0xe023) is FLAT_RING1_DS with an RPL of 3.

The guests SYSCALL callback is invoked with a broken iret frame, and if left unmodified by the guest, will fail on the way back out when Xen's iret tries to load a code segment into %ss.

In practice, this is only a problem for 32bit PV guests on AMD hardware, as Intel hardware doesn't permit the SYSCALL instruction outside of 64bit mode.

This appears to have been broken ever since 64bit support was added to Xen, and has gone unnoticed because Linux doesn't use SYSCALL in 32bit builds.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>
CC: Juergen Gross <[email protected]>

This wants backporting basically everywhere, and as such, also wants to be considered for 4.11 at this point.

---
 xen/arch/x86/x86_64/compat/entry.S | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
xen/arch/x86/x86_64/compat/entry.S +1 -1
index 6c7fcf9..2bc046c 100644
@@ -197,7 +197,7 @@ ENTRY(cstar_enter)
         /* sti could live here when we don't switch page tables below. */
         CR4_PV32_RESTORE
         movq  8(%rsp),%rax /* Restore %rax. */
-        movq  $FLAT_KERNEL_SS,8(%rsp)
+        movq  $FLAT_USER_SS32, 8(%rsp) /* Assume a 64bit domain.  Compat handled lower. */
         pushq %r11
         pushq $FLAT_USER_CS32
         pushq %rcx

xen/arch/x86/x86_64/compat/entry.S ENTRY(cstar_enter) · line 229

Quoted 7 lines
xen/arch/x86/x86_64/compat/entry.S +4 -0
@@ -223,6 +223,11 @@ ENTRY(cstar_enter)
         movq  VCPU_domain(%rbx),%rcx
         cmpb  $0,DOMAIN_is_32bit_pv(%rcx)
         je    switch_to_kernel
+
+        /* Fix up reported %cs/%ss for compat domains. */
+        movl  $0xe033, UREGS_ss(%rsp) /* Compat FLAT_RING3_SS */
+        movl  $0xe02b, UREGS_cs(%rsp) /* Compat FLAT_RING3_CS */

I wonder if it would be better to introduce COMPAT_FLAT_RING3_* in xen-x86_64.h?

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

In any case, the reasoning and code looks correct to me:

I considered that, and am open to suggestions.  The problem is that we don't want to put COMPAT definitions in that header file, because they are inapplicable to 64bit PV guests, who are intended consumers.

Add a way to include x86_32.h defining the needed COMPAT_* macros only?

For the same argument as the 64bit side, x86_32.h shouldn't contain COMPAT_* defines, as they are inapplicable.

Furthermore, the constants can't be shared in such an include, because of naming conflicts with x86_64.h.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#5 lore raw
In reply to Wei Liu
Quoted 47 lines · Wei Liu
Quoted 46 lines · Andrew Cooper

The existing FLAT_KERNEL_SS expands to the correct value, 0xe02b, but is the wrong constant to use. Switch to FLAT_USER_SS32.

For compat domains however, the reported values are entirely bogus. FLAT_USER_SS32 (value 0xe02b) is FLAT_RING3_CS in the 32bit ABI, while FLAT_USER_CS32 (value 0xe023) is FLAT_RING1_DS with an RPL of 3.

The guests SYSCALL callback is invoked with a broken iret frame, and if left unmodified by the guest, will fail on the way back out when Xen's iret tries to load a code segment into %ss.

In practice, this is only a problem for 32bit PV guests on AMD hardware, as Intel hardware doesn't permit the SYSCALL instruction outside of 64bit mode.

This appears to have been broken ever since 64bit support was added to Xen, and has gone unnoticed because Linux doesn't use SYSCALL in 32bit builds.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>
CC: Juergen Gross <[email protected]>

This wants backporting basically everywhere, and as such, also wants to be considered for 4.11 at this point.

---
 xen/arch/x86/x86_64/compat/entry.S | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
xen/arch/x86/x86_64/compat/entry.S +1 -1
index 6c7fcf9..2bc046c 100644
@@ -197,7 +197,7 @@ ENTRY(cstar_enter)
         /* sti could live here when we don't switch page tables below. */
         CR4_PV32_RESTORE
         movq  8(%rsp),%rax /* Restore %rax. */
-        movq  $FLAT_KERNEL_SS,8(%rsp)
+        movq  $FLAT_USER_SS32, 8(%rsp) /* Assume a 64bit domain.  Compat handled lower. */
         pushq %r11
         pushq $FLAT_USER_CS32
         pushq %rcx
@@ -223,6 +223,11 @@ ENTRY(cstar_enter)
         movq  VCPU_domain(%rbx),%rcx
         cmpb  $0,DOMAIN_is_32bit_pv(%rcx)
Quoted 8 lines

xen/arch/x86/x86_64/compat/entry.S ENTRY(cstar_enter) · line 229

Quoted 5 lines
xen/arch/x86/x86_64/compat/entry.S +4 -0
         je    switch_to_kernel
+
+        /* Fix up reported %cs/%ss for compat domains. */
+        movl  $0xe033, UREGS_ss(%rsp) /* Compat FLAT_RING3_SS */
+        movl  $0xe02b, UREGS_cs(%rsp) /* Compat FLAT_RING3_CS */

I wonder if it would be better to introduce COMPAT_FLAT_RING3_* in xen-x86_64.h?

That was my first thought, too.

Quoted 4 lines

In any case, the reasoning and code looks correct to me:

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by
#6 lore raw
In reply to Wei Liu
Quoted 49 lines
Quoted 1 line
Quoted 1 line · On 09.04.18 at 12:44, <[email protected]> wrote:
Quoted 24 lines · Andrew Cooper

The existing FLAT_KERNEL_SS expands to the correct value, 0xe02b, but is the wrong constant to use. Switch to FLAT_USER_SS32.

For compat domains however, the reported values are entirely bogus. FLAT_USER_SS32 (value 0xe02b) is FLAT_RING3_CS in the 32bit ABI, while FLAT_USER_CS32 (value 0xe023) is FLAT_RING1_DS with an RPL of 3.

The guests SYSCALL callback is invoked with a broken iret frame, and if left unmodified by the guest, will fail on the way back out when Xen's iret tries to load a code segment into %ss.

In practice, this is only a problem for 32bit PV guests on AMD hardware, as Intel hardware doesn't permit the SYSCALL instruction outside of 64bit mode.

This appears to have been broken ever since 64bit support was added to Xen, and has gone unnoticed because Linux doesn't use SYSCALL in 32bit builds.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>
CC: Juergen Gross <[email protected]>

Review

Quoted 7 lines

This wants backporting basically everywhere, and as such, also wants to be considered for 4.11 at this point.

---
 xen/arch/x86/x86_64/compat/entry.S | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/xen/arch/x86/x86_64/compat/entry.S

Quoted 15 lines

index 6c7fcf9..2bc046c 100644

xen/arch/x86/x86_64/compat/entry.S +1 -1
@@ -197,7 +197,7 @@ ENTRY(cstar_enter)
         /* sti could live here when we don't switch page tables below. */
         CR4_PV32_RESTORE
         movq  8(%rsp),%rax /* Restore %rax. */
-        movq  $FLAT_KERNEL_SS,8(%rsp)
+        movq  $FLAT_USER_SS32, 8(%rsp) /* Assume a 64bit domain.  Compat handled lower. */
         pushq %r11
         pushq $FLAT_USER_CS32
         pushq %rcx
@@ -223,6 +223,11 @@ ENTRY(cstar_enter)
         movq  VCPU_domain(%rbx),%rcx
         cmpb  $0,DOMAIN_is_32bit_pv(%rcx)
Quoted 8 lines

xen/arch/x86/x86_64/compat/entry.S ENTRY(cstar_enter) · line 229

Quoted 5 lines
xen/arch/x86/x86_64/compat/entry.S +4 -0
         je    switch_to_kernel
+
+        /* Fix up reported %cs/%ss for compat domains. */
+        movl  $0xe033, UREGS_ss(%rsp) /* Compat FLAT_RING3_SS */
+        movl  $0xe02b, UREGS_cs(%rsp) /* Compat FLAT_RING3_CS */

I wonder if it would be better to introduce COMPAT_FLAT_RING3_* in xen-x86_64.h?

We already have FLAT_COMPAT_RING3_{CS,DS,SS} - I don't see why two of them couldn't be used here (or their FLAT_COMPAT_USER_* aliases). With that

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#7 lore raw
Quoted 56 lines · Jan Beulich
Quoted 48 lines
Quoted 1 line
Quoted 1 line · On 09.04.18 at 12:44, <[email protected]> wrote:
Quoted 24 lines · Andrew Cooper

The existing FLAT_KERNEL_SS expands to the correct value, 0xe02b, but is the wrong constant to use. Switch to FLAT_USER_SS32.

For compat domains however, the reported values are entirely bogus. FLAT_USER_SS32 (value 0xe02b) is FLAT_RING3_CS in the 32bit ABI, while FLAT_USER_CS32 (value 0xe023) is FLAT_RING1_DS with an RPL of 3.

The guests SYSCALL callback is invoked with a broken iret frame, and if left unmodified by the guest, will fail on the way back out when Xen's iret tries to load a code segment into %ss.

In practice, this is only a problem for 32bit PV guests on AMD hardware, as Intel hardware doesn't permit the SYSCALL instruction outside of 64bit mode.

This appears to have been broken ever since 64bit support was added to Xen, and has gone unnoticed because Linux doesn't use SYSCALL in 32bit builds.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>
CC: Juergen Gross <[email protected]>

Review

Quoted 7 lines

This wants backporting basically everywhere, and as such, also wants to be considered for 4.11 at this point.

---
 xen/arch/x86/x86_64/compat/entry.S | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/xen/arch/x86/x86_64/compat/entry.S

Quoted 14 lines

index 6c7fcf9..2bc046c 100644

xen/arch/x86/x86_64/compat/entry.S +1 -1
@@ -197,7 +197,7 @@ ENTRY(cstar_enter)
         /* sti could live here when we don't switch page tables below. */
         CR4_PV32_RESTORE
         movq  8(%rsp),%rax /* Restore %rax. */
-        movq  $FLAT_KERNEL_SS,8(%rsp)
+        movq  $FLAT_USER_SS32, 8(%rsp) /* Assume a 64bit domain.  Compat handled lower. */
         pushq %r11
         pushq $FLAT_USER_CS32
         pushq %rcx
@@ -223,6 +223,11 @@ ENTRY(cstar_enter)
         movq  VCPU_domain(%rbx),%rcx
Quoted 8 lines

xen/arch/x86/x86_64/compat/entry.S ENTRY(cstar_enter) · line 229

Quoted 6 lines
xen/arch/x86/x86_64/compat/entry.S +4 -0
         cmpb  $0,DOMAIN_is_32bit_pv(%rcx)
         je    switch_to_kernel
+
+        /* Fix up reported %cs/%ss for compat domains. */
+        movl  $0xe033, UREGS_ss(%rsp) /* Compat FLAT_RING3_SS */
+        movl  $0xe02b, UREGS_cs(%rsp) /* Compat FLAT_RING3_CS */

I wonder if it would be better to introduce COMPAT_FLAT_RING3_* in xen-x86_64.h?

Quoted 4 lines

We already have FLAT_COMPAT_RING3_{CS,DS,SS} - I don't see why two of them couldn't be used here (or their FLAT_COMPAT_USER_* aliases). With that

Ooh - so we have.  I'd completely missed those.  Will fix.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel