lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Mon,  6 Jul 2020 18:42:15 +0200
From:   Sebastian Andrzej Siewior <>
Cc:     Thomas Gleixner <>,
        Ingo Molnar <>, Borislav Petkov <>,, "H. Peter Anvin" <>,
        Sebastian Andrzej Siewior <>
Subject: [PATCH] x86/alternatives: Let __text_poke() acquire the pte lock with enabled interrupts

The pte lock is never acquired from an IRQ-off region so it does not
require the interrupts to be disabled.
RT complains here because the spinlock_t must not be acquired with
disabled interrupts.

use_temporary_mm() expects interrupts to be off because it invokes
switch_mm_irqs_off() and uses per-CPU (current active mm) data.

Move local_irq_save() after the the pte lock has been acquired. Move
local_irq_restore() after the pte lock has been released.

Signed-off-by: Sebastian Andrzej Siewior <>
 arch/x86/kernel/alternative.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 8fd39ff74a499..7c59a87ebbde8 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -872,8 +872,6 @@ static void *__text_poke(void *addr, const void *opcode, size_t len)
 	BUG_ON(!pages[0] || (cross_page_boundary && !pages[1]));
-	local_irq_save(flags);
 	 * Map the page without the global bit, as TLB flushing is done with
 	 * flush_tlb_mm_range(), which is intended for non-global PTEs.
@@ -890,6 +888,8 @@ static void *__text_poke(void *addr, const void *opcode, size_t len)
+	local_irq_save(flags);
 	pte = mk_pte(pages[0], pgprot);
 	set_pte_at(poking_mm, poking_addr, ptep, pte);
@@ -939,8 +939,8 @@ static void *__text_poke(void *addr, const void *opcode, size_t len)
 	BUG_ON(memcmp(addr, opcode, len));
-	pte_unmap_unlock(ptep, ptl);
+	pte_unmap_unlock(ptep, ptl);
 	return addr;

Powered by blists - more mailing lists