Possible regression: module insertion, relocation misalignement

Robert Jarzmik robert.jarzmik at free.fr
Sat Aug 29 13:12:08 PDT 2015


Hello,

I have a strange regression with linux-next on module insertion. The stack I get
when inserting a module is in [3]. I'm using the gcc in [1], and added a small
print in [2]. This happens on a pxa310 cm-x300 platform.

As far as I understand the Oops, this is an unaligned access on the following
relocation (0xbf009a26):
	*(u32 *)loc += sym->st_value;

This happens regardless of the module I try, by that fat.ko, pxa3xx-nand.ko, etc
.. I add that I have not changed my toolchain for quite some time.

Is there anyone also affected by this bug ?

Cheers.

-- 
Robert

[1] gcc version
===============
rj at belgarion:~/mio_linux/kernel$ arm-linux-gnueabi-gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/arm-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabi/4.9/lto-wrapper
Target: arm-linux-gnueabi
Configured with: ../src/configure -v --with-pkgversion=' 4.9.2-10' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs --enable-languages=c,c++,go,fortran,objc --prefix=/usr --program-suffix=-4.9 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libitm --disable-libquadmath --enable-plugin --with-system-zlib --enable-objc-gc --enable-multiarch --disable-sjlj-exceptions --with-arch=armv4t --with-float=soft --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=arm-linux-gnueabi --program-prefix=arm-linux-gnueabi-
Thread model: posix
gcc version 4.9.2 ( 4.9.2-10) 

[2] Debug patch in arch/arm/kernel/module.c
===========================================
diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
index efdddcb97dd1..aed935c55d63 100644
--- a/arch/arm/kernel/module.c
+++ b/arch/arm/kernel/module.c
@@ -88,6 +88,9 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
                        return -ENOEXEC;
                }
 
+               pr_info("%s():%d dstsec=%p dstsec->sh_addr=%p rel=%p rel->r_offset=%u\n",
+                       __func__, __LINE__, dstsec, dstsec,
+                       dstsec->sh_addr, rel, rel->r_offset);
                loc = dstsec->sh_addr + rel->r_offset;
 
                switch (ELF32_R_TYPE(rel->r_info)) {

[3] Backtrace
=============
apply_relocate():93 dstsec=e4aa4e74 dstsec->sh_addr=e4aa4e74 rel=bf009420 rel->r_offset=3836194428
apply_relocate():93 dstsec=e4aa4eec dstsec->sh_addr=e4aa4eec rel=bf009a26 rel->r_offset=3836194436
Unable to handle kernel paging request at virtual address bf009a26
pgd = e1e28000
[bf009a26] *pgd=c1f0e851, *pte=c1f0a04f, *ppte=c1f0a01f
Internal error: Oops: 23 [#1] ARM
Modules linked in:
CPU: 0 PID: 607 Comm: insmod Not tainted 4.2.0-rc8-next-20150828-cm-x300+ #876
Hardware name: CM-X300 module
task: e222e700 ti: e1d6c000 task.ti: e1d6c000
PC is at apply_relocate+0x294/0x37c
LR is at 0xbf009a26
pc : [<c000e9a8>]    lr : [<bf009a26>]    psr: 80000013
sp : e1d6de40  ip : 60000013  fp : e4aa4f14
r10: e4a7ae84  r9 : e4a77ed8  r8 : e4aa552c
r7 : 00000000  r6 : e4a7ae84  r5 : e4aa4eec  r4 : bf00e0d4
r3 : bf009a26  r2 : 00000002  r1 : 00000000  r0 : bf000000
Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
Control: 0000397f  Table: c1e28018  DAC: 00000051
Process insmod (pid: 607, stack limit = 0xe1d6c198)
Stack: (0xe1d6de40 to 0xe1d6e000)
de40: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
de60: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
de80: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
dea0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
dec0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
dee0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
df00: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
df20: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
df40: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
df60: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
df80: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
dfa0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
dfc0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
dfe0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[<c000e9a8>] (apply_relocate) from [<c005c8bc>] (load_module+0x1150/0x1d8c)
[<c005c8bc>] (load_module) from [<c005d5d4>] (SyS_init_module+0xdc/0x140)
[<c005d5d4>] (SyS_init_module) from [<c000a420>] (ret_fast_syscall+0x0/0x38)
Code: bad PC value
---[ end trace 6006e5b4059a4901 ]---
Segmentation fault



More information about the linux-arm-kernel mailing list