]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-6.6/arm64-ptrace-use-saved-floating-point-state-type-to-determine-sve-layout.patch
36e909cc1ee1b8a38db4d577819c1d1d7aa65871
[thirdparty/kernel/stable-queue.git] / queue-6.6 / arm64-ptrace-use-saved-floating-point-state-type-to-determine-sve-layout.patch
1 From b017a0cea627fcbe158fc2c214fe893e18c4d0c4 Mon Sep 17 00:00:00 2001
2 From: Mark Brown <broonie@kernel.org>
3 Date: Mon, 25 Mar 2024 16:35:21 +0000
4 Subject: arm64/ptrace: Use saved floating point state type to determine SVE layout
5
6 From: Mark Brown <broonie@kernel.org>
7
8 commit b017a0cea627fcbe158fc2c214fe893e18c4d0c4 upstream.
9
10 The SVE register sets have two different formats, one of which is a wrapped
11 version of the standard FPSIMD register set and another with actual SVE
12 register data. At present we check TIF_SVE to see if full SVE register
13 state should be provided when reading the SVE regset but if we were in a
14 syscall we may have saved only floating point registers even though that is
15 set.
16
17 Fix this and simplify the logic by checking and using the format which we
18 recorded when deciding if we should use FPSIMD or SVE format.
19
20 Fixes: 8c845e273104 ("arm64/sve: Leave SVE enabled on syscall if we don't context switch")
21 Cc: <stable@vger.kernel.org> # 6.2.x
22 Signed-off-by: Mark Brown <broonie@kernel.org>
23 Link: https://lore.kernel.org/r/20240325-arm64-ptrace-fp-type-v1-1-8dc846caf11f@kernel.org
24 Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
25 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
26 ---
27 arch/arm64/kernel/ptrace.c | 5 +----
28 1 file changed, 1 insertion(+), 4 deletions(-)
29
30 --- a/arch/arm64/kernel/ptrace.c
31 +++ b/arch/arm64/kernel/ptrace.c
32 @@ -728,7 +728,6 @@ static void sve_init_header_from_task(st
33 {
34 unsigned int vq;
35 bool active;
36 - bool fpsimd_only;
37 enum vec_type task_type;
38
39 memset(header, 0, sizeof(*header));
40 @@ -744,12 +743,10 @@ static void sve_init_header_from_task(st
41 case ARM64_VEC_SVE:
42 if (test_tsk_thread_flag(target, TIF_SVE_VL_INHERIT))
43 header->flags |= SVE_PT_VL_INHERIT;
44 - fpsimd_only = !test_tsk_thread_flag(target, TIF_SVE);
45 break;
46 case ARM64_VEC_SME:
47 if (test_tsk_thread_flag(target, TIF_SME_VL_INHERIT))
48 header->flags |= SVE_PT_VL_INHERIT;
49 - fpsimd_only = false;
50 break;
51 default:
52 WARN_ON_ONCE(1);
53 @@ -757,7 +754,7 @@ static void sve_init_header_from_task(st
54 }
55
56 if (active) {
57 - if (fpsimd_only) {
58 + if (target->thread.fp_type == FP_STATE_FPSIMD) {
59 header->flags |= SVE_PT_REGS_FPSIMD;
60 } else {
61 header->flags |= SVE_PT_REGS_SVE;