Commit graph

30568 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 9aa2113365 util-lib: add debug messages when checking cgroup layout
This has become very complex, let's make it a bit easier to diagnose.
2017-11-15 22:58:24 +01:00
Zbigniew Jędrzejewski-Szmek 47a78d4102 Use plural DelegateControllers= consistently 2017-11-15 22:58:24 +01:00
Zbigniew Jędrzejewski-Szmek 5427b6afdb Update TODO 2017-11-15 22:58:24 +01:00
Lucas Werkmeister 3e6b74e885 Remove TODO entry (#7326)
This was documented in b0e8cec2dd (#7317).
2017-11-14 10:57:54 +01:00
Lennart Poettering b0e8cec2dd man: document > /dev/stderr pitfalls (#7317)
Fixes: #7254
See: #2473
2017-11-14 10:51:09 +01:00
Yu Watanabe 99c1401807 core/dbus-unit: add property_get_requires_mounts_for() to send correct message (#7322)
PR #7186 changes requires_mounts_for from strv to Hashmap.
So, it is necessary to implement a function for getting the property RequiresMountsFor=.
This introduces property_get_requires_mounts_for() which reads the Hashmap
and sends messages to bus.

Fixes #7321.
2017-11-14 09:01:21 +01:00
Zeal Jagannatha ab0fc8711b Fix error message when binding files (#7196)
If you use machinectl to bind a file into a container, it responds with a confusing error message about a temporary directory not being a directory.

I just swapped it to error with the source that was passed, rather than the tmpdir.

It would also be nice to be able to bind files, but that's a separate issue (#7195).

Before the change:

root@epona /var/lib/sandbox $ cat bar/foo 
Hello world!
root@epona /var/lib/sandbox $ machinectl bind testing /var/lib/sandbox/bar/foo /foo
Failed to bind mount: Failed to overmount /tmp/propagate.W5TNsj/mount: Not a directory

After the change:

root@epona /var/lib/sandbox $ machinectl bind testing /var/lib/sandbox/bar/foo /foo
Failed to bind mount: Failed to overmount /var/lib/sandbox/bar/foo: Not a directory
2017-11-14 08:11:41 +01:00
Lennart Poettering 861f16d267 systemctl: print a friendly message when systemctl is invoked, but PID 1 is not systemd (#7318)
We only show this message when we can't talk to systemd, so that client
side install can work.

Fixes: https://bugzilla.freedesktop.org/show_bug.cgi?id=69962
2017-11-13 22:03:32 +01:00
Lennart Poettering ab8519c28b core: only warn about BPF/cgroup missing once per runtime (#7319)
Let's reduce the amount of noise a bit, there's little point in
complaining loudly about every single unit like this, let's complain
only about the first one, and then downgrade the log level to LOG_DEBUG
for the other cases.

Fixes: #7188
2017-11-13 22:02:51 +01:00
Topi Miettinen 9c6888ac45 basic: remove redundant check (#7320)
The check is redundant as the whole block is only evaluated if
__IGNORE_pkey_mprotect is not defined. Change to #else.
2017-11-13 22:00:03 +01:00
Lennart Poettering 49b625ed82 man: rework systemd-vconsole-setup man page a bit (#7312)
It's not systemd that invokes the service internally as needed, it's
systemd-localed. Correct that.

Also, stop using the word "helper". To me a "helper" constitutes
something internal, not official API. I doubt systemd-vconsole-setup
really matches that description though, hence let's better avoid the
term.

Also, clean up some other wording, and be less imbiguous, by suggesting
a single command to apply vconsole.conf instead of two.

Follow-up for 597c25d2a7
2017-11-13 19:14:19 +01:00
Lennart Poettering f38326f21a
Merge pull request #7284 from poettering/cgroup-delegate-mask
add a concept of delegating cgroups per unit while enabling specific controllers
2017-11-13 12:14:23 +01:00
Lennart Poettering 10d67460f5 install: drop redundant printing of unit name (#7296)
We already print it as part of log_syntax() internal logic, don't print
it again, and in particular, don't print it at the end of log line, such
a strange place.

Follow-up for: 142468d895
2017-11-13 11:12:01 +01:00
Shuang Liu 597c25d2a7 man: remove productname which resulting trademark symbol (#7193) 2017-11-13 11:10:51 +01:00
Lennart Poettering 93e93da5cc
bpf-firewall: properly handle kernels where BPF cgroup is disabled but TRIE maps are enabled (#7298)
So far, we assumed that kernels where TRIE was on also supported
BPF/cgroup stuff. That's not a correct assumption to make, hence check
for both features separately.

Fixes: #7054
2017-11-13 10:56:43 +01:00
Lennart Poettering bd1750f7fe
Merge pull request #7310 from keszybz/missing-pkey_mprotect
basic/missing: add numbers for pkey_mprotect
2017-11-13 10:55:00 +01:00
Lennart Poettering a9f01ad1bf man: document the new Delegate= syntax 2017-11-13 10:49:15 +01:00
Lennart Poettering 0263828039 core: rework the Delegate= unit file setting to take a list of controller names
Previously it was not possible to select which controllers to enable for
a unit where Delegate=yes was set, as all controllers were enabled. With
this change, this is made configurable, and thus delegation units can
pick specifically what they want to manage themselves, and what they
don't care about.
2017-11-13 10:49:15 +01:00
Lennart Poettering 800f478c2f core: downgrade a log message from error to warning
Messages that do not indicate a failing operation, but where we continue
operation should be at LOG_WARN, not at LOG_ERR.
2017-11-13 10:49:15 +01:00
Lennart Poettering 7546145e26 string-util: add delete_trailing_chars() and skip_leading_chars() helpers
And let's port over a couple of users to the new APIs.
2017-11-13 10:47:15 +01:00
Lennart Poettering 78f3c4bca5 conf-parser: reindent some strangely indented function headers 2017-11-13 10:24:03 +01:00
Lennart Poettering bcde742e78 conf-parser: turn three bool function params into a flags fields
This makes things more readable and fixes some issues with incorrect
flag propagation between the various flavours of config_parse().
2017-11-13 10:24:03 +01:00
Lennart Poettering 92b5e60542 conf-parser: simplify things a bit by using strextend() 2017-11-13 10:24:03 +01:00
Lennart Poettering 57d6f70019 fileio: make use of DEFINE_TRIVIAL_CLEANUP_FUNC where it makes sense 2017-11-13 10:24:03 +01:00
Lennart Poettering 3160497017 cgroup: make use of unit_get_subtree_mask() where appropriate
subtree_mask is own_mask | members_mask, let's make use of that to
shorten a few things
2017-11-13 10:24:03 +01:00
Lennart Poettering ec635a2d21 cgroup: improve cg_mask_to_string a bit, and add tests for it 2017-11-13 10:24:03 +01:00
Lennart Poettering 00b4a24743 cgroup-util: add brief comments clarifying which controllers are v2-only and which v1-only 2017-11-13 10:24:03 +01:00
Lennart Poettering e7e4a2584f update TODO 2017-11-13 10:24:03 +01:00
Lennart Poettering 4e0c20de97 namespace: set up OS hierarchy only after mounting the new root, not before
Otherwise it's a pointless excercise, as we'll set up an empty directory
tree that's never going to be used.

Hence, let's move this around a bit, so that we do the basesystem
initialization exactly when RootImage= or RootDirectory= are used, but
not otherwise.
2017-11-13 10:22:36 +01:00
Robin McCorkell 521cdf01e4 Fix creating independent VTI tunnel (#7303) 2017-11-13 10:14:36 +01:00
Zbigniew Jędrzejewski-Szmek 91691f1d3e shared/seccomp: skip pkey_mprotect protections if the syscall is unknown
When compiling with an old kernel on architectures for which the
number is not defined in missing.h, a warning is generated in missing.h.
Let's just skip the protection in this case, to allow build to proceed.
2017-11-13 09:35:49 +01:00
Zbigniew Jędrzejewski-Szmek 213f2883c0 basic/missing: add numbers for pkey_mprotect
Follow-up for b835eeb4ec.
2017-11-13 09:27:53 +01:00
Zbigniew Jędrzejewski-Szmek b835eeb4ec
shared/seccomp: disallow pkey_mprotect the same as mprotect for W^X mappings (#7295)
MemoryDenyWriteExecution policy could be be bypassed by using pkey_mprotect
instead of mprotect to create an executable writable mapping.

The impact is mitigated by the fact that the man page says "Note that this
feature is fully available on x86-64, and partially on x86", so hopefully
people do not rely on it as a sole security measure.

Found by Karin Hossen and Thomas Imbert from Sogeti ESEC R&D.

https://bugs.launchpad.net/bugs/1725348
2017-11-12 17:28:48 +01:00
Lennart Poettering ce5faeac1f seccomp: include ARM set_tls in @default (#7297)
Fixes: #7135
2017-11-12 16:34:43 +01:00
Lennart Poettering aa2b10daec networkd: improve interface rename log message a bit (#7299)
Let's clarify that it's not networkd that renames interfaces, but
something else (for example, udev's link builtin based on .link files)

This doesn't change any logic, it just rewords the message a bit, to
clarify that we only log this for informational purposes, not because we
execute the rename operation ourselves.

Fixes: #7143
2017-11-12 16:26:58 +01:00
Zbigniew Jędrzejewski-Szmek edc3eff50f
Merge pull request #7301 from poettering/loginctl-ellipsize
Fix loginctl seat sysfs tree ellipsation logic.

Simple reproducer:
loginctl --full seat-status seat0|cat
→ after this PR, all lines are shown in full. Before, lines were ellipsized to terminal width.
2017-11-12 16:25:54 +01:00
Zbigniew Jędrzejewski-Szmek f886559e55
Merge pull request #7186 from poettering/track-deps
rework unit dependency data structure to track why deps get created
2017-11-12 16:14:41 +01:00
Yu Watanabe 7f749487c5 test-execute: change path to python3 (#7306)
Change python3 path from /bin/python3 to /usr/bin/python3 to make
the test work on Ubuntu Xenial.

Follow-up for #7178.
2017-11-12 16:09:00 +01:00
Yu Watanabe 74b1731c75 core/mount: fstype may be NULL 2017-11-12 14:27:25 +01:00
Lennart Poettering 17b6f896b4 update TODO 2017-11-12 14:27:25 +01:00
Lennart Poettering ecd48322c2 core: sd-bus can handle NULL strings nicely, let's use it
No need to set an empty string here, sd-bus serializes NULL as empty
string anway.
2017-11-12 14:27:19 +01:00
Zbigniew Jędrzejewski-Szmek cb6d2872ba
Merge pull request #7178 from yuwata/rfe-7169-v2
core: add support to specify errno in SystemCallFilter=
2017-11-12 12:45:23 +01:00
Yu Watanabe 7a18854fe7 test-execute: update test for SystemCallErrorNumber= 2017-11-11 21:54:29 +09:00
Yu Watanabe 3df90f24cc core: allow to specify errno number in SystemCallErrorNumber= 2017-11-11 21:54:24 +09:00
Yu Watanabe b4891260b9 test: add tests for syscall:errno style in SystemCallFilter= 2017-11-11 21:54:20 +09:00
Yu Watanabe 8cfa775f4f core: add support to specify errno in SystemCallFilter=
This makes each system call in SystemCallFilter= blacklist optionally
takes errno name or number after a colon. The errno takes precedence
over the one given by SystemCallErrorNumber=.

C.f. #7173.
Closes #7169.
2017-11-11 21:54:12 +09:00
Yu Watanabe 473d2ec39c test: add test for parse_errno() and parse_syscall_and_errno() 2017-11-11 21:53:56 +09:00
Yu Watanabe cf26c4a722 parse-util: add parse_errno() and parse_syscall_and_errno() 2017-11-11 21:29:17 +09:00
Yu Watanabe 1850d0d271 basic/errno-list: remove errno_max() and define ERRNO_MAX as 4095
In Linux kernel code, MAX_ERRNO is defined as 4095.
Here, we use that value for ERRNO_MAX.
2017-11-11 21:28:25 +09:00
Lennart Poettering 3850319be5 loginctl: rework sysfs tree dump, to honour --full and friends
Let's hook up the sysfs tree output with the output flags logic,
already used when dumping log lines or process trees. This way we get
very similar output handling for line breaking/ellipsation in all three
outputs of structured data.

Fixes: #7095
2017-11-10 21:44:29 +01:00