History

arm64/ptrace: Don't enable SVE when setting streaming SVE

Systems which implement SME without also implementing SVE are architecturally valid but were not initially supported by the kernel, unfortunately we missed one issue in the ptrace code. The SVE register setting code is shared between SVE and streaming mode SVE. When we set full SVE register state we currently enable TIF_SVE unconditionally, in the case where streaming SVE is being configured on a system that supports vanilla SVE this is not an issue since we always initialise enough state for both vector lengths but on a system which only support SME it will result in us attempting to restore the SVE vector length after having set streaming SVE registers. Fix this by making the enabling of SVE conditional on setting SVE vector state. If we set streaming SVE state and SVE was not already enabled this will result in a SVE access trap on next use of normal SVE, this will cause us to flush our register state but this is fine since the only way to trigger a SVE access trap would be to exit streaming mode which will cause the in register state to be flushed anyway.

Mark Brown committed 3 years ago

Commit 045aecd1 parent 89a65c31 file · +5 −3Browse files

Unified · Split

arch/arm64/kernel/ptrace.c+5−3
@@ -932,11 +932,13 @@ static int sve_set_common(struct task_struct *target, · 931 unmodified lines
932 /*932 /*
933 * Ensure target->thread.sve_state is up to date with target's933 * Ensure target->thread.sve_state is up to date with target's
934 * FPSIMD regs, so that a short copyin leaves trailing934 * FPSIMD regs, so that a short copyin leaves trailing
935 * registers unmodified. Always enable SVE even if going into935 * registers unmodified. Only enable SVE if we are
936 * streaming mode.936 * configuring normal SVE, a system with streaming SVE may not
937 * have normal SVE.
937 */938 */
938 fpsimd_sync_to_sve(target);939 fpsimd_sync_to_sve(target);
939 set_tsk_thread_flag(target, TIF_SVE);940 if (type == ARM64_VEC_SVE)
941 set_tsk_thread_flag(target, TIF_SVE);
940 target->thread.fp_type = FP_STATE_SVE;942 target->thread.fp_type = FP_STATE_SVE;
941 943
942 BUILD_BUG_ON(SVE_PT_SVE_OFFSET != sizeof(header));944 BUILD_BUG_ON(SVE_PT_SVE_OFFSET != sizeof(header));

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t