lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b64cb1b5-f9be-27ab-76e8-4fe84b947114@gmail.com>
Date:   Mon, 25 Nov 2019 13:53:28 -0700
From:   David Ahern <dsahern@...il.com>
To:     Ben Greear <greearb@...delatech.com>,
        netdev <netdev@...r.kernel.org>
Subject: Re: VRF and/or cgroups problem on Fedora-30, 5.2.21+ kernel

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.

Running 'perf record' while trying to do 'ip vrf exec' is an easy way to
hit the locked memory exceeded error. We could add a hint to iproute2.
Something like:

diff --git a/ip/ipvrf.c b/ip/ipvrf.c
index b9a43675cbd6..15637924f31a 100644
--- a/ip/ipvrf.c
+++ b/ip/ipvrf.c
@@ -281,9 +281,16 @@ static int vrf_configure_cgroup(const char *path,
int ifindex)
                fprintf(stderr, "Failed to load BPF prog: '%s'\n",
                        strerror(errno));

-               if (errno != EPERM) {
+               if (errno == EPERM) {
+                       if (geteuid() != 0)
+                               fprintf(stderr,
+                                       "Hint: Must run as root to set
VRF.\n");
+                       else
+                               fprintf(stderr,
+                                       "Hint: Most likely locked memory
threshold exceeded. Increase 'ulimit -l'\n");
+               } else {
                        fprintf(stderr,
-                               "Kernel compiled with CGROUP_BPF
enabled?\n");
+                               "Hint: Kernel compiled with CGROUP_BPF
enabled?\n");
                }
                goto out;
        }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ