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

Mark Brown broonie at kernel.org
Mon Nov 16 14:48:26 PST 2026


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 at kernel.org>

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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20261116/b2a8d018/attachment.sig>


More information about the linux-arm-kernel mailing list