aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorT.J. Purtell <tj@mobisocial.us>2013-11-05 12:07:18 -0500
committerCatalin Marinas <catalin.marinas@arm.com>2013-11-05 12:47:46 -0500
commitaa62c2091129af81a172350b718eb35d5448cebc (patch)
treeec9535c5dac3c4a68633247e874dd29b60b5c73e
parent847264fb7e73ade5b5e4b6eea3daa243a1f5217e (diff)
arm64: compat: Clear the IT state independent of the 32-bit ARM or Thumb-2 mode
The ARM architecture reference specifies that the IT state bits in the PSR must be all zeros in ARM mode or behavior is unspecified. If an ARM function is registered as a signal handler, and that signal is delivered inside a block of instructions following an IT instruction, some of the instructions at the beginning of the signal handler may be skipped if the IT state bits of the Program Status Register are not cleared by the kernel. Signed-off-by: T.J. Purtell <tj@mobisocial.us> [catalin.marinas@arm.com: code comment and commit log updated] Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
-rw-r--r--arch/arm64/kernel/signal32.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c
index e8772c07cf5c..e51bbe79f5b5 100644
--- a/arch/arm64/kernel/signal32.c
+++ b/arch/arm64/kernel/signal32.c
@@ -446,12 +446,13 @@ static void compat_setup_return(struct pt_regs *regs, struct k_sigaction *ka,
446 /* Check if the handler is written for ARM or Thumb */ 446 /* Check if the handler is written for ARM or Thumb */
447 thumb = handler & 1; 447 thumb = handler & 1;
448 448
449 if (thumb) { 449 if (thumb)
450 spsr |= COMPAT_PSR_T_BIT; 450 spsr |= COMPAT_PSR_T_BIT;
451 spsr &= ~COMPAT_PSR_IT_MASK; 451 else
452 } else {
453 spsr &= ~COMPAT_PSR_T_BIT; 452 spsr &= ~COMPAT_PSR_T_BIT;
454 } 453
454 /* The IT state must be cleared for both ARM and Thumb-2 */
455 spsr &= ~COMPAT_PSR_IT_MASK;
455 456
456 if (ka->sa.sa_flags & SA_RESTORER) { 457 if (ka->sa.sa_flags & SA_RESTORER) {
457 retcode = ptr_to_compat(ka->sa.sa_restorer); 458 retcode = ptr_to_compat(ka->sa.sa_restorer);