mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Bradley Morgan <bradley.morgan@linux.dev>
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 22:48:26 +0000	[thread overview]
Message-ID: <ee1998f2-69dc-419a-b388-dd4e08cc68d6@sirena.org.uk> (raw)
In-Reply-To: <20261110221836.3265929-2-bradley.morgan@linux.dev>

[-- Attachment #1: Type: text/plain, Size: 1162 bytes --]

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2026-11-16 22:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 22:18 [PATCH 0/2] arm64: signal: Fix ZT restore without ZA and clean up bounds check Bradley Morgan
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 [this message]
2026-11-16 23:07     ` Bradley Morgan
2026-11-10 22:18 ` [PATCH 2/2] arm64: signal: drop redundant bounds check in parse_user_sigframe() Bradley Morgan

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=ee1998f2-69dc-419a-b388-dd4e08cc68d6@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=bradley.morgan@linux.dev \
    --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

all inboxes | Powered by JetHome®