Re: [PATCH 1/2] arm64/fpsimd: signal: Require ZA context when restoring ZT context

From: Mark Brown

Date: Mon Nov 16 2026 - 17:48:45 EST


On Tue, Nov 10, 2026 at 10:18:35PM +0000, Bradley Morgan wrote:
> When restoring the signal frame, restore_zt_context() checks whether ZA
> is enabled via thread_za_enabled(&current->thread). However, if user.za
> is omitted from the signal frame, restore_za_context() is skipped entirely.
> If the signal handler touched SME prior to rt_sigreturn(), ZA remains
> enabled in current->thread.svcr from the handler context, causing
> thread_za_enabled() to succeed and restore_zt_context() to write userspace
> ZT data without restoring ZA state.
>
> Require user->za to be present in the signal frame before restoring ZT.

I supposed there's an argument that the signal handler might've intended
this but still, this does feel more sensible:

Reviewed-by: Mark Brown <broonie@xxxxxxxxxx>

though as the Sashiko report identifies we still leave ZA untouched if
both ZA and ZT are omitted from the signal frame. I'm not sure if it's
safer to reject any attempt to return from a signal with PSTATE.ZA set
but no ZA signal frame or if we should restore PSTATE.ZA to 0, the
former is safer but the latter is more in line with the handling here.

Attachment: signature.asc
Description: PGP signature