-
由 Andrii Nakryiko 提交于
mainline inclusion from mainline-5.14-rc1 commit bad2e478 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5EUVD CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bad2e478af3b4df9fd84b4db7779ea91bd618c16 ------------------------------------------------- Turn ony libbpf 1.0 mode. Fix all the explicit IS_ERR checks that now will be broken because libbpf returns NULL on error (and sets errno). Fix ASSERT_OK_PTR and ASSERT_ERR_PTR to work for both old mode and new modes and use them throughout selftests. This is trivial to do by using libbpf_get_error() API that all libbpf users are supposed to use, instead of IS_ERR checks. A bunch of checks also did explicit -1 comparison for various fd-returning APIs. Such checks are replaced with >= 0 or < 0 cases. There were also few misuses of bpf_object__find_map_by_name() in test_maps. Those are fixed in this patch as well. Signed-off-by: NAndrii Nakryiko <andrii@kernel.org> Signed-off-by: NAlexei Starovoitov <ast@kernel.org> Acked-by: NJohn Fastabend <john.fastabend@gmail.com> Acked-by: NToke Høiland-Jørgensen <toke@redhat.com> Link: https://lore.kernel.org/bpf/20210525035935.1461796-3-andrii@kernel.org (cherry picked from commit bad2e478) Signed-off-by: NWang Yufen <wangyufen@huawei.com> Conflicts: tools/testing/selftests/bpf/prog_tests/bpf_iter.c tools/testing/selftests/bpf/prog_tests/check_mtu.c tools/testing/selftests/bpf/prog_tests/prog_run_xattr.c tools/testing/selftests/bpf/prog_tests/ringbuf_multi.c tools/testing/selftests/bpf/prog_tests/sockmap_basic.c Signed-off-by: NWang Yufen <wangyufen@huawei.com>
1584c514