The vDSO should always produce the same errors as the system call. Either by reporting it explicitly or by falling back to the system call itself. Previously it was possible for a vDSO function to be present while the matching system call was disabled through CONFIG_COMPAT_32BIT_TIME=n, but this was aligned recently.
Make sure the error return values always match. Signed-off-by: Thomas Weißschuh <[email protected]> --- .../testing/selftests/vDSO/vdso_test_correctness.c | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tools/testing/selftests/vDSO/vdso_test_correctness.c b/tools/testing/selftests/vDSO/vdso_test_correctness.c index 3671ea815823..ffad3e636e56 100644 --- a/tools/testing/selftests/vDSO/vdso_test_correctness.c +++ b/tools/testing/selftests/vDSO/vdso_test_correctness.c @@ -277,14 +277,14 @@ static void test_one_clock_gettime(int clock, const char *name) printf("[RUN]\tTesting clock_gettime for clock %s (%d)...\n", name, clock); if (sys_clock_gettime(clock, &start) < 0) { - if (errno == EINVAL) { - vdso_ret = VDSO_CALL(vdso_clock_gettime, 2, clock, &vdso); - if (vdso_ret == -EINVAL) { - printf("[OK]\tNo such clock.\n"); - } else { - printf("[FAIL]\tNo such clock, but __vdso_clock_gettime returned %d\n", vdso_ret); - nerrs++; - } + vdso_ret = VDSO_CALL(vdso_clock_gettime, 2, clock, &vdso); + + if (-vdso_ret != errno) { + printf("[FAIL]\t clock_gettime(%d): Differing errors between syscall and vdso: %d %d\n", + clock, vdso_ret, errno); + nerrs++; + } else if (errno == EINVAL) { + printf("[OK]\tNo such clock.\n"); } else { printf("[WARN]\t clock_gettime(%d) syscall returned error %d\n", clock, errno); } @@ -339,14 +339,14 @@ static void test_one_clock_gettime64(int clock, const char *name) printf("[RUN]\tTesting clock_gettime64 for clock %s (%d)...\n", name, clock); if (sys_clock_gettime64(clock, &start) < 0) { - if (errno == EINVAL) { - vdso_ret = VDSO_CALL(vdso_clock_gettime64, 2, clock, &vdso); - if (vdso_ret == -EINVAL) { - printf("[OK]\tNo such clock.\n"); - } else { - printf("[FAIL]\tNo such clock, but __vdso_clock_gettime64 returned %d\n", vdso_ret); - nerrs++; - } + vdso_ret = VDSO_CALL(vdso_clock_gettime64, 2, clock, &vdso); + + if (-vdso_ret != errno) { + printf("[FAIL]\t clock_gettime64(%d): Differing errors between syscall and vdso: %d %d\n", + clock, vdso_ret, errno); + nerrs++; + } else if (errno == EINVAL) { + printf("[OK]\tNo such clock.\n"); } else { printf("[WARN]\t clock_gettime64(%d) syscall returned error %d\n", clock, errno); } -- 2.55.0

