xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [for-4.7] xen/arm: Don't call setup_virtual_regions multiple time
@ 2016-05-25 13:14 Julien Grall
  2016-05-25 13:28 ` Wei Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Julien Grall @ 2016-05-25 13:14 UTC (permalink / raw)
  To: xen-devel; +Cc: Julien Grall, sstabellini, wei.liu2, Chenxia Zhao

The commit 2aa925be84293b44ad587ed117184ace61b41dd6 "arm/x86: Use struct
virtual_region to do bug, symbol, and (x86) exception tables lookup."
has introduced virtual_region. The call to initialize those regions is
made in init_traps which is called during each CPU bring up.

This will result to register multiple time the same region and Xen crash
when an address is looked up.

This can be fixed by moving the call to setup_virtual_region directly in
start_xen.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reported-by: Chenxia Zhao <chenxiao.zhao@gmail.com>

---

Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

    This is a bug fix for Xen 4.7. Without this change, any use of
    virtual_region (printing a symbol) could lead to a crash in Xen.
---
 xen/arch/arm/setup.c | 1 +
 xen/arch/arm/traps.c | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 09ff1ea..9bc11c4 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -722,6 +722,7 @@ void __init start_xen(unsigned long boot_phys_offset,
     set_current((struct vcpu *)0xfffff000); /* debug sanity */
     idle_vcpu[0] = current;
 
+    setup_virtual_regions(NULL, NULL);
     /* Initialize traps early allow us to get backtrace when an error occurred */
     init_traps();
 
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 1828ea1..aa3e3c2 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -102,8 +102,6 @@ integer_param("debug_stack_lines", debug_stack_lines);
 
 void init_traps(void)
 {
-    setup_virtual_regions(NULL, NULL);
-
     /* Setup Hyp vector base */
     WRITE_SYSREG((vaddr_t)hyp_traps_vector, VBAR_EL2);
 
-- 
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [for-4.7] xen/arm: Don't call setup_virtual_regions multiple time
  2016-05-25 13:14 [for-4.7] xen/arm: Don't call setup_virtual_regions multiple time Julien Grall
@ 2016-05-25 13:28 ` Wei Liu
  2016-05-25 13:37 ` Konrad Rzeszutek Wilk
  2016-05-25 13:37 ` Wei Liu
  2 siblings, 0 replies; 5+ messages in thread
From: Wei Liu @ 2016-05-25 13:28 UTC (permalink / raw)
  To: Julien Grall; +Cc: sstabellini, wei.liu2, Chenxia Zhao, xen-devel

Should be "multiple times" in title.

On Wed, May 25, 2016 at 02:14:06PM +0100, Julien Grall wrote:
> The commit 2aa925be84293b44ad587ed117184ace61b41dd6 "arm/x86: Use struct
> virtual_region to do bug, symbol, and (x86) exception tables lookup."
> has introduced virtual_region. The call to initialize those regions is
> made in init_traps which is called during each CPU bring up.
> 
> This will result to register multiple time the same region and Xen crash
> when an address is looked up.
> 
> This can be fixed by moving the call to setup_virtual_region directly in
> start_xen.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>
> Reported-by: Chenxia Zhao <chenxiao.zhao@gmail.com>
> 
> ---
> 
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> 
>     This is a bug fix for Xen 4.7. Without this change, any use of
>     virtual_region (printing a symbol) could lead to a crash in Xen.

Yes, this needs fixing.

And of course this is all ARM code and you're the maintainer so I'm fine
with this going in:

Release-acked-by: Wei Liu <wei.liu2@citrix.com>

> ---
>  xen/arch/arm/setup.c | 1 +
>  xen/arch/arm/traps.c | 2 --
>  2 files changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
> index 09ff1ea..9bc11c4 100644
> --- a/xen/arch/arm/setup.c
> +++ b/xen/arch/arm/setup.c
> @@ -722,6 +722,7 @@ void __init start_xen(unsigned long boot_phys_offset,
>      set_current((struct vcpu *)0xfffff000); /* debug sanity */
>      idle_vcpu[0] = current;
>  
> +    setup_virtual_regions(NULL, NULL);
>      /* Initialize traps early allow us to get backtrace when an error occurred */
>      init_traps();
>  
> diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
> index 1828ea1..aa3e3c2 100644
> --- a/xen/arch/arm/traps.c
> +++ b/xen/arch/arm/traps.c
> @@ -102,8 +102,6 @@ integer_param("debug_stack_lines", debug_stack_lines);
>  
>  void init_traps(void)
>  {
> -    setup_virtual_regions(NULL, NULL);
> -
>      /* Setup Hyp vector base */
>      WRITE_SYSREG((vaddr_t)hyp_traps_vector, VBAR_EL2);
>  
> -- 
> 1.9.1
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [for-4.7] xen/arm: Don't call setup_virtual_regions multiple time
  2016-05-25 13:14 [for-4.7] xen/arm: Don't call setup_virtual_regions multiple time Julien Grall
  2016-05-25 13:28 ` Wei Liu
@ 2016-05-25 13:37 ` Konrad Rzeszutek Wilk
  2016-05-25 13:44   ` Wei Liu
  2016-05-25 13:37 ` Wei Liu
  2 siblings, 1 reply; 5+ messages in thread
From: Konrad Rzeszutek Wilk @ 2016-05-25 13:37 UTC (permalink / raw)
  To: Julien Grall; +Cc: sstabellini, wei.liu2, Chenxia Zhao, xen-devel

On Wed, May 25, 2016 at 02:14:06PM +0100, Julien Grall wrote:
> The commit 2aa925be84293b44ad587ed117184ace61b41dd6 "arm/x86: Use struct
> virtual_region to do bug, symbol, and (x86) exception tables lookup."
> has introduced virtual_region. The call to initialize those regions is
> made in init_traps which is called during each CPU bring up.
> 
> This will result to register multiple time the same region and Xen crash
> when an address is looked up.

AAh, and that would explain why I didn't see it when I ran it under
the emulator - I couldn't boot it with more than one CPU (the TIMER bug)!

> 
> This can be fixed by moving the call to setup_virtual_region directly in
> start_xen.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>
> Reported-by: Chenxia Zhao <chenxiao.zhao@gmail.com>

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> 
> ---
> 
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> 
>     This is a bug fix for Xen 4.7. Without this change, any use of
>     virtual_region (printing a symbol) could lead to a crash in Xen.
> ---
>  xen/arch/arm/setup.c | 1 +
>  xen/arch/arm/traps.c | 2 --
>  2 files changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
> index 09ff1ea..9bc11c4 100644
> --- a/xen/arch/arm/setup.c
> +++ b/xen/arch/arm/setup.c
> @@ -722,6 +722,7 @@ void __init start_xen(unsigned long boot_phys_offset,
>      set_current((struct vcpu *)0xfffff000); /* debug sanity */
>      idle_vcpu[0] = current;
>  
> +    setup_virtual_regions(NULL, NULL);
>      /* Initialize traps early allow us to get backtrace when an error occurred */
>      init_traps();
>  
> diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
> index 1828ea1..aa3e3c2 100644
> --- a/xen/arch/arm/traps.c
> +++ b/xen/arch/arm/traps.c
> @@ -102,8 +102,6 @@ integer_param("debug_stack_lines", debug_stack_lines);
>  
>  void init_traps(void)
>  {
> -    setup_virtual_regions(NULL, NULL);
> -
>      /* Setup Hyp vector base */
>      WRITE_SYSREG((vaddr_t)hyp_traps_vector, VBAR_EL2);
>  
> -- 
> 1.9.1
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [for-4.7] xen/arm: Don't call setup_virtual_regions multiple time
  2016-05-25 13:14 [for-4.7] xen/arm: Don't call setup_virtual_regions multiple time Julien Grall
  2016-05-25 13:28 ` Wei Liu
  2016-05-25 13:37 ` Konrad Rzeszutek Wilk
@ 2016-05-25 13:37 ` Wei Liu
  2 siblings, 0 replies; 5+ messages in thread
From: Wei Liu @ 2016-05-25 13:37 UTC (permalink / raw)
  To: Julien Grall; +Cc: sstabellini, wei.liu2, Chenxia Zhao, xen-devel

On Wed, May 25, 2016 at 02:14:06PM +0100, Julien Grall wrote:
> The commit 2aa925be84293b44ad587ed117184ace61b41dd6 "arm/x86: Use struct
> virtual_region to do bug, symbol, and (x86) exception tables lookup."
> has introduced virtual_region. The call to initialize those regions is
> made in init_traps which is called during each CPU bring up.
> 
> This will result to register multiple time the same region and Xen crash
> when an address is looked up.
> 
> This can be fixed by moving the call to setup_virtual_region directly in
> start_xen.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>
> Reported-by: Chenxia Zhao <chenxiao.zhao@gmail.com>
> 

Also fwiw:
Reviewed-by: Wei Liu <wei.liu2@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [for-4.7] xen/arm: Don't call setup_virtual_regions multiple time
  2016-05-25 13:37 ` Konrad Rzeszutek Wilk
@ 2016-05-25 13:44   ` Wei Liu
  0 siblings, 0 replies; 5+ messages in thread
From: Wei Liu @ 2016-05-25 13:44 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: Julien Grall, sstabellini, wei.liu2, Chenxia Zhao, xen-devel

On Wed, May 25, 2016 at 09:37:09AM -0400, Konrad Rzeszutek Wilk wrote:
> On Wed, May 25, 2016 at 02:14:06PM +0100, Julien Grall wrote:
> > The commit 2aa925be84293b44ad587ed117184ace61b41dd6 "arm/x86: Use struct
> > virtual_region to do bug, symbol, and (x86) exception tables lookup."
> > has introduced virtual_region. The call to initialize those regions is
> > made in init_traps which is called during each CPU bring up.
> > 
> > This will result to register multiple time the same region and Xen crash
> > when an address is looked up.
> 
> AAh, and that would explain why I didn't see it when I ran it under
> the emulator - I couldn't boot it with more than one CPU (the TIMER bug)!
> 
> > 
> > This can be fixed by moving the call to setup_virtual_region directly in
> > start_xen.
> > 
> > Signed-off-by: Julien Grall <julien.grall@arm.com>
> > Reported-by: Chenxia Zhao <chenxiao.zhao@gmail.com>
> 
> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

Pushed. Thanks everyone.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

end of thread, other threads:[~2016-05-25 13:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-25 13:14 [for-4.7] xen/arm: Don't call setup_virtual_regions multiple time Julien Grall
2016-05-25 13:28 ` Wei Liu
2016-05-25 13:37 ` Konrad Rzeszutek Wilk
2016-05-25 13:44   ` Wei Liu
2016-05-25 13:37 ` Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).