Skip to content

Commit aa7d3c8

Browse files
brooniectmarinas
authored andcommitted
kselftest/arm64: Fix SVE write data generation for SME only systems
fp-ptrace does not handle SME only systems correctly when generating data, on SME only systems scenarios where we are not in streaming mode will not have an expected vector length. This leads to attempts to do memcpy()s of zero byte arrays which can crash, fix this by skipping generation of SVE data for cases where we do not expect to have an active vector length. Signed-off-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent b021f45 commit aa7d3c8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tools/testing/selftests/arm64/fp/fp-ptrace.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,9 @@ static void sve_write_expected(struct test_config *config)
11511151
int vl = vl_expected(config);
11521152
int sme_vq = __sve_vq_from_vl(config->sme_vl_expected);
11531153

1154+
if (!vl)
1155+
return;
1156+
11541157
fill_random(z_expected, __SVE_ZREGS_SIZE(__sve_vq_from_vl(vl)));
11551158
fill_random(p_expected, __SVE_PREGS_SIZE(__sve_vq_from_vl(vl)));
11561159

@@ -1178,6 +1181,9 @@ static void sve_write_sve(pid_t child, struct test_config *config)
11781181
vl = vl_expected(config);
11791182
vq = __sve_vq_from_vl(vl);
11801183

1184+
if (!vl)
1185+
return;
1186+
11811187
iov.iov_len = SVE_PT_SVE_OFFSET + SVE_PT_SVE_SIZE(vq, SVE_PT_REGS_SVE);
11821188
iov.iov_base = malloc(iov.iov_len);
11831189
if (!iov.iov_base) {

0 commit comments

Comments
 (0)