Skip to contentSkip to conversation

xpti: fix bug in double fault handling

PATCH Superseded Juergen Gross 3 participants 5 messages Apr 23, 2018 1 message not in the archive

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 xpti: fix bug in double fault handling

When entering the hypervisor via the double fault handler resetting xen_cr3 was missing. This led to switching to pv_cr3 when returning from the next following interrupt. So repair this in order to allow interrupt handling to work even after a double fault.

---
 xen/arch/x86/x86_64/entry.S | 1 +
 1 file changed, 1 insertion(+)
xen/arch/x86/x86_64/entry.S +1 -0
index 45d9842d09..25427b0cec 100644
@@ -773,6 +773,7 @@ ENTRY(double_fault)
         neg   %rbx
 .Ldblf_cr3_load:
         mov   %rbx, %cr3
+        movq $0, STACK_CPUINFO_FIELD(xen_cr3)(%r14)
 .Ldblf_cr3_okay:
 
         movq  %rsp,%rdi
Signature · 7 lines
2.13.6


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 23.04.18 at 14:38, <[email protected]> wrote:

When entering the hypervisor via the double fault handler resetting xen_cr3 was missing. This led to switching to pv_cr3 when returning from the next following interrupt. So repair this in order to allow interrupt handling to work even after a double fault.

With s/interrupt/exception/ (or s/interrupt/interruption/) on the description (which is easy enough to do while committing)

I take it that your Rab can be implied here.

Jan

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

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 23.04.18 at 14:38, <[email protected]> wrote:

When entering the hypervisor via the double fault handler resetting xen_cr3 was missing. This led to switching to pv_cr3 when returning from the next following interrupt. So repair this in order to allow interrupt handling to work even after a double fault.

Quoted 7 lines
Quoted 1 line

With s/interrupt/exception/ (or s/interrupt/interruption/) on the description (which is easy enough to do while committing)

I take it that your Rab can be implied here.

Correct. :-)

Juergen

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

#4 lore raw
In reply to Juergen Gross
Quoted 15 lines · Juergen Gross

When entering the hypervisor via the double fault handler resetting xen_cr3 was missing. This led to switching to pv_cr3 when returning from the next following interrupt. So repair this in order to allow interrupt handling to work even after a double fault.

---
 xen/arch/x86/x86_64/entry.S | 1 +
 1 file changed, 1 insertion(+)
xen/arch/x86/x86_64/entry.S +0 -0
index 45d9842d09..25427b0cec 100644

xen/arch/x86/x86_64/entry.S ENTRY(double_fault) · line 779

Quoted 7 lines
xen/arch/x86/x86_64/entry.S +1 -0
@@ -773,6 +773,7 @@ ENTRY(double_fault)
         neg   %rbx
 .Ldblf_cr3_load:
         mov   %rbx, %cr3
+        movq $0, STACK_CPUINFO_FIELD(xen_cr3)(%r14)
 .Ldblf_cr3_okay:
 
         movq  %rsp,%rdi

What about the other write into xen_cr3 with a negated value?  Won't this still explode if we get an NMI or MCE at the wrong moment?

~Andrew

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

#5 lore raw
Quoted 22 lines · Andrew Cooper
Quoted 21 lines · Juergen Gross

When entering the hypervisor via the double fault handler resetting xen_cr3 was missing. This led to switching to pv_cr3 when returning from the next following interrupt. So repair this in order to allow interrupt handling to work even after a double fault.

---
 xen/arch/x86/x86_64/entry.S | 1 +
 1 file changed, 1 insertion(+)
xen/arch/x86/x86_64/entry.S +1 -0
index 45d9842d09..25427b0cec 100644
@@ -773,6 +773,7 @@ ENTRY(double_fault)
         neg   %rbx
 .Ldblf_cr3_load:
         mov   %rbx, %cr3
+        movq $0, STACK_CPUINFO_FIELD(xen_cr3)(%r14)
 .Ldblf_cr3_okay:
 
Quoted 4 lines

xen/arch/x86/x86_64/entry.S ENTRY(double_fault) · line 779

Quoted 1 line
xen/arch/x86/x86_64/entry.S +0 -0
         movq  %rsp,%rdi

What about the other write into xen_cr3 with a negated value?  Won't this still explode if we get an NMI or MCE at the wrong moment?

Hmm, you mean a NMI between the mov to %cr3 and zeroing xen_cr3? Could be an issue, yes. Okay, V3 then...

Juergen

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