[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH for 4.5] xen/arm: flush_tlb_domain: Disable IRQ when flushing TLB of another domain



When Xen is flushing the TLB for another domain than current, it has to
switch temporaly to the P2M of this domain. If the IRQs are enabled, it may
be possible to receive an interrupt that require to use the P2M of the current
domain, or even temporaly switch to another P2M.
For the former case, the translation would be wrong. For the latter one,
as the handler would restore the current P2M, Xen would flush the wrong domain
TLB.

Thankfully we don't have such interrupt handler, but it may be necessary
in the future to do that during when the user asks to dump domain stack via
a keystroke.

Signed-off-by: Julien Grall <julien.grall@xxxxxxxxxx>
---
    I'd like to see this patch in Xen 4.5. This may help people that want to
    implement a such keystroke handler (and even fix the current '0'). It will
    also avoid to introduce possible security issue on their own Xen-based
    product.

    The code is self contained and the interrupt is disabled/enabled within
    the same function and same check.
---
 xen/arch/arm/p2m.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 1585d35..c02bb2c 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -112,17 +112,25 @@ void p2m_restore_state(struct vcpu *n)
 
 void flush_tlb_domain(struct domain *d)
 {
+    unsigned long flags = 0;
+
     /* Update the VTTBR if necessary with the domain d. In this case,
      * it's only necessary to flush TLBs on every CPUs with the current VMID
      * (our domain).
      */
     if ( d != current->domain )
+    {
+        local_irq_save(flags);
         p2m_load_VTTBR(d);
+    }
 
     flush_tlb();
 
     if ( d != current->domain )
+    {
         p2m_load_VTTBR(current->domain);
+        local_irq_restore(flags);
+    }
 }
 
 /*
-- 
1.7.10.4


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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.