platform/upstream/systemd.git
6 years agofirstboot: do not write vconsole.conf when arg_keymap is empty
Yu Watanabe [Sat, 25 Nov 2017 10:11:57 +0000 (19:11 +0900)]
firstboot: do not write vconsole.conf when arg_keymap is empty

6 years agomachine: remove unused variables
Yu Watanabe [Fri, 24 Nov 2017 01:48:58 +0000 (10:48 +0900)]
machine: remove unused variables

6 years agojournald: add _printf_ attribute to server_driver_message()
Yu Watanabe [Fri, 24 Nov 2017 01:48:21 +0000 (10:48 +0900)]
journald: add _printf_ attribute to server_driver_message()

6 years agotests: make "test-execute" work in "sudo ninja -C build test" (#7463)
Lennart Poettering [Fri, 24 Nov 2017 21:56:44 +0000 (22:56 +0100)]
tests: make "test-execute" work in "sudo ninja -C build test" (#7463)

In this mode USER/LOGNAME still point to the original caller, and our
tests get confused by that.

Follow-up for: #7450

6 years agotmpfiles: check if not too many symbolic links. (#7423)
Lukasz Rubaszewski [Fri, 24 Nov 2017 21:28:14 +0000 (22:28 +0100)]
tmpfiles: check if not too many symbolic links. (#7423)

Some filesystems do not set d_type value when
readdir is called, so entry type is unknown.
Therefore check if accessing entry does not
return ELOOP error.

6 years agocore: remove empty cgroups (#7457)
Christian Brauner [Fri, 24 Nov 2017 20:05:16 +0000 (21:05 +0100)]
core: remove empty cgroups (#7457)

When we skip an unwritable cgroup also remove the empty mountpoint.

6 years agonetworkd: auto promote links if "promote_secondaries" is unset (#7167)
Michael Vogt [Fri, 24 Nov 2017 20:03:05 +0000 (21:03 +0100)]
networkd: auto promote links if "promote_secondaries" is unset (#7167)

The DHCP code in systemd-networkd relies on the
`net.ipv4.conf.{default,all,<if>}.promote_secondaries` sysctl to be set
(the kernels default is that it is unset). If this sysctl is not set
DHCP will work most of the time, however when the IP address changes
between leases then the system will loose its IP.

Because some distributions decided to not ship these defaults (Debian
is an example and via downstream Ubuntu) networkd by default will now
enable this sysctl opton automatically.

6 years agonspawn: hash the machine name, when looking for a suitable UID base (#7437)
Lennart Poettering [Fri, 24 Nov 2017 19:57:19 +0000 (20:57 +0100)]
nspawn: hash the machine name, when looking for a suitable UID base (#7437)

When "-U" is used we look for a UID range we can use for our container.
We start with the UID the tree is already assigned to, and if that
didn't work we'd pick random ranges so far. With this change we'll first
try to hash a suitable range from the container name, and use that if it
works, in order to make UID assignments more likely to be stable.

This follows a similar logic PID 1 follows when using DynamicUser=1.

6 years agoMerge pull request #7442 from poettering/scope-fixes
Lennart Poettering [Fri, 24 Nov 2017 16:15:09 +0000 (17:15 +0100)]
Merge pull request #7442 from poettering/scope-fixes

some fixes to the scope unit type

6 years agosystemctl: ignore shutdown's "-t" argument (#7459)
Lennart Poettering [Fri, 24 Nov 2017 16:01:32 +0000 (17:01 +0100)]
systemctl: ignore shutdown's "-t" argument (#7459)

We should not only ignore "-t" itself, but also whatever is passed to
it.

This pretty much reverts the core of
a4420f7b8ed73b05ef6f31622101e7804daef69f, and adds back in the status
quo ante. What a difference a ':' can make.

This also adds a quick comment for this, so that we don't make this
mistake again.

Fixes: #7413

6 years agoMerge pull request #7446 from poettering/efi-firmware-boot-fixes
Lennart Poettering [Fri, 24 Nov 2017 14:42:32 +0000 (15:42 +0100)]
Merge pull request #7446 from poettering/efi-firmware-boot-fixes

logind efi boot-into-firmware fixes

6 years agoMerge pull request #7458 from keszybz/two-build-fixes
Lennart Poettering [Fri, 24 Nov 2017 14:40:52 +0000 (15:40 +0100)]
Merge pull request #7458 from keszybz/two-build-fixes

Two build fixes

6 years agofirstboot: remove some unnecessary code (#7456)
Zbigniew Jędrzejewski-Szmek [Fri, 24 Nov 2017 14:40:24 +0000 (15:40 +0100)]
firstboot: remove some unnecessary code (#7456)

Inspired by #7449.

6 years agotest: skip DELEGATE test if the kernel can't do cgroupv2 (#7445)
Lennart Poettering [Fri, 24 Nov 2017 14:29:06 +0000 (15:29 +0100)]
test: skip DELEGATE test if the kernel can't do cgroupv2 (#7445)

Fixes: #7440

6 years agotest: handle gracefully if decompressor tools are not installed (#7455)
Lennart Poettering [Fri, 24 Nov 2017 13:08:51 +0000 (14:08 +0100)]
test: handle gracefully if decompressor tools are not installed (#7455)

Fixes: #7441

6 years agomeson: restore building of man pages on demand even if -Dman=false
Zbigniew Jędrzejewski-Szmek [Fri, 24 Nov 2017 13:00:29 +0000 (14:00 +0100)]
meson: restore building of man pages on demand even if -Dman=false

I want to configure -Dman=false for speed, but be able to build a specific
man page sometimes to check my edits. Commit 5b316b9ea6c broke this by mistake.
Let's adjust the condition to better match the logic of disabling tests only
if xsltproc is really not found.

6 years agoFix build without libkmod
Zbigniew Jędrzejewski-Szmek [Fri, 24 Nov 2017 12:53:36 +0000 (13:53 +0100)]
Fix build without libkmod

All other places where libkmod.h is included are guarded. Build would
fail with:

In file included from ../src/core/kmod-setup.c:35:0:
../src/basic/module-util.h:23:10: fatal error: libkmod.h: No such file or directory
 #include <libkmod.h>
          ^~~~~~~~~~~
compilation terminated.

6 years agoMerge pull request #7415 from keszybz/udev-alloca
Lennart Poettering [Fri, 24 Nov 2017 12:32:03 +0000 (13:32 +0100)]
Merge pull request #7415 from keszybz/udev-alloca

udev: modernize style in path_id

6 years agoMerge pull request #7453 from neosilky/coccinelle-fixes
Lennart Poettering [Fri, 24 Nov 2017 12:29:48 +0000 (13:29 +0100)]
Merge pull request #7453 from neosilky/coccinelle-fixes

Applied fixes from Coccinelle

6 years agoMerge pull request #7454 from neosilky/cocci-fixes
Lennart Poettering [Fri, 24 Nov 2017 12:29:32 +0000 (13:29 +0100)]
Merge pull request #7454 from neosilky/cocci-fixes

Apply more fixes from Coccinelle

6 years agoefivars: if OsIndicationsSupported does not exist, assume that reboot-to-firmware...
Lennart Poettering [Thu, 23 Nov 2017 21:05:46 +0000 (22:05 +0100)]
efivars: if OsIndicationsSupported does not exist, assume that reboot-to-firmware is not available

It's not advertised and hence not available.

Fixes: #7424

6 years agoefivars: minor coding style improvements
Lennart Poettering [Thu, 23 Nov 2017 21:05:34 +0000 (22:05 +0100)]
efivars: minor coding style improvements

6 years agologind: don't propagate firmware misbehaviours to bus clients
Lennart Poettering [Thu, 23 Nov 2017 21:02:10 +0000 (22:02 +0100)]
logind: don't propagate firmware misbehaviours to bus clients

If for some reason we can't query the firmware state, don't propagate
that to clients, but instead log about it, and claim that
reboot-to-firmware is not available (which is the right answer, since it
is not working).

Let's log about this though, as this is certainly relevant to know, even
though not for the client.

6 years agoRemove NULL as last parameter to strjoin
Daniel Lockyer [Fri, 24 Nov 2017 10:37:08 +0000 (10:37 +0000)]
Remove NULL as last parameter to strjoin

6 years agoReplace use of snprintf with xsprintf
Daniel Lockyer [Fri, 24 Nov 2017 10:36:04 +0000 (10:36 +0000)]
Replace use of snprintf with xsprintf

6 years agoReplace free and reassignment with free_and_replace
Daniel Lockyer [Fri, 24 Nov 2017 10:33:41 +0000 (10:33 +0000)]
Replace free and reassignment with free_and_replace

6 years agoReplace free and return NULL with return mfree
Daniel Lockyer [Fri, 24 Nov 2017 10:31:49 +0000 (10:31 +0000)]
Replace free and return NULL with return mfree

6 years agoReplace free and nullify by mfree
Daniel Lockyer [Fri, 24 Nov 2017 09:37:50 +0000 (09:37 +0000)]
Replace free and nullify by mfree

6 years agoReplace empty ternary with helper method
Daniel Lockyer [Fri, 24 Nov 2017 09:31:08 +0000 (09:31 +0000)]
Replace empty ternary with helper method

6 years agotest-execute: test more % specifiers (#7450)
Yu Watanabe [Fri, 24 Nov 2017 09:17:28 +0000 (18:17 +0900)]
test-execute: test more % specifiers (#7450)

6 years ago__attribute__((fallthrough)) only when -Wimplicit-fallthrough (#7448)
Shawn Landden [Fri, 24 Nov 2017 09:08:12 +0000 (01:08 -0800)]
__attribute__((fallthrough)) only when -Wimplicit-fallthrough (#7448)

That is version 7 or greater
https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/

Fix regression of https://github.com/systemd/systemd/pull/7389
82a27ba8217d09e4fef4c9550f8b733d174c5705
on older gccs

bumping to re-run CI
upstream             FAIL timed out
boot-smoke           FAIL non-zero exit status 1

6 years agojournalctl: add --output-fields= to --help text (#7443)
Lennart Poettering [Fri, 24 Nov 2017 09:04:14 +0000 (10:04 +0100)]
journalctl: add --output-fields= to --help text (#7443)

Follow-up for #7181

6 years agocore: track scope controllers on the bus
Lennart Poettering [Thu, 23 Nov 2017 19:15:48 +0000 (20:15 +0100)]
core: track scope controllers on the bus

This watches controllers on the bus, and unsets them automatically when
they disappear.

Note that this is primarily a cosmetical fix. Since unique bus names are not
recycled, there's strictly no need to forget about them, but it's a lot
nicer to do so.

6 years agocore: refuse accepting a scope controller unless we are called on the API bus
Lennart Poettering [Thu, 23 Nov 2017 19:02:00 +0000 (20:02 +0100)]
core: refuse accepting a scope controller unless we are called on the API bus

Let's make sure clients get early errors if they try something weird.

6 years agonspawn: make use of the RequestStop logic of scope units
Lennart Poettering [Thu, 23 Nov 2017 18:27:47 +0000 (19:27 +0100)]
nspawn: make use of the RequestStop logic of scope units

Since time began, scope units had a concept of "Controllers", a bus peer
that would be notified when somebody requested a unit to stop. None of
our code used that facility so far, let's change that.

This way, nspawn can print a nice message when somebody invokes
"systemctl stop" on the container's scope unit, and then react with the
right action to shut it down.

6 years agocore: serialize the "controller" field in scope units
Lennart Poettering [Thu, 23 Nov 2017 11:51:54 +0000 (12:51 +0100)]
core: serialize the "controller" field in scope units

We forgot to serialize it previously, hence daemon reload flushed it
out, since we also didn't write it to any unit file...

6 years agoman: reorder/add sections to systemd.exec(5) (#7412)
Lennart Poettering [Thu, 23 Nov 2017 20:20:48 +0000 (21:20 +0100)]
man: reorder/add sections to systemd.exec(5) (#7412)

The long long list of settings is getting too confusing, let's add some
sections and reorder things in them.

This makes no changes regarding contents, it only reorders things,
sometimes reindents them, and adds sections that made sense to me to
some degree.

Within each sections the settings are ordered by relevance (at least
according to how relevant I personally find them), and not
alphabetically.

6 years agoMerge pull request #7436 from poettering/mount-util-fixup
Lennart Poettering [Thu, 23 Nov 2017 20:01:12 +0000 (21:01 +0100)]
Merge pull request #7436 from poettering/mount-util-fixup

mount-util.c fixes regarding name_to_handle_at()

6 years agonetworkd: fix commit 5f04a209eae0a2a04eb60fd7235b3fcdf3cc81ba (#7432)
Susant Sahani [Thu, 23 Nov 2017 16:38:08 +0000 (22:08 +0530)]
networkd: fix commit 5f04a209eae0a2a04eb60fd7235b3fcdf3cc81ba (#7432)

If classless route not provided configure default routes.
Something went wrong in the rebase.

6 years agosmack: allow comments on smack rules (#7438)
WaLyong Cho [Thu, 23 Nov 2017 15:27:19 +0000 (00:27 +0900)]
smack: allow comments on smack rules (#7438)

6 years agohwdb: Add accel mount settings for Axxo TW-1011 2-in-1 (#7439)
Hans de Goede [Thu, 23 Nov 2017 15:25:42 +0000 (16:25 +0100)]
hwdb: Add accel mount settings for Axxo TW-1011 2-in-1 (#7439)

Add accel mount settings for the SMO8500 accelerometer found in
Axxo TW-1011 2-in-1 devices to 60-sensor.hwdb.

6 years agomeson: do not install RPM macros if rpmmacrosdir is set to no (#7430)
Yu Watanabe [Thu, 23 Nov 2017 13:20:22 +0000 (22:20 +0900)]
meson: do not install RPM macros if rpmmacrosdir is set to no (#7430)

Fixes #7427.

6 years agotests: install `test` as part of BASICTOOLS (#7434)
Evgeny Vereshchagin [Thu, 23 Nov 2017 12:28:12 +0000 (15:28 +0300)]
tests: install `test` as part of BASICTOOLS (#7434)

This makes TEST-19-DELEGATE, which is currently failing, work.

Closes https://github.com/systemd/systemd/issues/7425.

6 years agotest: fix test-mount-util when handling duplicate mounts on the same location
Lennart Poettering [Thu, 23 Nov 2017 11:48:42 +0000 (12:48 +0100)]
test: fix test-mount-util when handling duplicate mounts on the same location

The test was written so far under the assumption that if two mounts are
placed onto the same location the "upper" mount is listed later in
/proc/self/mountinfo. This appears not to be guaranteed however, as
running the tests in a normal nspawn shows.

This patch fixes that: it reverses the hashmap of mounts we build:
instead of keying by path, we key by mnt_id, and if we notice that
path_get_mnt_id() doesn't match what a line in /proc/self/mountinfo
says, we use the returned ID to check if maybe another line agrees.

Fixes: #7431

6 years agomount-util: fix bad indenting
Lennart Poettering [Thu, 23 Nov 2017 11:48:12 +0000 (12:48 +0100)]
mount-util: fix bad indenting

6 years agomount-util: EOVERFLOW might have other causes than buffer size issues
Lennart Poettering [Thu, 23 Nov 2017 11:44:49 +0000 (12:44 +0100)]
mount-util: EOVERFLOW might have other causes than buffer size issues

When we get EOVERFLOW this might be caused by untriggered nfs4 mounts
(see discussion at
https://github.com/systemd/systemd/pull/7395#issuecomment-346164481 and
further down).

Handle this nicely by falling back to fdinfo-based mntid determination.

Fixes: #7082

6 years agomount-util: fix error propagation in fd_fdinfo_mnt_id()
Lennart Poettering [Thu, 23 Nov 2017 11:44:17 +0000 (12:44 +0100)]
mount-util: fix error propagation in fd_fdinfo_mnt_id()

6 years agomount-util: drop exponential buffer growing in name_to_handle_at_loop()
Lennart Poettering [Thu, 23 Nov 2017 11:42:24 +0000 (12:42 +0100)]
mount-util: drop exponential buffer growing in name_to_handle_at_loop()

So, it appears name_to_handle_at() always returns the right buffer size
on EOVERFLOW, when it's returned due to a too small buffer. Let's rely
on that exclusively for sizing the buffer, and let's drop the
exponential buffer growing.

The new logic is now: if we see EOVERFLOW and the returned size has
increased, resize our buffer and try again. But if it didn't increase,
then propagate the EOVERFLOW as it likely has other causes.

6 years agocore/manager: check the existance of the special units (#7433)
Yu Watanabe [Thu, 23 Nov 2017 12:25:56 +0000 (21:25 +0900)]
core/manager: check the existance of the special units (#7433)

In the user mode, not all special units exist.
So, we need to check whether the units exist or not before operate
something to the units.
Such the check was mistakenly dropped by e68537f0ba1a4433ecdf58e609b1701ed7091abc.

Fixes #7426.

6 years agoFixed Type nmnds-ipv4 -> nmdns-ipv4 (#7435)
Carsten Strotmann [Thu, 23 Nov 2017 12:12:00 +0000 (12:12 +0000)]
Fixed Type nmnds-ipv4 -> nmdns-ipv4 (#7435)

6 years agocgroup: downgrade the log level of "invocation id" messages to debug (#7422)
Evgeny Vereshchagin [Thu, 23 Nov 2017 10:07:20 +0000 (13:07 +0300)]
cgroup: downgrade the log level of "invocation id" messages to debug (#7422)

Now that d3070fbdf6077d7d has been merged, these errors are not as
critical as they used to be.

6 years agoMerge pull request #7420 from brauner/2017-11-22/systemd_in_container_unified_cgroup_...
Evgeny Vereshchagin [Thu, 23 Nov 2017 01:11:04 +0000 (04:11 +0300)]
Merge pull request #7420 from brauner/2017-11-22/systemd_in_container_unified_cgroup_hierarchy

cgroup: skip unwritable cgroups

6 years agocgroup: test whether pure unified hierarchy is writable
Christian Brauner [Wed, 22 Nov 2017 16:27:03 +0000 (17:27 +0100)]
cgroup: test whether pure unified hierarchy is writable

If it is not writable we should not mount it.

6 years agocgroup: check whether unified hierarchy is writable
Christian Brauner [Wed, 22 Nov 2017 16:20:35 +0000 (17:20 +0100)]
cgroup: check whether unified hierarchy is writable

When systemd is running inside a container employing user
namespaces it currently mounts the unified cgroup hierarchy
without being able to write to it. This causes systemd to
freeze during boot.
This patch checks whether the unified cgroup hierarchy
is writable. If it is not it will not mount it.

This solution is based on a patch by Evgeny Vereshchagin.

Closes #6408.
Closes https://github.com/lxc/lxc/issues/1678 .

6 years agoMerge pull request #7416 from keszybz/readd-lost-test
Lennart Poettering [Wed, 22 Nov 2017 16:24:21 +0000 (17:24 +0100)]
Merge pull request #7416 from keszybz/readd-lost-test

Readd lost test

6 years agomeson: re-attach rule-syntax-check.py test
Zbigniew Jędrzejewski-Szmek [Wed, 22 Nov 2017 11:42:28 +0000 (12:42 +0100)]
meson: re-attach rule-syntax-check.py test

 39/248 rule-syntax-check                       OK     0.07 s

--- command ---
/home/zbyszek/src/systemd-work/test/rule-syntax-check.py \
    /home/zbyszek/src/systemd-work/build/../rules/60-block.rules \
    /home/zbyszek/src/systemd-work/build/../rules/60-cdrom_id.rules \
    /home/zbyszek/src/systemd-work/build/../rules/60-drm.rules \
    /home/zbyszek/src/systemd-work/build/../rules/60-evdev.rules \
    /home/zbyszek/src/systemd-work/build/../rules/60-input-id.rules \
    /home/zbyszek/src/systemd-work/build/../rules/60-persistent-alsa.rules \
    /home/zbyszek/src/systemd-work/build/../rules/60-persistent-input.rules \
    /home/zbyszek/src/systemd-work/build/../rules/60-persistent-storage.rules \
    /home/zbyszek/src/systemd-work/build/../rules/60-persistent-storage-tape.rules \
    /home/zbyszek/src/systemd-work/build/../rules/60-persistent-v4l.rules \
    /home/zbyszek/src/systemd-work/build/../rules/60-sensor.rules \
    /home/zbyszek/src/systemd-work/build/../rules/60-serial.rules \
    /home/zbyszek/src/systemd-work/build/../rules/70-joystick.rules \
    /home/zbyszek/src/systemd-work/build/../rules/70-mouse.rules \
    /home/zbyszek/src/systemd-work/build/../rules/70-touchpad.rules \
    /home/zbyszek/src/systemd-work/build/../rules/75-net-description.rules \
    /home/zbyszek/src/systemd-work/build/../rules/75-probe_mtd.rules \
    /home/zbyszek/src/systemd-work/build/../rules/78-sound-card.rules \
    /home/zbyszek/src/systemd-work/build/../rules/80-drivers.rules \
    /home/zbyszek/src/systemd-work/build/../rules/80-net-setup-link.rules \
    /home/zbyszek/src/systemd-work/build/rules/50-udev-default.rules \
    /home/zbyszek/src/systemd-work/build/rules/64-btrfs.rules \
    /home/zbyszek/src/systemd-work/build/rules/99-systemd.rules
--- stdout ---
...
-------

It got dropped by mistake in 72cdb3e783174dcf9223a49f03e3b0e2ca95ddb8.

6 years agorule-test-syntax: modernize syntax and add debug message
Zbigniew Jędrzejewski-Szmek [Wed, 22 Nov 2017 11:29:46 +0000 (12:29 +0100)]
rule-test-syntax: modernize syntax and add debug message

6 years agoMerge pull request #7406 from poettering/timestamp-rework
Zbigniew Jędrzejewski-Szmek [Wed, 22 Nov 2017 10:55:04 +0000 (11:55 +0100)]
Merge pull request #7406 from poettering/timestamp-rework

timestamping rework

6 years agoudev: "handle" oom in path_id
Zbigniew Jędrzejewski-Szmek [Wed, 22 Nov 2017 09:32:45 +0000 (10:32 +0100)]
udev: "handle" oom in path_id

path_prepend returned a status code, but it wasn't looked at anywhere.
Adding checks for the return value in all the bazillion places where it
is called is not very attractive, so let's just make the whole program
abort cleanly if the (very unlikely) oom is encountered.

6 years agoudev: modernize style in path_id
Zbigniew Jędrzejewski-Szmek [Wed, 22 Nov 2017 09:23:45 +0000 (10:23 +0100)]
udev: modernize style in path_id

No functional change.

6 years agonetworkd: introduce vxcan netdev. (#7150)
Susant Sahani [Wed, 22 Nov 2017 07:23:22 +0000 (12:53 +0530)]
networkd: introduce vxcan netdev. (#7150)

Similar to the virtual ethernet driver veth, vxcan implements a
local CAN traffic tunnel between two virtual CAN network devices.
When creating a vxcan, two vxcan devices are created as pair
When one end receives the packet it appears on its pair and vice
versa. The vxcan can be used for cross namespace communication.

6 years agoMerge pull request #7395 from poettering/nametohandleat-loop
Zbigniew Jędrzejewski-Szmek [Wed, 22 Nov 2017 07:20:36 +0000 (08:20 +0100)]
Merge pull request #7395 from poettering/nametohandleat-loop

name_to_handle_at() EOVERFLOW handling

6 years agonetworkd:DHCP-client ignore default route if classless static route is set (#6885)
Susant Sahani [Wed, 22 Nov 2017 06:43:55 +0000 (12:13 +0530)]
networkd:DHCP-client ignore default route if classless static route is set (#6885)

According to RFC 3442:

If the DHCP server returns both a Classless Static Routes option and
a Router option, the DHCP client MUST ignore the Router option.

fixes #5695.

6 years agoMerge pull request #7381 from poettering/cgroup-unified-delegate-rework
Zbigniew Jędrzejewski-Szmek [Wed, 22 Nov 2017 06:42:08 +0000 (07:42 +0100)]
Merge pull request #7381 from poettering/cgroup-unified-delegate-rework

Fix delegation in the unified hierarchy + more cgroup work

6 years agoMerge pull request #7389 from shawnl/warning
Zbigniew Jędrzejewski-Szmek [Wed, 22 Nov 2017 06:38:51 +0000 (07:38 +0100)]
Merge pull request #7389 from shawnl/warning

tree-wide: adjust fall through comments so that gcc is happy

6 years agoREADME: add requirements for IPAddress{Allow,Deny} (#7414)
Andrew Jeddeloh [Tue, 21 Nov 2017 22:54:20 +0000 (14:54 -0800)]
README: add requirements for IPAddress{Allow,Deny} (#7414)

Document kernel options needed for IPAddress{Allow,Deny}.

6 years agotest: fix UDEV-WANTS testcase for non-bash shells (#7407)
Lennart Poettering [Tue, 21 Nov 2017 16:38:43 +0000 (17:38 +0100)]
test: fix UDEV-WANTS testcase for non-bash shells (#7407)

testsuite.sh uses "set -o pipefile", which is a bashism, hence use bash
to invoke the script.

6 years agoDocs: Fix spelling and capitalization (#7408)
longersson [Tue, 21 Nov 2017 13:37:16 +0000 (14:37 +0100)]
Docs: Fix spelling and capitalization (#7408)

6 years agomeson: "upgrade" -Wimplicit-fallthrough to 5
Zbigniew Jędrzejewski-Szmek [Mon, 20 Nov 2017 13:23:40 +0000 (14:23 +0100)]
meson: "upgrade" -Wimplicit-fallthrough to 5

5 means that only the explicit attribute introduced in previous commit
is accepted. We don't want the comments anymore.

6 years agocore/exec: Restore SmackProcessLabel setting (#7378)
jobol [Tue, 21 Nov 2017 11:01:13 +0000 (12:01 +0100)]
core/exec: Restore SmackProcessLabel setting (#7378)

Smack LSM needs the capability CAP_MAC_ADMIN to allow
setting of the current Smack exec label. Consequently,
dropping capabilities must be done after changing the
current exec label.

This is only related to Smack LSM. But for clarity and
regularity, all setting of security context moved before
dropping capabilities.

See Issue 7108

6 years agoMerge pull request #7335 from poettering/dissect-meta-info
Lennart Poettering [Tue, 21 Nov 2017 10:58:31 +0000 (11:58 +0100)]
Merge pull request #7335 from poettering/dissect-meta-info

beef up image dissection, to gather image metadata

6 years agoMerge pull request #7363 from poettering/success-action
Lennart Poettering [Tue, 21 Nov 2017 10:57:42 +0000 (11:57 +0100)]
Merge pull request #7363 from poettering/success-action

Generalize FailureAction=, and add SuccessAction=

6 years agonetworkd: cleanup do not call link_enter_set_routes after label is set. (#6935)
Susant Sahani [Tue, 21 Nov 2017 10:54:14 +0000 (16:24 +0530)]
networkd: cleanup do not call link_enter_set_routes after label is set. (#6935)

Remove link_enter_set_routes after label is set.

6 years agotest: fix UDEV-WANTS testcase for non-bash shells
Lennart Poettering [Tue, 21 Nov 2017 10:08:22 +0000 (11:08 +0100)]
test: fix UDEV-WANTS testcase for non-bash shells

testsuite.sh uses "set -o pipefile", which is a bashism, hence use bash
to invoke the script.

6 years agoman: clarify that the controllers listed on Delegate= might not be the only ones
Lennart Poettering [Mon, 20 Nov 2017 11:40:08 +0000 (12:40 +0100)]
man: clarify that the controllers listed on Delegate= might not be the only ones

6 years agotest: add a test case that validates cgroup delegation
Lennart Poettering [Fri, 17 Nov 2017 19:06:26 +0000 (20:06 +0100)]
test: add a test case that validates cgroup delegation

This test runs on the unified hierarchy, and ensures that cgroup
delegation works properly, i.e. writ access is granted and the requested
controllers are enabled.

6 years agocgroup: fix delegation on the unified hierarchy
Lennart Poettering [Fri, 17 Nov 2017 18:25:18 +0000 (19:25 +0100)]
cgroup: fix delegation on the unified hierarchy

Make sure to add the delegation mask to the mask of controllers we have
to enable on our own unit. Do not claim it was a members mask, as such
a logic would mean we'd collide with cgroupv2's "no processes on inner
nodes policy".

This change does the right thing: it means any controller enabled
through Controllers= will be made available to subcrgoups of our unit,
but the unit itself has to still enable it through
cgroup.subtree_control (which it can since that file is delegated too)
to be inherited further down.

Or to say this differently: we only should manipulate
cgroup.subtree_control ourselves for inner nodes (i.e. slices), and
for leaves we need to provide a way to enable controllers in the slices
above, but stay away from the cgroup's own cgroup.subtree_control —
which is what this patch ensures.

Fixes: #7355

6 years agocgroup: properly determine cgroups zombie processes belong to
Lennart Poettering [Fri, 17 Nov 2017 18:24:06 +0000 (19:24 +0100)]
cgroup: properly determine cgroups zombie processes belong to

When a process becomes a zombie its cgroup might be deleted. Let's add
some minimal code to detect cases like this, so that we can still
attribute this back to the original cgroup.

6 years agocgroup-util: optimization — open subtree_control file only once for all controllers
Lennart Poettering [Fri, 17 Nov 2017 17:03:22 +0000 (18:03 +0100)]
cgroup-util: optimization — open subtree_control file only once for all controllers

6 years agoupdate TODO
Lennart Poettering [Fri, 17 Nov 2017 17:03:00 +0000 (18:03 +0100)]
update TODO

6 years agocore: unify common code for preparing for forking off unit processes
Lennart Poettering [Fri, 17 Nov 2017 15:43:08 +0000 (16:43 +0100)]
core: unify common code for preparing for forking off unit processes

This introduces a new function unit_prepare_exec() that encapsulates a
number of calls we do in preparation for spawning off some processes in
all our unit types that do so.

This allows us to neatly unify a bit of code between unit types and
shorten our code.

6 years agocgroup-util: move Set* allocation into cg_kernel_controllers()
Lennart Poettering [Fri, 17 Nov 2017 15:27:13 +0000 (16:27 +0100)]
cgroup-util: move Set* allocation into cg_kernel_controllers()

Previously, callers had to do this on their own. Let's make the call do
that instead, making the caller code a bit shorter.

6 years agonspawn: minor optimization
Lennart Poettering [Fri, 17 Nov 2017 12:42:58 +0000 (13:42 +0100)]
nspawn: minor optimization

no need to prepare the target path if we quite the loop anyway one step
later.

6 years agonspawn-mount: rework get_controllers() a bit
Lennart Poettering [Fri, 17 Nov 2017 12:35:56 +0000 (13:35 +0100)]
nspawn-mount: rework get_controllers() a bit

Let's rename get_controllers() → get_process_controllers(), in order to
underline the difference to cg_kernel_controllers(). After all, one
returns the controllers available to the process, the other the
controllers enabled in the kernel at all).

Let's also update the code to use read_line() and set_put_strdup() to
shorten the code a bit, and make it more robust.

6 years agonspawn: rework mount_systemd_cgroup_writable() a bit
Lennart Poettering [Fri, 17 Nov 2017 12:05:30 +0000 (13:05 +0100)]
nspawn: rework mount_systemd_cgroup_writable() a bit

We shouldn't call alloca() as part of function calls, that's not really
defined in C. Hence, let's first do our stack allocations, and then
invoke functions.

Also, some coding style fixes, and minor shuffling around.

No functional changes.

6 years agocgroup: move cgroup controller names def.h → cgroup-util.h
Lennart Poettering [Fri, 17 Nov 2017 12:02:14 +0000 (13:02 +0100)]
cgroup: move cgroup controller names def.h → cgroup-util.h

These definitions are clearly cgroup specific, hence let's move them out
of def.h

6 years agonetworkd: support incoming/outgoing device for rule matching (#7223)
Susant Sahani [Tue, 21 Nov 2017 10:51:50 +0000 (16:21 +0530)]
networkd: support incoming/outgoing device for rule matching (#7223)

Closes #7210

6 years agotest: fix UDEV-WANTS testcase for non-bash shells
Lennart Poettering [Tue, 21 Nov 2017 10:08:22 +0000 (11:08 +0100)]
test: fix UDEV-WANTS testcase for non-bash shells

testsuite.sh uses "set -o pipefile", which is a bashism, hence use bash
to invoke the script.

6 years agoudev: port udev_has_devtmpfs() to use path_get_mnt_id()
Lennart Poettering [Mon, 20 Nov 2017 15:08:06 +0000 (16:08 +0100)]
udev: port udev_has_devtmpfs() to use path_get_mnt_id()

This means there's a good chance the code also works on kernels that
lack name_to_handle_at().

6 years agomount-util: add new path_get_mnt_id() call that queries the mnt ID of a path
Lennart Poettering [Mon, 20 Nov 2017 15:05:41 +0000 (16:05 +0100)]
mount-util: add new path_get_mnt_id() call that queries the mnt ID of a path

This is a simple wrapper around name_to_handle_at_loop() and
fd_fdinfo_mnt_id() to query the mnt ID of a path. It uses
name_to_handle_at() where it can, and falls back to to
fd_fdinfo_mnt_id() where that doesn't work.

This is a best-effort thing of course, since neither name_to_handle_at()
nor the fdinfo logic work on all kernels.

6 years agomount-util: add name_to_handle_at_loop() wrapper around name_to_handle_at()
Lennart Poettering [Mon, 20 Nov 2017 14:29:53 +0000 (15:29 +0100)]
mount-util: add name_to_handle_at_loop() wrapper around name_to_handle_at()

As it turns out MAX_HANDLE_SZ is a lie, the handle buffer we pass into
name_to_handle_at() might need to be larger than MAX_HANDLE_SZ, and we
thus need to invoke name_to_handle_at() in a loop, growing the buffer as
needed.

This adds a new wrapper name_to_handle_at_loop() around
name_to_handle_at() that does the necessary looping, and ports over all
users.

Fixes: #7082

6 years agoman: bootup(7) is one of our own man pages
Lennart Poettering [Tue, 21 Nov 2017 09:16:12 +0000 (10:16 +0100)]
man: bootup(7) is one of our own man pages

6 years agocore: make use of unit_active_or_pending() where we can
Lennart Poettering [Tue, 21 Nov 2017 09:10:28 +0000 (10:10 +0100)]
core: make use of unit_active_or_pending() where we can

Let's make use of unit_active_or_pending() where we can. Note that this
change changes beaviour in one specific case: when shutdown.target is
active we'll now also return that the system is in "stopping" state, not
only when we try to get into it. That makes sense as shutdown.target is
ordered before the actually shutdown units such as
"systemd-poweroff.service", and if the state is queried between reaching
those we should also report "stopping".

6 years agomanager: introduce MANAGER_IS_FINISHED() macro
Lennart Poettering [Mon, 20 Nov 2017 20:24:59 +0000 (21:24 +0100)]
manager: introduce MANAGER_IS_FINISHED() macro

Let's make our finished checks a bit more readable. Checking the
timestamp is not entirely obvious, hence let's abstract that a bit by
adding a macro that shows what we are doing here, not how we doing it.

This is particularly useful if we want to change the definition of
"finished" later on, in particular, when we try to fix #7023.

6 years agomanager: add manager_get_dump_string()
Lennart Poettering [Mon, 20 Nov 2017 20:20:44 +0000 (21:20 +0100)]
manager: add manager_get_dump_string()

It's like manager_dump(), but returns a string. This allows us to reduce
some duplicate code. Also, while we are at it, turn off stdio locking
while we write to the memory FILE *f.

6 years agocore: add manager_dump() call, and make it output timestamp data
Lennart Poettering [Mon, 20 Nov 2017 20:11:32 +0000 (21:11 +0100)]
core: add manager_dump() call, and make it output timestamp data

It's a wrapper around manager_dump_units() and manager_dump_jobs(), and
outputs some additional timestamp data.

Also, port two users of this over.

6 years agomanager: rework the timestamps logic, so that they are an enum-index array
Lennart Poettering [Mon, 20 Nov 2017 20:01:13 +0000 (21:01 +0100)]
manager: rework the timestamps logic, so that they are an enum-index array

This makes things quite a bit more systematic I think, as we can
systematically operate on all timestamps, for example for the purpose of
serialization/deserialization.

This rework doesn't necessarily make things shorter in the individual
lines, but it does reduce the line count a bit.

(This is useful particularly when we want to add additional timestamps,
for example to solve #7023)

6 years agoshared: silence gcc warning (#7402)
Shawn Landden [Tue, 21 Nov 2017 07:24:12 +0000 (23:24 -0800)]
shared: silence gcc warning (#7402)

[346/1860] Compiling C object 'src/shared/systemd-shared-235@sha/firewall-util.c.o'.
../src/shared/firewall-util.c: In function ‘entry_fill_basics’:
../src/shared/firewall-util.c:81:79: warning: logical ‘and’ of equal expressions [-Wlogical-op]
[543/1860] Compiling C object 'src/shared/systemd-shared-235@sta/firewall-util.c.o'.
../src/shared/firewall-util.c: In function ‘entry_fill_basics’:
../src/shared/firewall-util.c:81:79: warning: logical ‘and’ of equal expressions [-Wlogical-op]

6 years agoNEWS: fix minor error (#7399)
Shawn Landden [Tue, 21 Nov 2017 02:05:57 +0000 (18:05 -0800)]
NEWS: fix minor error (#7399)

6 years agotree-wide: adjust fall through comments so that gcc is happy
Shawn Landden [Sun, 19 Nov 2017 18:06:10 +0000 (10:06 -0800)]
tree-wide: adjust fall through comments so that gcc is happy

Distcc removes comments, making the comment silencing
not work.

I know there was a decision against a macro in commit
ec251fe7d5bc24b5d38b0853bc5969f3a0ba06e2