Skip to content

Commit 5b43e7a

Browse files
author
Russell King
committed
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: <[email protected]> Acked-by: Nicolas Pitre <[email protected]> Signed-off-by: Russell King <[email protected]>
1 parent f928d4f commit 5b43e7a

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

arch/arm/kernel/entry-armv.S

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,17 @@ ENDPROC(__switch_to)
742742
#endif
743743
.endm
744744

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+
745756
.align 5
746757
.globl __kuser_helper_start
747758
__kuser_helper_start:
@@ -832,18 +843,13 @@ kuser_cmpxchg64_fixup:
832843
#error "incoherent kernel configuration"
833844
#endif
834845

835-
/* pad to next slot */
836-
.rept (16 - (. - __kuser_cmpxchg64)/4)
837-
.word 0
838-
.endr
839-
840-
.align 5
846+
kuser_pad __kuser_cmpxchg64, 64
841847

842848
__kuser_memory_barrier: @ 0xffff0fa0
843849
smp_dmb arm
844850
usr_ret lr
845851

846-
.align 5
852+
kuser_pad __kuser_memory_barrier, 32
847853

848854
__kuser_cmpxchg: @ 0xffff0fc0
849855

@@ -916,13 +922,14 @@ kuser_cmpxchg32_fixup:
916922

917923
#endif
918924

919-
.align 5
925+
kuser_pad __kuser_cmpxchg, 32
920926

921927
__kuser_get_tls: @ 0xffff0fe0
922928
ldr r0, [pc, #(16 - 8)] @ read TLS, set in kuser_get_tls_init
923929
usr_ret lr
924930
mrc p15, 0, r0, c13, c0, 3 @ 0xffff0fe8 hardware TLS code
925-
.rep 4
931+
kuser_pad __kuser_get_tls, 16
932+
.rep 3
926933
.word 0 @ 0xffff0ff0 software TLS value, then
927934
.endr @ pad up to __kuser_helper_version
928935

0 commit comments

Comments
 (0)