Re: [PATCH 1/3] Kprobes: Make kprobe modules more portable

From: Stephen Hemminger
Date: Tue Aug 08 2006 - 12:32:16 EST


On Tue, 8 Aug 2006 17:24:21 +0100
Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:

> On Mon, Aug 07, 2006 at 05:25:37PM +0530, Ananth N Mavinakayanahalli wrote:
> > From: Ananth N Mavinakayanahalli <ananth@xxxxxxxxxx>
> >
> > This patch introduces KPROBE_ADDR, a macro that abstracts out the
> > architecture-specific artefacts of getting the correct text address
> > given a symbol. While we are at it, also introduce the symbol_name field
> > in struct kprobe to allow for users to just specify the address to be
> > probed in terms of the kernel symbol. In-kernel kprobes infrastructure
> > decodes the actual text address to probe. The symbol resolution happens
> > only if the kprobe.addr isn't explicitly specified.
>
> This looks good. A few issues are left:
>
> - the KPROBE_ADDR macro is all uppercase and not exactly very descriptive.
> - the symbol name variant should be the default, and no one outside
> kprobes.c should know about the KPROBE_ADDR macro
> - we should return EINVAL instead of silently discarding things if people
> specify a symbol and an address.
> - we should have and offset into the symbol specified
>
> The updated patch below does that, aswell as updating the only inkernel
> kprobes user (tcp_probe.c) to the new interface (*) and removing the now
> obsolete kallsysms_lookup_name export.
>
> (*) tcp_probe.c shows very well how horrible the old interface was, as it's
> not portable to ppc64 as-is

Okay, does this makes kprobe's the first reflective kernel interface.
Watch out or it end up like JNI!
-
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/