Re: [PATCH -tip v4 6/6] [RFC] kprobes/x86: Call exception handlersdirectly from do_int3/do_debug

From: Masami Hiramatsu
Date: Wed Dec 11 2013 - 23:40:59 EST


(2013/12/11 22:31), Jiri Kosina wrote:
> On Tue, 3 Dec 2013, Steven Rostedt wrote:
>
>>> To avoid a kernel crash by probing on lockdep code, call
>>> kprobe_int3_handler and kprobe_debug_handler directly
>>> from do_int3 and do_debug. Since there is a locking code
>>> in notify_die, lockdep code can be invoked. And because
>>> the lockdep involves printk() related things, theoretically,
>>> we need to prohibit probing on much more code...
>>>
>>> Anyway, most of the int3 handlers in the kernel are already
>>> called from do_int3 directly, e.g. ftrace_int3_handler,
>>> poke_int3_handler, kgdb_ll_trap. Actually only
>>> kprobe_exceptions_notify is on the notifier_call_chain.
>>>
>>> So I think this is not a crazy thing.
>>
>> What? Oh, yeah. No, using notifiers in int3 handler is the crazy
>> thing ;-)
>
> Yeah, it's broken. Obviously, if you happen to trigger int3 before the
> notifier has been registered, it'd cause int3 exception to be unhandled.
> See
>
> commit 17f41571bb2c4a398785452ac2718a6c5d77180e
> Author: Jiri Kosina <jkosina@xxxxxxx>
> Date: Tue Jul 23 10:09:28 2013 +0200
>
> kprobes/x86: Call out into INT3 handler directly instead of using notifier
>
> for one such issue that happened with jump labels.
>
>> Hmm, if there's no users of the int3 notifier, should we just remove it?
>
> Hmm, there are still uprobes, right?

Right, uprobes still use it, however, since it only handles user-space
breakpoint, there is no problem.

Thank you!


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


--
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/