summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2017-02-08seccomp: on s390 the clone() parameters are reversedLennart Poettering
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-08nspawn: Add support for sysroot pivoting (#5258)Philip Withnall
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-08test: Fix a maybe-uninitialised compiler warning (#5269)Philip Withnall
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-08seccomp: MemoryDenyWriteExecute= should affect both mmap() and mmap2() (#5254)Lennart Poettering
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-08Merge pull request #5231 from keszybz/mask-wantsLennart Poettering
Mask individual .wants/.requires symlinks
2017-02-07dissect: don't honour NOAUTO flags when looking for ESP (#5224)Lennart Poettering
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-07core/load-dropin: add more sanity checks on .wants/.requires symlinksZbigniew Jędrzejewski-Szmek
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-07core: drop code that is now unusedZbigniew Jędrzejewski-Szmek
2017-02-07core: implement masking of .wants/.requires symlinksZbigniew Jędrzejewski-Szmek
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-07core: when loading .wants and .requires, follow the same logic as .d conf ↵Zbigniew Jędrzejewski-Szmek
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-07basic/dirent-util: allow suffix to be omitted for dirent_is_file_with_suffixZbigniew Jędrzejewski-Szmek
2017-02-07Merge pull request #5263 from poettering/install-aliasZbigniew Jędrzejewski-Szmek
2017-02-07Revert "fix handling of templates instantiated in /usr/lib (#5263)"Zbigniew Jędrzejewski-Szmek
This reverts commit 0698b674920aa8a56dbd6a625729a35e5ae9c5df. It was supposed to be merged, not squashed.
2017-02-07fix handling of templates instantiated in /usr/lib (#5263)Lennart Poettering
Fix handling of templates instantiated in /usr/lib. All work to fix #5136.
2017-02-07Merge pull request #5219 from poettering/run-size-checkZbigniew Jędrzejewski-Szmek
before reloading, check that /run/systemd has enough space
2017-02-07install: remove some unused parameters from various functions in install.cLennart Poettering
No need to pass what we don't use.
2017-02-07install: when a template unit is instantiated via a /usr symlink, consider ↵Lennart Poettering
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-07install: don't enter loop when traversing a template symlinksLennart Poettering
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-07Merge pull request #5225 from poettering/seccomp-socketEvgeny Vereshchagin
make RestrictAddressFamilies= officially a NOP on i386
2017-02-06core: use a memfd for serializationLennart Poettering
If we can, use a memfd for serializing state during a daemon reload or reexec. Fall back to a file in /run/systemd or /tmp only if memfds are not available. See: #5016
2017-02-06manager: refuse reloading/reexecing when /run is overly fullLennart Poettering
Let's add an extra safety check: before entering a reload/reexec, let's verify that there's enough room in /run for it. Fixes: #5016
2017-02-06systemd-mount: add missing fsck argument (#5238)Lukas Rusak
2017-02-06seccomp: RestrictAddressFamilies= is not supported on i386/s390/s390x, make ↵Lennart Poettering
it a NOP See: #5215
2017-02-06Merge pull request #5237 from keszybz/explicit-bzeroLennart Poettering
Use `explicit_bzero`
2017-02-06cgls: look at the right variable in error path (#5234)Zbigniew Jędrzejewski-Szmek
CID #1370779.
2017-02-05journalctl: replace string_erase with memset('x')Zbigniew Jędrzejewski-Szmek
The compiler should not be able to optimize out the memset, because optarg is global memory. In this case, not making the argument an empty string is nicer, so just use an open-coded version of string_erase from before the explicit_bzero change.
2017-02-05treewide: replace homegrown memory_erase with explicit_bzeroZbigniew Jędrzejewski-Szmek
explicit_bzero was added in glibc 2.25. Make use of it. explicit_bzero is hardcoded to zero the memory, so string erase now truncates the string, instead of overwriting it with 'x'. This causes a visible difference only in the journalctl case.
2017-02-05resolved: downgrade "processing query..." message to debug (#5233)Felipe Sateler
It doesn't really add much value in normal operation and just spams the log.
2017-02-05Merge pull request #5223 from keszybz/root-workdirMartin Pitt
Fix WorkDir=~ with empty User=
2017-02-05build-sys,man: describe systemd-umount and hook it up to installation (#5227)Zbigniew Jędrzejewski-Szmek
2017-02-05seccomp: don't ever try to add an ABI before removing the default native ABI ↵Evgeny Vereshchagin
(#5230) https://github.com/systemd/systemd/issues/5215#issuecomment-277156262 libseccomp does not allow you to add architectures to a filter that doesn't match the byte ordering of the architectures already added to the filter (it would be a mess, not to mention largely pointless) and since systemd attempts to add an ABI before removing the default native ABI, you will always fail on Power (either due to ppc or ppc64le). The fix is to remove the native ABI before adding a new ABI so you don't run into problems with byte ordering. You would likely see the same failure on a MIPS system. Thanks @pcmoore!
2017-02-05core/timer: downgrade message about random time addition (#5229)Zbigniew Jędrzejewski-Szmek
This seems like something that shouldn't be higher then debug level, even if it does not get emitted too often. Fixes #5228.
2017-02-04Silence two "unused function af_lookup" warnings (#5222)Zbigniew Jędrzejewski-Szmek
Gcc7 is smarter about detecting unused functions and detects those two functions which are unused in tests. But gperf generates them for us, so let's instead of removing tell gcc that we know they might be unused in the test code. In file included from ../src/test/test-af-list.c:29:0: ./src/basic/af-from-name.h:140:1: warning: ‘lookup_af’ defined but not used [-Wunused-function] lookup_af (register const char *str, register size_t len) ^~~~~~~~~ In file included from ../src/test/test-arphrd-list.c:29:0: ./src/basic/arphrd-from-name.h:125:1: warning: ‘lookup_arphrd’ defined but not used [-Wunused-function] lookup_arphrd (register const char *str, register size_t len) ^~~~~~~~~~~~~
2017-02-04systemd-mount features and improvements (#5067)Lukas Rusak
systemd-mount --unmount /some/path systemd-mount --umount /some/path systemd-mount -u /some/path systemd-unmount /some/path all do the same thing that one could expect from the name.
2017-02-03Merge pull request #4973 from poettering/run-raceMartin Pitt
run: fix race for "systemd-run --wait"
2017-02-03core/execute: pass the username to utmp/wtmp databaseZbigniew Jędrzejewski-Szmek
Before previous commit, username would be NULL for root, and set only for other users. So the argument passed to utmp_put_init_process() would be "root" for other users and NULL for root. Seems strange. Instead, always pass the username if available.
2017-02-03core/execute: set HOME, USER also for root usersZbigniew Jędrzejewski-Szmek
This changes the environment for services running as root from: LANG=C.utf8 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin INVOCATION_ID=ffbdec203c69499a9b83199333e31555 JOURNAL_STREAM=8:1614518 to LANG=C.utf8 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin HOME=/root LOGNAME=root USER=root SHELL=/bin/sh INVOCATION_ID=15a077963d7b4ca0b82c91dc6519f87c JOURNAL_STREAM=8:1616718 Making the environment special for the root user complicates things unnecessarily. This change simplifies both our logic (by making the setting of the variables unconditional), and should also simplify the logic in services (particularly scripts). Fixes #5124.
2017-02-03time-util: Fix overflow check introduce in commit f977849 (#5216)Benjamin Robin
2017-02-03run: exit early in --pty if service failedLennart Poettering
This reworks systemd-run so that in --pty mode we watch the unit state the way we do it in --wait mode. Whenever we notice that the service is in failed or inactive state finish right-away, but first write all unwritten characters we can read from the master TTY device. This makes sure that when the TTY service fails before it opens the slave PTY device we properly notice that and exit early, so that borked start parameters result in immediate systemd-run failure. Previously, we'd not notice this at all, as a PTY slave that never was opened won't result in POLLHUP events, and we'd hence simply keep reading from it forever. In essence, --pty now enables the same unit watching logic that --wait enables. However, unless --wait is specified we won#t show the final summary, hence the effective difference should be pretty minimal. Fixes: #3915
2017-02-03run: explicitly close pty forwarder before printing summaryLennart Poettering
If the PTY forwarder is still around our TTY will have borked settings, regarding newlines, hence explicitly close it before showing the summary, so that it looks pretty.
2017-02-03run: complain when --pty is used together with --no-block, which makes no senseLennart Poettering
2017-02-03sd-event: when an event source fails, don't assume the type of it is still setLennart Poettering
If a callback of an event source returns an error, then the event source might already be half-destroyed, if the callback dropped all refs. Hence, don't assume that the type is still valid, and save it before we issue the callback.
2017-02-03Merge pull request #5213 from keszybz/systemctl-root-catLennart Poettering
Two fixes to path lookup when --root is used
2017-02-02logind: Don't try to emit a change signal for the 'Sessions' property (#5211)afrantzis
The 'Sessions' property for both org.freedesktop.login1.User and org.freedesktop.login1.Seat is marked as EmitsChangedSignal(false). Trying to emit a change signal that includes the 'Sessions' property leads to the signal not being sent at all. Fixes #5210.
2017-02-02Merge pull request #5212 from poettering/time-rangeZbigniew Jędrzejewski-Szmek
time handling fixes
2017-02-02ptyfwd: set event source description strings for all event sources of a ↵Lennart Poettering
ptyfwd object
2017-02-02run: fix race for "systemd-run --wait"Lennart Poettering
D-Bus is inherently racy when a function returns an object path for a newly allocated object the client shall watch: as the object already exists before the client can subscribe to it, it might lose messages from it. Let's fix this, by explicitly querying unit properties right after subscribing to its property changes. Fixes: #4920
2017-02-02cgls: --machine= expects an argument, indicate that in log messagesLennart Poettering
We gnerally suffix file settings and cmdline options that expect ags with "=" to indicate that. Do so here, too.
2017-02-02time-util: add overflow checking to monotonic timestamp specificationsLennart Poettering
2017-02-02time-util: when formatting usec_t as raw integers use PRIu64Lennart Poettering
After all, usec_t is defined as uint64_t, and not as unsigned long long.