ddb60b
commit 1ce4508c92493cf03ea1b3c42e83540b387884fa
ddb60b
Author: Antonio Torres <antorres@redhat.com>
ddb60b
Date:   Fri Jul 2 07:12:48 2021 -0400
ddb60b
Subject: [PATCH] debug: don't set resource hard limit to zero
ddb60b
ddb60b
    Setting the resource hard limit to zero is irreversible, meaning if it
ddb60b
    is set to zero then there is no way to set it higher. This means
ddb60b
    enabling core dump is not possible, since setting a new resource limit
ddb60b
    for RLIMIT_CORE would fail. By only setting the soft limit to zero, we
ddb60b
    can disable and enable core dumps without failures.
ddb60b
ddb60b
    This fix is present in both main and 3.0.x upstream branches.
ddb60b
    
ddb60b
    Ticket in RHEL Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1977572
ddb60b
    Signed-off-by: Antonio Torres antorres@redhat.com
ddb60b
---
ddb60b
 src/lib/debug.c | 2 +-
ddb60b
 1 file changed, 1 insertion(+), 1 deletion(-)
ddb60b
ddb60b
diff --git a/src/lib/debug.c b/src/lib/debug.c
ddb60b
index 576bcb2a65..6330c9cb66 100644
ddb60b
--- a/src/lib/debug.c
ddb60b
+++ b/src/lib/debug.c
ddb60b
@@ -599,7 +599,7 @@ int fr_set_dumpable(bool allow_core_dumps)
ddb60b
 		struct rlimit no_core;
ddb60b
 
ddb60b
 		no_core.rlim_cur = 0;
ddb60b
-		no_core.rlim_max = 0;
ddb60b
+		no_core.rlim_max = core_limits.rlim_max;
ddb60b
 
ddb60b
 		if (setrlimit(RLIMIT_CORE, &no_core) < 0) {
ddb60b
 			fr_strerror_printf("Failed disabling core dumps: %s", fr_syserror(errno));