The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] Fix jump label with RO/NX module protection
@ 2011-01-23 14:45 matthieu castet
  2011-01-23 18:03 ` [tip:x86/urgent] x86: Fix jump label with RO/NX module protection crash tip-bot for matthieu castet
  0 siblings, 1 reply; 2+ messages in thread
From: matthieu castet @ 2011-01-23 14:45 UTC (permalink / raw)
  To: Linux Kernel list
  Cc: Xiaotian Feng, Ingo Molnar, linux-security-module, Jason Baron

[-- Attachment #1: Type: text/plain, Size: 153 bytes --]

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.

[-- Attachment #2: 0001-Fix-jump-table-in-module-init-section.patch --]
[-- Type: text/x-diff, Size: 1145 bytes --]

>From 0eeba453aaba0ebff86f0a7ad9bfb8afbde0c0dc Mon Sep 17 00:00:00 2001
From: Matthieu CASTET <castet.matthieu@free.fr>
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.

Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
---
 arch/x86/include/asm/jump_label.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/include/asm/jump_label.h b/arch/x86/include/asm/jump_label.h
index f52d42e..574dbc2 100644
--- a/arch/x86/include/asm/jump_label.h
+++ b/arch/x86/include/asm/jump_label.h
@@ -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);		\
-- 
1.7.2.3


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

* [tip:x86/urgent] x86: Fix jump label with RO/NX module protection crash
  2011-01-23 14:45 [PATCH] Fix jump label with RO/NX module protection matthieu castet
@ 2011-01-23 18:03 ` tip-bot for matthieu castet
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for matthieu castet @ 2011-01-23 18:03 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: sliakh.lkml, mingo, torvalds, rusty, a.p.zijlstra, jiang,
	fweisbec, akpm, rostedt, kees.cook, tglx, jbaron, xtfeng,
	linux-kernel, hpa, jmorris, arjan, davej, castet.matthieu, mingo

Commit-ID:  8969691343354bdd80eff5405a0f879edbf013d6
Gitweb:     http://git.kernel.org/tip/8969691343354bdd80eff5405a0f879edbf013d6
Author:     matthieu castet <castet.matthieu@free.fr>
AuthorDate: Sun, 23 Jan 2011 15:45:52 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
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.

Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
Cc: Xiaotian Feng <xtfeng@gmail.com>
Cc: Jason Baron <jbaron@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Siarhei Liakh <sliakh.lkml@gmail.com>
Cc: Xuxian Jiang <jiang@cs.ncsu.edu>
Cc: James Morris <jmorris@namei.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Dave Jones <davej@redhat.com>
Cc: Kees Cook <kees.cook@canonical.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
LKML-Reference: <4D3C3F20.7030203@free.fr>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/include/asm/jump_label.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/include/asm/jump_label.h b/arch/x86/include/asm/jump_label.h
index f52d42e..574dbc2 100644
--- a/arch/x86/include/asm/jump_label.h
+++ b/arch/x86/include/asm/jump_label.h
@@ -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);		\

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

end of thread, other threads:[~2011-01-23 18:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-23 14:45 [PATCH] Fix jump label with RO/NX module protection matthieu castet
2011-01-23 18:03 ` [tip:x86/urgent] x86: Fix jump label with RO/NX module protection crash tip-bot for matthieu castet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox