Re: [PATCH 3/3] x86: WARN_ON breakpoints from .kprobes.text section

From: Abhishek Sagar
Date: Mon Jan 28 2008 - 06:16:52 EST


On 1/28/08, Masami Hiramatsu <mhiramat@xxxxxxxxxx> wrote:
> Thank you for explanation, I hope I can understand it.
> Even if it causes a trap recursively, it could be checked (and ignored) by
> longjump_break_handler(), and passed to the debugger correctly.

Yes, all non-kprobe breakpoints are left to the kernel to be handled.
The objective here is to intercept the trap handling of a certain
category of such breakpoints and emit a warning. The premise being
that .kprobes.text section is a logical breakpoint-free zone.

> Please consider that someone expands jprobe(jprobe2) which uses
> jprobe_return2() instead of jprobe_return(), how would you handle it?

By a simple modification of is_jprobe_bkpt() (defined in patch #2 of
this series).

> Current kprobes provides an opportunity to those external probe frameworks
> for checking it by themselves.

Could you clarirfy this with some example. For now I'm assuming that
by external probe frameworks you mean kernel modules using kprobes. If
they embed breakpoints in their handlers, then they will simply not be
caught by this check because thay cannot lie in the .kprobes.text
section.

> By the way, external kernel debugger knows how kprobe (and exception notifier)
> works, so I think it can fetch his exception before kprobes does (by tweaking
> notifier chain, etc).
> (I hope all external kernel debuggers take care of it. :-))

I would image that from a code correctness's point of view it
shouldn't matter. In any case, nothing can be done if the kprobe
exception notifier is circumvented.

> Masami Hiramatsu
>
> Software Engineer
> Hitachi Computer Products (America) Inc.
> Software Solutions Division
>
> e-mail: mhiramat@xxxxxxxxxx

--
Thanks,
Abhishek Sagar
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/