summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-06-16nspawn: Clarify sync_cgroup(); tmp dirname, error messageLuke Shumaker
sync_cgroup() can sync name=systemd->unified or unified->name=systemd, depending on the setup. However, the names of things, comments, and error messages all assume (send the fals impression) that it only goes name=systemd->unfied.
2017-06-16nspawn: mount_legacy_cgns_supported(): Rename variables to not lieLuke Shumaker
mount_legacy_cgns_supported() is very clearly meant to be a version of mount_legacy_cgns_unsupported() modified to cope with the fact that it has already chroot()ed, and thus can't look at the host /sys. So, the loops and such look similar. However, to cope with the fact that it can't look at /sys, it deals with hierarchies in the outermost loop, rather than controllers. Yet, it kept the list variable named "controllers". That's confusing.
2017-06-16nspawn: Merge chown_cgroup(), sync_cgroup(), and create_subcgroup() into one ↵Luke Shumaker
cgroup_setup()
2017-06-16nspawn: Detect the outer_cgver once, and pass that aroundLuke Shumaker
Yes, the relevant functions in cgroup-util actually do cache the values with static variables. But passing it around as a value makes the flow much nicer. The symmetry of having both the inner and outer cg versions as a CGroupUnified enum makes the code much easier to grok; this could be done with cg_version(), but I still think this is more readable.
2017-06-16nspawn: nspawn-cgroup.{c,h}: s/unified_requested/inner_cgver/Luke Shumaker
2017-06-16nspawn: Move cgroup mount stuff from nspawn-mount.c to nspawn-cgroup.cLuke Shumaker
2017-06-16nspawn: Parse UNIFIED_CGROUP_HIERARCHY similarly to any other argLuke Shumaker
2017-06-16nspawn: Clarify detect_unified_cgroup_hierarchy()Luke Shumaker
2017-06-16nspawn: Rename arg_uid_shift -> uid_shiftLuke Shumaker
Naming it arg_uid_shift is confusing because of the global arg_uid_shift in nspawn.c
2017-06-16nspawn: Improve --help textLuke Shumaker
The `--help` text lies about what the `-U` flag does, and under-documents the `--private-users` values. . Fix that.
2017-06-16nspawn: Simplify tmpfs_patch_options() usage, and trickle that upLuke Shumaker
One of the things that tmpfs_patch_options does is take an (optional) UID, and insert "uid=${UID},gid=${UID}" into the options string. So we need a uid_t argument, and a way of telling if we should use it. Fortunately, that is built in to the uid_t value by having UID_INVALID as a possible value. So this is really a feature that requires one argument. Yet, it is somehow taking 4! That is absurd. Simplify it to only take one argument, and have that trickle all the way up to mount_all()'s usage. Now, in may of the uses, the argument becomes uid_shift == 0 ? UID_INVALID : uid_shift because it used to treat uid_shift=0 as invalid unless the patch_ids flag was also set. This keeps the behavior the same. Note that in all cases where it is invoked, if !userns, then uid_shift is 0; we don't have to add any checks for that. That said, I'm pretty sure that "uid=0" and not setting "uid=" are the same, but Christian Brauner seemed to not think so when implementing the cgns support. https://github.com/systemd/systemd/pull/3589
2017-06-16nspawn: mount_sysfs(): Reword the comment about /sys/fs/cgroupLuke Shumaker
The comment explains the obvious, but doesn't even mention the tricky part. Of course we need do set things up before we remount read-only! That's the general theme of the function! What was totally non-obvious is why we only need to create it if cg_ns_supported(), as the directory needs to exist no matter what. From reading the code, I was convinced that it was broken on pre-cgns kernels (pre-4.6, unless a distro backported it). So explain that skippint creating if !cg_ns_supported() is an optimization.
2017-06-16cgroup-util: Fix a comment about cg_kernel_controllers() behaviorLuke Shumaker
Remove ", arbitrary named hierarchies" from the list of things that cg_kernel_controllers() might return; /proc/cgroups does not contain "name=" pseudo-controllers (at least in any version of the kernel that I am aware of). If there are kernels out there that do put "name=" pseudo-controllers in /proc/cgroups, then the code that runs when SYSTEMD_NSPAWN_USE_CGNS=no is broken on these kernels. So there's precedent to ignoring these kernels, if they do exist.
2017-06-16nspawn: if !cg_ns_supported() then force arg_use_cgns = falseLuke Shumaker
It's silly that every time we check arg_use_cgns we also have to check cg_ns_supported(). So, simplify these checks and force arg_use_cgns = false if the kernel doesn't support cg_ns_supported.
2017-06-16nspawn: send_one_fd() uses the "return -errno" convention, not errnoLuke Shumaker
2017-06-16nspawn: fix clobbering of selinux context argZbigniew Jędrzejewski-Szmek
First bug fixed by gcc 7. Yikes. (cherry picked from commit 9ce6d1b319f8655100af6ecf5fd57e4558d57dd1)
2017-06-16tree-wide: adjust fall through comments so that gcc is happyZbigniew Jędrzejewski-Szmek
gcc 7 adds -Wimplicit-fallthrough=3 to -Wextra. There are a few ways we could deal with that. After we take into account the need to stay compatible with older versions of the compiler (and other compilers), I don't think adding __attribute__((fallthrough)), even as a macro, is worth the trouble. It sticks out too much, a comment is just as good. But gcc has some very specific requiremnts how the comment should look. Adjust it the specific form that it likes. I don't think the extra stuff we had in those comments was adding much value. (Note: the documentation seems to be wrong, and seems to describe a different pattern from the one that is actually used. I guess either the docs or the code will have to change before gcc 7 is finalized.) (cherry picked from commit ec251fe7d5bc24b5d38b0853bc5969f3a0ba06e2)
2017-06-16sparse: avoid clash with __bitwise and __force from 4.10 linux/types.h (#5061)Lubomir Rintel
It also used __bitwise and __force. It seems easier to rename our versions since they are local to this one single header. Also, undefine them afteerwards, so that we don't pollute the preprocessor macro namespace. (cherry picked from commit dc66f33a16596c2886a24da12e56ec096214e124)
2017-06-16nspawn: add missing -E to getopt_long (#4860)Wim de With
(cherry picked from commit 2e1f244efd2dfc1a60d032bef3d88b9ba6e0444b)
2017-06-16nspawn: fix cgroup mode detectionTejun Heo
cgroup mode detection is broken in two different ways. * detect_unified_cgroup_hierarchy() is called too nested in outer_child(). sync_cgroup() which is used by run() also needs to know the requested cgroup mode but it's currently always getting CGROUP_UNIFIED_UNKNOWN. This makes it skip syncing the inner cgroup hierarchy on some config combinations. $ cat /proc/self/cgroup | grep systemd 1:name=systemd:/user.slice/user-0.slice/session-c1.scope $ UNIFIED_CGROUP_HIERARCHY=0 SYSTEMD_NSPAWN_USE_CGNS=0 systemd-nspawn -M container ... [root@container ~]# cat /proc/self/cgroup | grep systemd 1:name=systemd:/machine.slice/machine-container.x86_64.scope $ exit $ UNIFIED_CGROUP_HIERARCHY=1 SYSTEMD_NSPAWN_USE_CGNS=0 systemd-nspawn -M container [root@container ~]# cat /proc/self/cgroup | grep 0:: 0::/ $ exit Note how the unified hierarchy case's path is not synchronized with the host. This for example can cause issues when there are multiple such containers. Fixed by moving detect_unified_cgroup_hierarchy() invocation to main(). * inner_child() was invoking cg_unified_flush(). inner_child() executes fully scoped and can't determine which cgroup mode the host was in. It doesn't make sense to keep flushing the detected mode when the host mode can't change. Fixed by replacing cg_unified_flush() invocations in outer_child() and inner_child() with one in main(). (cherry picked from commit bd15ab41a1347fed8266845f875842d1502e02a6)
2017-05-06Merge tag 'systemd/v232-8.parabola2' into systemd/parabolaHEADsystemd/parabolaLuke Shumaker
2017-05-06Merge tag 'systemd/v232-6.parabola1'systemd/v232-8.parabola2Luke Shumaker
2017-05-06build-sys: add check for gperf lookup function signature (#5055)Mike Gilbert
gperf-3.1 generates lookup functions that take a size_t length parameter instead of unsigned int. Test for this at configure time. Fixes: https://github.com/systemd/systemd/issues/5039
2016-12-17Merge tag 'systemd/v232-6.parabola1' into systemd/parabolaLuke Shumaker
2016-12-17# Rename "Linux Boot Manager" -> "Systemd Boot Manager"systemd/v232-6.parabola1Luke Shumaker
sed -i 's|Linux Boot Manager|Systemd Boot Manager|' src/boot/bootctl.c
2016-12-17FSDG: man/: Use FSDG operating systems as examples.Luke Shumaker
2016-12-17FSDG: systemd-resolved: Default to hostname "gnu-linux" instead of "linux"Luke Shumaker
2016-12-17FSDG: os-release: Default ID to "gnu-linux" instead of "linux".Luke Shumaker
As far as I can tell, no code in this repository actually uses the ID field, so this is just a man page change.
2016-12-17FSDG: os-release: Default to NAME "GNU/Linux" instead of "Linux".Luke Shumaker
2016-12-17FSDG: os-release: Default to PRETTY_NAME "GNU/Linux" instead of "Linux".Luke Shumaker
2016-12-17FSDG: man/: Refer to the operating system as GNU/Linux.Luke Shumaker
This is not a blind replacement of "Linux" with "GNU/Linux". In some cases, "Linux" is (correctly) used to refer to just the kernel. In others, it is in a string for which code must also be adjusted; these instances are not included in this commit.
2016-12-17Merge tag 'systemd/v232-4'systemd/v232-6Luke Shumaker
2016-12-17nspawn: don't hide --bind=/tmp/* mountsDave Reisner
This is a v232-applicable version of upstream c9fd987279a462e.
2016-12-17build-sys: check for lz4 in the old and new numbering scheme (#4717)Zbigniew Jędrzejewski-Szmek
lz4 upstream decided to switch to an incompatible numbering scheme (1.7.3 follows 131, to match the so version). PKG_CHECK_MODULES does not allow two version matches for the same package, so e.g. lz4 < 10 || lz4 >= 125 cannot be used. Check twice, once for "new" numbers (anything below 10 is assume to be new), once for the "old" numbers (anything above >= 125). This assumes that the "new" versioning will not get to 10 to quickly. I think that's a safe assumption, lz4 is a mature project. Fixed #4690.
2016-12-17journal: make sure to initially populate the space info cache (#4807)Franck Bui
Make sure to populate the cache in cache_space_refresh() at least once otherwise it's possible that the system boots fast enough (and the journal flush service is finished) before the invalidate cache timeout (30 us) has expired. Fixes: #4790
2016-12-17nspawn: fix exit code for --help and --version (#4609)Martin Pitt
Commit b006762 inverted the initial exit code which is relevant for --help and --version without a particular reason. For these special options, parse_argv() returns 0 so that our main() immediately skips to the end without adjusting "ret". Otherwise, if an actual container is being started, ret is set on error in run(), which still provides the "non-zero exit on error" behaviour. Fixes #4605.
2016-12-17Merge tag 'systemd/v232-4.parabola1' into systemd/parabolaLuke Shumaker
2016-12-17# Rename "Linux Boot Manager" -> "Systemd Boot Manager"systemd/v232-4.parabola1Luke Shumaker
sed -i 's|Linux Boot Manager|Systemd Boot Manager|' src/boot/bootctl.c
2016-12-17FSDG: man/: Use FSDG operating systems as examples.Luke Shumaker
2016-12-17FSDG: systemd-resolved: Default to hostname "gnu-linux" instead of "linux"Luke Shumaker
2016-12-17FSDG: os-release: Default ID to "gnu-linux" instead of "linux".Luke Shumaker
As far as I can tell, no code in this repository actually uses the ID field, so this is just a man page change.
2016-12-17FSDG: os-release: Default to NAME "GNU/Linux" instead of "Linux".Luke Shumaker
2016-12-17FSDG: os-release: Default to PRETTY_NAME "GNU/Linux" instead of "Linux".Luke Shumaker
2016-12-17FSDG: man/: Refer to the operating system as GNU/Linux.Luke Shumaker
This is not a blind replacement of "Linux" with "GNU/Linux". In some cases, "Linux" is (correctly) used to refer to just the kernel. In others, it is in a string for which code must also be adjusted; these instances are not included in this commit.
2016-12-17Revert "nspawn: try to bind mount resolved's resolv.conf snippet into the ↵systemd/v232-4Dave Reisner
container" This reverts commit 3539724c26a1b2b00c4eb3c004b635a4b8647de6.
2016-12-17disable RestrictAddressFamilies on i686Dave Reisner
Shit's broke, yo. https://github.com/systemd/systemd/issues/4575
2016-12-17device: Avoid calling unit_free(NULL) in device setup logic (#4748)Dave Reisner
Since a581e45ae8f9bb5c, there's a few function calls to unit_new_for_name which will unit_free on failure. Prior to this commit, a failure would result in calling unit_free with a NULL unit, and hit an assertion failure, seen at least via device_setup_unit: Assertion 'u' failed at src/core/unit.c:519, function unit_free(). Aborting. Fixes #4747 https://bugs.archlinux.org/task/51950
2016-12-17build-sys: do not install ctrl-alt-del.target symlink twiceZbigniew Jędrzejewski-Szmek
It was a harmless but pointless duplication. Fixes #4655. Note: in general we try to install as little as possible in /etc/systemd/{system,user}. We only install .wants links there for units which are "user configurable", i.e. which have an [Install] section. Most our units and aliases are not user configurable, do not have an [Install] section, and must be symlinked statically during installation. A few units do have an [Install] section, and are enabled through symlinks in /etc/ during installation using GENERAL_ALIASES. It *would* be possible to not create those symlinks, and instead require 'systemctl preset' to be invoked after installation, but GENERAL_ALIASES works well enough.
2016-12-17basic/virt: fix userns check on CONFIG_USER_NS=n kernel (#4651)Zbigniew Jędrzejewski-Szmek
ENOENT should be treated as "false", but because of the broken errno check it was treated as an error. So ConditionVirtualization=user-namespaces probably returned the correct answer, but only by accident. Fixes #4608.
2016-12-17core: don't use the unified hierarchy for the systemd cgroup yet (#4628)Martin Pitt
Too many things don't get along with the unified hierarchy yet: * https://github.com/opencontainers/runc/issues/1175 * https://github.com/docker/docker/issues/28109 * https://github.com/lxc/lxc/issues/1280 So revert the default to the legacy hierarchy for now. Developers of the above software can opt into the unified hierarchy with "systemd.legacy_systemd_cgroup_controller=0".