ryantimwilson / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone
b9a53a
From 0528a880ddf797a42b2de274e5c7bd2d9896c991 Mon Sep 17 00:00:00 2001
b9a53a
From: Lennart Poettering <lennart@poettering.net>
b9a53a
Date: Thu, 11 Oct 2018 18:31:11 +0200
b9a53a
Subject: [PATCH] main: introduce a define HIGH_RLIMIT_MEMLOCK similar to
b9a53a
 HIGH_RLIMIT_NOFILE
b9a53a
b9a53a
(cherry picked from commit c8884aceefc85245b9bdfb626e2daf27521259bd)
b9a53a
Related: #1789930
b9a53a
---
b9a53a
 src/basic/def.h | 3 +++
b9a53a
 src/core/main.c | 2 +-
b9a53a
 2 files changed, 4 insertions(+), 1 deletion(-)
b9a53a
b9a53a
diff --git a/src/basic/def.h b/src/basic/def.h
b9a53a
index 4d515c11b6..65ad659999 100644
b9a53a
--- a/src/basic/def.h
b9a53a
+++ b/src/basic/def.h
b9a53a
@@ -75,3 +75,6 @@
b9a53a
                 _CONF_PATHS_SPLIT_USR(n))
b9a53a
 
b9a53a
 #define LONG_LINE_MAX (1U*1024U*1024U)
b9a53a
+
b9a53a
+#define HIGH_RLIMIT_NOFILE (256*1024)
b9a53a
+#define HIGH_RLIMIT_MEMLOCK (1024ULL*1024ULL*64ULL)
b9a53a
diff --git a/src/core/main.c b/src/core/main.c
b9a53a
index b8c1e567ad..d6550ea161 100644
b9a53a
--- a/src/core/main.c
b9a53a
+++ b/src/core/main.c
b9a53a
@@ -1168,7 +1168,7 @@ static int bump_rlimit_memlock(struct rlimit *saved_rlimit) {
b9a53a
          * should normally disable such checks. We need them to implement IPAccessAllow= and IPAccessDeny=, hence let's
b9a53a
          * bump the value high enough for the root user. */
b9a53a
 
b9a53a
-        r = setrlimit_closest(RLIMIT_MEMLOCK, &RLIMIT_MAKE_CONST(1024ULL*1024ULL*16ULL));
b9a53a
+        r = setrlimit_closest(RLIMIT_MEMLOCK, &RLIMIT_MAKE_CONST(HIGH_RLIMIT_MEMLOCK));
b9a53a
         if (r < 0)
b9a53a
                 return log_warning_errno(r, "Setting RLIMIT_MEMLOCK failed, ignoring: %m");
b9a53a