summaryrefslogtreecommitdiff
path: root/src/journal/coredump.c
AgeCommit message (Collapse)Author
2014-12-12copy: use btrfs reflinking only whe we know we copy full filesLennart Poettering
2014-12-12util: when using basename() for creating temporary files, verify the ↵Lennart Poettering
resulting name is actually valid Also, rename filename_is_safe() to filename_is_valid(), since it actually does a full validation for what the kernel will accept as file name, it's not just a heuristic.
2014-11-29coredump: Support coredump.conf.d directories in the usual search pathsJosh Triplett
2014-11-28coredump: simplify a few things by allocating small fields on the stack ↵Lennart Poettering
rather than heap
2014-11-28coredump: rework compose_open_fds()Lennart Poettering
Use FOREACH_DIRENT() and FOREACH_LINE() macros instead of manual loops. Don't clobber return parameters on failure. Simplify some other things.
2014-11-28treewide: another round of simplificationsMichal Schmidt
Using the same scripts as in f647962d64e "treewide: yet more log_*_errno + return simplifications".
2014-11-28treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt
If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
2014-11-28treewide: more log_*_errno + return simplificationsMichal Schmidt
2014-11-28treewide: no need to negate errno for log_*_errno()Michal Schmidt
It corrrectly handles both positive and negative errno values.
2014-11-28treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt
As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
2014-11-27coredump: use openatZbigniew Jędrzejewski-Szmek
2014-11-27coredump: collect all /proc data useful for bug reportingJakub Filak
/proc/[pid]: - status - maps - limits - cgroup - cwd - root - environ - fd/ & fdinfo/ joined in open_fds
2014-11-07copy: change error code when hitting copy limit to EFBIGLennart Poettering
After all, this is about files, not arguments, hence EFBIG is more appropriate than E2BIG
2014-11-06s/commandline/command line/gHarald Hoyer
2014-10-24journald: removed gendered pronouns in commentKlaus Purer
2014-08-15coredump: display libdw fail string on stack trace failUmut Tezduyar Lindskog
- systemd[1]: hello.service: main process exited, code= dumped, status=3/QUIT - systemd-coredump[2541]: Failed to generate stack trace: Unwinding not supported for this architecture - systemd-coredump[2541]: Process 1024 (hello) of user 154 dumped core.
2014-07-31Always prefer our headers to system headersZbigniew Jędrzejewski-Szmek
In practice this shouldn't make much difference, but sometimes our headers might be newer, and we want to test them.
2014-07-26Always check asprintf return codeKarel Zak
There is a small number of the places in sources where we don't check asprintf() return code and assume that after error the function returns NULL pointer via the first argument. That's wrong, after error the content of pointer is undefined.
2014-07-16Let config_parse open file where applicableZbigniew Jędrzejewski-Szmek
Special care is needed so that we get an error message if the file failed to parse, but not when it is missing. To avoid duplicating the same error check in every caller, add an additional 'warn' boolean to tell config_parse whether a message should be issued. This makes things both shorter and more robust wrt. to error reporting.
2014-07-15Clear up confusion wrt. ENTRY_SIZE_MAX and DATA_SIZE_MAXZbigniew Jędrzejewski-Szmek
Define DATA_SIZE_MAX to mean the maximum size of a single field, and ENTRY_SIZE_MAX to mean the size of the whole entry, with some rough calculation of overhead over the payload. Check if entries are not too big when processing native journal messages.
2014-07-15Constify ConfigTableItem tablesZbigniew Jędrzejewski-Szmek
2014-07-11Fix build without any compression enabledZbigniew Jędrzejewski-Szmek
2014-07-06journal: add LZ4 as optional compressorZbigniew Jędrzejewski-Szmek
Add liblz4 as an optional dependency when requested with --enable-lz4, and use it in preference to liblzma for journal blob and coredump compression. To retain backwards compatibility, XZ is used to decompress old blobs. Things will function correctly only with lz4-119. Based on the benchmarks found on the web, lz4 seems to be the best choice for "quick" compressors atm. For pkg-config status, see http://code.google.com/p/lz4/issues/detail?id=135.
2014-06-27coredump: simplify compression logic a bitLennart Poettering
This also make sure we remove the original coredump temporary file if we successfully managed to compress the coredump.
2014-06-27coredump: replace Compression= setting by simpler Compress= boolean settingLennart Poettering
Let's move things closer to journald's configuration settings, which knows Compress= already, as a boolean. This makes things more uniform, but also gives us more freedom to possibly swap out the used compression algorithm one day.
2014-06-27coredump: don't expose the compression level as configuration optionLennart Poettering
This sounds overly low-level and implementation-detaily. Let's just use the default level XZ suggests. This gives us more room to possibly swap out the compression algorithm used, as the compression level range will not leak into user configuration.
2014-06-27coredump: don't be annoyed if another coredump hook removes our coredump ↵Lennart Poettering
while we work on it
2014-06-27coredump: fix how the compression level is verifiedLennart Poettering
2014-06-27coredump: add simple coredump vacuumingLennart Poettering
When disk space taken up by coredumps grows beyond a configured limit start removing the oldest coredump of the user with the most coredumps, until we get below the limit again.
2014-06-27coredump: make sure variable is set if uncompressedThomas Hindoe Paaboel Andersen
reorder the code so the fstat is done before we can jump to uncompressed
2014-06-26coredump: fix debug messageThomas Hindoe Paaboel Andersen
typo from 347272731e15d3c4a70fad7ccd7185e8e8059d01
2014-06-26coredump+coredumpctl: add COREDUMP_FILENAME, use in coredumpctlZbigniew Jędrzejewski-Szmek
2014-06-26coredump: make compression configurableZbigniew Jędrzejewski-Szmek
Add Compression={none,xz} and CompressionLevel=0-9 settings. Defaults are xz/6. Compression=filesystem may be added later. I picked "xz" for the compression "type", since we might want to add different compressors later on. XZ is fairly memory and CPU intensive, and embedded users will likely want to use LZO or some other lightweight compression mechanism.
2014-06-26coredump: compress core filesZbigniew Jędrzejewski-Szmek
Unfortunately the core is first written uncompressed, then compressed by reading from disk and writing to the output file. This is ugly and slow, but I don't see a way around, if we want to get the backtrace without keeping everything in memory.
2014-06-23coredump: log coredump even if core dumping failsZbigniew Jędrzejewski-Szmek
Journal might be functional even if we cannot write to /var/lib/systemd/coredump.
2014-06-23coredump: retrieve comm information from /procZbigniew Jędrzejewski-Szmek
Kernel mangles comm information in an irreversible way when comm constains repeated spaces. Retrieve comm information from /proc, and only fallback to the information provided on the commandline when retrieving information from /proc fails. Add exe information to the list of saved xattr. https://bugs.freedesktop.org/show_bug.cgi?id=62043
2014-06-23coredump: never write more than the configured processing size limit to diskLennart Poettering
2014-06-23coredump: quit early if we cannot store ay coredump to diskLennart Poettering
2014-06-23coredump: also escape spaces in comm fields when formatting file namesLennart Poettering
2014-06-20coredump: fix include of xattr.hFilipe Brandenburger
The correct path is now <sys/xattr.h> (from glibc-headers) and no longer <attr/xattr.h> (from libattr-devel.) Fixes: 34c10968cbe3b5591b3c0ce225b8694edd9709d0
2014-06-19coredump: simplify how we apply extended attributes to coredumpsLennart Poettering
2014-06-19coredump: include stacktrace of coredumps in the log messageLennart Poettering
elfutils' libdw is maintained, can read DWARF debug data and appears to be the library of choice for generating backtraces today.
2014-06-19coredump: add 3 more metadata fields to coredump entriesLennart Poettering
2014-06-19coredump: optionally store coredumps on disk, not in the journalLennart Poettering
Introduce a new configuration file /etc/systemd/coredump.conf to configure when to place coredumps in the journal and when on disk. Since the coredumps are quite large, default to storing them only on disk.
2014-04-12Unify GREEDY_REALLOC and GREEDY_REALLOC_TZbigniew Jędrzejewski-Szmek
greedy_realloc() and greedy_realloc0() now store the allocated size as the count, not bytes. Replace GREEDY_REALLOC uses with GREEDY_REALLOC_T everywhere, and then rename GREEDY_REALLOC_T to GREEDY_REALLOC. It is just too error-prone to have two slightly different macros which do the same thing.
2014-03-17journal: export valid_user_field and size definesZbigniew Jędrzejewski-Szmek
In preparation for use elsewhere.
2013-10-13Fix write-only use of a few variablesZbigniew Jędrzejewski-Szmek
Since the invention of read-only memory, write-only memory has been considered deprecated. Where appropriate, either make use of the value, or avoid writing it, to make it clear that it is not used.
2013-09-06systemd-coredump: Log crashes without coredumps on failureAndrew Cook
Make a best-effort attempt to store information about crashes during failure, currently if these are encountered the crash is completely silenced. ideally coredumpctl would show if a coredump is available.
2013-09-06systemd-coredump: Ignore coredumps larger than COREDUMP_MAXAndrew Cook
Currently this check happens when the coredump has been collected in it's entirety and being received by journald. this is not ideal behaviour when the crashing process is consuming significant percentage of physical memory such as a large instance of firefox or a java application.
2013-04-25coredump: use realloc() loop instead of malloc(768M)Colin Walters
I typically run VMs with 1024MiB allocated; systemd is unable to write coredumps in this scenario at all because the default kernel configuration will only overcommit 50% of available RAM. Avoid this failure by using a realloc() loop. See: http://lists.freedesktop.org/archives/systemd-devel/2013-April/010709.html