summaryrefslogtreecommitdiff
path: root/src/coredump
Commit message (Collapse)AuthorAgeFilesLines
* coredumpctl: fflush() stdout before invoking gdbLennart Poettering2021-03-111-1/+1
| | | | Fixes: #18936
* coredump: omit coredump info when -q is used with the `debug` verbFrantisek Sumsal2021-03-101-2/+4
| | | | | | | | Skip printing the coredump info table when using the `debug` verb in combination with the `-q/--quiet` option. Useful when trying to gather coredump info non-interactively via scripted gdb commands. Fixes: systemd/systemd#18935
* tree-wide: use UINT64_MAX or friendsYu Watanabe2021-03-053-6/+6
|
* coredumpctl: show container hostameZbigniew Jędrzejewski-Szmek2021-03-041-1/+1
| | | | | Fixes #18321. I don't see any point in showing the hostname in _HOSTNAME: it's either the same as COREDUMP_HOSTNAME or irrelevant.
* coredump: indent commentZbigniew Jędrzejewski-Szmek2021-03-011-5/+5
|
* signal-util: make -1 termination of ignore_signals() argument list unnecessaryLennart Poettering2021-02-251-2/+2
| | | | | | | | | | Clean up ignore_signals() + default_signals() + sigaction_many() a bit: make it unnecessary to explicitly terminate the signal list with -1. Merge all three calls into a single function that is just called with slightly different parameters. And eliminate an unnecessary extra iteration in its inner for() loop. No change in behaviour.
* Recommend drop-ins over modifications to the main config fileZbigniew Jędrzejewski-Szmek2021-02-191-7/+8
| | | | As discussed in https://github.com/systemd/systemd/pull/18347.
* tree-wide: return NULL from freeing functionsZbigniew Jędrzejewski-Szmek2021-02-161-5/+5
| | | | | | I started working on this because I wanted to change how DEFINE_TRIVIAL_CLEANUP_FUNC is defined. Even independently of that change, it's nice to make make things more consistent and predictable.
* coredump: add typedef for structZbigniew Jędrzejewski-Szmek2021-02-161-9/+8
|
* Move and rename parse_json_argument() functionZbigniew Jędrzejewski-Szmek2021-02-151-1/+2
| | | | | json.[ch] is a very generic implementation, and cmdline argument parsing doesn't fit there.
* Merge pull request #11484 from keszybz/udevadm-error-logsYu Watanabe2021-02-111-1/+1
|\ | | | | Use real return codes in _from_string() functions
| * tree-wide: use -EINVAL for enum invalid valuesZbigniew Jędrzejewski-Szmek2021-02-101-1/+1
| | | | | | | | | | | | | | | | | | As suggested in https://github.com/systemd/systemd/pull/11484#issuecomment-775288617. This does not touch anything exposed in src/systemd. Changing the defines there would be a compatibility break. Note that tests are broken after this commit. They will be fixed in the next one.
* | coredumpctl: include coredump size in outputLennart Poettering2021-02-101-32/+80
| | | | | | | | | | | | | | | | This improves the output of the "list" and "info" verbs and adds coredump size information to the output. For doing that a common helper function is added that analyzes the coredump file on disk.
* | coredumpctl: modernize table outputLennart Poettering2021-02-101-64/+122
|/ | | | | | | | | | | | | Let's use our table formatter for generating the coredump table. Bring support up to our current standards, with a bit of color, JSON output and so on. Also adds supports for setting a max for the number of lines to generate. (with the new -n switch) The existing -1 switch now becomes a synonym for "-n 1 --reverse" Fixes: #3271
* tree-wide: enable colorized logging for daemons when run in consoleYu Watanabe2021-02-012-2/+2
| | | | It may be useful when debugging daemons.
* tree-wide: Drop custom formatting for print() help messagesDaan De Meyer2021-01-311-6/+5
| | | | | | | | | | | | I think this formatting was originally used because it simplified adding new options to the help messages. However, these days, most tools their help message end with "\nSee the %s for details.\n" so the final line almost never has to be edited which eliminates the benefit of the custom formatting used for printf() help messages. Let's make things more consistent and use the same formatting for printf() help messages that we use everywhere else. Prompted by https://github.com/systemd/systemd/pull/18355#discussion_r567241580
* treewide: tighten variable scope in loops (#18372)Susant Sahani2021-01-271-13/+10
| | | | Also use _cleanup_free_ in one more place.
* meson: enable several tests even if the relevant features are disabledYu Watanabe2021-01-191-1/+1
|
* meson: fix indentationYu Watanabe2021-01-191-2/+3
|
* meson: make the second and third elements of tests or fuzzers optionalYu Watanabe2021-01-191-3/+1
| | | | Then, we can shorten many test definitions.
* Add install-sysconfdir=no-samples option for (non-)installation of sample ↵Josh Triplett2021-01-141-1/+1
| | | | | | | | | | | | | configs By default, systemd installs various sample configuration files containing commented-out defaults. Systems seeking to minimize the number of files in /etc may wish to install directories and configuration files that have semantic effects, but not install not commented-out sample configuration files. Turn install-sysconfdir into a multi-valued option, with a "no-samples" value to skip installing sample-only configuration files.
* coredumpctl: Add --debugger-args= optionMichal Fabik2020-12-161-36/+58
| | | | | | | This commit adds the possibility to pass command line options to the debugger invoked with coredumpctl debug. Resolves: #9905
* meson: add option to skip installing to $sysconfdirJörg Thalheim2020-11-121-1/+1
| | | | | | | | | | | | | | | | | | | | | This is useful for development where overwriting files out side the configured prefix will affect the host as well as stateless systems such as NixOS that don't let packages install to /etc but handle configuration on their own. Alternative to https://github.com/systemd/systemd/pull/17501 tested with: $ mkdir inst build && cd build $ meson \ -Dcreate-log-dirs=false \ -Dsysvrcnd-path=$(realpath ../inst)/etc/rc.d \ -Dsysvinit-path=$(realpath ../inst)/etc/init.d \ -Drootprefix=$(realpath ../inst) \ -Dinstall-sysconfdir=false \ --prefix=$(realpath ../inst) .. $ ninja install
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-098-8/+8
|
* tree-wide: assorted coccinelle fixesFrantisek Sumsal2020-10-092-18/+13
|
* coredump: use uid_is_system() when appropriateZbigniew Jędrzejewski-Szmek2020-09-251-1/+1
|
* Move {uid,gid}_is_*() from basic to sharedZbigniew Jędrzejewski-Szmek2020-09-251-0/+1
| | | | | Those are functions that express policy, and nothing in basic/ uses (or should use) them.
* coredump: don't convert s → µs twiceLennart Poettering2020-09-021-4/+10
| | | | | | | We already append 000000 early on when parsing the cmdline args, let's not do that a second time. Fixes: #16919
* Merge pull request #16841 from keszybz/acl-util-bitmaskLennart Poettering2020-08-311-2/+2
|\ | | | | Use a bitmask in fd_add_uid_acl_permission()
| * shared/acl-util: convert rd,wr,ex to a bitmaskZbigniew Jędrzejewski-Szmek2020-08-271-2/+2
| | | | | | | | | | | | | | | | | | I find this version much more readable. Add replacement defines so that when acl/libacl.h is not available, the ACL_{READ,WRITE,EXECUTE} constants are also defined. Those constants were declared in the kernel headers already in 1da177e4c3f41524e886b7f1b8a0c1f, so they should be the same pretty much everywhere.
* | tree-wide: drop pointless zero initialization (#16884)fangxiuning2020-08-281-1/+1
|/ | | tree-wide: drop pointless zero initialization
* acl-util: beef up add_acls_for_user()Lennart Poettering2020-08-251-1/+1
| | | | | | Let's add support for controlling r/w/x bits separetely. This is useful for using it to control access to directories, where r + x shall be enabled.
* coredump: port to use common add_acls_for_user()Lennart Poettering2020-07-211-24/+4
| | | | It's line-by-line the same logic, hence use the common implementation.
* coredump: use log_error_errno() where appropriateLennart Poettering2020-06-251-2/+2
|
* tree-wide: add new HAVE_COMPRESSION compile time flagLennart Poettering2020-06-252-2/+2
| | | | | | | | let's simplify the checks for ZSTD/LZ4/XZ As suggested: https://github.com/systemd/systemd/pull/16096#discussion_r440705585
* log: introduce log_parse_environment_cli() and log_setup_cli()Filipe Brandenburger2020-06-241-3/+1
| | | | | | | | | | | | | | | | Presently, CLI utilities such as systemctl will check whether they have a tty attached or not to decide whether to parse /proc/cmdline or EFI variable SystemdOptions looking for systemd.log_* entries. But this check will be misleading if these tools are being launched by a daemon, such as a monitoring daemon or automation service that runs in background. Make log handling of CLI tools uniform by never checking /proc/cmdline or EFI variables to determine the logging level. Furthermore, introduce a new log_setup_cli() shortcut to set up common options used by most command-line utilities.
* conf-parser: return mtime in config_parse() and friendsLennart Poettering2020-06-021-5/+8
| | | | | | | | | | | | | This is a follow-up for 9f83091e3cceb646a66fa9df89de6d9a77c21d86. Instead of reading the mtime off the configuration files after reading, let's do so before reading, but with the fd we read the data from. This is not only cleaner (as it allows us to save one stat()), but also has the benefit that we'll detect changes that happen while we read the files. This also reworks unit file drop-ins to use the common code for determining drop-in mtime, instead of reading system clock for that.
* journalctl,elsewhere: make sure --file=foo fails with sane error msg if foo ↵Lennart Poettering2020-05-191-1/+1
| | | | | | | | | | | | | is not readable It annoyed me for quite a while that running "journalctl --file=…" on a file that is not readable failed with a "File not found" error instead of a permission error. Let's fix that. We make this work by using the GLOB_NOCHECK flag for glob() which means that files are not accessible will be returned in the array as they are instead of being filtered away. This then means that our later attemps to open the files will fail cleanly with a good error message.
* tree-wide: make sure our control buffers are properly alignedLennart Poettering2020-05-071-4/+1
| | | | | | | | | | | | | We always need to make them unions with a "struct cmsghdr" in them, so that things properly aligned. Otherwise we might end up at an unaligned address and the counting goes all wrong, possibly making the kernel refuse our buffers. Also, let's make sure we initialize the control buffers to zero when sending, but leave them uninitialized when reading. Both the alignment and the initialization thing is mentioned in the cmsg(3) man page.
* coredump: add zstandard support for coredumpsNorbert Lange2020-05-042-3/+3
| | | | | this will hook libzstd into coredump, using this format as default.
* tree-wide: use cmsg_find() helper at various places where appropriateLennart Poettering2020-04-231-10/+2
|
* tree-wide: use recvmsg_safe() at various placesLennart Poettering2020-04-231-7/+7
| | | | | | | | | | | | | | | | | Let's be extra careful whenever we return from recvmsg() and see MSG_CTRUNC set. This generally means we ran into a programming error, as we didn't size the control buffer large enough. It's an error condition we should at least log about, or propagate up. Hence do that. This is particularly important when receiving fds, since for those the control data can be of any size. In particular on stream sockets that's nasty, because if we miss an fd because of control data truncation we cannot recover, we might not even realize that we are one off. (Also, when failing early, if there's any chance the socket might be AF_UNIX let's close all received fds, all the time. We got this right most of the time, but there were a few cases missing. God, UNIX is hard to use)
* coredumpctl: support --file=PATHFrantisek Sumsal2020-04-131-0/+18
| | | | | | Let's match journalctl's functionality by throwing --file for coredumpctl into the mix, so we can work on a single journal file as well.
* *: use _cleanup_close_ with fdopen() where trivialVito Caputo2020-03-311-5/+3
| | | | Also convert these to use take_fdopen().
* tree-wide: clean up --help texts a bitLennart Poettering2019-11-181-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This cleans up and unifies the outut of --help texts a bit: 1. Highlight the human friendly description string, not the command line via ANSI sequences. Previously both this description string and the brief command line summary was marked with the same ANSI highlight sequence, but given we auto-page to less and less does not honour multi-line highlights only the command line summary was affectively highlighted. Rationale: for highlighting the description instead of the command line: the command line summary is relatively boring, and mostly the same for out tools, the description on the other hand is pregnant, important and captions the whole thing and hence deserves highlighting. 2. Always suffix "Options" with ":" in the help text 3. Rename "Flags" → "Options" in one case 4. Move commands to the top in a few cases 5. add coloring to many more help pages 6. Unify on COMMAND instead of {COMMAND} in the command line summary. Some tools did it one way, others the other way. I am not sure what precisely {} is supposed to mean, that uppercasing doesn't, hence let's simplify and stick to the {}-less syntax And minor other tweaks.
* tree-wide: drop string.h when string-util.h or friends are includedYu Watanabe2019-11-041-1/+0
|
* tree-wide: drop missing.hYu Watanabe2019-10-311-1/+0
|
* coredump: Include module offsets in stack tracesAaron Plattner2019-10-181-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These offsets can be useful to decode stack traces through modules that don't have symbol names. For example, with a simple test that crashes after calling through several static functions, systemd-coredump reports this: Oct 17 : Process 640333 (a.out) of user 1000 dumped core. Stack trace of thread 640333: #0 0x00005562c2b9f11d n/a (/tmp/a.out) #1 0x00005562c2b9f12d n/a (/tmp/a.out) #2 0x00005562c2b9f139 n/a (/tmp/a.out) #3 0x00005562c2b9f145 n/a (/tmp/a.out) #4 0x00007fc768b39153 __libc_start_main (libc.so.6) #5 0x00005562c2b9f04e n/a (/tmp/a.out) With this change: Stack trace of thread 666897: #0 0x0000555668fbe11d n/a (/tmp/a.out + 0x111d) #1 0x0000555668fbe12d n/a (/tmp/a.out + 0x112d) #2 0x0000555668fbe139 n/a (/tmp/a.out + 0x1139) #3 0x0000555668fbe145 n/a (/tmp/a.out + 0x1145) #4 0x00007f7b5c828153 __libc_start_main (libc.so.6 + 0x27153) #5 0x0000555668fbe04e n/a (/tmp/a.out + 0x104e) Disassembling the test binary shows that these offsets line up: 0000000000001119 <crash>: 1119: 55 push %rbp 111a: 48 89 e5 mov %rsp,%rbp 111d: 0f 0b ud2 <---- #0 000000000000111f <b>: 111f: 55 push %rbp 1120: 48 89 e5 mov %rsp,%rbp 1123: b8 00 00 00 00 mov $0x0,%eax 1128: e8 ec ff ff ff callq 1119 <crash> 112d: 90 nop <---- #1 112e: 5d pop %rbp 112f: c3 retq 0000000000001130 <a>: 1130: 55 push %rbp 1131: 48 89 e5 mov %rsp,%rbp 1134: e8 e6 ff ff ff callq 111f <b> 1139: 90 nop <---- #2 113a: 5d pop %rbp 113b: c3 retq 000000000000113c <main>: 113c: 55 push %rbp 113d: 48 89 e5 mov %rsp,%rbp 1140: e8 eb ff ff ff callq 1130 <a> 1145: b8 00 00 00 00 mov $0x0,%eax <---- #3 114a: 5d pop %rbp 114b: c3 retq 114c: 0f 1f 40 00 nopl 0x0(%rax) (from libc.so.6) 0000000000027060 <__libc_start_main>: 27060: f3 0f 1e fa endbr64 27064: 41 56 push %r14 27066: 31 c0 xor %eax,%eax [...] 2714c: 48 8b 44 24 18 mov 0x18(%rsp),%rax 27151: ff d0 callq *%rax 27153: 89 c7 mov %eax,%edi <---- #4 27155: e8 e6 76 01 00 callq 3e840 <exit>
* Highlight the synopsis and summary in --helpZbigniew Jędrzejewski-Szmek2019-10-081-2/+4
| | | | | This doesn't cover all the binaries, but I don't know how to script this, and I run out of steam ;)
* Move the Commands section above Options sectionZbigniew Jędrzejewski-Szmek2019-10-081-7/+7
| | | | | | | For executables which take a verb, we should list the verbs first, and then options which modify those verbs second. The general layout of the man page is from general description to specific details, usually Overview, Commands, Options, Return Value, Examples, References.