xpti: fix bug in double fault handling
PATCH v3 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 exception, so repair this in order to allow exception handling to work even after a double fault.
--- xen/arch/x86/x86_64/entry.S | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
xen/arch/x86/x86_64/entry.S +3 -1
@@ -767,12 +767,14 @@ ENTRY(double_fault) /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */ mov STACK_CPUINFO_FIELD(xen_cr3)(%r14), %rbx - test %rbx, %rbx + neg %rbx jz .Ldblf_cr3_okay jns .Ldblf_cr3_load + mov %rbx, STACK_CPUINFO_FIELD(xen_cr3)(%r14) 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
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 23.04.18 at 15:59, <[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 exception, so repair this in order to allow exception handling to work even after a double fault.Signed-off-by Juergen Gross <[email protected]>
(and I'm glad Andrew had noticed the issue before me putting this in)
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 6 lines · Juergen Gross
When entering the hypervisor via the double fault handler resetting
xen_cr3was missing. This led to switching topv_cr3when returning from the next following exception, so repair this in order to allow exception handling to work even after a double fault.Signed-off-by Juergen Gross <[email protected]>
Quoted 14 lines
--- xen/arch/x86/x86_64/entry.S | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)xen/arch/x86/x86_64/entry.S +1
-1@@ -767,12 +767,14 @@ ENTRY(double_fault) /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */ mov STACK_CPUINFO_FIELD(xen_cr3)(%r14), %rbx - test %rbx, %rbx + neg %rbx
xen/arch/x86/x86_64/entry.S ENTRY(double_fault) · line 780
Quoted 10 lines
xen/arch/x86/x86_64/entry.S +2
-0jz .Ldblf_cr3_okay jns .Ldblf_cr3_load + mov %rbx, STACK_CPUINFO_FIELD(xen_cr3)(%r14) neg %rbx .Ldblf_cr3_load: mov %rbx, %cr3 + movq $0, STACK_CPUINFO_FIELD(xen_cr3)(%r14) .Ldblf_cr3_okay: movq %rsp,%rdi
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel