Commit Graph

55 Commits

Author SHA1 Message Date
Harald Hoyer 3f85ef0f05 s/commandline/command line/g 2014-11-06 15:34:18 +01:00
Klaus Purer b26c631ac9 journald: removed gendered pronouns in comment 2014-10-24 13:32:16 +02:00
Umut Tezduyar Lindskog 4d229b318a coredump: display libdw fail string on stack trace fail
- 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-08-15 03:10:20 +02:00
Zbigniew Jędrzejewski-Szmek 73f860db98 Always prefer our headers to system headers
In practice this shouldn't make much difference, but
sometimes our headers might be newer, and we want to
test them.
2014-07-31 08:56:03 -04:00
Karel Zak 7de80bfe2e Always check asprintf return code
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-26 15:08:41 -04:00
Zbigniew Jędrzejewski-Szmek 36f822c4bd Let config_parse open file where applicable
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-16 18:47:20 -04:00
Zbigniew Jędrzejewski-Szmek 874bc134ac Clear up confusion wrt. ENTRY_SIZE_MAX and DATA_SIZE_MAX
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-15 22:34:42 -04:00
Zbigniew Jędrzejewski-Szmek e9f3d2d508 Constify ConfigTableItem tables 2014-07-15 22:34:40 -04:00
Zbigniew Jędrzejewski-Szmek 3b1a55e110 Fix build without any compression enabled 2014-07-11 10:42:27 -04:00
Zbigniew Jędrzejewski-Szmek d89c8fdf48 journal: add LZ4 as optional compressor
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-07-06 19:06:03 -04:00
Lennart Poettering b59233e6a3 coredump: simplify compression logic a bit
This also make sure we remove the original coredump temporary file if we
successfully managed to compress the coredump.
2014-06-27 19:35:57 +02:00
Lennart Poettering 8c9571d0ae coredump: replace Compression= setting by simpler Compress= boolean setting
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-27 19:35:57 +02:00
Lennart Poettering cf677ac1b7 coredump: don't expose the compression level as configuration option
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-27 19:35:57 +02:00
Lennart Poettering 9d951bf491 coredump: don't be annoyed if another coredump hook removes our coredump while we work on it 2014-06-27 19:35:57 +02:00
Lennart Poettering cfc194575b coredump: fix how the compression level is verified 2014-06-27 19:35:57 +02:00
Lennart Poettering 0dc5d23c85 coredump: add simple coredump vacuuming
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-27 19:35:57 +02:00
Thomas Hindoe Paaboel Andersen 7849c2acd4 coredump: make sure variable is set if uncompressed
reorder the code so the fstat is done before we can jump to
uncompressed
2014-06-27 00:17:58 +02:00
Thomas Hindoe Paaboel Andersen 2bb9a7a286 coredump: fix debug message
typo from 347272731e
2014-06-26 23:16:58 +02:00
Zbigniew Jędrzejewski-Szmek 9fe13294a9 coredump+coredumpctl: add COREDUMP_FILENAME, use in coredumpctl 2014-06-26 01:41:04 -04:00
Zbigniew Jędrzejewski-Szmek 347272731e coredump: make compression configurable
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-26 01:41:04 -04:00
Zbigniew Jędrzejewski-Szmek cfd652ed61 coredump: compress core files
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-26 01:41:04 -04:00
Zbigniew Jędrzejewski-Szmek 2424a4755d coredump: log coredump even if core dumping fails
Journal might be functional even if we cannot write to
/var/lib/systemd/coredump.
2014-06-23 23:14:54 -04:00
Zbigniew Jędrzejewski-Szmek 1eef15b181 coredump: retrieve comm information from /proc
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-23 23:14:54 -04:00
Lennart Poettering 93240d3aba coredump: never write more than the configured processing size limit to disk 2014-06-23 16:28:05 +02:00
Lennart Poettering 6388c31525 coredump: quit early if we cannot store ay coredump to disk 2014-06-23 15:53:03 +02:00
Lennart Poettering b0b21dce0e coredump: also escape spaces in comm fields when formatting file names 2014-06-23 12:40:38 +02:00
Filipe Brandenburger cacd6403a0 coredump: fix include of xattr.h
The correct path is now <sys/xattr.h> (from glibc-headers) and no longer
<attr/xattr.h> (from libattr-devel.)

Fixes: 34c10968cb
2014-06-20 00:26:03 +02:00
Lennart Poettering 0cd77f9783 coredump: simplify how we apply extended attributes to coredumps 2014-06-19 12:38:45 +02:00
Lennart Poettering 8d4e028f18 coredump: include stacktrace of coredumps in the log message
elfutils' libdw is maintained, can read DWARF debug data and appears to
be the library of choice for generating backtraces today.
2014-06-19 12:38:45 +02:00
Lennart Poettering a035f8191a coredump: add 3 more metadata fields to coredump entries 2014-06-19 00:00:24 +02:00
Lennart Poettering 34c10968cb coredump: optionally store coredumps on disk, not in the journal
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-06-19 00:00:24 +02:00
Zbigniew Jędrzejewski-Szmek ca2d378414 Unify GREEDY_REALLOC and GREEDY_REALLOC_T
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-04-12 10:20:55 -04:00
Zbigniew Jędrzejewski-Szmek d18d46ecea journal: export valid_user_field and size defines
In preparation for use elsewhere.
2014-03-17 01:55:47 -04:00
Zbigniew Jędrzejewski-Szmek 872c8faaf2 Fix write-only use of a few variables
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-10-13 17:56:54 -04:00
Andrew Cook 92f2ff4415 systemd-coredump: Log crashes without coredumps on failure
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-06 10:09:55 +02:00
Andrew Cook ca0ceb6f3e systemd-coredump: Ignore coredumps larger than COREDUMP_MAX
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-09-06 10:09:54 +02:00
Colin Walters 910003d022 coredump: use realloc() loop instead of malloc(768M)
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
2013-04-25 22:51:31 -04:00
Harald Hoyer 7fd1b19bc9 move _cleanup_ attribute in front of the type
http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
2013-04-18 09:11:22 +02:00
Lennart Poettering c4aa09b06f journald: bring max coredump size in sync with max entry size 2013-04-08 20:35:26 +02:00
Zbigniew Jędrzejewski-Szmek 5e75606a41 coredump: do not free twice 2013-03-28 22:27:15 -04:00
Lennart Poettering 41be2ca14d coredump: bump coredump truncation size from 24M to 768M
In the long run we really should make this runtime configurable.
2013-03-01 19:22:30 +01:00
Mirco Tischler b7f7c68570 coredump: make use of the cleanup macros 2013-02-07 01:02:34 -05:00
Mirco Tischler f904546894 journal: log user units for coredumps and show them in systemctl status 2013-02-07 01:02:34 -05:00
Lukas Nykryn 9bdbc2e2ec systemctl,loginctl,cgls: do not ellipsize cgroup members when --full is specified
New file output.h with output flags and modes.

--full parameter also for cgls and loginctl.

Include 'all' parameter in flags (show_cgroup_by_path, show_cgroup,
show_cgroup_and_extra, show_cgroup_and_extra_by_spec).

get_process_cmdline with max_length == 0 will not ellipsize output.

Replace LINE_MAX with 0 in some calls of get_process_cmdline.

[zj: Default to --full when under pager for clgs.
     Drop '-f' since it wasn't documented and didn't actually work.
     Reindent a bit.
]
2013-01-16 12:11:47 -05:00
Shawn Landden 0d0f0c50d3 log.h: new log_oom() -> int -ENOMEM, use it
also a number of minor fixups and bug fixes: spelling, oom errors
that didn't print errors, not properly forwarding error codes,
few more consistency issues, et cetera
2012-07-26 11:48:26 +02:00
Shawn Landden 669241a076 use "Out of memory." consistantly (or with "\n")
glibc/glib both use "out of memory" consistantly so maybe we should
consider that instead of this.

Eliminates one string out of a number of binaries. Also fixes extra newline
in udev/scsi_id
2012-07-25 11:23:57 +02:00
Lennart Poettering b7def68494 util: rename join() to strjoin()
This is to match strappend() and the other string related functions.
2012-07-13 13:41:01 +02:00
Kay Sievers d2e54fae5c mkdir: append _label to all mkdir() calls that explicitly set the selinux context 2012-05-31 12:40:20 +02:00
Lennart Poettering ba1261bc02 build-sys: fix built with --disable-logind 2012-05-30 22:25:01 +02:00
Lennart Poettering 5430f7f2bc relicense to LGPLv2.1 (with exceptions)
We finally got the OK from all contributors with non-trivial commits to
relicense systemd from GPL2+ to LGPL2.1+.

Some udev bits continue to be GPL2+ for now, but we are looking into
relicensing them too, to allow free copy/paste of all code within
systemd.

The bits that used to be MIT continue to be MIT.

The big benefit of the relicensing is that closed source code may now
link against libsystemd-login.so and friends.
2012-04-12 00:24:39 +02:00