All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH-for-4.11] xpti: fix bug in double fault handling
@ 2018-04-23 11:37 Juergen Gross
  2018-04-23 12:11 ` Jan Beulich
       [not found] ` <5ADDCD7802000078001BD8E4@suse.com>
  0 siblings, 2 replies; 4+ messages in thread
From: Juergen Gross @ 2018-04-23 11:37 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 interrupt, e.g. after re-enabling interrupts
in machine_restart().

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 tools/firmware/xen-dir/shim.config | 2 +-
 xen/arch/x86/x86_64/entry.S        | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/firmware/xen-dir/shim.config b/tools/firmware/xen-dir/shim.config
index 4d5630f87a..0b9e001436 100644
--- a/tools/firmware/xen-dir/shim.config
+++ b/tools/firmware/xen-dir/shim.config
@@ -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
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 45d9842d09..d12fbcb55d 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -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:
 
-- 
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] 4+ messages in thread

* Re: [PATCH-for-4.11] xpti: fix bug in double fault handling
  2018-04-23 11:37 [PATCH-for-4.11] xpti: fix bug in double fault handling Juergen Gross
@ 2018-04-23 12:11 ` Jan Beulich
       [not found] ` <5ADDCD7802000078001BD8E4@suse.com>
  1 sibling, 0 replies; 4+ messages in thread
From: Jan Beulich @ 2018-04-23 12:11 UTC (permalink / raw)
  To: Juergen Gross; +Cc: Andrew Cooper, xen-devel

>>> On 23.04.18 at 13:37, <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 interrupt, e.g. after re-enabling interrupts
> in machine_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.

> --- a/tools/firmware/xen-dir/shim.config
> +++ b/tools/firmware/xen-dir/shim.config
> @@ -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?

> --- a/xen/arch/x86/x86_64/entry.S
> +++ b/xen/arch/x86/x86_64/entry.S
> @@ -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
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH-for-4.11] xpti: fix bug in double fault handling
       [not found] ` <5ADDCD7802000078001BD8E4@suse.com>
@ 2018-04-23 12:22   ` Juergen Gross
  2018-04-23 12:46     ` Jan Beulich
  0 siblings, 1 reply; 4+ messages in thread
From: Juergen Gross @ 2018-04-23 12:22 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Andrew Cooper, xen-devel

On 23/04/18 14:11, Jan Beulich wrote:
>>>> On 23.04.18 at 13:37, <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 interrupt, e.g. after re-enabling interrupts
>> in machine_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.

> 
>> --- a/tools/firmware/xen-dir/shim.config
>> +++ b/tools/firmware/xen-dir/shim.config
>> @@ -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?

Oh, that one again. Sorry. Maybe we should really take my related
patch to avoid issues like this one.

> 
>> --- a/xen/arch/x86/x86_64/entry.S
>> +++ b/xen/arch/x86/x86_64/entry.S
>> @@ -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
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH-for-4.11] xpti: fix bug in double fault handling
  2018-04-23 12:22   ` Juergen Gross
@ 2018-04-23 12:46     ` Jan Beulich
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Beulich @ 2018-04-23 12:46 UTC (permalink / raw)
  To: Juergen Gross; +Cc: Andrew Cooper, xen-devel

>>> On 23.04.18 at 14:22, <jgross@suse.com> wrote:
> On 23/04/18 14:11, Jan Beulich wrote:
>>>>> On 23.04.18 at 13:37, <jgross@suse.com> wrote:
>>> --- a/tools/firmware/xen-dir/shim.config
>>> +++ b/tools/firmware/xen-dir/shim.config
>>> @@ -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?
> 
> 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
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-23 11:37 [PATCH-for-4.11] xpti: fix bug in double fault handling Juergen Gross
2018-04-23 12:11 ` Jan Beulich
     [not found] ` <5ADDCD7802000078001BD8E4@suse.com>
2018-04-23 12:22   ` Juergen Gross
2018-04-23 12:46     ` 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.