Patch "arm64/ptrace: Ensure that the task sees ZT writes on first use" has been added to the 6.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    arm64/ptrace: Ensure that the task sees ZT writes on first use

to the 6.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     arm64-ptrace-ensure-that-the-task-sees-zt-writes-on-first-use.patch
and it can be found in the queue-6.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From 2f43f549cd0b3164ea0345e59aa3958c0d243383 Mon Sep 17 00:00:00 2001
From: Mark Brown <broonie@xxxxxxxxxx>
Date: Wed, 16 Aug 2023 19:40:07 +0100
Subject: arm64/ptrace: Ensure that the task sees ZT writes on first use

From: Mark Brown <broonie@xxxxxxxxxx>

commit 2f43f549cd0b3164ea0345e59aa3958c0d243383 upstream.

When the value of ZT is set via ptrace we don't disable traps for SME.
This means that when a the task has never used SME before then the value
set via ptrace will never be seen by the target task since it will
trigger a SME access trap which will flush the register state.

Disable SME traps when setting ZT, this means we also need to allocate
storage for SVE if it is not already allocated, for the benefit of
streaming SVE.

Fixes: f90b529bcbe5 ("arm64/sme: Implement ZT0 ptrace support")
Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
Cc: <stable@xxxxxxxxxxxxxxx> # 6.3.x
Link: https://lore.kernel.org/r/20230816-arm64-zt-ptrace-first-use-v2-1-00aa82847e28@xxxxxxxxxx
Signed-off-by: Catalin Marinas <catalin.marinas@xxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 arch/arm64/kernel/ptrace.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index a31af7a1abe3..187aa2b175b4 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -1177,6 +1177,11 @@ static int zt_set(struct task_struct *target,
 	if (!system_supports_sme2())
 		return -EINVAL;
 
+	/* Ensure SVE storage in case this is first use of SME */
+	sve_alloc(target, false);
+	if (!target->thread.sve_state)
+		return -ENOMEM;
+
 	if (!thread_za_enabled(&target->thread)) {
 		sme_alloc(target, true);
 		if (!target->thread.sme_state)
@@ -1186,8 +1191,10 @@ static int zt_set(struct task_struct *target,
 	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
 				 thread_zt_state(&target->thread),
 				 0, ZT_SIG_REG_BYTES);
-	if (ret == 0)
+	if (ret == 0) {
 		target->thread.svcr |= SVCR_ZA_MASK;
+		set_tsk_thread_flag(target, TIF_SME);
+	}
 
 	fpsimd_flush_task_state(target);
 
-- 
2.41.0



Patches currently in stable-queue which might be from broonie@xxxxxxxxxx are

queue-6.4/asoc-intel-sof_sdw-add-quirk-for-mtl-rvp.patch
queue-6.4/asoc-amd-vangogh-add-check-for-acp-config-flags-in-v.patch
queue-6.4/regulator-da9063-better-fix-null-deref-with-partial-dt.patch
queue-6.4/asoc-cs35l56-move-dsp-part-string-generation-so-that.patch
queue-6.4/asoc-sof-core-free-the-firmware-trace-before-calling.patch
queue-6.4/asoc-max98363-don-t-return-on-success-reading-revisi.patch
queue-6.4/asoc-intel-sof_sdw_rt_sdca_jack_common-test-sof_jack.patch
queue-6.4/asoc-intel-sof_sdw-add-quirk-for-lnl-rvp.patch
queue-6.4/asoc-sof-intel-fix-soundwire-hdaudio-mutual-exclusio.patch
queue-6.4/asoc-intel-sof_sdw-add-support-for-rex-soundwire.patch
queue-6.4/asoc-rt5665-add-missed-regulator_bulk_disable.patch
queue-6.4/asoc-intel-sof_sdw-add-quick-for-dell-sku-0bda.patch
queue-6.4/regulator-qcom-rpmh-fix-ldo-12-regulator-for-pm8550.patch
queue-6.4/asoc-meson-axg-tdm-formatter-fix-channel-slot-alloca.patch
queue-6.4/asoc-sof-amd-add-pci-revision-id-check.patch
queue-6.4/arm64-ptrace-ensure-that-the-task-sees-zt-writes-on-first-use.patch
queue-6.4/arm64-ptrace-ensure-that-sme-is-set-up-for-target-when-writing-ssve-state.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux