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