Skip to contentSkip to conversation

xen/arm: disable interrupts on return_to_hypervisor

PATCH In review Stefano Stabellini 2 participants 2 messages Dec 5, 2012 – Dec 6, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: disable interrupts on return_to_hypervisor

At the moment it is possible to reach return_to_hypervisor with interrupts enabled (it happens all the times when we are actually going back to hypervisor mode, when we don't take the return_to_guest path).

If that happens we risk loosing the content of ELR_hyp: if we receive an interrupt right after restoring ELR_hyp, once we come back we'll have a different value in ELR_hyp and the original is lost.

In order to make the return_to_hypervisor path safe, we disable interrupts before restoring any registers.

---
 xen/arch/arm/entry.S |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
xen/arch/arm/entry.S +1 -0
index 2ff32a1..1d6ff32 100644
@@ -108,6 +108,7 @@ ENTRY(return_to_guest)
 	RESTORE_ONE_BANKED(R11_fiq); RESTORE_ONE_BANKED(R12_fiq);
 	/* Fall thru */
 ENTRY(return_to_hypervisor)
+	cpsid i
 	ldr lr, [sp, #UREGS_lr]
 	ldr r11, [sp, #UREGS_pc]
 	msr ELR_hyp, r11
Signature · 1 line
1.7.2.5
#1 lore raw
Quoted 4 lines · Stefano Stabellini

At the moment it is possible to reach return_to_hypervisor with interrupts enabled (it happens all the times when we are actually going back to hypervisor mode, when we don't take the return_to_guest path).

Quoted 8 lines

If that happens we risk loosing the content of ELR_hyp: if we receive an interrupt right after restoring ELR_hyp, once we come back we'll have a different value in ELR_hyp and the original is lost.

In order to make the return_to_hypervisor path safe, we disable interrupts before restoring any registers.

Acked + applied, thanks.