[PATCH testsuite] tests/bpf: ask for unlimited RLIMIT_MEMLOCK

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently the code sets it to at most 128K, but this is not enough in
some aarch64/ppc64le environments. Therefore, stop guessing the magic
threshold and just set it straight to RLIM_INFINITY.

Fixes: 8f0f980a4ad5 ("selinux-testsuite: Add BPF tests")
Signed-off-by: Ondrej Mosnacek <omosnace@xxxxxxxxxx>
---
 tests/bpf/bpf_common.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/tests/bpf/bpf_common.c b/tests/bpf/bpf_common.c
index 681e2eb..f499034 100644
--- a/tests/bpf/bpf_common.c
+++ b/tests/bpf/bpf_common.c
@@ -41,24 +41,16 @@ int create_bpf_prog(void)
 
 /*
  * The default RLIMIT_MEMLOCK is normally 64K, however BPF map/prog requires
- * more than this so double it unless RLIM_INFINITY is set.
+ * more than this (the actual threshold varying across arches) so set it to
+ * RLIM_INFINITY.
  */
 void bpf_setrlimit(void)
 {
 	int result;
 	struct rlimit r;
 
-	result = getrlimit(RLIMIT_MEMLOCK, &r);
-	if (result < 0) {
-		fprintf(stderr, "Failed to get resource limit: %s\n",
-			strerror(errno));
-		exit(-1);
-	}
-
-	if (r.rlim_cur != RLIM_INFINITY && r.rlim_cur <= (64 * 1024)) {
-		r.rlim_cur *= 2;
-		r.rlim_max *= 2;
-	}
+	r.rlim_cur = RLIM_INFINITY;
+	r.rlim_max = RLIM_INFINITY;
 
 	result = setrlimit(RLIMIT_MEMLOCK, &r);
 	if (result < 0) {
-- 
2.24.1




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux