Skip to content

Commit b017a0c

Browse files
brooniectmarinas
authored andcommitted
arm64/ptrace: Use saved floating point state type to determine SVE layout
The SVE register sets have two different formats, one of which is a wrapped version of the standard FPSIMD register set and another with actual SVE register data. At present we check TIF_SVE to see if full SVE register state should be provided when reading the SVE regset but if we were in a syscall we may have saved only floating point registers even though that is set. Fix this and simplify the logic by checking and using the format which we recorded when deciding if we should use FPSIMD or SVE format. Fixes: 8c845e2 ("arm64/sve: Leave SVE enabled on syscall if we don't context switch") Cc: <[email protected]> # 6.2.x Signed-off-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 4cece76 commit b017a0c

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

arch/arm64/kernel/ptrace.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,6 @@ static void sve_init_header_from_task(struct user_sve_header *header,
761761
{
762762
unsigned int vq;
763763
bool active;
764-
bool fpsimd_only;
765764
enum vec_type task_type;
766765

767766
memset(header, 0, sizeof(*header));
@@ -777,20 +776,18 @@ static void sve_init_header_from_task(struct user_sve_header *header,
777776
case ARM64_VEC_SVE:
778777
if (test_tsk_thread_flag(target, TIF_SVE_VL_INHERIT))
779778
header->flags |= SVE_PT_VL_INHERIT;
780-
fpsimd_only = !test_tsk_thread_flag(target, TIF_SVE);
781779
break;
782780
case ARM64_VEC_SME:
783781
if (test_tsk_thread_flag(target, TIF_SME_VL_INHERIT))
784782
header->flags |= SVE_PT_VL_INHERIT;
785-
fpsimd_only = false;
786783
break;
787784
default:
788785
WARN_ON_ONCE(1);
789786
return;
790787
}
791788

792789
if (active) {
793-
if (fpsimd_only) {
790+
if (target->thread.fp_type == FP_STATE_FPSIMD) {
794791
header->flags |= SVE_PT_REGS_FPSIMD;
795792
} else {
796793
header->flags |= SVE_PT_REGS_SVE;

0 commit comments

Comments
 (0)