Skip to contentSkip to conversation

xen/arm: Don't call setup_virtual_regions multiple time

for-4.7 Julien Grall 3 participants 5 messages May 25, 2016

lore
Share & tools
lore
#0 lore raw

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.

---

Cc Konrad Rzeszutek Wilk <[email protected]>

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(-)
xen/arch/arm/setup.c +1 -0
index 09ff1ea..9bc11c4 100644
@@ -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();
 
xen/arch/arm/traps.c +0 -2
index 1828ea1..aa3e3c2 100644
@@ -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);
 
Signature · 7 lines
1.9.1


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#1 lore raw

Should be "multiple times" in title.

Quoted 14 lines · Julien Grall

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.

Quoted 6 lines

---

Cc Konrad Rzeszutek Wilk <[email protected]>

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:

Quoted 33 lines
---
 xen/arch/arm/setup.c | 1 +
 xen/arch/arm/traps.c | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)
xen/arch/arm/setup.c +1 -0
index 09ff1ea..9bc11c4 100644
@@ -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();
 
xen/arch/arm/traps.c +0 -2
index 1828ea1..aa3e3c2 100644
@@ -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);
 
Signature · 1 line
1.9.1

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#2 lore raw
In reply to Julien Grall
Quoted 7 lines · Julien Grall

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)!

Quoted 6 lines

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

Quoted 40 lines

---

Cc Konrad Rzeszutek Wilk <[email protected]>

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(-)
xen/arch/arm/setup.c +1 -0
index 09ff1ea..9bc11c4 100644
@@ -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();
 
xen/arch/arm/traps.c +0 -2
index 1828ea1..aa3e3c2 100644
@@ -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);
 
Signature · 1 line
1.9.1

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw
Quoted 13 lines · Konrad Rzeszutek Wilk
Quoted 7 lines · Julien Grall

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)!

Quoted 1 line
Quoted 7 lines
Quoted 5 lines

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

Pushed. Thanks everyone.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Reviewed-by
#4 lore raw
In reply to Julien Grall
Quoted 5 lines · Julien Grall

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.

Quoted 9 lines

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.

Also fwiw:

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel