Skip to contentSkip to conversation

xen/arm64: Make show_registers working even if current is not correctly set

PATCH Applied Julien Grall 2 participants 3 messages Sep 30, 2014 – Oct 1, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm64: Make show_registers working even if current is not correctly set

The commit 8ab802c "xen/arm: Restricted access to IFSR32_EL2 and FPEXC32_EL2" introduced the use of the variable current in show_registers.

The variable is not correctly set until Xen has finished to boot. Therefore any call to show_registers will result to crash Xen.

As the register IFSR32_EL2 is only printed when the registers represent a guest view, Xen can read the value only for this case.

---

This is a bug fix for Xen 4.5.

---
 xen/arch/arm/traps.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/traps.c +1 -1
index cda0523..4b4b4e0 100644
@@ -790,7 +790,7 @@ void show_registers(struct cpu_user_regs *regs)
 #else
     ctxt.far = READ_SYSREG(FAR_EL1);
     ctxt.esr_el1 = READ_SYSREG(ESR_EL1);
-    if ( is_32bit_domain(current->domain) )
+    if ( guest_mode(regs) && is_32bit_domain(current->domain) )
         ctxt.ifsr32_el2 = READ_SYSREG(IFSR32_EL2);
 #endif
     ctxt.vttbr_el2 = READ_SYSREG64(VTTBR_EL2);
Signature · 1 line
1.7.10.4
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Julien Grall

The commit 8ab802c "xen/arm: Restricted access to IFSR32_EL2 and FPEXC32_EL2" introduced the use of the variable current in show_registers.

The variable is not correctly set until Xen has finished to boot. Therefore any call to show_registers will result to crash Xen.

As the register IFSR32_EL2 is only printed when the registers represent a guest view, Xen can read the value only for this case.

Applied
#2 lore raw
Quoted 7 lines · Ian Campbell
Quoted 6 lines · Julien Grall

The commit 8ab802c "xen/arm: Restricted access to IFSR32_EL2 and FPEXC32_EL2" introduced the use of the variable current in show_registers.

The variable is not correctly set until Xen has finished to boot. Therefore any call to show_registers will result to crash Xen.

Quoted 6 lines
Quoted 4 lines

As the register IFSR32_EL2 is only printed when the registers represent a guest view, Xen can read the value only for this case.

Applied.