[PATCH 1/2] arm64/fpsimd: signal: Require ZA context when restoring ZT context
Bradley Morgan
bradley.morgan at linux.dev
Mon Nov 16 15:07:13 PST 2026
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 ZA
>> 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.
> 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.
Thx, do you suggest any remedies, id say sashiko is correct, but id hate
for code
to get hairy :)
--- Thanks!
More information about the linux-arm-kernel
mailing list