594167
From 19d3bf238c41c756b391fc7e66e5217cde42a896 Mon Sep 17 00:00:00 2001
594167
From: Lennart Poettering <lennart@poettering.net>
594167
Date: Tue, 8 Feb 2022 11:52:17 +0100
594167
Subject: [PATCH] coredump: raise the coredump save size on 64bit systems to
594167
 32G (and lower it to 1G on 32bit systems)
594167
594167
Apparently 2G is too low for various real-life systems. But raising it
594167
universally above 2^32 sounds wrong to me, since that makes no sense on
594167
32bit systems, that we still support.
594167
594167
Hence, let's raise the limit to 32G on 64bit systems, and *lower* it to
594167
1G on 32bit systems.
594167
594167
32G is 4 orders of magnitude higher then the old settings. Let's hope
594167
that's enough for now. Should this not be enough we can raise it
594167
further.
594167
594167
Fixes: #22076
594167
(cherry picked from commit e677041e7a6988f73de802db6e49d962d432944b)
594167
594167
Related: #2017035
594167
---
594167
 src/coredump/coredump.c | 10 ++++++++--
594167
 1 file changed, 8 insertions(+), 2 deletions(-)
594167
594167
diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c
594167
index 6a6e9765d4..fd156370b2 100644
594167
--- a/src/coredump/coredump.c
594167
+++ b/src/coredump/coredump.c
594167
@@ -48,8 +48,14 @@
594167
 #include "uid-alloc-range.h"
594167
 #include "user-util.h"
594167
 
594167
-/* The maximum size up to which we process coredumps */
594167
-#define PROCESS_SIZE_MAX ((uint64_t) (2LLU*1024LLU*1024LLU*1024LLU))
594167
+/* The maximum size up to which we process coredumps. We use 1G on 32bit systems, and 32G on 64bit systems */
594167
+#if __SIZEOF_POINTER__ == 4
594167
+#define PROCESS_SIZE_MAX ((uint64_t) (1LLU*1024LLU*1024LLU*1024LLU))
594167
+#elif __SIZEOF_POINTER__ == 8
594167
+#define PROCESS_SIZE_MAX ((uint64_t) (32LLU*1024LLU*1024LLU*1024LLU))
594167
+#else
594167
+#error "Unexpected pointer size"
594167
+#endif
594167
 
594167
 /* The maximum size up to which we leave the coredump around on disk */
594167
 #define EXTERNAL_SIZE_MAX PROCESS_SIZE_MAX