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, e.g. after re-enabling interrupts in machine_restart().
--- tools/firmware/xen-dir/shim.config | 2 +- xen/arch/x86/x86_64/entry.S | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
tools/firmware/xen-dir/shim.config +1 -1
@@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Xen/x86 4.11-unstable Configuration +# Xen/x86 4.11-rc Configuration # CONFIG_X86_64=y CONFIG_X86=y
xen/arch/x86/x86_64/entry.S +1 -0
@@ -772,6 +772,7 @@ ENTRY(double_fault) jns .Ldblf_cr3_load neg %rbx .Ldblf_cr3_load: + movq $0, STACK_CPUINFO_FIELD(xen_cr3)(%r14) mov %rbx, %cr3 .Ldblf_cr3_okay:
Signature · 7 lines
2.13.6 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 23.04.18 at 13:37, <[email protected]> wrote:
When entering the hypervisor via the double fault handler resetting
xen_cr3was missing. This led to switching topv_cr3when returning from the next following interrupt, e.g. after re-enabling interrupts inmachine_restart().
Pointing at bad behavior to justify a change is not very helpful, I think. Andrew's argument of exception handling wanting to continue to work even after a #DF is a better one imo.
tools/firmware/xen-dir/shim.config line 6
Quoted 10 lines
tools/firmware/xen-dir/shim.config +1
-1@@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Xen/x86 4.11-unstable Configuration +# Xen/x86 4.11-rc Configuration # CONFIG_X86_64=y CONFIG_X86=y
Stray change?
xen/arch/x86/x86_64/entry.S ENTRY(double_fault) · line 777
Quoted 9 lines
xen/arch/x86/x86_64/entry.S +1
-0@@ -772,6 +772,7 @@ ENTRY(double_fault) jns .Ldblf_cr3_load neg %rbx .Ldblf_cr3_load: + movq $0, STACK_CPUINFO_FIELD(xen_cr3)(%r14) mov %rbx, %cr3 .Ldblf_cr3_okay:
Just like for the other code paths this write should be after the CR3 load, or else NMI or #MC occurring between the two would fail to update CR3.
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]
Quoted 9 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 23.04.18 at 13:37, <[email protected]> wrote:
When entering the hypervisor via the double fault handler resetting
xen_cr3was missing. This led to switching topv_cr3when returning from the next following interrupt, e.g. after re-enabling interrupts inmachine_restart().Pointing at bad behavior to justify a change is not very helpful, I think. Andrew's argument of exception handling wanting to continue to work even after a #DF is a better one imo.
Okay.
Quoted 13 lines
tools/firmware/xen-dir/shim.config line 6
Quoted 11 lines
tools/firmware/xen-dir/shim.config +1
-1@@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Xen/x86 4.11-unstable Configuration +# Xen/x86 4.11-rc Configuration # CONFIG_X86_64=y CONFIG_X86=yStray change?
Oh, that one again. Sorry. Maybe we should really take my related patch to avoid issues like this one.
Quoted 13 lines
xen/arch/x86/x86_64/entry.S ENTRY(double_fault) · line 777
Quoted 10 lines
xen/arch/x86/x86_64/entry.S +1
-0@@ -772,6 +772,7 @@ ENTRY(double_fault) jns .Ldblf_cr3_load neg %rbx .Ldblf_cr3_load: + movq $0, STACK_CPUINFO_FIELD(xen_cr3)(%r14) mov %rbx, %cr3 .Ldblf_cr3_okay:Just like for the other code paths this write should be after the CR3 load, or else NMI or #MC occurring between the two would fail to update CR3.
Aah, right.
Will send V2 soon.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 16 lines
Quoted 1 line
Quoted 1 line · On 23.04.18 at 14:22, <[email protected]> wrote:
Quoted 13 lines · Jan Beulich
tools/firmware/xen-dir/shim.config line 6
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 23.04.18 at 13:37, <[email protected]> wrote:
tools/firmware/xen-dir/shim.config +1
-1@@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Xen/x86 4.11-unstable Configuration +# Xen/x86 4.11-rc Configuration # CONFIG_X86_64=y CONFIG_X86=yStray change?
Quoted 2 lines
Oh, that one again. Sorry. Maybe we should really take my related patch to avoid issues like this one.
I agree, but I'm not a maintainer of the file.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel