Skip to content

Commit c0139f6

Browse files
brooniectmarinas
authored andcommitted
arm64/ptrace: Clarify documentation of VL configuration via ptrace
When we configure SVE, SSVE or ZA via ptrace we allow the user to configure the vector length and specify any of the flags that are accepted when configuring via prctl(). This includes the S[VM]E_SET_VL_ONEXEC flag which defers the configuration of the VL until an exec(). We don't do anything to limit the provision of register data as part of configuring the _ONEXEC VL but as a function of the VL enumeration support we do this will be interpreted using the vector length currently configured for the process. This is all a bit surprising, and probably we should just not have allowed register data to be specified with _ONEXEC, but it's our ABI so let's add some explicit documentation in both the ABI documents and the source calling out what happens. The comments are also missing the fact that since SME does not have a mandatory 128 bit VL it is possible for VL enumeration to result in the configuration of a higher VL than was requested, cover that too. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20241106-arm64-sve-ptrace-vl-set-v1-1-3b164e8b559c@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent f95382d commit c0139f6

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

Documentation/arch/arm64/sme.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,10 @@ The regset data starts with struct user_za_header, containing:
346346

347347
* Writes to NT_ARM_ZT will set PSTATE.ZA to 1.
348348

349+
* If any register data is provided along with SME_PT_VL_ONEXEC then the
350+
registers data will be interpreted with the current vector length, not
351+
the vector length configured for use on exec.
352+
349353

350354
8. ELF coredump extensions
351355
---------------------------

Documentation/arch/arm64/sve.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,10 @@ The regset data starts with struct user_sve_header, containing:
402402
streaming mode and any SETREGSET of NT_ARM_SSVE will enter streaming mode
403403
if the target was not in streaming mode.
404404

405+
* If any register data is provided along with SVE_PT_VL_ONEXEC then the
406+
registers data will be interpreted with the current vector length, not
407+
the vector length configured for use on exec.
408+
405409
* The effect of writing a partial, incomplete payload is unspecified.
406410

407411

arch/arm64/kernel/ptrace.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,11 @@ static int sve_set_common(struct task_struct *target,
898898
if (ret)
899899
goto out;
900900

901-
/* Actual VL set may be less than the user asked for: */
901+
/*
902+
* Actual VL set may be different from what the user asked
903+
* for, or we may have configured the _ONEXEC VL not the
904+
* current VL:
905+
*/
902906
vq = sve_vq_from_vl(task_get_vl(target, type));
903907

904908
/* Enter/exit streaming mode */
@@ -1125,7 +1129,11 @@ static int za_set(struct task_struct *target,
11251129
if (ret)
11261130
goto out;
11271131

1128-
/* Actual VL set may be less than the user asked for: */
1132+
/*
1133+
* Actual VL set may be different from what the user asked
1134+
* for, or we may have configured the _ONEXEC rather than
1135+
* current VL:
1136+
*/
11291137
vq = sve_vq_from_vl(task_get_sme_vl(target));
11301138

11311139
/* Ensure there is some SVE storage for streaming mode */

0 commit comments

Comments
 (0)