* [PATCH 1/5] selftests: vdso: Fix vDSO name for powerpc
@ 2024-08-30 12:28 Christophe Leroy
2024-08-30 12:28 ` [PATCH 2/5] selftests: vdso: Fix vdso_config " Christophe Leroy
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Christophe Leroy @ 2024-08-30 12:28 UTC (permalink / raw)
To: Shuah Khan, Vincenzo Frascino, Thomas Gleixner, Andy Lutomirski,
H. Peter Anvin, Mark Brown, Jason A. Donenfeld
Cc: Christophe Leroy, linux-kselftest, linux-kernel, linuxppc-dev
Following error occurs when running vdso_test_correctness on powerpc:
~ # ./vdso_test_correctness
[WARN] failed to find vDSO
[SKIP] No vDSO, so skipping clock_gettime() tests
[SKIP] No vDSO, so skipping clock_gettime64() tests
[RUN] Testing getcpu...
[OK] CPU 0: syscall: cpu 0, node 0
On powerpc, vDSO is neither called linux-vdso.so.1 nor linux-gate.so.1
but linux-vdso32.so.1 or linux-vdso64.so.1.
Also search those two names before giving up.
Fixes: c7e5789b24d3 ("kselftest: Move test_vdso to the vDSO test suite")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
tools/testing/selftests/vDSO/vdso_test_correctness.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/testing/selftests/vDSO/vdso_test_correctness.c b/tools/testing/selftests/vDSO/vdso_test_correctness.c
index e691a3cf1491..cdb697ae8343 100644
--- a/tools/testing/selftests/vDSO/vdso_test_correctness.c
+++ b/tools/testing/selftests/vDSO/vdso_test_correctness.c
@@ -114,6 +114,12 @@ static void fill_function_pointers()
if (!vdso)
vdso = dlopen("linux-gate.so.1",
RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD);
+ if (!vdso)
+ vdso = dlopen("linux-vdso32.so.1",
+ RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD);
+ if (!vdso)
+ vdso = dlopen("linux-vdso64.so.1",
+ RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD);
if (!vdso) {
printf("[WARN]\tfailed to find vDSO\n");
return;
--
2.44.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/5] selftests: vdso: Fix vdso_config for powerpc
2024-08-30 12:28 [PATCH 1/5] selftests: vdso: Fix vDSO name for powerpc Christophe Leroy
@ 2024-08-30 12:28 ` Christophe Leroy
2024-08-30 12:28 ` [PATCH 3/5] selftests: vdso: Fix vDSO symbols lookup for powerpc64 Christophe Leroy
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Christophe Leroy @ 2024-08-30 12:28 UTC (permalink / raw)
To: Shuah Khan, Vincenzo Frascino, Thomas Gleixner, Andy Lutomirski,
H. Peter Anvin, Mark Brown, Jason A. Donenfeld
Cc: Christophe Leroy, linux-kselftest, linux-kernel, linuxppc-dev
Running vdso_test_correctness on powerpc64 gives the following warning:
~ # ./vdso_test_correctness
Warning: failed to find clock_gettime64 in vDSO
This is because vdso_test_correctness was built with VDSO_32BIT defined.
__powerpc__ macro is defined on both powerpc32 and powerpc64 so
__powerpc64__ needs to be checked first in vdso_config.h
Fixes: 693f5ca08ca0 ("kselftest: Extend vDSO selftest")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
tools/testing/selftests/vDSO/vdso_config.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/vDSO/vdso_config.h b/tools/testing/selftests/vDSO/vdso_config.h
index 7b543e7f04d7..00bfed6e4922 100644
--- a/tools/testing/selftests/vDSO/vdso_config.h
+++ b/tools/testing/selftests/vDSO/vdso_config.h
@@ -18,13 +18,13 @@
#elif defined(__aarch64__)
#define VDSO_VERSION 3
#define VDSO_NAMES 0
-#elif defined(__powerpc__)
+#elif defined(__powerpc64__)
#define VDSO_VERSION 1
#define VDSO_NAMES 0
-#define VDSO_32BIT 1
-#elif defined(__powerpc64__)
+#elif defined(__powerpc__)
#define VDSO_VERSION 1
#define VDSO_NAMES 0
+#define VDSO_32BIT 1
#elif defined (__s390__)
#define VDSO_VERSION 2
#define VDSO_NAMES 0
--
2.44.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/5] selftests: vdso: Fix vDSO symbols lookup for powerpc64
2024-08-30 12:28 [PATCH 1/5] selftests: vdso: Fix vDSO name for powerpc Christophe Leroy
2024-08-30 12:28 ` [PATCH 2/5] selftests: vdso: Fix vdso_config " Christophe Leroy
@ 2024-08-30 12:28 ` Christophe Leroy
2024-08-30 12:28 ` [PATCH 4/5] selftests: vdso: Fix the way vDSO functions are called for powerpc Christophe Leroy
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Christophe Leroy @ 2024-08-30 12:28 UTC (permalink / raw)
To: Shuah Khan, Vincenzo Frascino, Thomas Gleixner, Andy Lutomirski,
H. Peter Anvin, Mark Brown, Jason A. Donenfeld
Cc: Christophe Leroy, linux-kselftest, linux-kernel, linuxppc-dev
On powerpc64, following tests fail locating vDSO functions:
~ # ./vdso_test_abi
TAP version 13
1..16
# [vDSO kselftest] VDSO_VERSION: LINUX_2.6.15
# Couldn't find __kernel_gettimeofday
ok 1 # SKIP __kernel_gettimeofday
# clock_id: CLOCK_REALTIME
# Couldn't find __kernel_clock_gettime
ok 2 # SKIP __kernel_clock_gettime CLOCK_REALTIME
# Couldn't find __kernel_clock_getres
ok 3 # SKIP __kernel_clock_getres CLOCK_REALTIME
...
# Couldn't find __kernel_time
ok 16 # SKIP __kernel_time
# Totals: pass:0 fail:0 xfail:0 xpass:0 skip:16 error:0
~ # ./vdso_test_getrandom
__kernel_getrandom is missing!
~ # ./vdso_test_gettimeofday
Could not find __kernel_gettimeofday
~ # ./vdso_test_getcpu
Could not find __kernel_getcpu
On powerpc64, as shown below by readelf, vDSO functions symbols have
type NOTYPE, so also accept that type when looking for symbols.
$ powerpc64-linux-gnu-readelf -a arch/powerpc/kernel/vdso/vdso64.so.dbg
ELF Header:
Magic: 7f 45 4c 46 02 02 01 00 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, big endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: DYN (Shared object file)
Machine: PowerPC64
Version: 0x1
...
Symbol table '.dynsym' contains 12 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000524 84 NOTYPE GLOBAL DEFAULT 8 __[...]@@LINUX_2.6.15
2: 00000000000005f0 36 NOTYPE GLOBAL DEFAULT 8 __[...]@@LINUX_2.6.15
3: 0000000000000578 68 NOTYPE GLOBAL DEFAULT 8 __[...]@@LINUX_2.6.15
4: 0000000000000000 0 OBJECT GLOBAL DEFAULT ABS LINUX_2.6.15
5: 00000000000006c0 48 NOTYPE GLOBAL DEFAULT 8 __[...]@@LINUX_2.6.15
6: 0000000000000614 172 NOTYPE GLOBAL DEFAULT 8 __[...]@@LINUX_2.6.15
7: 00000000000006f0 84 NOTYPE GLOBAL DEFAULT 8 __[...]@@LINUX_2.6.15
8: 000000000000047c 84 NOTYPE GLOBAL DEFAULT 8 __[...]@@LINUX_2.6.15
9: 0000000000000454 12 NOTYPE GLOBAL DEFAULT 8 __[...]@@LINUX_2.6.15
10: 00000000000004d0 84 NOTYPE GLOBAL DEFAULT 8 __[...]@@LINUX_2.6.15
11: 00000000000005bc 52 NOTYPE GLOBAL DEFAULT 8 __[...]@@LINUX_2.6.15
Symbol table '.symtab' contains 56 entries:
Num: Value Size Type Bind Vis Ndx Name
...
45: 0000000000000000 0 OBJECT GLOBAL DEFAULT ABS LINUX_2.6.15
46: 00000000000006c0 48 NOTYPE GLOBAL DEFAULT 8 __kernel_getcpu
47: 0000000000000524 84 NOTYPE GLOBAL DEFAULT 8 __kernel_clock_getres
48: 00000000000005f0 36 NOTYPE GLOBAL DEFAULT 8 __kernel_get_tbfreq
49: 000000000000047c 84 NOTYPE GLOBAL DEFAULT 8 __kernel_gettimeofday
50: 0000000000000614 172 NOTYPE GLOBAL DEFAULT 8 __kernel_sync_dicache
51: 00000000000006f0 84 NOTYPE GLOBAL DEFAULT 8 __kernel_getrandom
52: 0000000000000454 12 NOTYPE GLOBAL DEFAULT 8 __kernel_sigtram[...]
53: 0000000000000578 68 NOTYPE GLOBAL DEFAULT 8 __kernel_time
54: 00000000000004d0 84 NOTYPE GLOBAL DEFAULT 8 __kernel_clock_g[...]
55: 00000000000005bc 52 NOTYPE GLOBAL DEFAULT 8 __kernel_get_sys[...]
Fixes: 98eedc3a9dbf ("Document the vDSO and add a reference parser")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
tools/testing/selftests/vDSO/parse_vdso.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/vDSO/parse_vdso.c b/tools/testing/selftests/vDSO/parse_vdso.c
index 4ae417372e9e..d9ccc5acac18 100644
--- a/tools/testing/selftests/vDSO/parse_vdso.c
+++ b/tools/testing/selftests/vDSO/parse_vdso.c
@@ -216,7 +216,8 @@ void *vdso_sym(const char *version, const char *name)
ELF(Sym) *sym = &vdso_info.symtab[chain];
/* Check for a defined global or weak function w/ right name. */
- if (ELF64_ST_TYPE(sym->st_info) != STT_FUNC)
+ if (ELF64_ST_TYPE(sym->st_info) != STT_FUNC &&
+ ELF64_ST_TYPE(sym->st_info) != STT_NOTYPE)
continue;
if (ELF64_ST_BIND(sym->st_info) != STB_GLOBAL &&
ELF64_ST_BIND(sym->st_info) != STB_WEAK)
--
2.44.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/5] selftests: vdso: Fix the way vDSO functions are called for powerpc
2024-08-30 12:28 [PATCH 1/5] selftests: vdso: Fix vDSO name for powerpc Christophe Leroy
2024-08-30 12:28 ` [PATCH 2/5] selftests: vdso: Fix vdso_config " Christophe Leroy
2024-08-30 12:28 ` [PATCH 3/5] selftests: vdso: Fix vDSO symbols lookup for powerpc64 Christophe Leroy
@ 2024-08-30 12:28 ` Christophe Leroy
2024-08-30 12:28 ` [PATCH 5/5] selftests: vdso: Use parse_vdso.h in vdso_test_abi Christophe Leroy
2024-08-30 12:41 ` [PATCH 1/5] selftests: vdso: Fix vDSO name for powerpc Jason A. Donenfeld
4 siblings, 0 replies; 7+ messages in thread
From: Christophe Leroy @ 2024-08-30 12:28 UTC (permalink / raw)
To: Shuah Khan, Vincenzo Frascino, Thomas Gleixner, Andy Lutomirski,
H. Peter Anvin, Mark Brown, Jason A. Donenfeld
Cc: Christophe Leroy, linux-kselftest, linux-kernel, linuxppc-dev
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>
---
Documentation/ABI/stable/vdso | 8 ++-
tools/testing/selftests/vDSO/vdso_call.h | 70 +++++++++++++++++++
tools/testing/selftests/vDSO/vdso_test_abi.c | 9 +--
.../selftests/vDSO/vdso_test_correctness.c | 15 ++--
.../testing/selftests/vDSO/vdso_test_getcpu.c | 3 +-
.../selftests/vDSO/vdso_test_getrandom.c | 5 +-
.../selftests/vDSO/vdso_test_gettimeofday.c | 3 +-
7 files changed, 95 insertions(+), 18 deletions(-)
create mode 100644 tools/testing/selftests/vDSO/vdso_call.h
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.
diff --git a/tools/testing/selftests/vDSO/vdso_call.h b/tools/testing/selftests/vDSO/vdso_call.h
new file mode 100644
index 000000000000..bb237d771051
--- /dev/null
+++ b/tools/testing/selftests/vDSO/vdso_call.h
@@ -0,0 +1,70 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Macro to call vDSO functions
+ *
+ * Copyright (C) 2024 Christophe Leroy <christophe.leroy@csgroup.eu>, CS GROUP France
+ */
+#ifndef __VDSO_CALL_H__
+#define __VDSO_CALL_H__
+
+#ifdef __powerpc__
+
+#define LOADARGS_1(fn, __arg1) do { \
+ _r0 = fn; \
+ _r3 = (long)__arg1; \
+} while (0)
+
+#define LOADARGS_2(fn, __arg1, __arg2) do { \
+ _r0 = fn; \
+ _r3 = (long)__arg1; \
+ _r4 = (long)__arg2; \
+} while (0)
+
+#define LOADARGS_3(fn, __arg1, __arg2, __arg3) do { \
+ _r0 = fn; \
+ _r3 = (long)__arg1; \
+ _r4 = (long)__arg2; \
+ _r5 = (long)__arg3; \
+} while (0)
+
+#define LOADARGS_5(fn, __arg1, __arg2, __arg3, __arg4, __arg5) do { \
+ _r0 = fn; \
+ _r3 = (long)__arg1; \
+ _r4 = (long)__arg2; \
+ _r5 = (long)__arg3; \
+ _r6 = (long)__arg4; \
+ _r7 = (long)__arg5; \
+} while (0)
+
+#define VDSO_CALL(fn, nr, args...) ({ \
+ register void *_r0 asm ("r0"); \
+ register long _r3 asm ("r3"); \
+ register long _r4 asm ("r4"); \
+ register long _r5 asm ("r5"); \
+ register long _r6 asm ("r6"); \
+ register long _r7 asm ("r7"); \
+ register long _r8 asm ("r8"); \
+ register long _rval asm ("r3"); \
+ \
+ LOADARGS_##nr(fn, args); \
+ \
+ asm volatile( \
+ " mtctr %0\n" \
+ " bctrl\n" \
+ " bns+ 1f\n" \
+ " neg 3, 3\n" \
+ "1:" \
+ : "+r" (_r0), "=r" (_r3), "+r" (_r4), "+r" (_r5), \
+ "+r" (_r6), "+r" (_r7), "+r" (_r8) \
+ : "r" (_rval) \
+ : "r9", "r10", "r11", "r12", "cr0", "cr1", "cr5", \
+ "cr6", "cr7", "xer", "lr", "ctr", "memory" \
+ ); \
+ _rval; \
+})
+
+#else
+#define VDSO_CALL(fn, nr, args...) fn(args)
+#endif
+
+#endif
diff --git a/tools/testing/selftests/vDSO/vdso_test_abi.c b/tools/testing/selftests/vDSO/vdso_test_abi.c
index 96d32fd65b42..00034208c4c6 100644
--- a/tools/testing/selftests/vDSO/vdso_test_abi.c
+++ b/tools/testing/selftests/vDSO/vdso_test_abi.c
@@ -20,6 +20,7 @@
#include "../kselftest.h"
#include "vdso_config.h"
+#include "vdso_call.h"
extern void *vdso_sym(const char *version, const char *name);
extern void vdso_init_from_sysinfo_ehdr(uintptr_t base);
@@ -61,7 +62,7 @@ static void vdso_test_gettimeofday(void)
}
struct timeval tv;
- long ret = vdso_gettimeofday(&tv, 0);
+ long ret = VDSO_CALL(vdso_gettimeofday, 2, &tv, 0);
if (ret == 0) {
ksft_print_msg("The time is %lld.%06lld\n",
@@ -86,7 +87,7 @@ static void vdso_test_clock_gettime(clockid_t clk_id)
}
struct timespec ts;
- long ret = vdso_clock_gettime(clk_id, &ts);
+ long ret = VDSO_CALL(vdso_clock_gettime, 2, clk_id, &ts);
if (ret == 0) {
ksft_print_msg("The time is %lld.%06lld\n",
@@ -111,7 +112,7 @@ static void vdso_test_time(void)
return;
}
- long ret = vdso_time(NULL);
+ long ret = VDSO_CALL(vdso_time, 1, NULL);
if (ret > 0) {
ksft_print_msg("The time in hours since January 1, 1970 is %lld\n",
@@ -138,7 +139,7 @@ static void vdso_test_clock_getres(clockid_t clk_id)
}
struct timespec ts, sys_ts;
- long ret = vdso_clock_getres(clk_id, &ts);
+ long ret = VDSO_CALL(vdso_clock_getres, 2, clk_id, &ts);
if (ret == 0) {
ksft_print_msg("The vdso resolution is %lld %lld\n",
diff --git a/tools/testing/selftests/vDSO/vdso_test_correctness.c b/tools/testing/selftests/vDSO/vdso_test_correctness.c
index cdb697ae8343..5fb97ad67eea 100644
--- a/tools/testing/selftests/vDSO/vdso_test_correctness.c
+++ b/tools/testing/selftests/vDSO/vdso_test_correctness.c
@@ -20,6 +20,7 @@
#include <limits.h>
#include "vdso_config.h"
+#include "vdso_call.h"
#include "../kselftest.h"
static const char **name;
@@ -186,7 +187,7 @@ static void test_getcpu(void)
ret_sys = sys_getcpu(&cpu_sys, &node_sys, 0);
if (vdso_getcpu)
- ret_vdso = vdso_getcpu(&cpu_vdso, &node_vdso, 0);
+ ret_vdso = VDSO_CALL(vdso_getcpu, 3, &cpu_vdso, &node_vdso, 0);
if (vgetcpu)
ret_vsys = vgetcpu(&cpu_vsys, &node_vsys, 0);
@@ -269,7 +270,7 @@ static void test_one_clock_gettime(int clock, const char *name)
if (sys_clock_gettime(clock, &start) < 0) {
if (errno == EINVAL) {
- vdso_ret = vdso_clock_gettime(clock, &vdso);
+ vdso_ret = VDSO_CALL(vdso_clock_gettime, 2, clock, &vdso);
if (vdso_ret == -EINVAL) {
printf("[OK]\tNo such clock.\n");
} else {
@@ -282,7 +283,7 @@ static void test_one_clock_gettime(int clock, const char *name)
return;
}
- vdso_ret = vdso_clock_gettime(clock, &vdso);
+ vdso_ret = VDSO_CALL(vdso_clock_gettime, 2, clock, &vdso);
end_ret = sys_clock_gettime(clock, &end);
if (vdso_ret != 0 || end_ret != 0) {
@@ -331,7 +332,7 @@ static void test_one_clock_gettime64(int clock, const char *name)
if (sys_clock_gettime64(clock, &start) < 0) {
if (errno == EINVAL) {
- vdso_ret = vdso_clock_gettime64(clock, &vdso);
+ vdso_ret = VDSO_CALL(vdso_clock_gettime64, 2, clock, &vdso);
if (vdso_ret == -EINVAL) {
printf("[OK]\tNo such clock.\n");
} else {
@@ -344,7 +345,7 @@ static void test_one_clock_gettime64(int clock, const char *name)
return;
}
- vdso_ret = vdso_clock_gettime64(clock, &vdso);
+ vdso_ret = VDSO_CALL(vdso_clock_gettime64, 2, clock, &vdso);
end_ret = sys_clock_gettime64(clock, &end);
if (vdso_ret != 0 || end_ret != 0) {
@@ -401,7 +402,7 @@ static void test_gettimeofday(void)
return;
}
- vdso_ret = vdso_gettimeofday(&vdso, &vdso_tz);
+ vdso_ret = VDSO_CALL(vdso_gettimeofday, 2, &vdso, &vdso_tz);
end_ret = sys_gettimeofday(&end, NULL);
if (vdso_ret != 0 || end_ret != 0) {
@@ -431,7 +432,7 @@ static void test_gettimeofday(void)
}
/* And make sure that passing NULL for tz doesn't crash. */
- vdso_gettimeofday(&vdso, NULL);
+ VDSO_CALL(vdso_gettimeofday, 2, &vdso, NULL);
}
int main(int argc, char **argv)
diff --git a/tools/testing/selftests/vDSO/vdso_test_getcpu.c b/tools/testing/selftests/vDSO/vdso_test_getcpu.c
index b758f68c6c9c..cdeaed45fb26 100644
--- a/tools/testing/selftests/vDSO/vdso_test_getcpu.c
+++ b/tools/testing/selftests/vDSO/vdso_test_getcpu.c
@@ -14,6 +14,7 @@
#include "../kselftest.h"
#include "parse_vdso.h"
#include "vdso_config.h"
+#include "vdso_call.h"
struct getcpu_cache;
typedef long (*getcpu_t)(unsigned int *, unsigned int *,
@@ -42,7 +43,7 @@ int main(int argc, char **argv)
return KSFT_SKIP;
}
- ret = get_cpu(&cpu, &node, 0);
+ ret = VDSO_CALL(get_cpu, 3, &cpu, &node, 0);
if (ret == 0) {
printf("Running on CPU %u node %u\n", cpu, node);
} else {
diff --git a/tools/testing/selftests/vDSO/vdso_test_getrandom.c b/tools/testing/selftests/vDSO/vdso_test_getrandom.c
index 05122425a873..94aa1cffde52 100644
--- a/tools/testing/selftests/vDSO/vdso_test_getrandom.c
+++ b/tools/testing/selftests/vDSO/vdso_test_getrandom.c
@@ -21,6 +21,7 @@
#include "../kselftest.h"
#include "parse_vdso.h"
+#include "vdso_call.h"
#ifndef timespecsub
#define timespecsub(tsp, usp, vsp) \
@@ -120,7 +121,7 @@ static void vgetrandom_init(void)
printf("__vdso_getrandom is missing!\n");
exit(KSFT_FAIL);
}
- if (grnd_ctx.fn(NULL, 0, 0, &grnd_ctx.params, ~0UL) != 0) {
+ if (VDSO_CALL(grnd_ctx.fn, 5, NULL, 0, 0, &grnd_ctx.params, ~0UL) != 0) {
printf("failed to fetch vgetrandom params!\n");
exit(KSFT_FAIL);
}
@@ -143,7 +144,7 @@ static ssize_t vgetrandom(void *buf, size_t len, unsigned long flags)
exit(KSFT_FAIL);
}
}
- return grnd_ctx.fn(buf, len, flags, state, grnd_ctx.params.size_of_opaque_state);
+ return VDSO_CALL(grnd_ctx.fn, 5, buf, len, flags, state, grnd_ctx.params.size_of_opaque_state);
}
enum { TRIALS = 25000000, THREADS = 256 };
diff --git a/tools/testing/selftests/vDSO/vdso_test_gettimeofday.c b/tools/testing/selftests/vDSO/vdso_test_gettimeofday.c
index ee4f1ca56a71..e31b18ffae33 100644
--- a/tools/testing/selftests/vDSO/vdso_test_gettimeofday.c
+++ b/tools/testing/selftests/vDSO/vdso_test_gettimeofday.c
@@ -19,6 +19,7 @@
#include "../kselftest.h"
#include "parse_vdso.h"
#include "vdso_config.h"
+#include "vdso_call.h"
int main(int argc, char **argv)
{
@@ -43,7 +44,7 @@ int main(int argc, char **argv)
}
struct timeval tv;
- long ret = gtod(&tv, 0);
+ long ret = VDSO_CALL(gtod, 2, &tv, 0);
if (ret == 0) {
printf("The time is %lld.%06lld\n",
--
2.44.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 5/5] selftests: vdso: Use parse_vdso.h in vdso_test_abi
2024-08-30 12:28 [PATCH 1/5] selftests: vdso: Fix vDSO name for powerpc Christophe Leroy
` (2 preceding siblings ...)
2024-08-30 12:28 ` [PATCH 4/5] selftests: vdso: Fix the way vDSO functions are called for powerpc Christophe Leroy
@ 2024-08-30 12:28 ` Christophe Leroy
2024-08-30 12:41 ` [PATCH 1/5] selftests: vdso: Fix vDSO name for powerpc Jason A. Donenfeld
4 siblings, 0 replies; 7+ messages in thread
From: Christophe Leroy @ 2024-08-30 12:28 UTC (permalink / raw)
To: Shuah Khan, Vincenzo Frascino, Thomas Gleixner, Andy Lutomirski,
H. Peter Anvin, Mark Brown, Jason A. Donenfeld
Cc: Christophe Leroy, linux-kselftest, linux-kernel, linuxppc-dev
Don't duplicate parse_vdso function prototypes, include
the header instead.
Fixes: 693f5ca08ca0 ("kselftest: Extend vDSO selftest")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
tools/testing/selftests/vDSO/vdso_test_abi.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/tools/testing/selftests/vDSO/vdso_test_abi.c b/tools/testing/selftests/vDSO/vdso_test_abi.c
index 00034208c4c6..a54424e2336f 100644
--- a/tools/testing/selftests/vDSO/vdso_test_abi.c
+++ b/tools/testing/selftests/vDSO/vdso_test_abi.c
@@ -21,10 +21,7 @@
#include "../kselftest.h"
#include "vdso_config.h"
#include "vdso_call.h"
-
-extern void *vdso_sym(const char *version, const char *name);
-extern void vdso_init_from_sysinfo_ehdr(uintptr_t base);
-extern void vdso_init_from_auxv(void *auxv);
+#include "parse_vdso.h"
static const char *version;
static const char **name;
--
2.44.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/5] selftests: vdso: Fix vDSO name for powerpc
2024-08-30 12:28 [PATCH 1/5] selftests: vdso: Fix vDSO name for powerpc Christophe Leroy
` (3 preceding siblings ...)
2024-08-30 12:28 ` [PATCH 5/5] selftests: vdso: Use parse_vdso.h in vdso_test_abi Christophe Leroy
@ 2024-08-30 12:41 ` Jason A. Donenfeld
2024-08-30 13:34 ` Shuah Khan
4 siblings, 1 reply; 7+ messages in thread
From: Jason A. Donenfeld @ 2024-08-30 12:41 UTC (permalink / raw)
To: Christophe Leroy, Shuah Khan
Cc: Vincenzo Frascino, Thomas Gleixner, Andy Lutomirski,
H. Peter Anvin, Mark Brown, linux-kselftest, linux-kernel,
linuxppc-dev
Hi Shuah,
No 0/5 patch, so replying to the first one.
These are fixes to the vDSO selftests that Christophe is ostensibly
providing as a preamble to his work porting vgetrandom to PPC. Do you
mind if I take these via my random tree so his PPC vgetrandom code can
go on top of it?
Jason
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/5] selftests: vdso: Fix vDSO name for powerpc
2024-08-30 12:41 ` [PATCH 1/5] selftests: vdso: Fix vDSO name for powerpc Jason A. Donenfeld
@ 2024-08-30 13:34 ` Shuah Khan
0 siblings, 0 replies; 7+ messages in thread
From: Shuah Khan @ 2024-08-30 13:34 UTC (permalink / raw)
To: Jason A. Donenfeld, Christophe Leroy, Shuah Khan
Cc: Vincenzo Frascino, Thomas Gleixner, Andy Lutomirski,
H. Peter Anvin, Mark Brown, linux-kselftest, linux-kernel,
linuxppc-dev, Shuah Khan
On 8/30/24 06:41, Jason A. Donenfeld wrote:
> Hi Shuah,
>
> No 0/5 patch, so replying to the first one.
>
> These are fixes to the vDSO selftests that Christophe is ostensibly
> providing as a preamble to his work porting vgetrandom to PPC. Do you
> mind if I take these via my random tree so his PPC vgetrandom code can
> go on top of it?
>
> Jason
>
Yes - here is the Ack to apply to all patches in the series:
Acked-by: Shuah Khan <skhan@linuxfoundation.org>
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-08-30 13:35 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-30 12:28 [PATCH 1/5] selftests: vdso: Fix vDSO name for powerpc Christophe Leroy
2024-08-30 12:28 ` [PATCH 2/5] selftests: vdso: Fix vdso_config " Christophe Leroy
2024-08-30 12:28 ` [PATCH 3/5] selftests: vdso: Fix vDSO symbols lookup for powerpc64 Christophe Leroy
2024-08-30 12:28 ` [PATCH 4/5] selftests: vdso: Fix the way vDSO functions are called for powerpc Christophe Leroy
2024-08-30 12:28 ` [PATCH 5/5] selftests: vdso: Use parse_vdso.h in vdso_test_abi Christophe Leroy
2024-08-30 12:41 ` [PATCH 1/5] selftests: vdso: Fix vDSO name for powerpc Jason A. Donenfeld
2024-08-30 13:34 ` Shuah Khan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox