* What's does KPROBE_ENTRY mean?
@ 2007-06-21 5:13 jidong xiao
2007-07-26 5:43 ` jidong xiao
0 siblings, 1 reply; 5+ messages in thread
From: jidong xiao @ 2007-06-21 5:13 UTC (permalink / raw)
To: linux-kernel
I searched in linux kernel 2.6.10, didn't find it, then I tried
2.6.20, it is there. But I am not familiar with assembly language, so
can anybody kindly explain it, I don't know the difference between
KPROBE_ENTRY and ENTRY, however, I can find both of these items in
some files, such as arch/x86_64/kernel/entry.S.
Thank you.
Regards
Jason Xiao
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: What's does KPROBE_ENTRY mean?
2007-06-21 5:13 What's does KPROBE_ENTRY mean? jidong xiao
@ 2007-07-26 5:43 ` jidong xiao
2007-07-26 6:11 ` Paul Mundt
0 siblings, 1 reply; 5+ messages in thread
From: jidong xiao @ 2007-07-26 5:43 UTC (permalink / raw)
To: linux-kernel
Anyone can help this?
On 6/21/07, jidong xiao <jidong.xiao@gmail.com> wrote:
> I searched in linux kernel 2.6.10, didn't find it, then I tried
> 2.6.20, it is there. But I am not familiar with assembly language, so
> can anybody kindly explain it, I don't know the difference between
> KPROBE_ENTRY and ENTRY, however, I can find both of these items in
> some files, such as arch/x86_64/kernel/entry.S.
>
> Thank you.
>
> Regards
> Jason Xiao
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: What's does KPROBE_ENTRY mean?
2007-07-26 5:43 ` jidong xiao
@ 2007-07-26 6:11 ` Paul Mundt
2007-07-26 6:50 ` jidong xiao
0 siblings, 1 reply; 5+ messages in thread
From: Paul Mundt @ 2007-07-26 6:11 UTC (permalink / raw)
To: jidong xiao; +Cc: linux-kernel
On Thu, Jul 26, 2007 at 01:43:10PM +0800, jidong xiao wrote:
> Anyone can help this?
>
> On 6/21/07, jidong xiao <jidong.xiao@gmail.com> wrote:
> > I searched in linux kernel 2.6.10, didn't find it, then I tried
> > 2.6.20, it is there. But I am not familiar with assembly language, so
> > can anybody kindly explain it, I don't know the difference between
> > KPROBE_ENTRY and ENTRY, however, I can find both of these items in
> > some files, such as arch/x86_64/kernel/entry.S.
> >
KPROBE_ENTRY() is the assembly equivalent of __kprobes, it places the
symbol in a special section (.kprobes.text) where probes can't be
inserted. This is usually helpful in cases where inserting the probe may
lead to recursion or other undesirable behaviour.
See include/linux/linkage.h and include/linux/kprobes.h.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: What's does KPROBE_ENTRY mean?
2007-07-26 6:11 ` Paul Mundt
@ 2007-07-26 6:50 ` jidong xiao
2007-07-26 7:06 ` Paul Mundt
0 siblings, 1 reply; 5+ messages in thread
From: jidong xiao @ 2007-07-26 6:50 UTC (permalink / raw)
To: Paul Mundt, linux-kernel
Thanks.So if I don't care any probes, and I actually don't need to
take use of kprobes, then I can use the functions defined through
KPROBE_ENTRY() the same way as those defined via ENTRY(), right?
Regards
Jason Xiao
On 7/26/07, Paul Mundt <lethal@linux-sh.org> wrote:
> On Thu, Jul 26, 2007 at 01:43:10PM +0800, jidong xiao wrote:
> > Anyone can help this?
> >
> > On 6/21/07, jidong xiao <jidong.xiao@gmail.com> wrote:
> > > I searched in linux kernel 2.6.10, didn't find it, then I tried
> > > 2.6.20, it is there. But I am not familiar with assembly language, so
> > > can anybody kindly explain it, I don't know the difference between
> > > KPROBE_ENTRY and ENTRY, however, I can find both of these items in
> > > some files, such as arch/x86_64/kernel/entry.S.
> > >
> KPROBE_ENTRY() is the assembly equivalent of __kprobes, it places the
> symbol in a special section (.kprobes.text) where probes can't be
> inserted. This is usually helpful in cases where inserting the probe may
> lead to recursion or other undesirable behaviour.
>
> See include/linux/linkage.h and include/linux/kprobes.h.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: What's does KPROBE_ENTRY mean?
2007-07-26 6:50 ` jidong xiao
@ 2007-07-26 7:06 ` Paul Mundt
0 siblings, 0 replies; 5+ messages in thread
From: Paul Mundt @ 2007-07-26 7:06 UTC (permalink / raw)
To: jidong xiao; +Cc: linux-kernel
On Thu, Jul 26, 2007 at 02:50:38PM +0800, jidong xiao wrote:
> Thanks.So if I don't care any probes, and I actually don't need to
> take use of kprobes, then I can use the functions defined through
> KPROBE_ENTRY() the same way as those defined via ENTRY(), right?
>
Yes, there's nothing special about KPROBE_ENTRY() other than the section
placement. It even wraps in to ENTRY() after the .pushsection.
As you can see from kernel/kprobes.c:
static int __kprobes in_kprobes_functions(unsigned long addr)
{
if (addr >= (unsigned long)__kprobes_text_start &&
addr < (unsigned long)__kprobes_text_end)
return -EINVAL;
return 0;
}
...
and in __register_kprobe():
if (!kernel_text_address((unsigned long) p->addr) ||
in_kprobes_functions((unsigned long) p->addr))
return -EINVAL;
So the only behavioural change for these symbols is that insertion of
probes is prohibited. There is nothing inherently special about them
otherwise, and platforms that don't enable kprobes aren't going to
care either.
One curious thing is that while KPROBE_ENTRY() unconditionally does
a .pushsection .kprobes.text, __kprobes does this conditionally
depending on CONFIG_KPROBES. While this doesn't hurt anything, it's
inconsistent to say the least. We should probably either make __kprobes
explicitly always use .kprobes.text, or just wrap KPROBE_ENTRY to ENTRY
directly and forego the .pushsection when CONFIG_KPROBES=n.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-07-26 7:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-21 5:13 What's does KPROBE_ENTRY mean? jidong xiao
2007-07-26 5:43 ` jidong xiao
2007-07-26 6:11 ` Paul Mundt
2007-07-26 6:50 ` jidong xiao
2007-07-26 7:06 ` Paul Mundt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox