Commit Graph

34588 Commits

Author SHA1 Message Date
Yu Watanabe e91c99059b test: add comment in test-network-tables.c 2018-07-24 01:25:24 +09:00
Yu Watanabe 3fe30d85e3 resolve: define _DNS_SERVER_TYPE_MAX in enum 2018-07-24 01:23:41 +09:00
Yu Watanabe dc8bc9adde sd-device: include sd-device.h in device-internal.h 2018-07-24 01:22:32 +09:00
Lion Yang 2fafabfdc4 coredumpctl: info shows the last entry by default
Closes #9524.
2018-07-23 17:45:53 +02:00
Lennart Poettering 1d2d351319
Merge pull request #9658 from LukeShu/to-upstream/misc-cleanup
nspawn: Miscellaneous touch-up
2018-07-23 17:44:56 +02:00
Yu Watanabe aa8d423ef9 systemctl: set string table size for safety 2018-07-23 23:59:09 +09:00
Yu Watanabe a890906ce3 test: add a table test for ShowStatus 2018-07-23 23:45:01 +09:00
Yu Watanabe bee38b5cf8 core: serialize and deserialize current ShowStatus
Fixes #9663.
2018-07-23 23:42:48 +09:00
Yu Watanabe 7a293242e0 core: normalize ShowStatus 2018-07-23 21:55:26 +09:00
Yu Watanabe 08540a9591 meson: allow building resolved and machined without nss modules
This adds -Dnss-resolve= and -Dnss-mymachines= meson options.
By using this option, e.g., resolved can be built without nss-resolve.
When no nss modules are built, then test-nss is neither built.

Also, This changes the option name -Dmyhostname= to -Dnss-myhostname=
for consistency to other nss related options.

Closes #9596.
2018-07-23 14:03:05 +02:00
Yu Watanabe a0cb8078b1 meson: drop redundant messages
The equivalent messages are shown in the last summary.
2018-07-23 14:03:05 +02:00
Jon Ringle fbb48d4c66 Make final kill signal configurable
Usecase is to allow changing the final kill from SIGKILL to SIGQUIT which
should create a core dump useful for debugging why the service didn't stop
with the SIGTERM
2018-07-23 13:44:54 +02:00
Lennart Poettering 0c462ea4ef tree-wide: port various bits over to open_parent() 2018-07-23 13:38:18 +02:00
Lennart Poettering ef8becfac5 fs-util: introduce open_parent() helper
We often open the parent directory of a path. Let's add a common helper
for that, that shortens our code a bit and adds some extra safety
checks, for example it will fail if used on the root directory (which
doesn't really have a parent).

The helper is actually generalized from a function in btrfs-util.[ch]
which already existed for this purpose.
2018-07-23 13:38:18 +02:00
Lennart Poettering 09942654d3 fileio: add additional safety checks
Let's protect against attempts to create temporary files above the root
dir, as that makes little sense.

Let's better be safe than sorry.
2018-07-23 13:38:18 +02:00
Lennart Poettering 3e14d36a8a systemctl: show ExecStop= data after ExecStart= data
the service manager serializes ExecStop= execution data after
ExecStart=, like it makes sense and how it should be expected. However,
systemctl previously would reverse them when deserializing them locally,
and thus show ExecStop= results before ExecStart= results. And that's
confusing. Let's fix that.
2018-07-23 13:36:47 +02:00
Lennart Poettering 6a1d4d9fa6 core: properly reset all ExecStatus structures when entering a new unit cycle
Whenever a unit is started fresh we should flush out any runtime data
from the previous cycle. We are pretty good at that already, but what so
far we missed was the ExecStart=/ExecStop=/… command exit status data.
Let's fix that, and properly flush out that stuff too.

Consider this service:

    [Service]
    ExecStart=/bin/sleep infinity
    ExecStop=/bin/false

When this service is started, then stopped and then started again
"systemctl status" would show the ExecStop= results of the previous run
along with the ExecStart= results of the current one, which is very
confusing. With this patch this is corrected: the data is kept right
until the moment the new service cycle starts, and then flushed out.
Hence "systemctl status" in that case will only show the ExecStart=
data, but no ExecStop= data, like it should be.

This should fix part of the confusion of #9588
2018-07-23 13:36:47 +02:00
Lennart Poettering 42cb05d5ff execute: document what the different structures are for in comments 2018-07-23 13:36:47 +02:00
Lennart Poettering ee39ca20c6 core: drop "argv" field from ExecParameter structure
We always initialize it from the same field in ExecCommand anyway, hence
there's no point in passing it separately to exec_spawn(), after all we
already pass the ExecCommand structure itself anyway.

No change in behaviour.
2018-07-23 13:36:47 +02:00
Lennart Poettering 2ed26ed065 execute: use structure initialization when filling in exec status 2018-07-23 13:36:47 +02:00
Chen Qi 2484bff32b check nobody user/group validity only when not cross compiling
Using `getent' and `id' command in case of cross compiling does not
make much sense. This is because it is the host files that are checked.

Besides, in some restricted cross compilation environment, these two
command may not even be available. This is to avoid host comtamination.

So we should only check the validity using getent and id when not
cross compiling.
2018-07-23 13:08:32 +02:00
Evgeny Vereshchagin 0ffa4c7c4b tests: skip test_get_process_cmdline_harder if `mount --make-rslave /` fails with EPERM or EACCESS
That call to mount was added as a safeguard against a kernel bug which was fixed in
torvalds/linux@bbd5192.

In principle, the error could be ignored because

* normally everything mounted on /proc/PID should disappear as soon as the PID has gone away
* test-mount-util that had been confused by those phantom entries in /proc/self/mountinfo was
  taught to ignore them in 112cc3b.

On the other hand, in practice, if the mount fails, then the next one is extremely unlikely to
succeed, so it seems to be reasonable to just skip the rest of `test_get_process_cmdline_harder`
if that happens.

Closes https://github.com/systemd/systemd/issues/9649.
2018-07-23 11:30:57 +02:00
Carlo Caione ba9778d9b7 login1: policy: Authorize active users to boot to firmware
Currently to set the flag to reboot into the firmware setup an
authentication by an administrative user is required. Since we are
already enabling active users to reboot the system, it is advisable to
let the user decide if he wants to boot into the firmware setup without
any more hassle.
2018-07-23 11:12:33 +02:00
Yu Watanabe 0a924a775a meson: check the existence of ninja.build for fuzzer tests 2018-07-23 08:50:26 +02:00
Yu Watanabe ba323bbead meson: do not build module-util.c when libkmod is not found
Follow-up for 3cb9b42af3 (#9516).

Fixes oss-fuzz-9532.
2018-07-23 08:50:26 +02:00
Yu Watanabe f330408d62 tree-wide: drop empty lines in comments 2018-07-23 08:44:24 +02:00
Filipe Brandenburger 46f2579c2a systemctl: Only wait when there's something to wait for.
Tested:
- `systemctl --wait start i-do-not-exist.service` does not wait.
- `systemctl --wait start i-do-not-exist.service valid-unit.service` does.
2018-07-21 23:40:08 +09:00
glitsj16 bc21034688 Fix grammar 2018-07-21 10:17:58 +09:00
Josh Soref 7957e55d05 Minor grammar changes
mostly inserting / removing commas / periods as appropriate.
occasionally fixing duplicated words, proper brand case, and singular/plurals.
2018-07-20 22:18:39 +02:00
Lennart Poettering f14d0b2314
Merge pull request #9671 from keszybz/tasks-max-doc
Document user@.service and friends
2018-07-20 20:05:45 +02:00
Luke Shumaker 677a72cd3e nspawn: mount_sysfs(): Unconditionally mkdir /sys/fs/cgroup
Currently, mount_sysfs() only creates /sys/fs/cgroup if cg_ns_supported().
The comment explains that we need to "Create mountpoint for
cgroups. Otherwise we are not allowed since we remount /sys read-only.";
that is: that we need to do it now, rather than later.  However, the
comment doesn't do anything to explain why we only need to do this if
cg_ns_supported(); shouldn't we _always_ need to do it?

The answer is that if !use_cgns, then this was already done by the outer
child, so mount_sysfs() only needs to do it if use_cgns.  Now,
mount_sysfs() doesn't know whether use_cgns, but !cg_ns_supported() implies
!use_cgns, so we can optimize" the case where we _know_ !use_cgns, and deal
with a no-op mkdir_p() in the false-positive where cgns_supported() but
!use_cgns.

But is it really much of an optimization?  We're potentially spending an
access(2) (cg_ns_supported() could be cached from a previous call) to
potentially save an lstat(2) and mkdir(2); and all of them are on virtual
fileystems, so they should all be pretty cheap.

So, simplify and drop the conditional.  It's a dubious optimization that
requires more text to explain than it's worth.
2018-07-20 12:12:03 -04:00
Luke Shumaker f09e86bcaa cgroup-util: cg_kernel_controllers(): Fix comment about including "name="
Remove "arbitrary named hierarchies" from the list of things that
cg_kernel_controllers() might return, and clarify that "name="
pseudo-controllers are not included in the returned list.

/proc/cgroups does not contain "name=" pseudo-controllers, and
cg_kernel_controllers() makes no effort to enumerate them via a different
mechanism.
2018-07-20 12:12:02 -04:00
Luke Shumaker 93dbdf6cb1 nspawn: sync_cgroup(): Rename arg_uid_shift -> uid_shift
Naming it arg_uid_shift is confusing because of the global arg_uid_shift in
nspawn.c
2018-07-20 12:12:02 -04:00
Luke Shumaker 0402948206 nspawn: Move cgroup mount stuff from nspawn-mount.c to nspawn-cgroup.c 2018-07-20 12:12:02 -04:00
Luke Shumaker 2fa017f169 nspawn: Simplify tmpfs_patch_options() usage, and trickle that up
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 type 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 !use_userns (sometimes called !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
2018-07-20 12:12:02 -04:00
Luke Shumaker 9c0fad5fb5 nspawn: Simplify mkdir_userns() usage, and trickle that up
One of the things that mkdir_userns{,_p}() does is take an (optional) UID,
and chown the directory to that.  So we need a uid_t argument, and a way of
telling if we should use that uid_t argument.  Fortunately, that is built
in to the uid_t type by having UID_INVALID as a possible value.

However, currently mkdir_userns() also takes a MountSettingsMask and checks
a couple of bits in it to decide if it should perform the chown.

Drop the mask argument, and instead have the caller pass UID_INVALID if it
shouldn't chown.
2018-07-20 12:12:02 -04:00
Zbigniew Jędrzejewski-Szmek a99655b052 man: add a description of user@.service, user-runtime-dir@.service, user-*.slice
Fixes #9590.
2018-07-20 16:57:50 +02:00
Zbigniew Jędrzejewski-Szmek 96719f158a man: split systemd.special(7) into separate system/user sections
User units were in the middle, which is just confusing. Let's discuss
all system units first, and all user units second.

I'm using "System manager units" and "user manager units" instead of the more
obvious "system units" and "user units", because there are also units like
"user@.service".
2018-07-20 16:57:50 +02:00
Lennart Poettering 79d53eb8f7 bus-unit-util: tiny coding style fix 2018-07-20 16:57:35 +02:00
Lennart Poettering 2f28018cb8 nss: never become IPC clients for services that are about to be started
This is an attempt to automatically detect and avoid certain kinds of
NSS deadlocks as discussed in this thread:

https://lists.freedesktop.org/archives/systemd-devel/2018-July/040975.html
2018-07-20 16:57:35 +02:00
Lennart Poettering 3992221767 doc: document the two new env vars set by the service manager 2018-07-20 16:57:35 +02:00
Lennart Poettering d521916d0f pid1: tell PAM/NSS modules why we are calling them 2018-07-20 16:57:35 +02:00
Lennart Poettering abc291aafb NEWS: document nss-ldap incompatibilities 2018-07-20 16:57:35 +02:00
Lennart Poettering 088c49c3da growfs: make global variables that don't need to be exported static 2018-07-20 16:57:35 +02:00
Lennart Poettering 6b228852bc path-util: avoid name clashes
One of those days we should rework this to use the UNIQ macros, but for
now, an underscore should be enough.
2018-07-20 16:57:35 +02:00
Lennart Poettering ccfc19c960 env-util: make env-util.h self contained
The header file references strlen(), hence it should include string.h
2018-07-20 16:57:35 +02:00
Lennart Poettering 74bf45bb2c tests: prefer MS_SLAVE over MS_PRIVATE for turning off mount propagation
When we open our own little namespace for running our tests in, let's
turn off mount propagation only one way, rather than both ways. This is
better as this means we don't pin host mounts unnecessarily long in our
namespace, even though the host already got rid of them. This is because
MS_SLAVE in contrast to MS_PRIVATE allows umount events to propagate
from the host into our environment.
2018-07-20 16:51:20 +02:00
Ryutaroh Matsumoto be60dd3ec8 Various accountings are not implied by their controllers
The original manpage says "Implies BBBAccounting" many times but actually that accounting is not implied by the respective resource control in v239 with the unified cgroup hierarchy. This commit removes those false explanations.
2018-07-20 16:44:40 +02:00
Lennart Poettering a33ffd1505 update TODO 2018-07-20 16:38:53 +02:00
Lennart Poettering f606cd16d3
Merge pull request #9500 from zsol/append
Add support for opening files for appending
2018-07-20 15:45:08 +02:00