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

number of funcs in func_info doesn't match number of subprogs #177

Open
leiqi96 opened this issue Feb 16, 2022 · 3 comments
Open

number of funcs in func_info doesn't match number of subprogs #177

leiqi96 opened this issue Feb 16, 2022 · 3 comments

Comments

@leiqi96
Copy link

leiqi96 commented Feb 16, 2022

Environment: ubuntu 21.04 kernel 5.11.0

  1. It fails to load epf-lsm program.
    Error: the BPF_PROG_LOAD syscall failed. Verifier output: func#0 @0 number of funcs in func_info doesn't match number of subprogs verification time 13 usec stack depth 0 processed 0 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0

Here is the log used by strace
bpf(BPF_PROG_LOAD, {prog_type=BPF_PROG_TYPE_LSM, insn_cnt=192, insns=0x561ac794b510, license="GPL", log_level=0, log_size=0, log_buf=NULL, kern_version=KERNEL_VERSION(5, 11, 0), prog_flags=0, prog_name="sb_mount", prog_ifindex=0, expected_attach_type=BPF_LSM_MAC, prog_btf_fd=10, func_info_rec_size=8, func_info=0x561ac77b82f0, func_info_cnt=2, line_info_rec_size=16, line_info=0x561ac77b87f0, line_info_cnt=69, attach_btf_id=32269, attach_prog_fd=0}, 144) = -1 EINVAL (Invalid argument)

I searched the linux kernel 5.11.0 and found the error is raising when eBPF verifier trying to compare attr->func_info_cnt and env->subprog_cnt but I don't understand why.

  1. I also want to know which library is used to load ebpf program
@vadorovsky
Copy link
Member

Could you post your kernel config? It should be available in /proc/config or /proc/config.gz. I'm usually testing lockc with the newest kernels coming in openSUSE Tumbleweed, but we will try to test with Ubuntu 21.04 soon.

I also want to know which library is used to load ebpf program

We are using Aya (https://github.com/aya-rs/aya) for loading eBPF programs. So far we are using it in a bit unusual way, where we still keep eBPF programs in C and we use Aya only for loading them from the userspace. But we plan to rewrite eBPF programs in Rust in the future.

@leiqi96
Copy link
Author

leiqi96 commented Feb 16, 2022

Do you mean the /boo/config file?
cat /boot/config-5.11.0-49-generic > config-5.11.0-49-generic.txt
The below is the file
config-5.11.0-49-generic.txt

@leiqi96
Copy link
Author

leiqi96 commented Feb 18, 2022

Recent tests:
lockc-v1.0.6 with ubuntu 21.10 works well.

kernel :5.13.0-28-generic

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

No branches or pull requests

2 participants