All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org, mingo@kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
	x86@kernel.org, fche@redhat.com, "H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH -tip  0/2] kprobes/x86: Fix bugs for NMI handling
Date: Mon, 24 Feb 2014 11:39:09 +0900	[thread overview]
Message-ID: <530AB0CD.6090602@hitachi.com> (raw)
In-Reply-To: <20140220033924.12285.97230.stgit@ltc230.yrl.intra.hitachi.co.jp>

Hi Ingo,

Should I resend this series to your kernel.org address?

Thank you,

(2014/02/20 12:39), Masami Hiramatsu wrote:
> The following series fixes bugs hidden in the ancient code.
> 
> The bugs suddenly appeared when I enabled over 6,000 kprobes
> and ran perf-top with --call-graph. The bugs are hidden in
> the old code and it have woken up by real stress testing.
> 
> Actually, current kprobes doesn't expect an NMI handler
> hits in single-stepping state (including preparation and
> do_debug() handling). Moreover, the NMI handler causing
> a page fault by trying to access user pages, is out of
> imagination! :) But perf does it.
> 
> Thus the previous code optimistically check the current
> running kprobe state, and if it is in the singlestep state,
> it changes the IP address to probed address and return,
> because it expects the page fault happened on the single
> stepped code.
> However, in fact, the perf's NMI can interrupt the
> do_debug or somewhere around that and it may cause a
> page fault. In this case, putting the IP address to
> probed address is simply wrong. It causes unexpected
> kernel crash.
> To handle this correctly, this patch fixes it to ensure
> the page-fault address is actually same to the single-
> stepping address, and only if so, set the IP address
> to the probed address.
> 
> I also found another small mistake which gives up the
> recovery from reentered kprobes in single-stepping state,
> but it also assumes that there is no NMI handler interrupts
> in that state. It should gives up only when the nested
> reentering happens.
> 
> Thanks to Ingo and Frank for encouraging me to start
> stress testing with massive multiple kprobes. :)
> 
> Thank you,
> 
> ---
> 
> Masami Hiramatsu (2):
>       [BUGFIX]kprobes/x86: Fix page-fault handling logic
>       kprobes/x86: Allow to handle reentered kprobe on singlestepping
> 
> 
>  arch/x86/kernel/kprobes/core.c |   16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
> 
> --
> Signature
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 
> 


-- 
Masami HIRAMATSU
IT Management Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com



      parent reply	other threads:[~2014-02-24  2:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-20  3:39 [PATCH -tip 0/2] kprobes/x86: Fix bugs for NMI handling Masami Hiramatsu
2014-02-20  3:39 ` [PATCH -tip 1/2] [BUGFIX]kprobes/x86: Fix page-fault handling logic Masami Hiramatsu
2014-02-20  3:39 ` [PATCH -tip 2/2] kprobes/x86: Allow to handle reentered kprobe on singlestepping Masami Hiramatsu
2014-02-24  2:39 ` Masami Hiramatsu [this message]

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=530AB0CD.6090602@hitachi.com \
    --to=masami.hiramatsu.pt@hitachi.com \
    --cc=fche@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.