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

BPF exceeds default net.core.optmem_max limit #12

Open
lmb opened this issue Sep 18, 2020 · 2 comments
Open

BPF exceeds default net.core.optmem_max limit #12

lmb opened this issue Sep 18, 2020 · 2 comments

Comments

@lmb
Copy link
Contributor

lmb commented Sep 18, 2020

If you try to run tests / use the filter on stock Ubuntu, you get the following error:

$ sudo -E go test 
--- FAIL: TestNew (0.08s)
    rakelimit_test.go:14: Can't create limiter: can't attach BPF to socket: cannot allocate memory

This is because SO_ATTACH_BPF checks the size of the program against net.core.optmem_max limit. The default value for that on my Ubuntu install is 20480. We currently need something > 32768 but < 65536.

We should try to get the filter size below the default value. See also #2.

@lmb lmb changed the title The filter exceeds the default net.core.optmem_max limit BPF exceeds default net.core.optmem_max limit Sep 18, 2020
@kckeiks
Copy link

kckeiks commented Jan 22, 2022

I am getting the following when running tests without sudo:

Can't load program field FilterIpv4: ....: operation not permitted (MEMLOCK may be too low, consider rlimit.RemoveMemlock)

The tests seem to fail when calling loadRakeObjects. I see that it's a EPERM error (I'm using cilium/ebpf v0.8).

There is no error when using the filter but it does not load per bpftool prog list. Everything works when I run sudo. Is this related? I'm not too familiar with the error/issue you posted and this one.

@lmb
Copy link
Contributor Author

lmb commented Jan 24, 2022

No, these two are probably not related. It's either MEMLOCK as the error message suggests, or https://www.kernel.org/doc/html/latest/admin-guide/sysctl/kernel.html#unprivileged-bpf-disabled

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