Skip to content

Commit 40a8e87

Browse files
brooniectmarinas
authored andcommitted
arm64/sme: Disable ZA and streaming mode when handling signals
The ABI requires that streaming mode and ZA are disabled when invoking signal handlers, do this in setup_return() when we prepare the task state for the signal handler. Signed-off-by: Mark Brown <[email protected]> Reviewed-by: Catalin Marinas <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 8bd7f91 commit 40a8e87

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

arch/arm64/kernel/signal.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,13 @@ static void setup_return(struct pt_regs *regs, struct k_sigaction *ka,
759759
/* TCO (Tag Check Override) always cleared for signal handlers */
760760
regs->pstate &= ~PSR_TCO_BIT;
761761

762+
/* Signal handlers are invoked with ZA and streaming mode disabled */
763+
if (system_supports_sme()) {
764+
current->thread.svcr &= ~(SYS_SVCR_EL0_ZA_MASK |
765+
SYS_SVCR_EL0_SM_MASK);
766+
sme_smstop();
767+
}
768+
762769
if (ka->sa.sa_flags & SA_RESTORER)
763770
sigtramp = ka->sa.sa_restorer;
764771
else

0 commit comments

Comments
 (0)