Subject: Re: VRF and/or cgroups problem on Fedora-30, 5.2.21+ kernel

From: Toke Høiland-Jørgensen <[email-masked]>
Date: Tue, 26 Nov 2019 09:48:37 +0100

David Ahern <[email-masked]> writes:

> On 11/25/19 10:35 AM, Ben Greear wrote:
>>>> And surely 'ip' could output a better error than just 'permission
>>>> denied' for
>>>> this error case?  Or even something that would show up in dmesg to give
>>>> a clue?
>>>
>>> That error comes from the bpf syscall:
>>>
>>> bpf(BPF_PROG_LOAD, {prog_type=BPF_PROG_TYPE_CGROUP_SOCK, insn_cnt=6,
>>> insns=0x7ffc8e5d1e00, license="GPL", log_level=1, log_size=262144,
>>> log_buf="", 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}, 112) = -1 EPERM
>>> (Operation not permitted)
>> 
>> So, we can change iproute/lib/bpf.c to print a suggestion to increase
>> locked memory
>> if this returns EPERM?
>> 
>
> looks like SYS_ADMIN and locked memory are the -EPERM failures.
>
> I do not see any API that returns user->locked_vm, only per-task
> locked_vm. Knowing that number would help a lot in understanding proper
> system settings.

Yes! Having a way to see the current amount of locked memory is sorely
needed. Absent this, the application basically has to do one of:

- Throw up its hands and tell the user to increase ulimit (not terribly
  user-friendly)
- Just set the limit to infinity (this is what iproute2 does; works, but
  defeats the whole purpose of having a limit in the first place)
- Keep retrying while gradually increasing the limit (inefficient, and
  annoying to have to implement everywhere)

-Toke