Skip to contentSkip to conversation

Fix jump label with RO/NX module protection

PATCH In review matthieu castet 1 participant 2 messages Jan 23, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix jump label with RO/NX module protection

I think it should be applied before 2.6.38 release, because without this patch there can be crash if RO/NX module protection and jump label are enabled.

Quoted 1 line

From 0eeba453aaba0ebff86f0a7ad9bfb8afbde0c0dc Mon Sep 17 00:00:00 2001

From: Matthieu CASTET <[email protected]>
Date: Thu, 20 Jan 2011 21:25:03 +0100
Subject: [PATCH] Fix jump table in module init section

If we use jump table in module init, there are marked as removed in __jump_table section after init is done.

But we already applied ro permissions on the module, so we can't modify a read only section (crash in remove_jump_label_module_init).

Make the __jump_table section rw.

---
 arch/x86/include/asm/jump_label.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/include/asm/jump_label.h +1 -1
index f52d42e..574dbc2 100644
@@ -14,7 +14,7 @@
 	do {							\
 		asm goto("1:"					\
 			JUMP_LABEL_INITIAL_NOP			\
-			".pushsection __jump_table,  \"a\" \n\t"\
+			".pushsection __jump_table,  \"aw\" \n\t"\
 			_ASM_PTR "1b, %l[" #label "], %c0 \n\t" \
 			".popsection \n\t"			\
 			: :  "i" (key) :  : label);		\
Signature · 1 line
1.7.2.3
#1 lore raw

[tip:x86/urgent] x86: Fix jump label with RO/NX module protection crash

Commit-ID:  8969691343354bdd80eff5405a0f879edbf013d6
Gitweb:     http://git.kernel.org/tip/8969691343354bdd80eff5405a0f879edbf013d6
Author:     matthieu castet <[email protected]>
AuthorDate: Sun, 23 Jan 2011 15:45:52 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Sun, 23 Jan 2011 16:12:45 +0100

x86: Fix jump label with RO/NX module protection crash

If we use jump table in module init, there are marked as removed in __jump_table section after init is done.

But we already applied ro permissions on the module, so we can't modify a read only section (crash in remove_jump_label_module_init).

Make the __jump_table section rw.

Cc Xiaotian Feng <[email protected]>
Cc Jason Baron <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arjan van de Ven <[email protected]>
Cc Siarhei Liakh <[email protected]>
Cc Xuxian Jiang <[email protected]>
Cc James Morris <[email protected]>
Cc Rusty Russell <[email protected]>
Cc Dave Jones <[email protected]>
Cc Kees Cook <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Andrew Morton <[email protected]>

LKML-Reference: <[email protected]>

---
 arch/x86/include/asm/jump_label.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/include/asm/jump_label.h +1 -1
index f52d42e..574dbc2 100644
@@ -14,7 +14,7 @@
 	do {							\
 		asm goto("1:"					\
 			JUMP_LABEL_INITIAL_NOP			\
-			".pushsection __jump_table,  \"a\" \n\t"\
+			".pushsection __jump_table,  \"aw\" \n\t"\
 			_ASM_PTR "1b, %l[" #label "], %c0 \n\t" \
 			".popsection \n\t"			\
 			: :  "i" (key) :  : label);		\