Commit Graph

28194 Commits

Author SHA1 Message Date
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
Lennart Poettering aa20394579 notify: document that we fake the PID when sending sd_notify() 2017-02-06 20:01:24 +01:00
Lennart Poettering d543b9f586 update TODO 2017-02-06 18:37:28 +01:00
Lennart Poettering b3bb64767a man: document that sd_notify() is racy in some cases 2017-02-06 18:21:27 +01:00
Lukas Rusak 0f92383243 systemd-mount: add missing fsck argument (#5238) 2017-02-06 14:25:15 +01:00
Lennart Poettering 142bd808a1 man: Document that RestrictAddressFamilies= doesn't work on s390/s390x/...
We already say that it doesn't work on i386, but there are more archs
like that apparently.
2017-02-06 14:17:12 +01:00
Lennart Poettering ad8f1479b4 seccomp: RestrictAddressFamilies= is not supported on i386/s390/s390x, make it a NOP
See: #5215
2017-02-06 14:17:12 +01:00
Lennart Poettering 3576dddf27 update TODO 2017-02-06 13:49:40 +01:00
Lennart Poettering 9194199c98 Merge pull request #5237 from keszybz/explicit-bzero
Use `explicit_bzero`
2017-02-06 13:35:56 +01:00
Zbigniew Jędrzejewski-Szmek 65c8834942 cgls: look at the right variable in error path (#5234)
CID #1370779.
2017-02-06 13:34:01 +01:00
Zbigniew Jędrzejewski-Szmek 1075122f42 journalctl: replace string_erase with memset('x')
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-05 21:07:55 -05:00
Zbigniew Jędrzejewski-Szmek 2d26d8e07e treewide: replace homegrown memory_erase with explicit_bzero
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-05 21:07:55 -05:00
Felipe Sateler 52e634271f resolved: downgrade "processing query..." message to debug (#5233)
It doesn't really add much value in normal operation and just spams the log.
2017-02-05 17:17:50 -05:00
Martin Pitt d2697a95fe Merge pull request #5223 from keszybz/root-workdir
Fix WorkDir=~ with empty User=
2017-02-05 22:31:02 +01:00
Zbigniew Jędrzejewski-Szmek d20a328f97 build-sys,man: describe systemd-umount and hook it up to installation (#5227) 2017-02-05 22:27:38 +01:00
Evgeny Vereshchagin 1b52793d5d seccomp: don't ever try to add an ABI before removing the default native ABI (#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-05 11:58:19 -05:00
Sergey Ptashnick 2604f8270c catalog: update Russian translation (#5232) 2017-02-05 11:56:47 -05:00
Zbigniew Jędrzejewski-Szmek 382852fd58 core/timer: downgrade message about random time addition (#5229)
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-05 09:37:46 +01:00
Zbigniew Jędrzejewski-Szmek cfe5b07106 Silence two "unused function af_lookup" warnings (#5222)
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-04 10:25:20 -05:00
Lukas Rusak c37fb55bd8 systemd-mount features and improvements (#5067)
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-04 10:21:49 -05:00
Martin Pitt b4a8c5ddb1 Merge pull request #4973 from poettering/run-race
run: fix race for "systemd-run --wait"
2017-02-03 18:44:42 +01:00
Martin Pitt 63927b9f4c man: clarify interface for suspend/resume integration (#5220)
Fixes #4916.
2017-02-03 12:11:37 -05:00
Zbigniew Jędrzejewski-Szmek 6a93917df9 core/execute: pass the username to utmp/wtmp database
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-03 11:49:43 -05:00
Zbigniew Jędrzejewski-Szmek 8b89628a10 core/execute: set HOME, USER also for root users
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-03 11:49:22 -05:00
Benjamin Robin d201d90838 time-util: Fix overflow check introduce in commit f977849 (#5216) 2017-02-03 16:13:55 +01:00
Lennart Poettering 95f1d6bfec run: exit early in --pty if service failed
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-03 11:51:57 +01:00
Lennart Poettering 9182fb52ac run: explicitly close pty forwarder before printing summary
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-03 11:51:57 +01:00
Lennart Poettering 578c03bce0 run: complain when --pty is used together with --no-block, which makes no sense 2017-02-03 11:51:57 +01:00
Lennart Poettering 8f5c235d9e sd-event: when an event source fails, don't assume the type of it is still set
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-03 11:51:57 +01:00
Lennart Poettering 5c1d991f40 Merge pull request #5213 from keszybz/systemctl-root-cat
Two fixes to path lookup when --root is used
2017-02-03 11:02:28 +01:00
Mirza Krak ce283b8887 rules: allow systemd to manage UBI volumes (#5214)
UBI is a software layer on top of MTD devices that is used with flash
chips.
2017-02-03 09:26:50 +01:00
afrantzis 7d049e304e logind: Don't try to emit a change signal for the 'Sessions' property (#5211)
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-02 20:39:26 -05:00
Zbigniew Jędrzejewski-Szmek 2341216ad7 Merge pull request #5212 from poettering/time-range
time handling fixes
2017-02-02 20:36:18 -05:00
Lennart Poettering 9a1c8f2d24 ptyfwd: set event source description strings for all event sources of a ptyfwd object 2017-02-02 20:59:43 +01:00
Lennart Poettering 5b1bad8d45 run: fix race for "systemd-run --wait"
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-02 20:59:43 +01:00
Lennart Poettering ed737400c2 cgls: --machine= expects an argument, indicate that in log messages
We gnerally suffix file settings and cmdline options that expect ags
with "=" to indicate that. Do so here, too.
2017-02-02 20:12:32 +01:00
Lennart Poettering 315782db14 time-util: add overflow checking to monotonic timestamp specifications 2017-02-02 20:12:32 +01:00
Lennart Poettering 74c5b33b0a time-util: when formatting usec_t as raw integers use PRIu64
After all, usec_t is defined as uint64_t, and not as unsigned long long.
2017-02-02 20:12:31 +01:00