Commit 920fd5e1 authored by Artem Savkov's avatar Artem Savkov Committed by Daniel Borkmann
Browse files

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.

Fixes: b858ba8c ("selftests/bpf: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK")
Signed-off-by: default avatarArtem Savkov <asavkov@redhat.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Reviewed-by: default avatarYafang Shao <laoar.shao@gmail.com>
Link: https://lore.kernel.org/bpf/20220421130104.1582053-1-asavkov@redhat.com
parent 9d87e41a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -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