This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [PATCH -tip v4 0/6] kprobes: introduce NOKPROBE_SYMBOL() and fixes crash bugs
- From: Josh Stone <jistone at redhat dot com>
- To: Ingo Molnar <mingo at kernel dot org>, Masami Hiramatsu <masami dot hiramatsu dot pt at hitachi dot com>
- Cc: Ananth N Mavinakayanahalli <ananth at in dot ibm dot com>, Sandeepa Prabhu <sandeepa dot prabhu at linaro dot org>, x86 at kernel dot org, lkml <linux-kernel at vger dot kernel dot org>, "Steven Rostedt (Red Hat)" <rostedt at goodmis dot org>, systemtap at sourceware dot org, "David S. Miller" <davem at davemloft dot net>
- Date: Thu, 12 Dec 2013 12:42:16 -0800
- Subject: Re: [PATCH -tip v4 0/6] kprobes: introduce NOKPROBE_SYMBOL() and fixes crash bugs
- Authentication-results: sourceware.org; auth=none
- References: <20131204012841 dot 22118 dot 82992 dot stgit at kbuild-fedora dot novalocal> <20131204084551 dot GA31772 at gmail dot com> <529FBA71 dot 6070107 at hitachi dot com> <20131205102127 dot GA19923 at gmail dot com> <52A137B6 dot 6030307 at hitachi dot com> <20131210152811 dot GA1195 at gmail dot com> <52A7CA0A dot 9060009 at hitachi dot com> <20131211133423 dot GB3101 at gmail dot com> <52A9515E dot 5050505 at hitachi dot com> <20131212140347 dot GA17059 at gmail dot com>
On 12/12/2013 06:03 AM, Ingo Molnar wrote:
>> No, because the int3 already changes the original instruction.
>> This means that you cannot skip singlestep(or emulate) the
>> instruction which is copied to execution buffer (ainsn->insn),
>> even if you have such the flag.
>> So, kprobe requires the annotations on the singlestep path.
> I don't understand this reasoning.
>
> Lets assume we allow a probe to be inserted in the single-step path.
> Such a probe will be an INT3 instruction and if it hits we get a
> recursive INT3 invocation. In that case the INT3 handler should simply
> restore the original instruction and _leave it so_. There's no
> single-stepping needed - the probe is confused and must be discarded.
So if you restore the original instruction, then you're essentially
creating a dynamic blacklist for the singlestep path, right? I think
that's fine, as long as you still allow recursive probes elsewhere to
just singlestep and skip that occurrence.
It also helps with the inlining issues, since an inlined function
instance in the singlestep path can get dynamically blocked, while still
allowing inline instances elsewhere to be probed normally. Then you
don't have to force always/never inline decisions - whatever gcc decides
to do with inlines and static functions can be dealt with.
Josh