[ltt-dev] [PATCH V1] ARM: Set bit 0 for thumb mode in kallsyms_lookup_name returned address

Jon Medhurst (Tixy) jon.medhurst at linaro.org
Tue Sep 20 03:24:44 EDT 2011


On Mon, 2011-09-19 at 16:10 +0100, Dave Martin wrote:
> On Mon, Sep 19, 2011 at 10:00 AM, Avik Sil <avik.sil at linaro.org> wrote:
> > This patch fixes the undefined instruction oops due to execution
> > of thumb-2 code in ARM mode. The zero bit in the symbol address
> > returned by kallsyms_lookup_name is not set, leading to switching
> > to ARM mode that generates oops while executing thumb-2 code. For
> > detailed discussion, see [1].
> > [1] http://lists.casi.polymtl.ca/pipermail/ltt-dev/2011-September/005176.html
> >
> > v1:
> >        - include wrapper function kallsyms_lookup_funcptr as suggested
> >        by Dave Martin
> >
> > Signed-off-by: Avik Sil <avik.sil at linaro.org>
> 
> Looks reasonable.
> 
> Tixy, could it make sense for that definition of
> kallsyms_lookup_funcptr to migrate into the kernel headers?  I had the
> impression that you might also have used this in some places, if it
> had been available.
> 

I don't think so, the problems with kprobes are a bit more involved. The
only candidate for using this new function is in kprobes.c ...

/*
 * Some oddball architectures like 64bit powerpc have function descriptors
 * so this must be overridable.
 */
#ifndef kprobe_lookup_name
#define kprobe_lookup_name(name, addr) \
	addr = ((kprobe_opcode_t *)(kallsyms_lookup_name(name)))
#endif

Replacing the kallsyms_lookup_name() here would make kprobes 'better'
for Thumb (avoid a small runtime overhead and some inconsistencies). But
I don't think that the semantics of the new function match this use, and
if it were desirable, we could overload the above kprobes function from
ARM arch code anyway. In fact, I think I'll propose such a patch...

-- 
Tixy








More information about the lttng-dev mailing list