diff options
author | Toke Høiland-Jørgensen <toke@redhat.com> | 2020-10-27 00:36:23 +0100 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2020-10-27 22:46:17 +0100 |
commit | c66dca98a24cb5f3493dd08d40bcfa94a220fa92 (patch) | |
tree | 2a3cdc8a19c1861cfceb41575634337fa10c3f69 /samples/bpf/tracex2_user.c | |
parent | 343a3e8bc635bd4c58d45a4fe67f9c3a78fbd191 (diff) |
samples/bpf: Set rlimit for memlock to infinity in all samples
The memlock rlimit is a notorious source of failure for BPF programs. Most
of the samples just set it to infinity, but a few used a lower limit. The
problem with unconditionally setting a lower limit is that this will also
override the limit if the system-wide setting is *higher* than the limit
being set, which can lead to failures on systems that lock a lot of memory,
but set 'ulimit -l' to unlimited before running a sample.
One fix for this is to only conditionally set the limit if the current
limit is lower, but it is simpler to just unify all the samples and have
them all set the limit to infinity.
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Link: https://lore.kernel.org/bpf/20201026233623.91728-1-toke@redhat.com
Diffstat (limited to 'samples/bpf/tracex2_user.c')
-rw-r--r-- | samples/bpf/tracex2_user.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/samples/bpf/tracex2_user.c b/samples/bpf/tracex2_user.c index 3e36b3e4e3ef..3d6eab711d23 100644 --- a/samples/bpf/tracex2_user.c +++ b/samples/bpf/tracex2_user.c @@ -116,7 +116,7 @@ static void int_exit(int sig) int main(int ac, char **argv) { - struct rlimit r = {1024*1024, RLIM_INFINITY}; + struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY}; long key, next_key, value; struct bpf_link *links[2]; struct bpf_program *prog; |