From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Peter Zijlstra <peterz@infradead.org>,
Vince Weaver <vincent.weaver@maine.edu>,
LKML <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>, Dave Jones <davej@redhat.com>
Subject: Re: perf/tracepoint: another fuzzer generated lockup
Date: Sun, 17 Nov 2013 16:53:59 +0900 [thread overview]
Message-ID: <52887617.7050302@hitachi.com> (raw)
In-Reply-To: <20131115142851.GA17498@localhost.localdomain>
(2013/11/15 23:28), Frederic Weisbecker wrote:
> On Fri, Nov 15, 2013 at 09:15:21AM -0500, Steven Rostedt wrote:
>> On Fri, 15 Nov 2013 13:28:33 +0100
>> Peter Zijlstra <peterz@infradead.org> wrote:
>>
>>> On Fri, Nov 15, 2013 at 10:16:18AM +0900, Masami Hiramatsu wrote:
>>>> Kprobes itself can detect nested call by using per-cpu current-running
>>>> kprobe pointer. And if it is nested, it just skips calling handlers.
>>>> Anyway, I don't recommend to probe inside the handlers, but yes,
>>>> you can trace perf-handler by ftrace B). I actually traced a kprobe-bug
>>>> by kprobe-tracer last night, that was amazing :)
>>>
>>> Ah, ok, so that would avoid the worst problems. Good. Should we still
>>> mark the entire perf swevent path as __kprobes just to be sure?
>>
>> I wouldn't unless we can prove that it breaks. It's sometimes nice to
>> be able to debug the debugging facilities with the debugging
>> facilities ;-)
>
> Even with the existing __kprobes annotations, I'm sure we can find many ways to
> break the kernel.
>
> We can reproduce that bug with irq_work recursion with setting a kprobe in
> the end of the irq_work() arch low level handler for example. Or simply
> somewhere in irq_exit().
>
> I think we could do dangerous things with breakpoints as well. Setting breakpoints
> in do_debug() or stuffs like that.
>
> So keeping up with __kprobes annotations to every potential dangerous site
> is not viable IMHO. It's important to maintain basic sanity with tagging sites
> that are used by kprobes itself but we can't really prevent from any issue.
>
> At some point it's up to the user to know what he's doing and avoid recursion.
> As long as kprobes can be set only by root.
Hmm, it would be better to add some documentation how users can avoid
such thing.
> OTOH it would be nice to detect these kind of behaviour (thinking about irq_work for
> example) and warn when something wrong is suspected.
Agreed.
FYI, kprobes has a recursion detection counter and it is reported via
debugfs/tracing/kprobe_profile :)
Thank you,
--
Masami HIRAMATSU
IT Management Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com
next prev parent reply other threads:[~2013-11-17 7:54 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-08 19:45 Vince Weaver
2013-11-08 20:06 ` Vince Weaver
2013-11-08 20:02 ` Frederic Weisbecker
2013-11-08 20:23 ` Vince Weaver
2013-11-08 20:48 ` Frederic Weisbecker
2013-11-08 21:15 ` Vince Weaver
2013-11-08 22:24 ` Frederic Weisbecker
2013-11-08 22:36 ` Frederic Weisbecker
2013-11-09 1:09 ` Steven Rostedt
2013-11-09 14:10 ` Peter Zijlstra
2013-11-09 14:20 ` Frederic Weisbecker
2013-11-11 12:44 ` Ingo Molnar
2013-11-11 15:53 ` Peter Zijlstra
2013-11-11 21:13 ` Ingo Molnar
2013-11-09 14:52 ` Frederic Weisbecker
2013-11-09 15:13 ` Peter Zijlstra
2013-11-09 15:27 ` Frederic Weisbecker
2013-11-09 15:59 ` Peter Zijlstra
2013-11-09 16:08 ` Frederic Weisbecker
2013-11-09 15:11 ` Peter Zijlstra
2013-11-09 15:22 ` Frederic Weisbecker
2013-11-09 15:30 ` Peter Zijlstra
2013-11-14 15:23 ` Peter Zijlstra
2013-11-14 15:33 ` Peter Zijlstra
2013-11-14 15:35 ` Frederic Weisbecker
2013-11-15 1:16 ` Masami Hiramatsu
2013-11-15 12:28 ` Peter Zijlstra
2013-11-15 14:15 ` Steven Rostedt
2013-11-15 14:28 ` Frederic Weisbecker
2013-11-17 7:53 ` Masami Hiramatsu [this message]
2013-11-17 9:43 ` Peter Zijlstra
2013-11-14 16:03 ` Frederic Weisbecker
2013-11-14 17:20 ` Vince Weaver
2013-11-14 17:14 ` Peter Zijlstra
2013-11-14 17:41 ` Steven Rostedt
2013-11-14 19:18 ` Vince Weaver
2013-11-19 19:18 ` [tip:perf/urgent] ftrace, perf: Avoid infinite event generation loop tip-bot for Peter Zijlstra
2013-11-09 0:25 ` perf/tracepoint: another fuzzer generated lockup Frederic Weisbecker
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=52887617.7050302@hitachi.com \
--to=masami.hiramatsu.pt@hitachi.com \
--cc=davej@redhat.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.weaver@maine.edu \
/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
Powered by JetHome