diff mbox

Possible regression: module insertion, relocation misalignement

Message ID 87k2sayrle.fsf@belgarion.home (mailing list archive)
State New, archived
Headers show

Commit Message

Robert Jarzmik Sept. 1, 2015, 5:30 p.m. UTC
Russell King - ARM Linux <linux@arm.linux.org.uk> writes:

> On Tue, Sep 01, 2015 at 01:00:39AM +0200, Robert Jarzmik wrote:
>> [2] readelf -Sr pxa3xx_nand.ko
>> ==============================
>>   [12] __bug_table       PROGBITS        00000000 002232 000018 00   A  0   0  1
>
> This shows that the bug table has an alignment of 1, which is silly as
> it contains 32-bit values - this really ought to be indicating an
> alignment of 4.
>
> I notice that a bunch of my modules are the same as well.  Try adding
> ".align 2" into arch/arm/include/asm/bug.h, __BUG() macro, just after
> ".pushsection __bug_table" which should have the effect of increasing
> the alignment of the section.
Okay, I made the change, and tested it now I'm after work. Your fix does indeed
remove the problem.

> It probably hasn't been noticed on ARMv6 and later because they'll
> always fix up these relocations transparently.
>
> For ARMv5 and older, you really ought to have the alignment handler
> enabled - IP networking pretty much relies on this being present to
> catch corner cases (eg, with TCP options mis-aligning subsequent data.)
That is curious, because I have this in my configuration :
  #define CONFIG_ALIGNMENT_TRAP 1.
And yet it happens ... I will remove the fix and try to follow the data abort
path to understand why the alignment fault is not dealt with.
diff mbox

Patch

diff --git a/arch/arm/include/asm/bug.h b/arch/arm/include/asm/bug.h
index b274bde24905..e7335a92144e 100644
--- a/arch/arm/include/asm/bug.h
+++ b/arch/arm/include/asm/bug.h
@@ -40,6 +40,7 @@  do {								\
 		"2:\t.asciz " #__file "\n" 			\
 		".popsection\n" 				\
 		".pushsection __bug_table,\"a\"\n"		\
+		".align 2\n"					\
 		"3:\t.word 1b, 2b\n"				\
 		"\t.hword " #__line ", 0\n"			\
 		".popsection");					\