Re: [PATCH 1/2] arm64/fpsimd: signal: Require ZA context when restoring ZT context
From: Bradley Morgan
Date: Mon Nov 16 2026 - 18:08:31 EST
On 11/16/26 10:48 PM, Mark Brown wrote:
On Tue, Nov 10, 2026 at 10:18:35PM +0000, Bradley Morgan wrote:
When restoring the signal frame, restore_zt_context() checks whether ZAI supposed there's an argument that the signal handler might've intended
is enabled via thread_za_enabled(¤t->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.
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.
Thx, do you suggest any remedies, id say sashiko is correct, but id hate for code
to get hairy :)
--- Thanks!