All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] xpti: fix bug in double fault handling
@ 2018-04-23 13:59 Juergen Gross
  2018-04-23 14:05 ` Andrew Cooper
  2018-04-23 14:06 ` Jan Beulich
  0 siblings, 2 replies; 3+ messages in thread
From: Juergen Gross @ 2018-04-23 13:59 UTC (permalink / raw)
  To: xen-devel; +Cc: Juergen Gross, andrew.cooper3, jbeulich

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.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 xen/arch/x86/x86_64/entry.S | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 45d9842d09..1cd7d93892 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -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
-- 
2.13.6


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] xpti: fix bug in double fault handling
  2018-04-23 13:59 [PATCH v3] xpti: fix bug in double fault handling Juergen Gross
@ 2018-04-23 14:05 ` Andrew Cooper
  2018-04-23 14:06 ` Jan Beulich
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Cooper @ 2018-04-23 14:05 UTC (permalink / raw)
  To: Juergen Gross, xen-devel; +Cc: jbeulich

On 23/04/18 14:59, Juergen Gross 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 exception, so repair this in order to allow
> exception handling to work even after a double fault.
>
> Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>

> ---
>  xen/arch/x86/x86_64/entry.S | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
> index 45d9842d09..1cd7d93892 100644
> --- a/xen/arch/x86/x86_64/entry.S
> +++ b/xen/arch/x86/x86_64/entry.S
> @@ -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


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] xpti: fix bug in double fault handling
  2018-04-23 13:59 [PATCH v3] xpti: fix bug in double fault handling Juergen Gross
  2018-04-23 14:05 ` Andrew Cooper
@ 2018-04-23 14:06 ` Jan Beulich
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2018-04-23 14:06 UTC (permalink / raw)
  To: Juergen Gross; +Cc: Andrew Cooper, xen-devel

>>> On 23.04.18 at 15:59, <jgross@suse.com> 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 exception, so repair this in order to allow
> exception handling to work even after a double fault.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>
(and I'm glad Andrew had noticed the issue before me putting this in)

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-04-23 14:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-23 13:59 [PATCH v3] xpti: fix bug in double fault handling Juergen Gross
2018-04-23 14:05 ` Andrew Cooper
2018-04-23 14:06 ` Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.