]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
arm64/signal: Restore TPIDR2 register rather than memory state
authorMark Brown <broonie@kernel.org>
Thu, 22 Jun 2023 13:39:45 +0000 (14:39 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 23 Jun 2023 17:31:50 +0000 (18:31 +0100)
Currently when restoring the TPIDR2 signal context we set the new value
from the signal frame in the thread data structure but not the register,
following the pattern for the rest of the data we are restoring. This does
not work in the case of TPIDR2, the register always has the value for the
current task. This means that either we return to userspace and ignore the
new value or we context switch and save the register value on top of the
newly restored value.

Load the value from the signal context into the register instead.

Fixes: 39e54499280f ("arm64/signal: Include TPIDR2 in the signal context")
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: <stable@vger.kernel.org> # 6.3.x
Link: https://lore.kernel.org/r/20230621-arm64-fix-tpidr2-signal-restore-v2-1-c8e8fcc10302@kernel.org
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/kernel/signal.c

index 2cfc810d0a5b16493608e5c6f8925cdd3521af13..10b407672c4278d607fe6d5f7794c1258f0c0eab 100644 (file)
@@ -398,7 +398,7 @@ static int restore_tpidr2_context(struct user_ctxs *user)
 
        __get_user_error(tpidr2_el0, &user->tpidr2->tpidr2, err);
        if (!err)
-               current->thread.tpidr2_el0 = tpidr2_el0;
+               write_sysreg_s(tpidr2_el0, SYS_TPIDR2_EL0);
 
        return err;
 }