Commit graph

39294 commits

Author SHA1 Message Date
Yu Watanabe 1cdca39752 man: use literal tag 2019-03-21 23:38:51 +09:00
Yu Watanabe c4f58deab5 network,udev: split static condition tests from net_match_config() 2019-03-21 23:37:39 +09:00
Yu Watanabe 2bd0da7a05 network: drop unnecessary strdup() 2019-03-21 23:37:39 +09:00
Yu Watanabe f9f88198ce core/unit: use condition_test_list() 2019-03-21 23:37:39 +09:00
Yu Watanabe 828fa6108b condition: introduce condition_test_list() 2019-03-21 23:37:39 +09:00
Yu Watanabe f6d6d53237 log: expose log_object_internalv() 2019-03-21 23:37:39 +09:00
Zbigniew Jędrzejewski-Szmek fa28e4e377
Merge pull request #12059 from poettering/nspawn-typos
some typo and other fixes result of the OCI nspawn merge
2019-03-21 15:14:11 +01:00
Zbigniew Jędrzejewski-Szmek b1de39dec8 man: make separate "Errors" sections subsection of "Return value"
Logically, this is better, because we're describing a subset of possible
return values. Visually this also looks quite good because groff renders
refsect2 much less prominently.

Also rewrap things, add <constant> in various places, fix some typos.
2019-03-21 14:53:00 +01:00
Zbigniew Jędrzejewski-Szmek 6d99c5d1d9 man: document error values for sd_id128_get_*() 2019-03-21 14:13:02 +01:00
Lennart Poettering c3d13d2ad5
Merge pull request #12058 from keszybz/oci-simplifications
Follow-ups for nspawn-oci review
2019-03-21 13:55:09 +01:00
Lennart Poettering f4e803c809 nspawn: add a few missing flags from --help text 2019-03-21 13:31:09 +01:00
Lennart Poettering d99058c979 man: adjust nspawn man page to follow same section/order as --help text
No other changes, just some reshuffling and adding of section headers
(well, admittedly, I changed some "see above" and "see below" in the
text to match the new order.)
2019-03-21 13:27:48 +01:00
Lennart Poettering 2514865391 nspawn: reorder --help text, and add section
The list is so long, let's add a bit of structure and order things a
bit.
2019-03-21 13:27:19 +01:00
Lennart Poettering 2c9b7a7e62 mount: when we fail to establish an inaccessible mount gracefully, undo the mount 2019-03-21 12:41:02 +01:00
Lennart Poettering 74b6ce90a0 capability: add a test that fails if we ever enter > 64bit capability territory 2019-03-21 12:38:18 +01:00
Lennart Poettering 46eda04373 capability: also cap CAP_LAST_CAP at 63 2019-03-21 12:37:30 +01:00
Lennart Poettering 664ff517d3 capability: typo fix 2019-03-21 12:31:36 +01:00
Lennart Poettering 246bb37044 capability: use UINT64_C() where appropriate 2019-03-21 12:31:29 +01:00
Lennart Poettering bff749416e capability: minimize scope of a few variables 2019-03-21 12:31:14 +01:00
Lennart Poettering 15ce3f2664 capability: minor coding style updates 2019-03-21 12:30:49 +01:00
Lennart Poettering d09a25855f capability: add missing ')'
As pointed out by @polarina

d0b6a10c00 (commitcomment-32857641)
2019-03-21 12:29:18 +01:00
Zbigniew Jędrzejewski-Szmek c924888ffd sd-id128: look for invocation id in environment first, keyring second
As general principle, we generally check command line args first, the
enviroment second, and external configuration and system state only later.
In case of the invocation ID, checking the keyring before the environment
was implemented as a poor-man's security measure. But this is not really
useful, since we're moving within the same security boundary. So let's just
do the expected thing, and check environment first.

Prompted by https://github.com/systemd/systemd/pull/11991#issuecomment-474647652.
2019-03-21 12:06:15 +01:00
Zbigniew Jędrzejewski-Szmek 6757a01356 util-lib: get rid of a helper variable 2019-03-21 11:08:58 +01:00
Zbigniew Jędrzejewski-Szmek f1531db5af nspawn-oci: add helper function for free_and_strdup with oom check 2019-03-21 11:08:58 +01:00
Zbigniew Jędrzejewski-Szmek d0b6a10c00
Merge pull request #9762 from poettering/nspawn-oci
OCI runtime support for nspawn
2019-03-21 11:01:53 +01:00
Zbigniew Jędrzejewski-Szmek 19130626a0 nspawn-oci: use SYNTHETIC_ERRNO 2019-03-21 10:51:43 +01:00
Lennart Poettering 13fbfc3013 update TODO 2019-03-20 21:49:33 +01:00
Lennart Poettering 6f765baf23 core: rework how we reset the TTY after use by a service
This makes two changes:

1. Instead of resetting the configured service TTY each time after a
   process exited, let's do so only when the service goes back to "dead"
   state. This should be preferable in case the started processes leave
   background child processes around that still reference the TTY.

2. chmod() and chown() the TTY at the same time. This should make it
   safe to run "systemd-run -p DynamicUser=1 -p StandardInput=tty -p
   TTYPath=/dev/tty8 /bin/bash" without leaving a TTY owned by a dynamic
   user around.
2019-03-20 21:28:02 +01:00
Lennart Poettering 6c0ae73956 execute: split check if we might touch a tty out of exec_context_may_touch_console()
Some simple refactoring that'll come handy in a later commit.
2019-03-20 21:20:00 +01:00
Lennart Poettering 955f1c852e execute: use path_equal() to compare tty names
After all they might be strings such as pts/1 which we really should
consider the same as pts//1.
2019-03-20 21:18:59 +01:00
Lennart Poettering 4bf953d91b
Merge pull request #12049 from keszybz/assorted-fixups
Assorted fixups
2019-03-20 18:27:34 +01:00
David Michael 82bd4da71e shared/install: Preserve escape characters for escaped unit names
Since switching to extract_first_word with no flags for parsing
unit names in 4c9565eea5, escape
characters will be stripped from escaped unit names such as
"mnt-persistent\x2dvolume.mount" resulting in the unit not being
configured as defined.  Preserve escape characters again for
compatibility with existing preset definitions.
2019-03-20 18:26:24 +01:00
Lennart Poettering 2e13c0c354 systemctl: start_unit() returns > 0 on error, let's catch that properly
Let's make sure we fall back correctly to initctl when start_unit()
returns an error > 0.

Fixes: #11546
2019-03-20 15:05:27 +01:00
Lennart Poettering 9dccc6d3ae systemctl: use strv_consume() where we can 2019-03-20 14:53:07 +01:00
Lennart Poettering 61ff45db95 systemctl: port to static destructors 2019-03-20 14:53:07 +01:00
Zbigniew Jędrzejewski-Szmek d3bdba3816 test-fileio: avoid warning about ineffective comparison
On arm64 with gcc-8.2.1-5.fc29.aarch64:
../src/test/test-fileio.c:645:29: warning: comparison is always false due to limited range of data type [-Wtype-limits]
                 assert_se(c == EOF || safe_fgetc(f, &c) == 1);
                             ^~

Casting c to int is not enough, gcc is able to figure out that the original
type was unsigned and still warns. So let's just silence the warning like
in test-sizeof.c.
2019-03-20 14:00:12 +01:00
Zbigniew Jędrzejewski-Szmek afd5c1e373 sd-bus: reduce scope of variable 2019-03-20 13:34:35 +01:00
Zbigniew Jędrzejewski-Szmek 96d2e0978d sd-bus: avoid IN_SET() invocation with two identical values
Fixes #12036.

../../../src/systemd/src/libsystemd/sd-bus/bus-objects.c: In function ‘add_object_vtable_internal’:
../../../src/systemd/src/basic/macro.h:423:19: error: duplicate case value
2019-03-20 13:28:29 +01:00
Zbigniew Jędrzejewski-Szmek cc99274d7d test-alloc-util: add a smoke test for greedy_realloc 2019-03-20 13:17:27 +01:00
Zbigniew Jędrzejewski-Szmek 631427d622 TODO: add some bootctl items 2019-03-20 13:17:27 +01:00
Zbigniew Jędrzejewski-Szmek a49945e663
Merge pull request #12033 from fbuihuu/watched-process-improvments
Watched process improvments
2019-03-20 13:03:06 +01:00
Zbigniew Jędrzejewski-Szmek ec7b77642c
Merge pull request #12047 from poettering/cryptsetup-fixlets
some small cryptsetup, ask-password and allocation fixlets
2019-03-20 13:02:34 +01:00
Chris Morin 08f9e80b3f journal-file: handle SIGBUS on offlining thread
The thread launched in journal_file_set_offline() accesses a memory
mapped file, so it needs to handle SIGBUS. Leave SIGBUS unblocked on the
offlining thread so that it uses the same handler as the main thread.

The result of triggering SIGBUS in a thread where it's blocked is
undefined in Linux. The tested implementations were observed to cause
the default handler to run, taking down the whole journald process.

We can leave SIGBUS unblocked in multiple threads since it's handler is
thread-safe. If SIGBUS is sent to the journald process asynchronously
(i.e. with kill, sigqueue, or raise), either thread handling it will
result in the same behavior: it will install the default handler and
reraise the signal, killing the process.

Fixes: #12042
2019-03-20 13:02:04 +01:00
Zbigniew Jędrzejewski-Szmek 45ce112002
Merge pull request #12024 from poettering/bindtoifindex
use SO_BINDTOIFINDEX where appropriate
2019-03-20 11:16:51 +01:00
Franck Bui 01542056aa scope: tiny cleanup: UNIT(s) -> u
No functional changes.
2019-03-20 10:51:49 +01:00
Franck Bui 846a07b505 core: only watch processes when it's really necessary
If we know that main pid is our child then it's unnecessary to watch all
other processes of a unit since in this case we will get SIGCHLD when the main
process will exit and will act upon accordingly.

So let's watch all processes only if the main process is not our child since in
this case we need to detect when the cgroup will become empty in order to
figure out when the service becomes dead. This is only needed by cgroupv1.
2019-03-20 10:51:49 +01:00
Franck Bui f75f613d25 core: reduce the number of stalled PIDs from the watched processes list when possible
Some PIDs can remain in the watched list even though their processes have
exited since a long time. It can easily happen if the main process of a forking
service manages to spawn a child before the control process exits for example.

However when a pid is about to be mapped to a unit by calling unit_watch_pid(),
the caller usually knows if the pid should belong to this unit exclusively: if
we just forked() off a child, then we can be sure that its PID is otherwise
unused. In this case we take this opportunity to remove any stalled PIDs from
the watched process list.

If we learnt about a PID in any other form (for example via PID file, via
searching, MAINPID= and so on), then we can't assume anything.
2019-03-20 10:51:49 +01:00
Franck Bui 4d05154600 process-util: introduce pid_is_my_child() helper
No functional changes.
2019-03-20 10:51:49 +01:00
Lennart Poettering 054b6be05b ask-password: add extra paranoid overflow check 2019-03-20 10:48:33 +01:00
Lennart Poettering 32ae18206f alloc-util: typo fix 2019-03-20 10:48:33 +01:00