selftests/bpf: fix attach tests retcode checks
Subsystems (5)
PATCH 1/1 selftests/bpf: fix attach tests retcode checks
Switching to libbpf 1.0 API broke test_sock and test_sysctl as they check for return of bpf_prog_attach to be exactly -1. Switch the check to '< 0' instead.
--- tools/testing/selftests/bpf/test_sock.c | 2 +- tools/testing/selftests/bpf/test_sysctl.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/test_sock.c +1 -1
@@ -492,7 +492,7 @@ static int run_test_case(int cgfd, const struct sock_test *test) goto err; } -if (attach_sock_prog (cgfd, progfd, test->attach_type) ==-1 ) { +if (attach_sock_prog (cgfd, progfd, test->attach_type) <0 ) {if (test->result ==ATTACH_REJECT ) goto out;else
tools/testing/selftests/bpf/test_sysctl.c +1 -1
@@ -1560,7 +1560,7 @@ static int run_test_case(int cgfd, struct sysctl_test *test) goto err; } -if (bpf_prog_attach (progfd, cgfd, atype,BPF_F_ALLOW_OVERRIDE ) ==-1 ) { +if (bpf_prog_attach (progfd, cgfd, atype,BPF_F_ALLOW_OVERRIDE ) <0 ) {if (test->result ==ATTACH_REJECT ) goto out;else
Signature · 1 line
2.35.1
Quoted 7 lines · Artem Savkov
Switching to libbpf 1.0 API broke
test_sockandtest_sysctlas they check for return ofbpf_prog_attachto be exactly -1. Switch the check to '< 0' instead.Fixes b858ba8c52b6 ("selftests/bpf: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK")Signed-off-by Artem Savkov <[email protected]>
Quoted 34 lines
--- tools/testing/selftests/bpf/test_sock.c | 2 +- tools/testing/selftests/bpf/test_sysctl.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)tools/testing/selftests/bpf/test_sock.c +1
-1@@ -492,7 +492,7 @@ static int run_test_case(int cgfd, const struct sock_test *test) goto err; } -if (attach_sock_prog (cgfd, progfd, test->attach_type) ==-1 ) { +if (attach_sock_prog (cgfd, progfd, test->attach_type) <0 ) {if (test->result ==ATTACH_REJECT ) goto out;else tools/testing/selftests/bpf/test_sysctl.c +1
-2@@ -1560,7 +1560,7 @@ static int run_test_case(int cgfd, struct sysctl_test *test) goto err; } -if (bpf_prog_attach (progfd, cgfd, atype,BPF_F_ALLOW_OVERRIDE ) ==-1 ) { +if (bpf_prog_attach (progfd, cgfd, atype,BPF_F_ALLOW_OVERRIDE ) <0 ) {if (test->result ==ATTACH_REJECT ) goto out;else --2.35.1
Signature · 2 lines
Regards Yafang
This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:
Quoted 8 lines · On Thu, 21 Apr 2022 15:01:04 +0200 you wrote:
Switching to libbpf 1.0 API broke
test_sockandtest_sysctlas they check for return ofbpf_prog_attachto be exactly -1. Switch the check to '< 0' instead.Fixes b858ba8c52b6 ("selftests/bpf: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK")Signed-off-by Artem Savkov <[email protected]>[...]
Here is the summary with links:
- [bpf-next] selftests/bpf: fix attach tests retcode checks
https://git.kernel.org/bpf/bpf-next/c/920fd5e1771d
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html