Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update libbpf to v1.0.0 #216

Merged
merged 1 commit into from Aug 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion libbpf
Submodule libbpf updated 74 files
+3 −3 .github/actions/build-selftests/build_selftests.sh
+6 −14 .github/actions/build-selftests/helpers.sh
+73,598 −68,776 .github/actions/build-selftests/vmlinux.h
+5 −3 .github/actions/vmtest/action.yml
+2 −2 .github/workflows/build.yml
+1 −1 .github/workflows/coverity.yml
+1 −1 .github/workflows/ondemand.yml
+1 −1 .github/workflows/pahole.yml
+1 −1 .github/workflows/test.yml
+0 −130 .travis.yml
+1 −1 BPF-CHECKPOINT-COMMIT
+1 −1 CHECKPOINT-COMMIT
+38 −18 README.md
+0 −0 ci/diffs/.do_not_use_dot_patch_here
+0 −0 ci/diffs/001-fix-oob-write-in-test_verifier.diff
+7 −6 ci/managers/debian.sh
+15 −0 ci/managers/test_compile.sh
+0 −0 ci/managers/travis_wait.bash
+4 −3 ci/managers/ubuntu.sh
+0 −0 ci/rootfs/mkrootfs_arch.sh
+13 −6 ci/rootfs/mkrootfs_debian.sh
+0 −0 ci/rootfs/mkrootfs_tweak.sh
+0 −0 ci/rootfs/s390x-self-hosted-builder/README.md
+0 −0 ci/rootfs/s390x-self-hosted-builder/actions-runner-libbpf.Dockerfile
+0 −0 ci/rootfs/s390x-self-hosted-builder/actions-runner-libbpf.service
+0 −0 ci/rootfs/s390x-self-hosted-builder/fs/usr/bin/actions-runner
+0 −0 ci/rootfs/s390x-self-hosted-builder/fs/usr/bin/entrypoint
+0 −0 ci/rootfs/s390x-self-hosted-builder/qemu-user-static.service
+0 −0 ci/vmtest/configs/ALLOWLIST-4.9.0
+1 −2 ci/vmtest/configs/ALLOWLIST-5.5.0
+1 −0 ci/vmtest/configs/DENYLIST-5.5.0
+1 −0 ci/vmtest/configs/DENYLIST-latest
+4 −0 ci/vmtest/configs/DENYLIST-latest.s390x
+6 −14 ci/vmtest/helpers.sh
+76 −0 ci/vmtest/run_selftests.sh
+2 −11 docs/libbpf_naming_convention.rst
+213 −9 include/uapi/linux/bpf.h
+14 −3 include/uapi/linux/btf.h
+3 −0 include/uapi/linux/if_link.h
+5 −2 include/uapi/linux/perf_event.h
+2 −2 include/uapi/linux/pkt_cls.h
+16 −6 src/Makefile
+141 −334 src/bpf.c
+26 −125 src/bpf.h
+11 −0 src/bpf_core_read.h
+245 −9 src/bpf_helper_defs.h
+13 −0 src/bpf_helpers.h
+53 −21 src/bpf_tracing.h
+206 −208 src/btf.c
+33 −86 src/btf.h
+110 −50 src/btf_dump.c
+1 −1 src/gen_loader.c
+856 −1,628 src/libbpf.c
+112 −459 src/libbpf.h
+18 −109 src/libbpf.map
+3 −13 src/libbpf_common.h
+19 −23 src/libbpf_internal.h
+28 −2 src/libbpf_legacy.h
+6 −121 src/libbpf_probes.c
+2 −2 src/libbpf_version.h
+2 −5 src/linker.c
+10 −55 src/netlink.c
+431 −48 src/relo_core.c
+8 −2 src/relo_core.h
+8 −6 src/skel_internal.h
+4 −16 src/usdt.bpf.h
+65 −64 src/usdt.c
+0 −1,260 src/xsk.c
+0 −336 src/xsk.h
+1 −0 travis-ci
+0 −14 travis-ci/managers/test_compile.sh
+0 −2,710 travis-ci/vmtest/configs/config-latest.s390x
+0 −3,071 travis-ci/vmtest/configs/config-latest.x86_64
+0 −63 travis-ci/vmtest/run_selftests.sh
2 changes: 1 addition & 1 deletion libbpfgo.go
Expand Up @@ -1047,7 +1047,7 @@ func (it *BPFMapIterator) Next() bool {
nextPtr := unsafe.Pointer(&next[0])

errC, err := C.bpf_map_get_next_key(it.b.fd, prevPtr, nextPtr)
if errno, ok := err.(syscall.Errno); errC == -1 && ok && errno == C.ENOENT {
if errno, ok := err.(syscall.Errno); errC == -2 && ok && errno == C.ENOENT {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the return code for the function call, the iterator test failed because of this change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it! I see now. i guess it's redundant to check errno == C.ENOENT and errC = -2. Do you think we should simplify to just the following?:

Suggested change
if errno, ok := err.(syscall.Errno); errC == -2 && ok && errno == C.ENOENT {
if errC == -2 {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually outside the scope of this PR, so I'd say leave it for now and we can reassess before the next release

return false
}
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions selftest/cgroup/main.bpf.c
Expand Up @@ -14,8 +14,8 @@ struct {
} events SEC(".maps");
long ringbuffer_flags = 0;

SEC("cgroup/socket")
int cgroup__socket(struct bpf_sock *sk)
SEC("cgroup/sock")
grantseltzer marked this conversation as resolved.
Show resolved Hide resolved
int cgroup__sock(struct bpf_sock *sk)
{
int *process;

Expand Down
2 changes: 1 addition & 1 deletion selftest/cgroup/main.go
Expand Up @@ -29,7 +29,7 @@ func main() {
os.Exit(-1)
}

prog, err := bpfModule.GetProgram("cgroup__socket")
prog, err := bpfModule.GetProgram("cgroup__sock")
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(-1)
Expand Down
2 changes: 1 addition & 1 deletion selftest/iterators/main.go
Expand Up @@ -65,7 +65,7 @@ func main() {
testMap[key] = checked
}
if iterator.Err() != nil {
fmt.Fprintln(os.Stderr, iterator.Err())
fmt.Fprintf(os.Stderr, "iterator error: %v\n", iterator.Err())
os.Exit(-1)
}

Expand Down
4 changes: 2 additions & 2 deletions selftest/netns/main.bpf.c
Expand Up @@ -14,8 +14,8 @@ struct {
} events SEC(".maps");
long ringbuffer_flags = 0;

SEC("sk_lookup/lookup_pass")
int sk_lookup__lookup_pass(struct bpf_sk_lookup *ctx)
SEC("sk_lookup")
int sk_lookup__lookup(struct bpf_sk_lookup *ctx)
{
int *process;

Expand Down
2 changes: 1 addition & 1 deletion selftest/netns/main.go
Expand Up @@ -25,7 +25,7 @@ func main() {
os.Exit(-1)
}

prog, err := bpfModule.GetProgram("sk_lookup__lookup_pass")
prog, err := bpfModule.GetProgram("sk_lookup__lookup")
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(-1)
Expand Down