linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Jason Baron <jbaron@redhat.com>,
	Frederic Weisbecker <fweisbec@gmail.com>
Subject: Re: [PATCH 0/5 v2] [GIT PULL] x86/jump label: Paranoid checks and 2 or 5 byte nops
Date: Thu, 02 Feb 2012 17:04:40 -0500	[thread overview]
Message-ID: <1328220280.5882.122.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <1328193068.5882.95.camel@gandalf.stny.rr.com>

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

On Thu, 2012-02-02 at 09:31 -0500, Steven Rostedt wrote:

> This code died on "enabling" the nop. I think the code now enables some
> nops by default on boot up, which doesn't expect to see the
> "default_nop".
> 

Ah, we do have jump labels that are default on. I'm still not triggering
these, I'm not sure why. Perhaps a command line difference?

Anyway, this should fix the bug:

-- Steve


Ingo,

Please pull the latest tip/perf/jump-label-4 tree, which can be found at:

  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
tip/perf/jump-label-4

Head SHA1: 7bbd9688727dd30cd44b90b3c9c35f0f66af77ff


Steven Rostedt (1):
      x86/jump labels: Handle initialization of enabled nops

----
 arch/x86/kernel/jump_label.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---------------------------
commit 7bbd9688727dd30cd44b90b3c9c35f0f66af77ff
Author: Steven Rostedt <srostedt@redhat.com>
Date:   Thu Feb 2 16:55:43 2012 -0500

    x86/jump labels: Handle initialization of enabled nops
    
    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>

diff --git a/arch/x86/kernel/jump_label.c b/arch/x86/kernel/jump_label.c
index 2839524..d560c80 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);


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2012-02-02 22:04 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-28 16:09 [PATCH 0/5 v2] [GIT PULL] x86/jump label: Paranoid checks and 2 or 5 byte nops Steven Rostedt
2012-01-28 16:09 ` [PATCH 1/5 v2] x86/jump-label: Use best default nops for inital jump label calls Steven Rostedt
2012-01-28 16:09 ` [PATCH 2/5 v2] x86/jump-label: Do not bother updating nops if they are correct Steven Rostedt
2012-01-28 16:09 ` [PATCH 3/5 v2] x86/jump-label: Add safety checks to jump label conversions Steven Rostedt
2012-01-28 16:09 ` [PATCH 4/5 v2] jump labels: Add infrastructure to update jump labels at compile time Steven Rostedt
2012-01-28 16:09 ` [PATCH 5/5 v2] x86/jump labels: Use etiher 5 byte or 2 byte jumps Steven Rostedt
2012-01-30 14:48 ` [PATCH 0/5 v2] [GIT PULL] x86/jump label: Paranoid checks and 2 or 5 byte nops Ingo Molnar
2012-01-30 15:07   ` Steven Rostedt
2012-01-31 19:48     ` Ingo Molnar
2012-02-01  5:08       ` Steven Rostedt
2012-02-01  8:05         ` Ingo Molnar
2012-02-01 13:20           ` Steven Rostedt
2012-02-01 15:21           ` Steven Rostedt
2012-02-02 13:51             ` Ingo Molnar
2012-02-02 14:10               ` H. Peter Anvin
2012-02-02 14:31                 ` Steven Rostedt
2012-02-02 22:04                   ` Steven Rostedt [this message]
2012-02-02 22:07                     ` H. Peter Anvin
2012-02-02 22:53                       ` Steven Rostedt
2012-02-03  7:36                   ` Ingo Molnar
2012-02-03 13:31                     ` Steven Rostedt
2012-02-05 11:47                       ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1328220280.5882.122.camel@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jbaron@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).