lkml.org 
[lkml]   [2012]   [Mar]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 7/7] x86/jump labels: Handle initialization of enabled nops
From: Steven Rostedt <srostedt@redhat.com>

When jump labels are initialized at boot up, they are compared
to the default_nop before switching to the ideal nop.

But if a jump label is enabled by default on start up, the
enabled code does not test against the default nop, only the
ideal nop. But as this jump label has not been converted to the
ideal nop, it fails the check, and will crash the box.

The enabled path needs to be aware of initialization too.

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
arch/x86/kernel/jump_label.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/jump_label.c b/arch/x86/kernel/jump_label.c
index 9bae2c9..c3ae7c3 100644
--- a/arch/x86/kernel/jump_label.c
+++ b/arch/x86/kernel/jump_label.c
@@ -66,7 +66,8 @@ static void __jump_label_transform(struct jump_entry *entry,
code.jump_short = 0xeb;
code.offset = entry->target - (entry->code + 2);
/* Check for overflow ? */
- } else if (memcmp(ip, ideal_nop, 5) == 0) {
+ } else if ((!init && memcmp(ip, ideal_nop, 5) == 0) ||
+ (init && memcmp(ip, default_nop, 5) == 0)) {
size = JUMP_LABEL_NOP_SIZE;
code.jump = 0xe9;
code.offset = entry->target - (entry->code + size);
--
1.7.8.3

[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2012-03-08 23:25    [W:0.134 / U:0.824 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site