Skip to contentSkip to conversation

selftests/bpf: fix attach_probe on s390

PATCH Applied Ilya Leoshkevich 3 participants 3 messages Jul 12, 2019 – Jul 15, 2019

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/bpf: fix attach_probe on s390

attach_probe test fails, because it cannot install a kprobe on a non-existent sys_nanosleep symbol.

Use the correct symbol name for the nanosleep syscall on 64-bit s390. Don't bother adding one for 31-bit mode, since tests are compiled only in 64-bit mode.

Fixes 1e8611bbdfc9 ("selftests/bpf: add kprobe/uprobe selftests")
---
 tools/testing/selftests/bpf/prog_tests/attach_probe.c | 2 ++
 1 file changed, 2 insertions(+)
tools/testing/selftests/bpf/prog_tests/attach_probe.c +2 -0
index a4686395522c..47af4afc5013 100644
@@ -23,6 +23,8 @@ ssize_t get_base_addr() {
 
 #ifdef __x86_64__
 #define SYS_KPROBE_NAME "__x64_sys_nanosleep"
+#elif defined(__s390x__)
+#define SYS_KPROBE_NAME "__s390x_sys_nanosleep"
 #else
 #define SYS_KPROBE_NAME "sys_nanosleep"
 #endif
Signature · 1 line
2.21.0
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Ilya Leoshkevich

attach_probe test fails, because it cannot install a kprobe on a non-existent sys_nanosleep symbol.

Quoted 8 lines

Use the correct symbol name for the nanosleep syscall on 64-bit s390. Don't bother adding one for 31-bit mode, since tests are compiled only in 64-bit mode.

Fixes 1e8611bbdfc9 ("selftests/bpf: add kprobe/uprobe selftests")

---

This arch-specific naming is very unfortunate. I'm thinking of doing this automatically in libbpf to help usability.

Quoted 19 lines
 tools/testing/selftests/bpf/prog_tests/attach_probe.c | 2 ++
 1 file changed, 2 insertions(+)
tools/testing/selftests/bpf/prog_tests/attach_probe.c +2 -1
index a4686395522c..47af4afc5013 100644
@@ -23,6 +23,8 @@ ssize_t get_base_addr() {
 
 #ifdef __x86_64__
 #define SYS_KPROBE_NAME "__x64_sys_nanosleep"
+#elif defined(__s390x__)
+#define SYS_KPROBE_NAME "__s390x_sys_nanosleep"
 #else
 #define SYS_KPROBE_NAME "sys_nanosleep"
 #endif
--

2.21.0

maintainer Applied
#2 lore raw
In reply to Ilya Leoshkevich
Quoted 10 lines · Ilya Leoshkevich

attach_probe test fails, because it cannot install a kprobe on a non-existent sys_nanosleep symbol.

Use the correct symbol name for the nanosleep syscall on 64-bit s390. Don't bother adding one for 31-bit mode, since tests are compiled only in 64-bit mode.

Fixes 1e8611bbdfc9 ("selftests/bpf: add kprobe/uprobe selftests")

Applied, thanks!