All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5.4] x86: ipipe: Harden path between use_temporary_mm and unuse_temporary_mm
@ 2021-03-14 16:08 Jan Kiszka
  2021-03-14 17:14 ` Philippe Gerum
  0 siblings, 1 reply; 12+ messages in thread
From: Jan Kiszka @ 2021-03-14 16:08 UTC (permalink / raw)
  To: Xenomai

From: Jan Kiszka <jan.kiszka@siemens.com>

This is only called during early init, e.g. for switching alternatives.
Still, switch_mm_irqs_off would complain without this, and we are better
safe than sorry.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

4.19 is not affected. Dovetail solves this differently, via 
local_irq_save_full which is not available in I-pipe and not worth to 
introduce for this purpose.

 arch/x86/include/asm/mmu_context.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h
index 0d9dd08c2122..2b4afca4e15f 100644
--- a/arch/x86/include/asm/mmu_context.h
+++ b/arch/x86/include/asm/mmu_context.h
@@ -383,6 +383,7 @@ static inline temp_mm_state_t use_temporary_mm(struct mm_struct *mm)
 	temp_mm_state_t temp_state;
 
 	lockdep_assert_irqs_disabled();
+	hard_cond_local_irq_disable();
 	temp_state.mm = this_cpu_read(cpu_tlbstate.loaded_mm);
 	switch_mm_irqs_off(NULL, mm, current);
 
@@ -407,6 +408,7 @@ static inline void unuse_temporary_mm(temp_mm_state_t prev_state)
 {
 	lockdep_assert_irqs_disabled();
 	switch_mm_irqs_off(NULL, prev_state.mm, current);
+	hard_cond_local_irq_enable();
 
 	/*
 	 * Restore the breakpoints if they were disabled before the temporary mm
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-03-15 12:11 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-14 16:08 [PATCH 5.4] x86: ipipe: Harden path between use_temporary_mm and unuse_temporary_mm Jan Kiszka
2021-03-14 17:14 ` Philippe Gerum
2021-03-15  6:19   ` Jan Kiszka
2021-03-15  8:08     ` Jan Kiszka
2021-03-15  9:03       ` Philippe Gerum
2021-03-15  9:00     ` Philippe Gerum
2021-03-15  9:22       ` Jan Kiszka
2021-03-15  9:43         ` Philippe Gerum
2021-03-15 10:02           ` Philippe Gerum
2021-03-15  9:47         ` Philippe Gerum
2021-03-15  9:57           ` Jan Kiszka
2021-03-15 12:11             ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.