diff options
| -rw-r--r-- | tools/testing/selftests/bpf/test_dev_cgroup.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/test_dev_cgroup.c b/tools/testing/selftests/bpf/test_dev_cgroup.c index 02c85d6c89b0..c1535b34f14f 100644 --- a/tools/testing/selftests/bpf/test_dev_cgroup.c +++ b/tools/testing/selftests/bpf/test_dev_cgroup.c | |||
| @@ -10,6 +10,8 @@ | |||
| 10 | #include <string.h> | 10 | #include <string.h> |
| 11 | #include <errno.h> | 11 | #include <errno.h> |
| 12 | #include <assert.h> | 12 | #include <assert.h> |
| 13 | #include <sys/time.h> | ||
| 14 | #include <sys/resource.h> | ||
| 13 | 15 | ||
| 14 | #include <linux/bpf.h> | 16 | #include <linux/bpf.h> |
| 15 | #include <bpf/bpf.h> | 17 | #include <bpf/bpf.h> |
| @@ -23,15 +25,19 @@ | |||
| 23 | 25 | ||
| 24 | int main(int argc, char **argv) | 26 | int main(int argc, char **argv) |
| 25 | { | 27 | { |
| 28 | struct rlimit limit = { RLIM_INFINITY, RLIM_INFINITY }; | ||
| 26 | struct bpf_object *obj; | 29 | struct bpf_object *obj; |
| 27 | int error = EXIT_FAILURE; | 30 | int error = EXIT_FAILURE; |
| 28 | int prog_fd, cgroup_fd; | 31 | int prog_fd, cgroup_fd; |
| 29 | __u32 prog_cnt; | 32 | __u32 prog_cnt; |
| 30 | 33 | ||
| 34 | if (setrlimit(RLIMIT_MEMLOCK, &limit) < 0) | ||
| 35 | perror("Unable to lift memlock rlimit"); | ||
| 36 | |||
| 31 | if (bpf_prog_load(DEV_CGROUP_PROG, BPF_PROG_TYPE_CGROUP_DEVICE, | 37 | if (bpf_prog_load(DEV_CGROUP_PROG, BPF_PROG_TYPE_CGROUP_DEVICE, |
| 32 | &obj, &prog_fd)) { | 38 | &obj, &prog_fd)) { |
| 33 | printf("Failed to load DEV_CGROUP program\n"); | 39 | printf("Failed to load DEV_CGROUP program\n"); |
| 34 | goto err; | 40 | goto out; |
| 35 | } | 41 | } |
| 36 | 42 | ||
| 37 | if (setup_cgroup_environment()) { | 43 | if (setup_cgroup_environment()) { |
| @@ -89,5 +95,6 @@ int main(int argc, char **argv) | |||
| 89 | err: | 95 | err: |
| 90 | cleanup_cgroup_environment(); | 96 | cleanup_cgroup_environment(); |
| 91 | 97 | ||
| 98 | out: | ||
| 92 | return error; | 99 | return error; |
| 93 | } | 100 | } |
