-
-
Notifications
You must be signed in to change notification settings - Fork 4k
systemd-coredump with journal storage doesn't handle cores >2GiB #26748
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
In systemd Does setting /cc @DaanDeMeyer |
Reproducer: #include <stdio.h>
#include <stdlib.h>
int main(void) {
char *memhog = malloc(1024UL * 1024UL * 3072UL);
printf("%c\n", *(char*)NULL);
return 0;
} Relevant settings from [Coredump]
Storage=journal
ProcessSizeMax=32G
JournalSizeMax=32G With defaults settings (i.e. compact journal):
With
So, as @mgreen89 already explained, the main issue here is that the systemd/src/coredump/coredump.c Line 617 in 23f315d
only reads up to 0x7ffff000 (2,147,479,552) bytes - that's not our limitation, but limitation of the read() (and similar) syscalls on both 32-bit and 64-bit platforms (see man 2 read , the NOTES section).
To mitigate this, we'd have to read the coredump in chunks - I guess using |
Also, while systemd/src/journal/journald-native.c Lines 394 to 398 in 2e6606a
I.e. with patch: diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c
index a6b0d96488..64d3239037 100644
--- a/src/coredump/coredump.c
+++ b/src/coredump/coredump.c
@@ -614,7 +614,7 @@ static int allocate_journal_field(int fd, size_t size, char **ret, size_t *ret_s
memcpy(field, "COREDUMP=", 9);
- n = read(fd, field + 9, size);
+ n = loop_read(fd, field + 9, size, false);
if (n < 0)
return log_error_errno((int) n, "Failed to read core data: %m");
if ((size_t) n < size)
|
Thanks for looking into this. I was initially attracted to the journal storage mostly as it seemed to have a slightly more resilient story for core rotation. I've since changed just to use the I think there's probably a hole here, but it might just be a documentation issue at this time if this is opening up further issues. |
The man page claimed the default was 10M, but that's not true, it's 767M. Also mention there's no point in increasing it further. See: systemd#26748
Fix in #28127 |
The man page claimed the default was 10M, but that's not true, it's 767M. Also mention there's no point in increasing it further. See: systemd#26748
Fixes: systemd#26748 (cherry picked from commit a73c74d) (cherry picked from commit fa0ef8e) (cherry picked from commit 540a490)
Fixes: systemd#26748 (cherry picked from commit a73c74d) (cherry picked from commit fa0ef8e)
Fixes: systemd#26748 (cherry picked from commit a73c74d)
Uh oh!
There was an error while loading. Please reload this page.
systemd version the issue has been seen with
253
Used distribution
n/a (irrelevant - should occur across all distros)
Linux kernel version used
n/a (irrelevant - should occur on any still-supported kernel version)
CPU architectures issue was seen on
x86_64
Component
systemd-coredump
Expected behaviour you didn't see
systemd-coredump being able to store cores larger than 2GiB in size when using journal storage
Unexpected behaviour you saw
systemd-coredump doesn't pass core to journal for storage, and the following log is output in journalctl:
Steps to reproduce the problem
Configure the kernel core pattern to use systemd-coredump:
(this may vary between versions, but the issue is present in the latest version of systemd-coredump)
Configure the coredump settings to handle large cores and set journal storage.
In
coredump.conf
:OPTIONAL: configure journal settings - this is not required as it doesn't get as far as journal:
In
journald.conf
Start a process that uses more than 2GB of memory, and then generate a core from it (e.g. with
kill -11 <pid>
to send a SIGSEGV).The core will be dumped to a temporary file in
/var/lib/systemd/coredump
.In the journal handling section here this file is read in, but the
read
API reads at most 0x7ffff000 (2,147,479,552) bytes of data (see the Notes section here) so it will never read the entire core if it's larger than this and will always bail out here.Additional program output to the terminal or log subsystem illustrating the issue
No response
The text was updated successfully, but these errors were encountered: