From mboxrd@z Thu Jan 1 00:00:00 1970 From: jon.medhurst@linaro.org (Jon Medhurst (Tixy)) Date: Tue, 20 Sep 2011 08:24:44 +0100 Subject: [ltt-dev] [PATCH V1] ARM: Set bit 0 for thumb mode in kallsyms_lookup_name returned address In-Reply-To: References: <1316422804-32562-1-git-send-email-avik.sil@linaro.org> Message-ID: <1316503484.2253.15.camel@linaro1> On Mon, 2011-09-19 at 16:10 +0100, Dave Martin wrote: > On Mon, Sep 19, 2011 at 10:00 AM, Avik Sil 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 > > 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