diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2013-07-04 06:32:04 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2013-07-31 16:31:09 -0400 |
commit | 5b43e7a383d69381ffe53423e46dd0fafae07da3 (patch) | |
tree | dc963749afd1416d8737cf273385819896a33ba0 /arch/arm | |
parent | f928d4f2a86f46b030fa0850385b4391fc2b5918 (diff) |
ARM: poison memory between kuser helpers
Poison the memory between each kuser helper. This ensures that any
branch between the kuser helpers will be appropriately trapped.
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/arm')
-rw-r--r-- | arch/arm/kernel/entry-armv.S | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index a39cfc2a1f90..02437345289a 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S | |||
@@ -742,6 +742,17 @@ ENDPROC(__switch_to) | |||
742 | #endif | 742 | #endif |
743 | .endm | 743 | .endm |
744 | 744 | ||
745 | .macro kuser_pad, sym, size | ||
746 | .if (. - \sym) & 3 | ||
747 | .rept 4 - (. - \sym) & 3 | ||
748 | .byte 0 | ||
749 | .endr | ||
750 | .endif | ||
751 | .rept (\size - (. - \sym)) / 4 | ||
752 | .word 0xe7fddef1 | ||
753 | .endr | ||
754 | .endm | ||
755 | |||
745 | .align 5 | 756 | .align 5 |
746 | .globl __kuser_helper_start | 757 | .globl __kuser_helper_start |
747 | __kuser_helper_start: | 758 | __kuser_helper_start: |
@@ -832,18 +843,13 @@ kuser_cmpxchg64_fixup: | |||
832 | #error "incoherent kernel configuration" | 843 | #error "incoherent kernel configuration" |
833 | #endif | 844 | #endif |
834 | 845 | ||
835 | /* pad to next slot */ | 846 | kuser_pad __kuser_cmpxchg64, 64 |
836 | .rept (16 - (. - __kuser_cmpxchg64)/4) | ||
837 | .word 0 | ||
838 | .endr | ||
839 | |||
840 | .align 5 | ||
841 | 847 | ||
842 | __kuser_memory_barrier: @ 0xffff0fa0 | 848 | __kuser_memory_barrier: @ 0xffff0fa0 |
843 | smp_dmb arm | 849 | smp_dmb arm |
844 | usr_ret lr | 850 | usr_ret lr |
845 | 851 | ||
846 | .align 5 | 852 | kuser_pad __kuser_memory_barrier, 32 |
847 | 853 | ||
848 | __kuser_cmpxchg: @ 0xffff0fc0 | 854 | __kuser_cmpxchg: @ 0xffff0fc0 |
849 | 855 | ||
@@ -916,13 +922,14 @@ kuser_cmpxchg32_fixup: | |||
916 | 922 | ||
917 | #endif | 923 | #endif |
918 | 924 | ||
919 | .align 5 | 925 | kuser_pad __kuser_cmpxchg, 32 |
920 | 926 | ||
921 | __kuser_get_tls: @ 0xffff0fe0 | 927 | __kuser_get_tls: @ 0xffff0fe0 |
922 | ldr r0, [pc, #(16 - 8)] @ read TLS, set in kuser_get_tls_init | 928 | ldr r0, [pc, #(16 - 8)] @ read TLS, set in kuser_get_tls_init |
923 | usr_ret lr | 929 | usr_ret lr |
924 | mrc p15, 0, r0, c13, c0, 3 @ 0xffff0fe8 hardware TLS code | 930 | mrc p15, 0, r0, c13, c0, 3 @ 0xffff0fe8 hardware TLS code |
925 | .rep 4 | 931 | kuser_pad __kuser_get_tls, 16 |
932 | .rep 3 | ||
926 | .word 0 @ 0xffff0ff0 software TLS value, then | 933 | .word 0 @ 0xffff0ff0 software TLS value, then |
927 | .endr @ pad up to __kuser_helper_version | 934 | .endr @ pad up to __kuser_helper_version |
928 | 935 | ||