OSDN Git Service

selftests/bpf: set RLIMIT_MEMLOCK properly for test_libbpf_open.c
authorYonghong Song <yhs@fb.com>
Mon, 29 Apr 2019 23:59:38 +0000 (16:59 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 31 May 2019 13:46:08 +0000 (06:46 -0700)
commit6d9f8909e5408da5a049957a13aa856fe98322d6
treed92ef4dcf1bdd904cf09c95fb04bea083a8445a2
parentf3ed010f2bfe75ebc4dd5a903a4af627b9b8b683
selftests/bpf: set RLIMIT_MEMLOCK properly for test_libbpf_open.c

[ Upstream commit 6cea33701eb024bc6c920ab83940ee22afd29139 ]

Test test_libbpf.sh failed on my development server with failure
  -bash-4.4$ sudo ./test_libbpf.sh
  [0] libbpf: Error in bpf_object__probe_name():Operation not permitted(1).
      Couldn't load basic 'r0 = 0' BPF program.
  test_libbpf: failed at file test_l4lb.o
  selftests: test_libbpf [FAILED]
  -bash-4.4$

The reason is because my machine has 64KB locked memory by default which
is not enough for this program to get locked memory.
Similar to other bpf selftests, let us increase RLIMIT_MEMLOCK
to infinity, which fixed the issue.

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/bpf/test_libbpf_open.c