Commit graph

31108 commits

Author SHA1 Message Date
Lennart Poettering fa75683700 update TODO 2017-12-06 13:40:50 +01:00
Lennart Poettering afde45740f meson: print warnings if the "nobody" user/group name is not compatible with the local system
At least on Fedora and Debian systems this not obvious to get right,
hence warn.
2017-12-06 13:40:50 +01:00
Lennart Poettering 66d73cc728 test-execute: use the "nogroup" group if it exists for testing
We currently look for "nobody" and "nfsnobody" when testing groups, both
of which do not exist on Ubuntu, our main testing environment. Let's
extend the tests slightly to also use "nogroup" if it exists.
2017-12-06 13:40:50 +01:00
Lennart Poettering 05fd2156b7 journal,coredump: do not do ACL magic for "nobody" user either
The "nobody" user might possibly be seen by the journal or coredumping
code if unmapped userns-using processes are somehow visible to them.
Let's make sure we don't do the ACL magic for this user either, since
this is a special system user that might be backed by different real
users in different contexts.
2017-12-06 13:40:50 +01:00
Lennart Poettering 7e61fd02b0 user-util: synthesize user records for "nobody" the same way as for "root"
We already synthesize records for both "root" and "nobody" in
nss-systemd. Let's do the same in our own NSS wrappers that are supposed
to bypass NSS if possible. Previously this was done for "root" only, but
let's clean this up, and do the same for "nobody" too, so that we
synthesize records the same way everywhere, regardless whether in NSS or
internally.
2017-12-06 13:40:50 +01:00
Lennart Poettering 3a664727fa user-util: add UID_NOBODY defines that resolve to (uid_t) 65534
We use it all over the place, let's add a #define for it. Makes things
easier greppable, and more explanatory I think.
2017-12-06 13:40:50 +01:00
Lennart Poettering 8343827793 nss-systemd: tweak checks when we consult PID 1 for dynamic UID/GID lookups
Instead of contacting PID 1 for dynamic UID/GID lookups for all
UIDs/GIDs that do not qualify as "system" do the more precise check
instead: check if they actually qualify for the "dynamic" range.
2017-12-06 13:40:50 +01:00
Lennart Poettering 4e72397b00 coredump,journal: do not do ACL magic for processes of dynamic UIDs
Dynamic UIDs should be treated like system users in this regard.
2017-12-06 13:40:50 +01:00
Lennart Poettering ece877d434 user-util: add new uid_is_system() helper
This adds uid_is_system() and gid_is_system(), similar in style to
uid_is_dynamic(). That a helper like this is useful is illustrated by
the fact that test-condition.c didn't get the check right so far, which
this patch fixes.
2017-12-06 13:40:50 +01:00
Lennart Poettering 399725532d doc: add a document briefly explaining UID/GID range assumptions we make 2017-12-06 13:40:50 +01:00
Lennart Poettering 87d5e4f286 build-sys: make the dynamic UID range, and the container UID range configurable
Also, export these ranges in our pkg-config files.
2017-12-06 12:55:37 +01:00
Yu Watanabe 6a483c5b2f
Merge pull request #7497 from yuwata/fix-cpu-set
fixes related to cpu_set
2017-12-06 13:32:06 +09:00
Yu Watanabe c072c6d39a
Merge pull request #7547 from hvenev/sysctl-no-net-default
Do not set `net.ipv4.conf.default.*`
2017-12-06 13:28:23 +09:00
Lennart Poettering 93719c6b0e mount-util: shorten the loop a bit (#7545)
The loop preparation and part of the loop contents are actually the
same, let's merge this.

Also, it's so much fun tweaking around in the name_to_handle_at() code,
let's do more of it with this patch!

(This also adds two NULL assignments, that aren't strictly necessary.
However, I figured its safer to place them in there, just in case the
for() condition is changed later. After all the freeing of the handle
and the invalidation of the cleanup-controller pointer to it are
otherwise really far away from each other...)
2017-12-06 13:19:03 +09:00
Yu Watanabe a0605ddfcf
Merge pull request #7549 from poettering/ptyfwd-fixes
pty forwarder fixes
2017-12-06 13:16:27 +09:00
Yu Watanabe 4e79aeaa65 test-execute: add tests for CPUAffinity= 2017-12-06 10:44:20 +09:00
Yu Watanabe 784b9a1a32 run: Allows the user to reset CPUAffinity= back to an empty list
Before this CPUAffinity= requires a valid cpu set, and the setting
cannot be reset. Moreover, if CPUAffinity= with empty string is passed,
then message container is closed without no values appended, thus
we get error.
This makes CPUAffinity= accepts empty string to reset the setting
and avoid error.
2017-12-06 10:32:48 +09:00
Yu Watanabe 501941aaf0 core: merge multiple CPUAffinity= settings 2017-12-06 10:32:42 +09:00
Yu Watanabe da681e1bd2 tree-wide: use cpu_set_mfree() 2017-12-06 10:32:38 +09:00
Yu Watanabe a9a2ed3f52 cpu-set-util: introduce cpu_set_mfree() 2017-12-06 10:32:35 +09:00
Yu Watanabe 6d8a29b2e1 cpu-set-util: internally merge two functions 2017-12-06 10:32:32 +09:00
Lennart Poettering b57b372a05 man: fix binary path in systemd(1) (#7550)
Otherwise people might assume that systemd was installed in the $PATH,
but it is not. Do the same as for systemd-vconsole-setup.service and
friends: let's include the full path in the man page.
2017-12-05 21:46:58 +01:00
Zbigniew Jędrzejewski-Szmek 11d0f6cb67
Merge pull request #7532 from yuwata/test-execute
test-execute: add test for that DynamicUser= migrates StateDirectory=
2017-12-05 21:43:14 +01:00
Zbigniew Jędrzejewski-Szmek fdaf80672e
Merge pull request #7539 from yuwata/man-options
Add missing parsing and documentation for several options
2017-12-05 21:40:21 +01:00
Lennart Poettering fa9be0a6f0
Merge pull request #7494 from poettering/nspawn-cgroups
some nspawn cgroup fixes + dissecting and testing love
2017-12-05 18:53:24 +01:00
Lennart Poettering d147457cc9 run: run pty forwarder at higher event priority than the bus
We want any tty I/O to happen before we look at service messages, hence
let's set priorities on them, and give tty I/O a higher priority.
2017-12-05 18:33:24 +01:00
Lennart Poettering e22e69a31e ptyfwd: before deciding that a pty is fully drained, ask the kernel again
Apparently there's no guarantee that EPOLLIN is immediately propagated
from a pty slave to the master when data is written to it, hence it's
not sufficient to check EPOLLIN to decide whether the pty device is
drained.

Let's fix this by asking the kernel directly through SIOCINQ + SIOCOUTQ,
if there's anything buffered left.

Fixes: #7531
2017-12-05 18:33:24 +01:00
Michal Koutný deb4e7080d service: Don't stop unneeded units needed by restarted service (#7526)
An auto-restarted unit B may depend on unit A with StopWhenUnneeded=yes.
If A stops before B's restart timeout expires, it'll be started again as part
of B's dependent jobs. However, if stopping takes longer than the timeout, B's
running stop job collides start job which also cancels B's start job. Result is
that neither A or B are active.

Currently, when a service with automatic restarting fails, it transitions
through following states:
        1) SERVICE_FAILED or SERVICE_DEAD to indicate the failure,
        2) SERVICE_AUTO_RESTART while restart timer is running.

The StopWhenUnneeded= check takes place in service_enter_dead between the two
state mentioned above. We temporarily store the auto restart flag to query it
during the check. Because we don't return control to the main event loop, this
new service unit flag needn't be serialized.

This patch prevents the pathologic situation when the service with Restart=
won't restart automatically. As a side effect it also avoid restarting the
dependency unit with StopWhenUnneeded=yes.

Fixes: #7377
2017-12-05 16:51:19 +01:00
Lennart Poettering 0eb89fe6b6 hexdecoct: fix comment typo (#7548) 2017-12-06 00:42:58 +09:00
Yu Watanabe 028f3a7f9c test-execute: add test for that DynamicUser= migrate StateDirectory=
Test for 949befd3f0.
2017-12-06 00:37:09 +09:00
Yu Watanabe f0e018e748 test-execute: cleanup
This makes rename the test units by a consistent naming scheme,
add several logs, and sort internal functions.
No functional change.
2017-12-06 00:36:55 +09:00
Hristo Venev 3f550c31b3 networkd: fix memory leak in promote_secondaries_enabled 2017-12-05 16:56:54 +02:00
Hristo Venev 8e1a72535c networkd: fix promote_secondaries logic
The value for `default` has no influence at all.
2017-12-05 16:56:52 +02:00
Hristo Venev 9fefb9e3cd Do not set net.ipv4.conf.default.*
It is redundant because in these cases the values in
`net.ipv4.conf.all.*` take precedence. Also, setting the `default` does
nothing for devices that already exist.
2017-12-05 16:34:59 +02:00
Yu Watanabe 3db93b3fc8 man: journal-remote: add missing options
This adds documents about supported, mainly SSL related,  options
in jurnal-remote, journal-upload, and journal-gatewayd.
2017-12-05 23:30:50 +09:00
Yu Watanabe bf2d3d7cae man: fix typo 2017-12-05 23:30:47 +09:00
Yu Watanabe e7ff71281d man: include standard-options.xml in systemd-hwdb(8) 2017-12-05 23:30:44 +09:00
Yu Watanabe c94c581c7b man: add missing options to and use standard-options.xml in udevadm(8) 2017-12-05 23:30:41 +09:00
Yu Watanabe 5639df9a80 udevadm: getopt() and help message cleanup
This adds missing options, mainly '--version' in getopt(), removes
an unused option from getopt().
Also, this adds a deprecate message in `udevadm hwdb`, and cleanups
help messages.

Follow-up for 65eb4378c3.
2017-12-05 23:30:10 +09:00
Lennart Poettering 6c782b7a47 fstab-generator: port some code to strextend_with_separator() 2017-12-05 13:49:13 +01:00
Lennart Poettering 8fe9c8d920 test: add a simple script that runs all our integration tests one after the other 2017-12-05 13:49:13 +01:00
Lennart Poettering 9b45c2bf02 tests: don't use "netcat" for testing TEST-10-ISSUE-2467
Apparently there are a myriad of netcat implementations around, and they
all behave slightly differently. The one I have on my Fedora 27
installation will cause a failure when invoked as "nc -U" on an AF_UNIX
socket whose connections are immediately disconnected, thus causing the
test to fail.

Let's avoid all ambiguities in this regard, and drop usage of netcat
altoegther. Instead let's use a FIFO in the file system, which we can
connect to with only shell commands, and is hence much simpler and
more reliable to test with.

The actual test is supposed to validate that PID 1 doesn't hang when
activation of a socket-activated service fails, hence which transport
mechanism is used ultimately doesn't matter, as long as we activate the
service, and we do here...
2017-12-05 13:49:13 +01:00
Lennart Poettering f2d566b728 tests: make TEST-10-ISSUE-2467 also run in nspawn
No reason not to run it in nspawn, and it's easier to debug than the
qemu version.
2017-12-05 13:49:13 +01:00
Lennart Poettering de54e02d5e nspawn: when in hybrid mode, chown() both the legacy and the unified hierarchy to the root in the container
If user namespacing is used, let's make sure that the root user in the
container gets access to both /sys/fs/cgroup/systemd and
/sys/fs/cgroup/unified.

This matches similar logic in cg_set_access().
2017-12-05 13:49:13 +01:00
Lennart Poettering 2d3a5a73e0 nspawn: make sure images containing an ESP are compatible with userns -U mode
In -U mode we might need to re-chown() all files and directories to
match the UID shift we want for the image. That's problematic on fat
partitions, such as the ESP (and which is generated by mkosi's
--bootable switch), because fat of course knows no UID/GID file
ownership natively.

With this change we take benefit of the uid= and gid= mount options FAT
knows: instead of chown()ing all files and directories we can just
specify the right UID/GID to use at mount time.

This beefs up the image dissection logic in two ways:

1. First of all support for mounting relevant file systems with
   uid=/gid= is added: when a UID is specified during mount it is used for
   all applicable file systems.

2. Secondly, two new mount flags are added:
   DISSECT_IMAGE_MOUNT_ROOT_ONLY and DISSECT_IMAGE_MOUNT_NON_ROOT_ONLY.
   If one is specified the mount routine will either only mount the root
   partition of an image, or all partitions except the root partition.
   This is used by nspawn: first the root partition is mounted, so that
   we can determine the UID shift in use so far, based on ownership of
   the image's root directory. Then, we mount the remaining partitions
   in a second go, this time with the right UID/GID information.
2017-12-05 13:49:12 +01:00
Lennart Poettering bb8ad9eaca string-util: rework strextend() to optionally inset separators between each appended string
This adds a new flavour of strextend(), called
strextend_with_separator(), which takes an optional separator string. If
specified, the separator is inserted between each appended string, as
well as before the first one, but only if the original string was
non-empty.

This new call is particularly useful when appending new options to mount
option strings and suchlike, which need to be comma-separated, and
initially start out from an empty string.
2017-12-05 13:49:12 +01:00
Lennart Poettering 1cfdbe293f cgroup: also include "cgroups.threads" in the list of files to chown
Also, add "cgroups.stat". It's read-only anyway, hence its UID/GID
ownership matters little, but it's probably a good idea to keep it
ownership in sync with the other read-only files such as
"cgroups.controllers".

Also, order the list of files alphabetically.
2017-12-05 13:49:12 +01:00
Lennart Poettering 8199d554c1 nspawn: figure out cgroup mode *after* mounting image
If we operate on a disk image (i.e. --image=) then it's pointless to
look into the mount directory before it is actually mounted to see which
systemd version is running inside...

Unfortunately we only mount the disk image in the child process, but the
parent needs to know the cgroup mode, hence add some IPC for this
purpose and communicate the cgroup mode determined from the image back
to the parent.
2017-12-05 13:49:12 +01:00
Lennart Poettering 28faeda47f path-util: when checking systemd versions, check both lib and lib64
We need to check both to be compatible with multilib images.
2017-12-05 13:44:34 +01:00
Zbigniew Jędrzejewski-Szmek 3aa6a55904
Merge pull request #7542 from yuwata/build-cleanup
several build cleanups
2017-12-05 12:13:17 +01:00