Skip to content

Commit 61da7c8

Browse files
brooniewilldeacon
authored andcommitted
arm64/signal: Don't assume that TIF_SVE means we saved SVE state
When we are in a syscall we will only save the FPSIMD subset even though the task still has access to the full register set, and on context switch we will only remove TIF_SVE when loading the register state. This means that the signal handling code should not assume that TIF_SVE means that the register state is stored in SVE format, it should instead check the format that was recorded during save. Fixes: 8c845e2 ("arm64/sve: Leave SVE enabled on syscall if we don't context switch") Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20240130-arm64-sve-signal-regs-v2-1-9fc6f9502782@kernel.org Signed-off-by: Will Deacon <will@kernel.org>
1 parent 54be6c6 commit 61da7c8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

arch/arm64/kernel/fpsimd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1635,7 +1635,7 @@ void fpsimd_preserve_current_state(void)
16351635
void fpsimd_signal_preserve_current_state(void)
16361636
{
16371637
fpsimd_preserve_current_state();
1638-
if (test_thread_flag(TIF_SVE))
1638+
if (current->thread.fp_type == FP_STATE_SVE)
16391639
sve_to_fpsimd(current);
16401640
}
16411641

arch/arm64/kernel/signal.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ static int preserve_sve_context(struct sve_context __user *ctx)
242242
vl = task_get_sme_vl(current);
243243
vq = sve_vq_from_vl(vl);
244244
flags |= SVE_SIG_FLAG_SM;
245-
} else if (test_thread_flag(TIF_SVE)) {
245+
} else if (current->thread.fp_type == FP_STATE_SVE) {
246246
vq = sve_vq_from_vl(vl);
247247
}
248248

@@ -878,7 +878,7 @@ static int setup_sigframe_layout(struct rt_sigframe_user_layout *user,
878878
if (system_supports_sve() || system_supports_sme()) {
879879
unsigned int vq = 0;
880880

881-
if (add_all || test_thread_flag(TIF_SVE) ||
881+
if (add_all || current->thread.fp_type == FP_STATE_SVE ||
882882
thread_sm_enabled(&current->thread)) {
883883
int vl = max(sve_max_vl(), sme_max_vl());
884884

0 commit comments

Comments
 (0)