diff options
author | Jeremy Fitzhardinge <jeremy@goop.org> | 2009-02-03 19:01:46 -0500 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2009-02-03 20:22:40 -0500 |
commit | 06fc732c33a7ff5e4c91bcf4a6ca86b5e335ad9a (patch) | |
tree | eb6a202f5bc01a5c8ac9f7245b9097f18ac44e57 /arch/x86/xen/multicalls.h | |
parent | b1792e367053968f2ddb48bc911d314143ce6242 (diff) |
xen: disable interrupts before saving in percpu
Impact: Fix race condition
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.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/x86/xen/multicalls.h')
-rw-r--r-- | arch/x86/xen/multicalls.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/x86/xen/multicalls.h b/arch/x86/xen/multicalls.h index 858938241616..fa3e10725d98 100644 --- a/arch/x86/xen/multicalls.h +++ b/arch/x86/xen/multicalls.h | |||
@@ -19,8 +19,10 @@ DECLARE_PER_CPU(unsigned long, xen_mc_irq_flags); | |||
19 | paired with xen_mc_issue() */ | 19 | paired with xen_mc_issue() */ |
20 | static inline void xen_mc_batch(void) | 20 | static inline void xen_mc_batch(void) |
21 | { | 21 | { |
22 | unsigned long flags; | ||
22 | /* need to disable interrupts until this entry is complete */ | 23 | /* need to disable interrupts until this entry is complete */ |
23 | local_irq_save(__get_cpu_var(xen_mc_irq_flags)); | 24 | local_irq_save(flags); |
25 | __get_cpu_var(xen_mc_irq_flags) = flags; | ||
24 | } | 26 | } |
25 | 27 | ||
26 | static inline struct multicall_space xen_mc_entry(size_t args) | 28 | static inline struct multicall_space xen_mc_entry(size_t args) |