aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2013-07-04 06:00:23 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2013-07-31 16:30:57 -0400
commitf928d4f2a86f46b030fa0850385b4391fc2b5918 (patch)
treea7326ffbc1e345d44bb3ebdede8f74e147951406 /arch
parent3b2f64d00c46e1e4e9bd0bb9bb12619adac27a4b (diff)
ARM: poison the vectors page
Fill the empty regions of the vectors page with an exception generating instruction. This ensures that any inappropriate branch to the vector page is appropriately trapped, rather than just encountering some code to execute. (The vectors page was filled with zero before, which corresponds with the "andeq r0, r0, r0" instruction - a no-op.) Cc: <stable@vger.kernel.org> Acked-by Nicolas Pitre <nico@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/kernel/traps.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index cab094c234ee..9433e8a12b5e 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -818,10 +818,20 @@ void __init early_trap_init(void *vectors_base)
818 extern char __vectors_start[], __vectors_end[]; 818 extern char __vectors_start[], __vectors_end[];
819 extern char __kuser_helper_start[], __kuser_helper_end[]; 819 extern char __kuser_helper_start[], __kuser_helper_end[];
820 int kuser_sz = __kuser_helper_end - __kuser_helper_start; 820 int kuser_sz = __kuser_helper_end - __kuser_helper_start;
821 unsigned i;
821 822
822 vectors_page = vectors_base; 823 vectors_page = vectors_base;
823 824
824 /* 825 /*
826 * Poison the vectors page with an undefined instruction. This
827 * instruction is chosen to be undefined for both ARM and Thumb
828 * ISAs. The Thumb version is an undefined instruction with a
829 * branch back to the undefined instruction.
830 */
831 for (i = 0; i < PAGE_SIZE / sizeof(u32); i++)
832 ((u32 *)vectors_base)[i] = 0xe7fddef1;
833
834 /*
825 * Copy the vectors, stubs and kuser helpers (in entry-armv.S) 835 * Copy the vectors, stubs and kuser helpers (in entry-armv.S)
826 * into the vector page, mapped at 0xffff0000, and ensure these 836 * into the vector page, mapped at 0xffff0000, and ensure these
827 * are visible to the instruction stream. 837 * are visible to the instruction stream.