Commit graph

28233 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek fc6149a6ce Merge pull request #4962 from poettering/root-directory-2
Add new MountAPIVFS= boolean unit file setting + RootImage=
2017-02-08 23:05:05 -05:00
Zbigniew Jędrzejewski-Szmek ef3116b5d4 man: add more commas for clarify and reword a few sentences 2017-02-08 22:53:16 -05:00
Evgeny Vereshchagin 52a4aafb4d Merge pull request #5270 from poettering/seccomp-namespace-fix
swap seccomp filter params on s390
2017-02-09 03:31:22 +03:00
David Glasser 2026e39b2d man: fix docs for swap's DefaultDependencies= (#5278)
There was a missing dependency and one with the wrong type. Additionally, refer
to DefaultDependencies= once instead of twice, without a vague reference in the
first one that doesn't mention that the value matters.

Fixes #5226.
2017-02-09 00:12:36 +01:00
Lennart Poettering b8076e3d06 update TODO 2017-02-08 22:21:27 +01:00
Lennart Poettering ae9d60ce4e seccomp: on s390 the clone() parameters are reversed
Add a bit of code that tries to get the right parameter order in place
for some of the better known architectures, and skips
restrict_namespaces for other archs.

This also bypasses the test on archs where we don't know the right
order.

In this case I didn't bother with testing the case where no filter is
applied, since that is hopefully just an issue for now, as there's
nothing stopping us from supporting more archs, we just need to know
which order is right.

Fixes: #5241
2017-02-08 22:21:27 +01:00
Jan Synacek 6bc30691b1 systemctl: make sure that --now is carried out (#5209)
When services are already enabled/disabled/masked, make sure
that --now still enforces start/stop.
2017-02-08 20:57:08 +01:00
Franck Bui 4470860388 sd-event: "when exiting no signal event are pending" is a wrong assertion (#5271)
The code make the following assertion: when freeing a event loop object
(usually it's done after exiting from the main event loop), no signal events
are still queued and are pending.

This assertion can be found in event_unmask_signal_data() with
"assert(!d->current);" assertion.

It appears that this assertion can be wrong at least in a specific case
described below.

Consider the following example which is inspired from udev: a process defines 3
source events: 2 are created by sd_event_add_signal() and 1 is created by
sd_event_add_post().

 1. the process receives the 2 signals consecutively so that signal 'A' source
     event is queued and pending. Consequently the post source event is also
     queued and pending. This is done by sd_event_wait().

 2. The callback for signal 'A' is called by sd_event_dispatch().

 3. The next call to sd_event_wait() will queue signal 'B' source event.

 4. The callback for the post source event is called and calls sd_event_exit().

 5. the event loop is exited.

 6. freeing the event loop object will lead to the assertion failure in
     event_unmask_signal_data().

This patch simply removes this assertion as it doesn't seem to be a
bug if the signal data still reference a signal source at this point.
2017-02-08 20:56:22 +01:00
Peter Körner bd9bb4ca61 sysctl.d: replace URL of SysRq key documentation (#5274)
The kernel documentation page is not distribution specific and also more
likely to be up to date than the Fedora wiki page referenced previously.
2017-02-08 19:42:43 +01:00
Philip Withnall b53ede699c nspawn: Add support for sysroot pivoting (#5258)
Add a new --pivot-root argument to systemd-nspawn, which specifies a
directory to pivot to / inside the container; while the original / is
pivoted to another specified directory (if provided). This adds
support for booting container images which may contain several bootable
sysroots, as is common with OSTree disk images. When these disk images
are booted on real hardware, ostree-prepare-root is run in conjunction
with sysroot.mount in the initramfs to achieve the same results.
2017-02-08 16:54:31 +01:00
Philip Withnall 6a909d41e1 test: Fix a maybe-uninitialised compiler warning (#5269)
The compiler warning is a false positive, since n_addresses is always
initialised on the success path from parse_argv(), but the compiler
obviously can’t work that out.

Fixes:
   src/test/test-nss.c:426:9: warning: 'n_addresses' may be used uninitialized in this function [-Wmaybe-uninitialized]
2017-02-08 16:53:01 +01:00
Lennart Poettering 8a50cf6957 seccomp: MemoryDenyWriteExecute= should affect both mmap() and mmap2() (#5254)
On i386 we block the old mmap() call entirely, since we cannot properly
filter it. Thankfully it hasn't been used by glibc since quite some
time.

Fixes: #5240
2017-02-08 15:14:02 +01:00
Lennart Poettering b6f08ecda9 Merge pull request #5231 from keszybz/mask-wants
Mask individual .wants/.requires symlinks
2017-02-08 14:50:56 +01:00
Lennart Poettering a48dd3475b dissect: don't honour NOAUTO flags when looking for ESP (#5224)
The flag is originally defined for "basic data partitions", but not for the
ESP. We reuse it for the various partitions defined by the Discoverable
Partitions Spec, but it isn't defined for the ESP, hence don't check for
it. Instead, do check for GPT_FLAG_NO_BLOCK_IO_PROTOCOL, as that flag
actually is defined for all partition types, and recommended to use by
the UEFI spec.

Fixes: #5218
2017-02-07 22:10:48 -05:00
Franck Bui fbc42f1332 tests: add dropin dependency tests
[zj: tests assertions adjusted to the different logic in which masking
     of a dependency through one name, does not forbid the dependency
     being added through another name.]
2017-02-07 21:32:10 -05:00
Zbigniew Jędrzejewski-Szmek 317cd27afb core/load-dropin: add more sanity checks on .wants/.requires symlinks
Feb 04 22:35:42 systemd[1462]: foo.service: Wants dependency dropin /home/zbyszek/.config/systemd/user/foo.service.wants/diffname.service target ../barbar.service has different name
Feb 04 22:35:42 systemd[1462]: foo.service: Wants dependency dropin /home/zbyszek/.config/systemd/user/foo.service.wants/wrongname is not a valid unit name, ignoring
2017-02-07 21:32:00 -05:00
Zbigniew Jędrzejewski-Szmek dcc4f30ecc core: drop code that is now unused 2017-02-07 21:31:59 -05:00
Zbigniew Jędrzejewski-Szmek 5be5d39bf0 core: implement masking of .wants/.requires symlinks
Fixes #1169.
Fixes #4830.

Example log errors:
Feb 04 22:13:28 systemd[1462]: foo.service: Wants dependency on empty_file.service is masked by /home/zbyszek/.config/systemd/user/foo.service.wants/empty_file.service, ignoring
Feb 04 22:13:28 systemd[1462]: foo.service: Wants dependency on masked.service is masked by /home/zbyszek/.config/systemd/user/foo.service.wants/masked.service, ignoring
2017-02-07 21:31:59 -05:00
Zbigniew Jędrzejewski-Szmek 9577878210 core: when loading .wants and .requires, follow the same logic as .d conf dropins
Essentially, instead of sequentially adding deps based on all symlinks
encountered in .wants and .requires dirs for each name and each unit file load
path, iteratate over the load paths and unit names gathering symlinks, then
order them based on priority, and then iterate over the final list, adding
dependencies.

This patch doesn't change the logic too much, except that the order in which
dependencies are applied might be different. It wasn't defined before, so that
not really a change. Adding filtering on the symlinks is left for later
patches.
2017-02-07 21:31:22 -05:00
Zbigniew Jędrzejewski-Szmek 5dd11ab5f3 basic/dirent-util: allow suffix to be omitted for dirent_is_file_with_suffix 2017-02-07 21:06:38 -05:00
Lennart Poettering cec2a20dab man: s/--unmount/--umount/g (#5243)
The --help text currently uses the "--umount" spelling, hence to the
same in the man page too.

And let's settle on "umount" instead of "unmount" here, since most folks
probably expect that when typing in a command, as util-linux' tool is
called "umount" after all, and so is the symlink "systemd-umount" we
install.
2017-02-07 19:54:37 -05:00
Zbigniew Jędrzejewski-Szmek a4bee98152 Merge pull request #5263 from poettering/install-alias 2017-02-07 19:50:20 -05:00
Zbigniew Jędrzejewski-Szmek 2cb2eba61b Revert "fix handling of templates instantiated in /usr/lib (#5263)"
This reverts commit 0698b67492.

It was supposed to be merged, not squashed.
2017-02-07 19:49:55 -05:00
Lennart Poettering 0698b67492 fix handling of templates instantiated in /usr/lib (#5263)
Fix handling of templates instantiated in /usr/lib.
All work to fix #5136.
2017-02-07 19:48:56 -05:00
Lucas Werkmeister 8331eaabc7 man: document *.d/ drop-in file order (#5262) 2017-02-07 18:58:02 -05:00
lewo 15fcdc98cf tmpfiles.d: set primary group rights to r-w (#5265)
If the /var/log/journal directory is created with rigths 700, the application
of an ACL rules without any primary group right sets it to 0. A chmod 755 on
this file will then only set the ACL mask and let the ACL primary group right
to 0. The directory is then unreadable for the primary group.

This patch explicitly sets the primary group to avoid this problem.

Fixes #5264.
2017-02-07 18:56:55 -05:00
Zbigniew Jędrzejewski-Szmek 55295fd84d Merge pull request #5219 from poettering/run-size-check
before reloading, check that /run/systemd has enough space
2017-02-07 18:37:04 -05:00
Lennart Poettering 27413cde03 Merge pull request #5259 from lucaswerkmeister/man
Manpage improvements
2017-02-07 20:24:43 +01:00
Lennart Poettering ee152d2f6b Merge pull request #5261 from AsciiWolf/master
l10n: various fixes
2017-02-07 20:24:05 +01:00
Lennart Poettering 80cb9da358 install: remove some unused parameters from various functions in install.c
No need to pass what we don't use.
2017-02-07 20:22:09 +01:00
Lennart Poettering dfead90d93 install: when a template unit is instantiated via a /usr symlink, consider it enabled
If a unit foobar@.service stored below /usr is instantiated via a
symlink foobar@quux.service also below /usr, then we should consider the
instance statically enabled, while the template itself should continue
to be considered enabled/disabled/static depending on its [Install]
section.

In order to implement this we'll now look for enablement symlinks in all
unit search paths, not just in the config and runtime dirs.

Fixes: #5136
2017-02-07 20:16:12 +01:00
AsciiWolf 3f33236b6b l10n: fix file permissions of Indonesian translation 2017-02-07 19:02:01 +01:00
AsciiWolf fabb53c2c9 l10n: fix strings formatting in Czech translation 2017-02-07 19:00:24 +01:00
Lucas Werkmeister c04becfa72 man: document that systemd-run --on-* cannot be used with --pty 2017-02-07 16:26:02 +01:00
Lennart Poettering 9f6cbcf53c install: don't enter loop when traversing a template symlinks
Before this patch, if we'd encounter an instance or template symlink
while traversing a chain of symlinks we'd fill in the instance name and
retry the iteration. This makes no sense if the resulting name is
actually the same as we are coming from, as we'd just spin a couple of
times in the loop, until the UNIT_FILE_FOLLOW_SYMLINK_MAX iteration
limit is hit.

Fix this, by accepted the symlink as it is, if it identical to what we
filled in.
2017-02-07 16:22:49 +01:00
Lucas Werkmeister ee3c52ebbe man: use systemctl enable --now 2017-02-07 16:20:25 +01:00
Lucas Werkmeister aa9f9e587d man: add cross-reference
The third paragraph of the Description already linked to
systemd.resource-control(5), but it was missing from the list of
additional options for the [Service] section.
2017-02-07 16:20:25 +01:00
Lennart Poettering 08fe86d5be update TODO 2017-02-07 12:21:29 +01:00
Lennart Poettering 41488e1f7a dissect: try to read roothash value off user.verity.roothash xattr of image file
This slightly extends the roothash loading logic to first check for a
user.verity.roothash extended attribute on the image file. If it exists,
it is used as Verity root hash and the ".roothash" file is not used.

This should improve the chance that the roothash is retained when the
file is moved around, as the data snippet is attached directly to the
image file. The field is still detached from the file payload however,
in order to make sure it may be trusted independently.

This does not replace the ".roothash" file loading, it simply adds a
second way to retrieve the data.

Extended attributes are often a poor choice for storing metadata like
this as it is usually difficult to discover for admins and users, and
hard to fix if it ever gets out of sync.  However, in this case I think
it's safe as verity implies read-only access, and thus there's little
chance of it to get out of sync.
2017-02-07 12:21:29 +01:00
Lennart Poettering 78ebe98061 core,nspawn,dissect: make nspawn's .roothash file search reusable
This makes nspawn's logic of automatically discovering the root hash of
an image file generic, and then reuses it in systemd-dissect and in
PID1's RootImage= logic, so that verity is automatically set up whenever
we can.
2017-02-07 12:21:28 +01:00
Lennart Poettering 915e6d1676 core: add RootImage= setting for using a specific image file as root directory for a service
This is similar to RootDirectory= but mounts the root file system from a
block device or loopback file instead of another directory.

This reuses the image dissector code now used by nspawn and
gpt-auto-discovery.
2017-02-07 12:19:42 +01:00
Lennart Poettering 2eedfd2d8b dissect: make sure to manually follow symlinks when mounting dissected image
If the dissected image contains symlinks for the mount points we need we
need to make sure to follow this with chase_symlinks() so that we don't
leave the image.
2017-02-07 11:22:05 +01:00
Lennart Poettering 20b7a0070c core: actually make "+" prefix in ReadOnlyPaths=, InaccessiblePaths=, ReadWritablePaths= work
5327c910d2 claimed to add support for "+"
for prefixing paths with the configured RootDirectory=. But actually it
only implemented it in the backend, it did not add support for it to the
configuration file parsers. Fix that now.
2017-02-07 11:22:05 +01:00
Lennart Poettering 5d997827e2 core: add a per-unit setting MountAPIVFS= for mounting /dev, /proc, /sys in conjunction with RootDirectory=
This adds a boolean unit file setting MountAPIVFS=. If set, the three
main API VFS mounts will be mounted for the service. This only has an
effect on RootDirectory=, which it makes a ton times more useful.

(This is basically the /dev + /proc + /sys mounting code posted in the
original #4727, but rebased on current git, and with the automatic logic
replaced by explicit logic controlled by a unit file setting)
2017-02-07 11:22:05 +01:00
Lennart Poettering 1eb7e08e20 core: fix minor memleak in namespace.c
The source_malloc field wants to be freed, too.
2017-02-07 11:22:05 +01:00
Evgeny Vereshchagin d52fbaa58c Merge pull request #5225 from poettering/seccomp-socket
make RestrictAddressFamilies= officially a NOP on i386
2017-02-07 05:06:54 +03:00
Evgeny Vereshchagin 1fb8579749 Merge pull request #5239 from poettering/notify-access-all
man: document that sd_notify() is racy in some cases
2017-02-06 23:59:33 +03:00
Lennart Poettering 6a1da642b3 update TODO 2017-02-06 21:14:31 +01:00
Lennart Poettering 0ca48bb0e8 README: suffix unit file options with "=" 2017-02-06 21:13:29 +01:00
Lennart Poettering 33bac67b48 update TODO 2017-02-06 20:26:33 +01:00