From: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
To: "Abhishek Sagar" <sagar.abhishek@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
jkenisto@us.ibm.com, "Masami Hiramatsu" <mhiramat@redhat.com>,
"Ingo Molnar" <mingo@elte.hu>
Subject: Re: [PATCH 0/3][RFC] x86: Catch stray non-kprobe breakpoints
Date: Tue, 29 Jan 2008 18:48:21 +0530 [thread overview]
Message-ID: <20080129131821.GA27312@in.ibm.com> (raw)
In-Reply-To: <863e9df20801290240t6c724cb9x145fd6b1ca4f3c78@mail.gmail.com>
On Tue, Jan 29, 2008 at 04:10:58PM +0530, Abhishek Sagar wrote:
> On 1/29/08, Ananth N Mavinakayanahalli <ananth@in.ibm.com> wrote:
> > > Non kprobe breakpoints in the kernel might lie inside the .kprobes.text section. Such breakpoints can easily be identified by in_kprobes_functions and can be caught early. These are problematic and a warning should be emitted to discourage them (in any rare case, if they actually occur).
> >
> > Why? As Masami indicated in an earlier reply, the annotation is to
> > prevent *only* kprobes.
>
> May be I'm completely off the mark here, but shouldn't a small subset
> of this section simply be 'breakpoint-free' rather than 'kprobe-free'?
> Placing a breakpoint on kprobe_handler (say) can loop into a recursive
> trap without allowing the debugger's notifier chain to be invoked.
A well heeled debugger will necessarily take care of saving contexts
(using techniques like setjmp/longjmp, etc) to help it recover from such
nested cases (See xmon for example).
> I'm assuming that non-kprobe exception notifiers may (or even should) run
> after kprobe's notifier callback (kprobe_exceptions_notify).
Yes, any such notifier is invoked after kprobe's callback as the kprobe
notifier is always registered with the highest priority.
> > > For this, a check can route the trap handling of such breakpoints away from kprobe_handler (which ends up calling even more functions marked as __kprobes) from inside kprobe_exceptions_notify.
> >
> > Well.. we pass on control of a !kprobe breakpoint to the kernel. This is
> > exactly what permits debuggers like xmon to work fine now.
>
> This will still happen. It doesn't stop non-kprobe breakpoints from
> being handled, wherever they may be.
>
> > I don't see any harm in such breakpoints being handled autonomously
> > without any sort of kprobe influence.
>
> Here's what seems to be happening currently:
>
> int3 (non-kprobe) -> do_int3 ->kprobe_exceptions_notify ->
> kprobe_handler (passes the buck to the kernel) -> non-krpobe/debugger
> exception handler.
>
> Here's what the patch will do:
>
> int3 (non-kprobe) -> do_int3 ->kprobe_exceptions_notify ->
> WARN_ON/kprobe_handler -> non-kprobe/debugger exception handler.
>
> The WARN_ON (and not a BUG_ON) will be hit iff:
> (in_kprobes_functions(addr) && !is_jprobe_bkpt(addr))
But that still is unneeded dmesg clutter, IMHO.
Ananth
next prev parent reply other threads:[~2008-01-29 13:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-27 9:08 [PATCH 0/3][RFC] x86: Catch stray non-kprobe breakpoints Abhishek Sagar
2008-01-29 6:02 ` Ananth N Mavinakayanahalli
2008-01-29 10:40 ` Abhishek Sagar
2008-01-29 13:18 ` Ananth N Mavinakayanahalli [this message]
2008-01-29 17:24 ` Abhishek Sagar
2008-01-29 15:13 ` Masami Hiramatsu
2008-01-29 18:08 ` Abhishek Sagar
2008-01-29 19:29 ` Masami Hiramatsu
2008-01-30 4:07 ` Ananth N Mavinakayanahalli
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=20080129131821.GA27312@in.ibm.com \
--to=ananth@in.ibm.com \
--cc=jkenisto@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@redhat.com \
--cc=mingo@elte.hu \
--cc=sagar.abhishek@gmail.com \
/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.