libbpf / libbpf-rs

Minimal and opinionated eBPF tooling for the Rust ecosystem
Other
790 stars 138 forks source link

Maximum uprobes a process can attach #942

Closed sebastiaoamaro closed 1 month ago

sebastiaoamaro commented 2 months ago

Hi again! I want to have a process that attaches a lot of uprobes (more than 1023), however, it gives the error:

Failed to attach function **err: bpf call "libbpf_rs::program::Program::attach_uprobe_with_opts<alloc::string::String>::{{closure}}" returned NULL
libbpf: prog 'handle_uprobe': failed to create BPF link for perf_event FD 1023: -24 (Too many open files)
libbpf: prog 'handle_uprobe': failed to attach to uprobe ** Too many open files

I tried changing "ulimit -n", but it remains the same.

Do you have any insights on how to change this maximum? Thanks!

d-e-s-o commented 2 months ago

Unless BPF just misuses this error code for different but potentially related limits, ulimit -nshould do the trick. Have you adjusted the limit the limit and then executed your process in the same shell? I think it's a per-shell adjustment. If that doesn't help I'd suggest sending an email to the bpf mailing list. They'll probably be able to help you.

sebastiaoamaro commented 2 months ago

I tried even inside the script I was running to avoid all possibilities, but still it remains the same. Sorry, for the unrelated question but isn't this bpf@vger.kernel.org the email for kernel patches only?

d-e-s-o commented 2 months ago

Sorry, for the unrelated question but isn't this bpf@vger.kernel.org the email for kernel patches only?

My understanding is that it is for all kinds of discussions, including announcements and questions (examples of non-patches are [0] [1])

d-e-s-o commented 1 month ago

Discussion moved to https://lore.kernel.org/bpf/0102A73F-5317-4412-8E74-921CF146531E@getmailspring.com/