Commit aa62c209 authored by T.J. Purtell's avatar T.J. Purtell Committed by Catalin Marinas

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: default avatarT.J. Purtell <tj@mobisocial.us>
[catalin.marinas@arm.com: code comment and commit log updated]
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent 847264fb
...@@ -446,12 +446,13 @@ static void compat_setup_return(struct pt_regs *regs, struct k_sigaction *ka, ...@@ -446,12 +446,13 @@ static void compat_setup_return(struct pt_regs *regs, struct k_sigaction *ka,
/* Check if the handler is written for ARM or Thumb */ /* Check if the handler is written for ARM or Thumb */
thumb = handler & 1; thumb = handler & 1;
if (thumb) { if (thumb)
spsr |= COMPAT_PSR_T_BIT; spsr |= COMPAT_PSR_T_BIT;
spsr &= ~COMPAT_PSR_IT_MASK; else
} else {
spsr &= ~COMPAT_PSR_T_BIT; spsr &= ~COMPAT_PSR_T_BIT;
}
/* The IT state must be cleared for both ARM and Thumb-2 */
spsr &= ~COMPAT_PSR_IT_MASK;
if (ka->sa.sa_flags & SA_RESTORER) { if (ka->sa.sa_flags & SA_RESTORER) {
retcode = ptr_to_compat(ka->sa.sa_restorer); retcode = ptr_to_compat(ka->sa.sa_restorer);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment