Re: Assertion fails at samples/bpf/test_maps

Jesper Dangaard Brouer

On Tue, 21 Jun 2016 18:54:53 -0700
Alexei Starovoitov <alexei.starovoitov@...> wrote:

On Tue, Jun 21, 2016 at 11:48 AM, William Tu via iovisor-dev
<iovisor-dev@...> wrote:

I'm running test_maps under net-next/samples/bpf/, commit
601009780635. The code logic all make sense but I got the assertion
errors / coredump for some unknown reason under different compiler
optimization flags (-O0 and -O2). The test_hashmap_sanity() works fine
but fails at test_percpu_hashmap_sanity().

First run with normal build (which has -O2)
[root@vm-dev bpf]# ./test_maps
test_maps: samples/bpf/test_maps.c:137: test_percpu_hashmap_sanity:
Assertion `bpf_lookup_elem(map_fd, &key, value) == -1 &&
(*__errno_location ()) == 2' failed.

Strange I get:

$ sudo ./test_maps
failed to create per-cpu arraymap 'Operation not permitted'

strace says:

bpf(BPF_MAP_CREATE, {map_type=0x6 /* BPF_MAP_TYPE_??? */, key_size=4, value_size=8, max_entries=20000}, 48) = -1 EPERM (Operation not permitted)

that's even more weird.
May be some compiler issue.
I've tested with gcc 5.2 and 6.1

Compile host: Fedora 22
* LLVM version 3.7.1 (llc and clang same version)
* gcc version 5.3.1 20151207 (Red Hat 5.3.1-2) (GCC)

Ran on a Fedora 23 host, running Alexei's kernel tree on "xdp" branch,
samples/bpf from same git tree.

Daniel, Brenden, Jesper, did you ever see anything like it?
Not working for me actually... but different error, strange.

Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
Author of

Join to automatically receive all group messages.