diff options
author | Christophe Leroy <christophe.leroy@csgroup.eu> | 2024-08-30 14:28:38 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2024-08-30 15:48:45 +0200 |
commit | 6eda706a535c3d0119eaefaad5fc119609639ed2 (patch) | |
tree | 21d56eb7fb38ba7ecf3aa922fe6721b6bd7cd3d3 /Documentation/ABI/stable | |
parent | selftests: vDSO: fix vDSO symbols lookup for powerpc64 (diff) | |
download | linux-6eda706a535c3d0119eaefaad5fc119609639ed2.tar.xz linux-6eda706a535c3d0119eaefaad5fc119609639ed2.zip |
selftests: vDSO: fix the way vDSO functions are called for powerpc
vdso_test_correctness test fails on powerpc:
~ # ./vdso_test_correctness
...
[RUN] Testing clock_gettime for clock CLOCK_REALTIME_ALARM (8)...
[FAIL] No such clock, but __vdso_clock_gettime returned 22
[RUN] Testing clock_gettime for clock CLOCK_BOOTTIME_ALARM (9)...
[FAIL] No such clock, but __vdso_clock_gettime returned 22
[RUN] Testing clock_gettime for clock CLOCK_SGI_CYCLE (10)...
[FAIL] No such clock, but __vdso_clock_gettime returned 22
...
[RUN] Testing clock_gettime for clock invalid (-1)...
[FAIL] No such clock, but __vdso_clock_gettime returned 22
[RUN] Testing clock_gettime for clock invalid (-2147483648)...
[FAIL] No such clock, but __vdso_clock_gettime returned 22
[RUN] Testing clock_gettime for clock invalid (2147483647)...
[FAIL] No such clock, but __vdso_clock_gettime returned 22
On powerpc, a call to a VDSO function is not an ordinary C function
call. Unlike several architectures which returns a negative error code
in case of an error, powerpc sets CR[SO] and returns the error code
as a positive value.
Define and use a macro called VDSO_CALL() which takes a pointer
to the function to call, the number of arguments and the arguments.
Also update ABI vdso documentation to reflect this subtlety.
Provide a specific version of VDSO_CALL() for powerpc that negates
the error code on return when CR[SO] is set.
Fixes: c7e5789b24d3 ("kselftest: Move test_vdso to the vDSO test suite")
Fixes: 2e9a97256616 ("selftests: vdso: Add a selftest for vDSO getcpu()")
Fixes: 693f5ca08ca0 ("kselftest: Extend vDSO selftest")
Fixes: b2f1c3db2887 ("kselftest: Extend vdso correctness test to clock_gettime64")
Fixes: 4920a2590e91 ("selftests/vDSO: add tests for vgetrandom")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Acked-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'Documentation/ABI/stable')
-rw-r--r-- | Documentation/ABI/stable/vdso | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Documentation/ABI/stable/vdso b/Documentation/ABI/stable/vdso index 951838d42781..85dbb6a160df 100644 --- a/Documentation/ABI/stable/vdso +++ b/Documentation/ABI/stable/vdso @@ -9,9 +9,11 @@ maps an ELF DSO into that program's address space. This DSO is called the vDSO and it often contains useful and highly-optimized alternatives to real syscalls. -These functions are called just like ordinary C function according to -your platform's ABI. Call them from a sensible context. (For example, -if you set CS on x86 to something strange, the vDSO functions are +These functions are called according to your platform's ABI. On many +platforms they are called just like ordinary C function. On other platforms +(ex: powerpc) they are called with the same convention as system calls which +is different from ordinary C functions. Call them from a sensible context. +(For example, if you set CS on x86 to something strange, the vDSO functions are within their rights to crash.) In addition, if you pass a bad pointer to a vDSO function, you might get SIGSEGV instead of -EFAULT. |