[PATCH] kprobes: Ensure blacklist data is aligned

From: Vineet Gupta
Date: Thu May 01 2014 - 01:17:29 EST


ARC Linux (not supporting native unaligned access) was failing to boot
because __start_kprobe_blacklist was not aligned.

This was because per generated vmlinux.lds it was emitted right next
to .rodata with strings etc hence could be randomly unaligned.

Fix that by ensuring a word alignment. While 4 would suffice for 32bit
arches and problem at hand, it is probably better to put 8.

| Path: (null) CPU: 0 PID: 1 Comm: swapper Not tainted
| 3.15.0-rc3-next-20140430 #2
| task: 8f044000 ti: 8f01e000 task.ti: 8f01e000
|
| [ECR ]: 0x00230400 => Misaligned r/w from 0x800fb0d3
| [EFA ]: 0x800fb0d3
| [BLINK ]: do_one_initcall+0x86/0x1bc
| [ERET ]: init_kprobes+0x52/0x120

Signed-off-by: Vineet Gupta <vgupta@xxxxxxxxxxxx>
---
include/asm-generic/vmlinux.lds.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 40ceb3ceba79..8e0204a68c74 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -110,7 +110,8 @@
#endif

#ifdef CONFIG_KPROBES
-#define KPROBE_BLACKLIST() VMLINUX_SYMBOL(__start_kprobe_blacklist) = .; \
+#define KPROBE_BLACKLIST() . = ALIGN(8); \
+ VMLINUX_SYMBOL(__start_kprobe_blacklist) = .; \
*(_kprobe_blacklist) \
VMLINUX_SYMBOL(__stop_kprobe_blacklist) = .;
#else
--
1.8.3.2



--
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/