| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Fixes: #18936
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
| |
Fixes #18321. I don't see any point in showing the hostname in
_HOSTNAME: it's either the same as COREDUMP_HOSTNAME or irrelevant.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
As discussed in https://github.com/systemd/systemd/pull/18347.
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
json.[ch] is a very generic implementation, and cmdline argument parsing
doesn't fit there.
|
|\
| |
| | |
Use real return codes in _from_string() functions
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|/
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
It may be useful when debugging daemons.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
Also use _cleanup_free_ in one more place.
|
| |
|
| |
|
|
|
|
| |
Then, we can shorten many test definitions.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
This commit adds the possibility to pass command line options to the
debugger invoked with coredumpctl debug.
Resolves: #9905
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Those are functions that express policy, and nothing in basic/ uses
(or should use) them.
|
|
|
|
|
|
|
| |
We already append 000000 early on when parsing the cmdline args, let's
not do that a second time.
Fixes: #16919
|
|\
| |
| | |
Use a bitmask in fd_add_uid_acl_permission()
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
It's line-by-line the same logic, hence use the common implementation.
|
| |
|
|
|
|
|
|
|
|
| |
let's simplify the checks for ZSTD/LZ4/XZ
As suggested:
https://github.com/systemd/systemd/pull/16096#discussion_r440705585
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
this will hook libzstd into coredump,
using this format as default.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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)
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Also convert these to use take_fdopen().
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
This doesn't cover all the binaries, but I don't know how to script
this, and I run out of steam ;)
|
|
|
|
|
|
|
| |
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.
|