Skip to contentSkip to conversation

x86/jumpmplabel changes for v3.12-rc1

GIT PULL H. Peter Anvin 1 participant 1 message Sep 11, 2013

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

Hi Linus,

One more x86 tree for this merge window. This tree improves the handling of jump labels, so that most of the time we don't have to do a massive initial patching run. Furthermore, we will error out of the jump label is not what is expected, e.g. if it has been corrupted or tampered with.

The following changes since commit ad81f0545ef01ea651886dddac4bef6cec930092:

Linux 3.11-rc1 (2013-07-14 15:18:27 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/jumplabel

for you to fetch changes up to fb40d7a8994a3cc7a1e1c1f3258ea8662a366916:

x86/jump-label: Show where and what was wrong on errors (2013-08-06 21:54:33 -0400)

----------------------------------------------------------------
Steven Rostedt (4):
x86/jump-label: Use best default nops for inital jump label calls x86/jump-label: Do not bother updating nops if they are correct x86/jump-label: Add safety checks to jump label conversions x86/jump-label: Show where and what was wrong on errors

 arch/x86/include/asm/jump_label.h |  9 +++--
 arch/x86/kernel/jump_label.c      | 70 ++++++++++++++++++++++++++++++++++++---
 2 files changed, 73 insertions(+), 6 deletions(-)
arch/x86/include/asm/jump_label.h +7 -2
index 3a16c14..64507f3 100644
@@ -3,18 +3,23 @@
 
 #ifdef __KERNEL__
 
+#include <linux/stringify.h>
 #include <linux/types.h>
 #include <asm/nops.h>
 #include <asm/asm.h>
 
 #define JUMP_LABEL_NOP_SIZE 5
 
-#define STATIC_KEY_INITIAL_NOP ".byte 0xe9 \n\t .long 0\n\t"
+#ifdef CONFIG_X86_64
+# define STATIC_KEY_INIT_NOP P6_NOP5_ATOMIC
+#else
+# define STATIC_KEY_INIT_NOP GENERIC_NOP5_ATOMIC
+#endif
 
 static __always_inline bool arch_static_branch(struct static_key *key)
 {
 	asm goto("1:"
-		STATIC_KEY_INITIAL_NOP
+		".byte " __stringify(STATIC_KEY_INIT_NOP) "\n\t"
 		".pushsection __jump_table,  \"aw\" \n\t"
 		_ASM_ALIGN "\n\t"
 		_ASM_PTR "1b, %l[l_yes], %c0 \n\t"
arch/x86/kernel/jump_label.c +66 -4

99 lines not on this page · raw message