xen: disable interrupts before saving in percpu
Subsystems (2)
PATCH 1/1 xen: disable interrupts before saving in percpu
xen_mc_batch has a small preempt race where it takes the address of a percpu variable immediately before disabling interrupts, thereby leaving a small window in which we may migrate to another cpu and save the flags in the wrong percpu variable. Disable interrupts before saving the old flags in a percpu.
---arch/x86/xen/multicalls.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
===================================================================
arch/x86/xen/multicalls.h +0 -0
@@ -19,8 +19,10 @@paired with xen_mc_issue() */
static inline void xen_mc_batch(void)
{
+ unsigned long flags; /* need to disable interrupts until this entry is complete */
- local_irq_save(__get_cpu_var(xen_mc_irq_flags));
+ local_irq_save(flags);
+ __get_cpu_var(xen_mc_irq_flags) = flags;
}
static inline struct multicall_space xen_mc_entry(size_t args)
H. Peter Anvin
AppliedQuoted 5 lines · Jeremy Fitzhardinge
xen_mc_batchhas a small preempt race where it takes the address of a percpu variable immediately before disabling interrupts, thereby leaving a small window in which we may migrate to another cpu and save the flags in the wrong percpu variable. Disable interrupts before saving the old flags in a percpu.
Applied to tip:core/xen, thanks!
-hpa
Quoted 10 lines · H. Peter Anvin
Quoted 6 lines · Jeremy Fitzhardinge
xen_mc_batchhas a small preempt race where it takes the address of a percpu variable immediately before disabling interrupts, thereby leaving a small window in which we may migrate to another cpu and save the flags in the wrong percpu variable. Disable interrupts before saving the old flags in a percpu.Applied to tip:core/xen, thanks!
Can you push this Linusward too?
Thanks,
J
Quoted 10 lines · Jeremy Fitzhardinge
Quoted 9 lines · H. Peter Anvin
Quoted 6 lines · Jeremy Fitzhardinge
xen_mc_batchhas a small preempt race where it takes the address of a percpu variable immediately before disabling interrupts, thereby leaving a small window in which we may migrate to another cpu and save the flags in the wrong percpu variable. Disable interrupts before saving the old flags in a percpu.
Quoted 4 lines
Quoted 1 line
Applied to tip:core/xen, thanks!
Can you push this Linusward too?
Just merged into tip:core/urgent, so it should end up in the next set of pull requests.
-hpa