Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Bradley Morgan <bradley.morgan@linux.dev>
To: Mark Brown <broonie@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH 1/2] arm64/fpsimd: signal: Require ZA context when restoring ZT context
Date: Mon, 16 Nov 2026 23:07:13 +0000	[thread overview]
Message-ID: <a5b278b7-9e9e-43d0-9fcb-a937d3e2a0b5@linux.dev> (raw)
In-Reply-To: <ee1998f2-69dc-419a-b388-dd4e08cc68d6@sirena.org.uk>


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(&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@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!


      reply	other threads:[~2026-11-16 23:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20261110221836.3265929-1-bradley.morgan@linux.dev>
2026-11-10 22:18 ` [PATCH 1/2] arm64/fpsimd: signal: Require ZA context when restoring ZT context Bradley Morgan
2026-11-16 22:48   ` Mark Brown
2026-11-16 23:07     ` Bradley Morgan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a5b278b7-9e9e-43d0-9fcb-a937d3e2a0b5@linux.dev \
    --to=bradley.morgan@linux.dev \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=stable@vger.kernel.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox