From: Björn Töpel bjorn@rivosinc.com
Commit 08d0ce30e0e4 ("riscv: Implement syscall wrappers") introduced some regressions in libbpf, and the kselftests BPF suite, which are fixed with these three patches.
Note that there's an outstanding fix [1] for ftrace syscall tracing which is also a fallout from the commit above.
Björn
[1] https://lore.kernel.org/linux-riscv/20231003182407.32198-1-alexghiti@rivosin...
Alexandre Ghiti (1): libbpf: Fix syscall access arguments on riscv
Björn Töpel (2): selftests/bpf: Define SYS_PREFIX for riscv selftests/bpf: Define SYS_NANOSLEEP_KPROBE_NAME for riscv
tools/lib/bpf/bpf_tracing.h | 2 -- tools/testing/selftests/bpf/progs/bpf_misc.h | 3 +++ tools/testing/selftests/bpf/test_progs.h | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-)
base-commit: 9077fc228f09c9f975c498c55f5d2e882cd0da59
From: Alexandre Ghiti alexghiti@rivosinc.com
Since commit 08d0ce30e0e4 ("riscv: Implement syscall wrappers"), riscv selects ARCH_HAS_SYSCALL_WRAPPER so let's use the generic implementation of PT_REGS_SYSCALL_REGS().
Fixes: 08d0ce30e0e4 ("riscv: Implement syscall wrappers") Signed-off-by: Alexandre Ghiti alexghiti@rivosinc.com --- tools/lib/bpf/bpf_tracing.h | 2 -- 1 file changed, 2 deletions(-)
diff --git a/tools/lib/bpf/bpf_tracing.h b/tools/lib/bpf/bpf_tracing.h index 3803479dbe10..1c13f8e88833 100644 --- a/tools/lib/bpf/bpf_tracing.h +++ b/tools/lib/bpf/bpf_tracing.h @@ -362,8 +362,6 @@ struct pt_regs___arm64 { #define __PT_PARM7_REG a6 #define __PT_PARM8_REG a7
-/* riscv does not select ARCH_HAS_SYSCALL_WRAPPER. */ -#define PT_REGS_SYSCALL_REGS(ctx) ctx #define __PT_PARM1_SYSCALL_REG __PT_PARM1_REG #define __PT_PARM2_SYSCALL_REG __PT_PARM2_REG #define __PT_PARM3_SYSCALL_REG __PT_PARM3_REG
From: Björn Töpel bjorn@rivosinc.com
SYS_PREFIX was missing for a RISC-V, which made a couple of kprobe tests fail.
Add missing SYS_PREFIX for RISC-V.
Fixes: 08d0ce30e0e4 ("riscv: Implement syscall wrappers") Signed-off-by: Björn Töpel bjorn@rivosinc.com --- tools/testing/selftests/bpf/progs/bpf_misc.h | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/tools/testing/selftests/bpf/progs/bpf_misc.h b/tools/testing/selftests/bpf/progs/bpf_misc.h index 38a57a2e70db..799fff4995d8 100644 --- a/tools/testing/selftests/bpf/progs/bpf_misc.h +++ b/tools/testing/selftests/bpf/progs/bpf_misc.h @@ -99,6 +99,9 @@ #elif defined(__TARGET_ARCH_arm64) #define SYSCALL_WRAPPER 1 #define SYS_PREFIX "__arm64_" +#elif defined(__TARGET_ARCH_riscv) +#define SYSCALL_WRAPPER 1 +#define SYS_PREFIX "__riscv_" #else #define SYSCALL_WRAPPER 0 #define SYS_PREFIX "__se_"
From: Björn Töpel bjorn@rivosinc.com
Add missing sys_nanosleep name for RISC-V, which is used by some tests (e.g. attach_probe).
Fixes: 08d0ce30e0e4 ("riscv: Implement syscall wrappers") Signed-off-by: Björn Töpel bjorn@rivosinc.com --- tools/testing/selftests/bpf/test_progs.h | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/bpf/test_progs.h b/tools/testing/selftests/bpf/test_progs.h index 77bd492c6024..2f9f6f250f17 100644 --- a/tools/testing/selftests/bpf/test_progs.h +++ b/tools/testing/selftests/bpf/test_progs.h @@ -417,6 +417,8 @@ int get_bpf_max_tramp_links(void); #define SYS_NANOSLEEP_KPROBE_NAME "__s390x_sys_nanosleep" #elif defined(__aarch64__) #define SYS_NANOSLEEP_KPROBE_NAME "__arm64_sys_nanosleep" +#elif defined(__riscv) +#define SYS_NANOSLEEP_KPROBE_NAME "__riscv_sys_nanosleep" #else #define SYS_NANOSLEEP_KPROBE_NAME "sys_nanosleep" #endif
Hi Björn,
On Wed, Oct 4, 2023 at 4:09 AM Björn Töpel bjorn@kernel.org wrote:
From: Björn Töpel bjorn@rivosinc.com
Commit 08d0ce30e0e4 ("riscv: Implement syscall wrappers") introduced some regressions in libbpf, and the kselftests BPF suite, which are fixed with these three patches.
This series looks good to me. Thanks for fixing the issues!
Reviewed-by: Sami Tolvanen samitolvanen@google.com
Sami
Hello:
This series was applied to bpf/bpf-next.git (master) by Andrii Nakryiko andrii@kernel.org:
On Wed, 4 Oct 2023 13:09:02 +0200 you wrote:
From: Björn Töpel bjorn@rivosinc.com
Commit 08d0ce30e0e4 ("riscv: Implement syscall wrappers") introduced some regressions in libbpf, and the kselftests BPF suite, which are fixed with these three patches.
Note that there's an outstanding fix [1] for ftrace syscall tracing which is also a fallout from the commit above.
[...]
Here is the summary with links: - [bpf,1/3] libbpf: Fix syscall access arguments on riscv https://git.kernel.org/bpf/bpf-next/c/8a412c5c1cd6 - [bpf,2/3] selftests/bpf: Define SYS_PREFIX for riscv https://git.kernel.org/bpf/bpf-next/c/0f2692ee4324 - [bpf,3/3] selftests/bpf: Define SYS_NANOSLEEP_KPROBE_NAME for riscv https://git.kernel.org/bpf/bpf-next/c/b55b775f0316
You are awesome, thank you!
linux-kselftest-mirror@lists.linaro.org