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

libbpf: bpf_test_run_opts has non-zero extra bytes #129

Open
liangcheng-yu opened this issue Jun 2, 2023 · 0 comments
Open

libbpf: bpf_test_run_opts has non-zero extra bytes #129

liangcheng-yu opened this issue Jun 2, 2023 · 0 comments

Comments

@liangcheng-yu
Copy link

liangcheng-yu commented Jun 2, 2023

Hi, I happened to setup uBPF on two different VMs, both with a clean Ubuntu 20.04.06 LTS and the same clang version etc.
For VM1 it gave me 100% tests passed, while VM2 8 tests failed (iovisor/ubpf#266 (comment)).
Below are the details:

# The one with 100% tests passed
lc@vm1:~/ubpf$ sudo build/bin/bpf_conformance_runner --test_file_path tests/add.data --plugin_path build/external/bpf_conformance/bin/libbpf_plugin  --debug true
Test file: "tests/add.data"
Input memory:
Expected return value: 3
Expected error string:
Byte code: b4  00  00  00  00  00  00  00  b4  01  00  00  02  00  00  00  04  00  00  00  01  00  00  00  0c  10  00  00  00  00  00  00  95  00  00  00  00  00  00  00
Test "tests/add.data" succeeded
Test results:
PASS: "tests/add.data"
Passed 1 out of 1 tests.

lc@vm1:~/ubpf$ echo b4  00  00  00  00  00  00  00  b4  01  00  00  02  00  00  00  04  00  00  00  01  00  00  00  0c  10  00  00  00  00  00  00  95  00  00  00  00  00  00  00 | sudo build/external/bpf_conformance/bin/libbpf_plugin
3

lc@vm1:~/ubpf$ echo b4  00  00  00  00  00  00  00  b4  01  00  00  02  00  00  00  04  00  00  00  01  00  00  00  0c  10  00  00  00  00  00  00  95  00  00  00  00  00  00  00 | sudo strace build/external/bpf_conformance/bin/libbpf_plugin
.... [removed for readability]
bpf(BPF_PROG_LOAD, {prog_type=BPF_PROG_TYPE_XDP, insn_cnt=5, insns=0x7bff30, license="MIT", log_level=0, log_size=0, log_buf=NULL, kern_version=KERNEL_VERSION(0, 0, 0), prog_flags=0, prog_name="", prog_ifindex=0, expected_attach_type=BPF_CGROUP_INET_INGRESS, prog_btf_fd=0, func_info_rec_size=0, func_info=NULL, func_info_cnt=0, line_info_rec_size=0, line_info=NULL, line_info_cnt=0, attach_btf_id=0, attach_prog_fd=0}, 128) = 3
bpf(BPF_PROG_TEST_RUN, {test={prog_fd=3, retval=0, data_size_in=0, data_size_out=0, data_in=NULL, data_out=NULL, repeat=1, duration=0, ctx_size_in=0, ctx_size_out=0, ctx_in=NULL, ctx_out=NULL}}, 128) = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0x1), ...}) = 0
write(1, "3\n", 23
)                      = 2
exit_group(0)                           = ?
+++ exited with 0 +++

# The VM with 8 failed tests
lc@vm2:~/ubpf$ echo b4  00  00  00  00  00  00  00  b4  01  00  00  02  00  00  00  04  00  00  00  01  00  00  00  0c  10  00  00  00  00  00  00  95  00  00  00  00  00  00  00 | sudo build/external/bpf_conformance/bin/libbpf_plugin
libbpf: bpf_test_run_opts has non-zero extra bytes

lc@vm2:~/ubpf$ sudo build/bin/bpf_conformance_runner --test_file_path tests/add.data --plugin_path build/external/bpf_conformance/bin/libbpf_plugin  --debug true
Test file: "tests/add.data"
Input memory:
Expected return value: 3
Expected error string:
Byte code: b4  00  00  00  00  00  00  00  b4  01  00  00  02  00  00  00  04  00  00  00  01  00  00  00  0c  10  00  00  00  00  00  00  95  00  00  00  00  00  00  00
Test results:
ERROR: "tests/add.data" Plugin returned invalid return value
Passed 0 out of 1 tests.

lc@vm2:~/ubpf$ echo b4  00  00  00  00  00  00  00  b4  01  00  00  02  00  00  00  04  00  00  00  01  00  00  00  0c  10  00  00  00  00  00  00  95  00  00  00  00  00  00  00 | sudo strace build/external/bpf_conformance/bin/libbpf_plugin
execve("build/external/bpf_conformance/bin/libbpf_plugin", ["build/external/bpf_conformance/b"...], 0x7ffe1108d920 /* 15 vars */) = 0
.... [removed for readability]
bpf(BPF_PROG_LOAD, {prog_type=BPF_PROG_TYPE_XDP, insn_cnt=5, insns=0x2181f30, license="MIT", log_level=0, log_size=0, log_buf=NULL, kern_version=KERNEL_VERSION(0, 0, 0), prog_flags=0, prog_name="", prog_ifindex=0, expected_attach_type=BPF_CGROUP_INET_INGRESS, prog_btf_fd=0, func_info_rec_size=0, func_info=NULL, func_info_cnt=0, line_info_rec_size=0, line_info=NULL, line_info_cnt=0, attach_btf_id=0, attach_prog_fd=0}, 128) = 3
write(2, "libbpf: bpf_test_run_opts has no"..., 51libbpf: bpf_test_run_opts has non-zero extra bytes
) = 51
exit_group(0)                           = ?
+++ exited with 0 +++

For context, both VMs have the same clang, OS version, and apt show libbpf-dev prints, and I set up the environment with the same exact set up scripts and cmake build/test instructions

Package: libbpf-dev
Version: 1:0.5.0-1~ubuntu20.04.1
Priority: optional
Section: universe/libdevel
Source: libbpf (0.5.0-1~ubuntu20.04.1)
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 802 kB
Depends: libbpf0 (= 1:0.5.0-1~ubuntu20.04.1), libelf-dev, zlib1g-dev
Download-Size: 188 kB
APT-Manual-Installed: yes
APT-Sources: http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages
Description: eBPF helper library (development files)
libbpf is a library for loading eBPF programs and reading and
manipulating eBPF objects from user-space.
.
This package is needed to compile programs against libbpf.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant