]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
7 years agocore: add "invocation ID" concept to service manager
Lennart Poettering [Tue, 30 Aug 2016 21:18:46 +0000 (23:18 +0200)] 
core: add "invocation ID" concept to service manager

This adds a new invocation ID concept to the service manager. The invocation ID
identifies each runtime cycle of a unit uniquely. A new randomized 128bit ID is
generated each time a unit moves from and inactive to an activating or active
state.

The primary usecase for this concept is to connect the runtime data PID 1
maintains about a service with the offline data the journal stores about it.
Previously we'd use the unit name plus start/stop times, which however is
highly racy since the journal will generally process log data after the service
already ended.

The "invocation ID" kinda matches the "boot ID" concept of the Linux kernel,
except that it applies to an individual unit instead of the whole system.

The invocation ID is passed to the activated processes as environment variable.
It is additionally stored as extended attribute on the cgroup of the unit. The
latter is used by journald to automatically retrieve it for each log logged
message and attach it to the log entry. The environment variable is very easily
accessible, even for unprivileged services. OTOH the extended attribute is only
accessible to privileged processes (this is because cgroupfs only supports the
"trusted." xattr namespace, not "user."). The environment variable may be
altered by services, the extended attribute may not be, hence is the better
choice for the journal.

Note that reading the invocation ID off the extended attribute from journald is
racy, similar to the way reading the unit name for a logging process is.

This patch adds APIs to read the invocation ID to sd-id128:
sd_id128_get_invocation() may be used in a similar fashion to
sd_id128_get_boot().

PID1's own logging is updated to always include the invocation ID when it logs
information about a unit.

A new bus call GetUnitByInvocationID() is added that allows retrieving a bus
path to a unit by its invocation ID. The bus path is built using the invocation
ID, thus providing a path for referring to a unit that is valid only for the
current runtime cycleof it.

Outlook for the future: should the kernel eventually allow passing of cgroup
information along AF_UNIX/SOCK_DGRAM messages via a unique cgroup id, then we
can alter the invocation ID to be generated as hash from that rather than
entirely randomly. This way we can derive the invocation race-freely from the
messages.

7 years agoutil: use SPECIAL_ROOT_SLICE macro where appropriate
Lennart Poettering [Tue, 30 Aug 2016 19:49:26 +0000 (21:49 +0200)] 
util: use SPECIAL_ROOT_SLICE macro where appropriate

7 years agolog: minor fixes
Lennart Poettering [Tue, 30 Aug 2016 19:02:36 +0000 (21:02 +0200)] 
log: minor fixes

Most important is a fix to negate the error number if necessary, before we
first access it.

7 years agojournal: fix format string used for usec_t
Lennart Poettering [Tue, 30 Aug 2016 19:01:58 +0000 (21:01 +0200)] 
journal: fix format string used for usec_t

7 years agojournal: complete slice info in journal metadata
Lennart Poettering [Tue, 30 Aug 2016 19:00:52 +0000 (21:00 +0200)] 
journal: complete slice info in journal metadata

We are already attaching the system slice information to log messages, now add
theuser slice info too, as well as the object slice info.

7 years agobus-util: generalize helper for ID128 prpoerties
Lennart Poettering [Fri, 26 Aug 2016 17:20:02 +0000 (19:20 +0200)] 
bus-util: generalize helper for ID128 prpoerties

This way, we can make use of this in other code, too.

7 years agostrv: fix STRV_FOREACH_BACKWARDS() to be a single statement only
Lennart Poettering [Fri, 26 Aug 2016 17:18:15 +0000 (19:18 +0200)] 
strv: fix STRV_FOREACH_BACKWARDS() to be a single statement only

Let's make sure people invoking STRV_FOREACH_BACKWARDS() as a single statement
of an if statement don't fall into a trap, and find the tail for the list via
strv_length().

7 years agoMerge pull request #4304 from poettering/notify-nul-check
Lennart Poettering [Fri, 7 Oct 2016 16:30:53 +0000 (18:30 +0200)] 
Merge pull request #4304 from poettering/notify-nul-check

3 minor improvements for notification message handling

7 years agocore: only warn on short reads on signal fd 4304/head
Zbigniew Jędrzejewski-Szmek [Fri, 7 Oct 2016 13:39:42 +0000 (09:39 -0400)] 
core: only warn on short reads on signal fd

7 years agonetworkd: remote checksum offload for vxlan (#4110)
Susant Sahani [Fri, 7 Oct 2016 13:46:18 +0000 (19:16 +0530)] 
networkd: remote checksum offload for vxlan (#4110)

This patch adds support to remote checksum checksum offload to VXLAN.
This patch adds RemoteCheckSumTx and RemoteCheckSumRx vxlan configuration
to enable remote checksum offload for transmit and receive on the VXLAN tunnel.

7 years agoarchitecture: Add support for the RISC-V architecture. (#4305)
rwmjones [Fri, 7 Oct 2016 12:56:27 +0000 (13:56 +0100)] 
architecture: Add support for the RISC-V architecture. (#4305)

RISC-V is an open source ISA in development since 2010 at UCB.
For more information, see https://riscv.org/

I am adding RISC-V support to Fedora:
https://fedoraproject.org/wiki/Architectures/RISC-V

There are three major variants of the architecture (32-, 64- and
128-bit).  The 128-bit variant is a paper exercise, but the other
two really exist in silicon.  RISC-V is always little endian.

On Linux, the default kernel uname(2) can return "riscv" for all
variants.  However a patch was added recently which makes the kernel
return one of "riscv32" or "riscv64" (or in future "riscv128").  So
systemd should be prepared to handle any of "riscv", "riscv32" or
"riscv64" (in future, "riscv128" but that is not included in the
current patch).  If the kernel returns "riscv" then you need to use
the pointer size in order to know the real variant.

The Fedora/RISC-V kernel only ever returns "riscv64" since we're
only doing Fedora for 64 bit at the moment, and we've patched the
kernel so it doesn't return "riscv".

As well as the major bitsize variants, there are also architecture
extensions.  However I'm trying to ensure that uname(2) does *not*
return any other information about those in utsname.machine, so that
we don't end up with "riscv64abcde" nonsense.  Instead those
extensions will be exposed in /proc/cpuinfo similar to how flags
work in x86.

7 years agomanager: tighten incoming notification message checks
Lennart Poettering [Fri, 7 Oct 2016 10:14:33 +0000 (12:14 +0200)] 
manager: tighten incoming notification message checks

Let's not accept datagrams with embedded NUL bytes. Previously we'd simply
ignore everything after the first NUL byte. But given that sending us that is
pretty ugly let's instead complain and refuse.

With this change we'll only accept messages that have exactly zero or one NUL
bytes at the very end of the datagram.

7 years agomanager: be stricter with incomining notifications, warn properly about too large...
Lennart Poettering [Fri, 7 Oct 2016 10:12:10 +0000 (12:12 +0200)] 
manager: be stricter with incomining notifications, warn properly about too large ones

Let's make the kernel let us know the full, original datagram size of the
incoming message. If it's larger than the buffer space provided by us, drop the
whole message with a warning.

Before this change the kernel would truncate the message for us to the buffer
space provided, and we'd not complain about this, and simply process the
incomplete message as far as it made sense.

7 years agomanager: don't ever busy loop when we get a notification message we can't process
Lennart Poettering [Fri, 7 Oct 2016 10:08:51 +0000 (12:08 +0200)] 
manager: don't ever busy loop when we get a notification message we can't process

If the kernel doesn't permit us to dequeue/process an incoming notification
datagram message it's still better to stop processing the notification messages
altogether than to enter a busy loop where we keep getting notified but can't
do a thing about it.

With this change, manager_dispatch_notify_fd() behaviour is changed like this:

- if an error indicating a spurious wake-up is seen on recvmsg(), ignore it
  (EAGAIN/EINTR)

- if any other error is seen on recvmsg() propagate it, thus disabling
  processing of further wakeups

- if any error is seen on later code in the function, warn about it but do not
  propagate it, as in this cas we're not going to busy loop as the offending
  message is already dequeued.

7 years agoMerge pull request #4300 from keszybz/mkosi
Lennart Poettering [Fri, 7 Oct 2016 07:58:25 +0000 (09:58 +0200)] 
Merge pull request #4300 from keszybz/mkosi

Various mkosi bits

7 years agocore: add possibility to set action for ctrl-alt-del burst (#4105)
Lukáš Nykrýn [Fri, 7 Oct 2016 01:08:21 +0000 (03:08 +0200)] 
core: add possibility to set action for ctrl-alt-del burst (#4105)

For some certification, it should not be possible to reboot the machine through ctrl-alt-delete. Currently we suggest our customers to mask the ctrl-alt-delete target, but that is obviously not enough.

Patching the keymaps to disable that is really not a way to go for them, because the settings need to be easily checked by some SCAP tools.

7 years agoMerge pull request #4299 from poettering/variety
Evgeny Vereshchagin [Thu, 6 Oct 2016 20:43:08 +0000 (23:43 +0300)] 
Merge pull request #4299 from poettering/variety

ioctl socket fixes, sd-bus error updates, resolved error addition, PAM stub process priv fix

7 years agouser-util: rework maybe_setgroups() a bit 4299/head
Lennart Poettering [Thu, 6 Oct 2016 15:54:12 +0000 (17:54 +0200)] 
user-util: rework maybe_setgroups() a bit

Let's drop the caching of the setgroups /proc field for now. While there's a
strict regime in place when it changes states, let's better not cache it since
we cannot really be sure we follow that regime correctly.

More importantly however, this is not in performance sensitive code, and
there's no indication the cache is really beneficial, hence let's drop the
caching and make things a bit simpler.

Also, while we are at it, rework the error handling a bit, and always return
negative errno-style error codes, following our usual coding style. This has
the benefit that we can sensible hanld read_one_line_file() errors, without
having to updat errno explicitly.

7 years agotree-wide: drop some misleading compiler warnings
Lennart Poettering [Thu, 6 Oct 2016 15:44:51 +0000 (17:44 +0200)] 
tree-wide: drop some misleading compiler warnings

gcc at some optimization levels thinks thes variables were used without
initialization. it's wrong, but let's make the message go anyway.

7 years agocore: leave PAM stub process around with GIDs updated
Lennart Poettering [Thu, 6 Oct 2016 14:03:01 +0000 (16:03 +0200)] 
core: leave PAM stub process around with GIDs updated

In the process execution code of PID 1, before
096424d1230e0a0339735c51b43949809e972430 the GID settings where changed before
invoking PAM, and the UID settings after. After the change both changes are
made after the PAM session hooks are run. When invoking PAM we fork once, and
leave a stub process around which will invoke the PAM session end hooks when
the session goes away. This code previously was dropping the remaining privs
(which were precisely the UID). Fix this code to do this correctly again, by
really dropping them else (i.e. the GID as well).

While we are at it, also fix error logging of this code.

Fixes: #4238
7 years agosd-bus: add DNS errors to the errno translation table
Lennart Poettering [Thu, 6 Oct 2016 14:01:44 +0000 (16:01 +0200)] 
sd-bus: add DNS errors to the errno translation table

We generate these, hence we should also add errno translations for them.

7 years agoresolved: properly handle BADCOOKIE DNS error
Lennart Poettering [Thu, 6 Oct 2016 14:01:05 +0000 (16:01 +0200)] 
resolved: properly handle BADCOOKIE DNS error

Add this new error code (documented in RFC7873) to our list of known errors.

7 years agosd-bus: add a few missing entries to the error translation tables
Lennart Poettering [Thu, 6 Oct 2016 13:50:30 +0000 (15:50 +0200)] 
sd-bus: add a few missing entries to the error translation tables

These were forgotten, let's add some useful mappings for all errors we define.

7 years agosd-device/networkd: unify code to get a socket for issuing netdev ioctls on
Lennart Poettering [Thu, 6 Oct 2016 13:48:15 +0000 (15:48 +0200)] 
sd-device/networkd: unify code to get a socket for issuing netdev ioctls on

As suggested here:

https://github.com/systemd/systemd/pull/4296#issuecomment-251911349

Let's try AF_INET first as socket, but let's fall back to AF_NETLINK, so that
we can use a protocol-independent socket here if possible. This has the benefit
that our code will still work even if AF_INET/AF_INET6 is made unavailable (for
exmple via seccomp), at least on current kernels.

7 years agomkosi: install Fedora 25 4300/head
Zbigniew Jędrzejewski-Szmek [Thu, 6 Oct 2016 15:53:07 +0000 (11:53 -0400)] 
mkosi: install Fedora 25

No need to look back at the past. Fedora 25 is here (almost).

7 years agomkosi: drop git clean
Zbigniew Jędrzejewski-Szmek [Thu, 6 Oct 2016 15:52:36 +0000 (11:52 -0400)] 
mkosi: drop git clean

This is required after systemd/mkosi#25.

7 years agomkosi: disable our own cache
Zbigniew Jędrzejewski-Szmek [Tue, 4 Oct 2016 15:02:22 +0000 (11:02 -0400)] 
mkosi: disable our own cache

No point in spamming the fs.

7 years agomkosi: create .mkosi directory
Zbigniew Jędrzejewski-Szmek [Tue, 4 Oct 2016 15:00:02 +0000 (11:00 -0400)] 
mkosi: create .mkosi directory

Since it looks like we'll wind up with a bunch of mkosi files for different
distros, it's probably better to keep them in a subdirectory.

7 years agoupdate TODO
Lennart Poettering [Thu, 6 Oct 2016 09:54:03 +0000 (11:54 +0200)] 
update TODO

7 years agoMerge pull request #4280 from giuseppe/unprivileged-user
Lennart Poettering [Thu, 6 Oct 2016 13:44:27 +0000 (15:44 +0200)] 
Merge pull request #4280 from giuseppe/unprivileged-user

[RFC] run systemd in an unprivileged container

7 years agounits: systemd-udevd: add AF_INET and AF_INET6 to RestrictAddressFamilies= (#4296)
Yu Watanabe [Thu, 6 Oct 2016 13:40:53 +0000 (22:40 +0900)] 
units: systemd-udevd: add AF_INET and AF_INET6 to RestrictAddressFamilies= (#4296)

The udev builtin command `net_setup_link` requires AF_INET and AF_INET6.

Fixes #4293.

7 years agoMerge pull request #4199 from dvdhrm/hwdb-order
Lennart Poettering [Thu, 6 Oct 2016 09:58:13 +0000 (11:58 +0200)] 
Merge pull request #4199 from dvdhrm/hwdb-order

hwdb: return conflicts in a well-defined order

7 years agocore: do not fail in a container if we can't use setgroups 4280/head
Giuseppe Scrivano [Wed, 28 Sep 2016 16:37:39 +0000 (18:37 +0200)] 
core: do not fail in a container if we can't use setgroups

It might be blocked through /proc/PID/setgroups

7 years agoaudit: disable if cannot create NETLINK_AUDIT socket
Giuseppe Scrivano [Wed, 28 Sep 2016 16:26:25 +0000 (18:26 +0200)] 
audit: disable if cannot create NETLINK_AUDIT socket

7 years agonetworkd: fix coding style (#4294)
Susant Sahani [Thu, 6 Oct 2016 09:45:07 +0000 (15:15 +0530)] 
networkd: fix coding style (#4294)

7 years agojournald, ratelimit: fix inaccurate message suppression in journal_rate_limit_test...
Yuki Inoguchi [Thu, 6 Oct 2016 09:44:51 +0000 (18:44 +0900)] 
journald, ratelimit: fix inaccurate message suppression in journal_rate_limit_test() (#4291)

Currently, the ratelimit does not handle the number of suppressed messages accurately.
Even though the number of messages reaches the limit, it still allows to add one extra messages to journal.

This patch fixes the problem.

7 years agocatalog,po: update Polish translation (#4290)
Piotr Drąg [Wed, 5 Oct 2016 20:59:37 +0000 (22:59 +0200)] 
catalog,po: update Polish translation (#4290)

7 years agoFix typo
Giuseppe Scrivano [Tue, 4 Oct 2016 08:51:25 +0000 (10:51 +0200)] 
Fix typo

7 years agonetworkd: use BridgeFDB as well on bridge ports (#4253)
Tobias Jungel [Wed, 5 Oct 2016 15:06:40 +0000 (17:06 +0200)] 
networkd: use BridgeFDB as well on bridge ports (#4253)

[BridgeFDB] did not apply to bridge ports so far. This patch adds the proper
handling. In case of a bridge interface the correct flag NTF_MASTER is now set
in the netlink call. FDB MAC addresses are now applied in
link_enter_set_addresses to make sure the link is setup.

7 years agoAdded ArchLinux config for mkosi (#4274)
Zeal Jagannatha [Wed, 5 Oct 2016 12:00:06 +0000 (14:00 +0200)] 
Added ArchLinux config for mkosi (#4274)

7 years agoseccomp: add support for the s390 architecture (#4287)
hbrueckner [Wed, 5 Oct 2016 11:58:55 +0000 (13:58 +0200)] 
seccomp: add support for the s390 architecture (#4287)

Add seccomp support for the s390 architecture (31-bit and 64-bit)
to systemd.

This requires libseccomp >= 2.3.1.

7 years agonspawn: add log message to let users know that nspawn needs an empty /dev directory...
Djalal Harouni [Wed, 5 Oct 2016 04:57:02 +0000 (06:57 +0200)] 
nspawn: add log message to let users know that nspawn needs an empty /dev directory (#4226)

Fixes https://github.com/systemd/systemd/issues/3695

At the same time it adds a protection against userns chown of inodes of
a shared mount point.

7 years agoNEWS: typo fixes (#4285)
Thomas H. P. Andersen [Tue, 4 Oct 2016 18:41:46 +0000 (20:41 +0200)] 
NEWS: typo fixes (#4285)

7 years agotree-wide: remove consecutive duplicate words in comments
Stefan Schweter [Sun, 2 Oct 2016 17:37:21 +0000 (19:37 +0200)] 
tree-wide: remove consecutive duplicate words in comments

7 years agolist: LIST_INSERT_BEFORE: update head if necessary (#4261)
Michael Olbrich [Tue, 4 Oct 2016 14:15:37 +0000 (16:15 +0200)] 
list: LIST_INSERT_BEFORE: update head if necessary (#4261)

If the new item is inserted before the first item in the list, then the
head must be updated as well.
Add a test to the list unit test to check for this.

7 years agoautomount: make sure the expire event is restarted after a daemon-reload (#4265)
Michael Olbrich [Tue, 4 Oct 2016 14:13:27 +0000 (16:13 +0200)] 
automount: make sure the expire event is restarted after a daemon-reload (#4265)

If the corresponding mount unit is deserialized after the automount unit
then the expire event is set up in automount_trigger_notify(). However, if
the mount unit is deserialized first then the automount unit is still in
state AUTOMOUNT_DEAD and automount_trigger_notify() aborts without setting
up the expire event.
Explicitly call automount_start_expire() during coldplug to make sure that
the expire event is set up as necessary.

Fixes #4249.

7 years agoTypo (`mathes` → `matches`) (#4283)
Lucas Werkmeister [Tue, 4 Oct 2016 13:53:16 +0000 (15:53 +0200)] 
Typo (`mathes` → `matches`) (#4283)

7 years agopo: updated Swedish translation (#4241)
andhe [Tue, 4 Oct 2016 13:36:03 +0000 (15:36 +0200)] 
po: updated Swedish translation (#4241)

* po: updated Swedish translation

* po: swedish: fix login vs write logs to confusion

Since previous commit (updated messages) there's now a mix of
different translation meanings for the same thing.
While both translations are technically correct I think the
meaning of the original messages are probably "to login" rather
than "to write log messages to". This commit switches all
translations to the "login" meaning.

7 years agoMerge pull request #4273 from keszybz/docs
Martin Pitt [Tue, 4 Oct 2016 13:34:08 +0000 (15:34 +0200)] 
Merge pull request #4273 from keszybz/docs

Routing-domains-manpage tweak and NEWS update

7 years agoTypo (`virtiualization` → `virtualization`) (#4281)
Elias Probst [Tue, 4 Oct 2016 12:37:28 +0000 (14:37 +0200)] 
Typo (`virtiualization` → `virtualization`) (#4281)

7 years agoman: remove consecutive duplicate words (#4268)
Stefan Schweter [Mon, 3 Oct 2016 15:09:54 +0000 (17:09 +0200)] 
man: remove consecutive duplicate words (#4268)

This PR removes consecutive duplicate words from the man pages of:

* `resolved.conf.xml`
* `systemd.exec.xml`
* `systemd.socket.xml`

7 years agonspawn: set shared propagation mode for the container
Alban Crequy [Sat, 1 Oct 2016 08:58:56 +0000 (10:58 +0200)] 
nspawn: set shared propagation mode for the container

7 years agobuild-sys: use non-breaking spaces in contributor list 4273/head
Zbigniew Jędrzejewski-Szmek [Sun, 2 Oct 2016 12:52:52 +0000 (14:52 +0200)] 
build-sys: use non-breaking spaces in contributor list

I think it's easier to read peoples' names with this change.

7 years agoNEWS: add another batch of entries
Zbigniew Jędrzejewski-Szmek [Sun, 2 Oct 2016 12:51:49 +0000 (14:51 +0200)] 
NEWS: add another batch of entries

7 years agoman: rework the explanation of Domains=
Zbigniew Jędrzejewski-Szmek [Sun, 2 Oct 2016 12:32:44 +0000 (14:32 +0200)] 
man: rework the explanation of Domains=

Put more emphasis on the routing part. This is the more interesting
thing, and also more complicated and novel.

Explain "search domains" as the special case. Also explain the effect of
~. in more detail.

7 years agoman: fix indentation in table
Zbigniew Jędrzejewski-Szmek [Sun, 2 Oct 2016 11:24:54 +0000 (13:24 +0200)] 
man: fix indentation in table

<entry>-ies must be a single line of text. Otherwise docbook does strange
things to the indentation.

7 years agocore: do not try to create /run/systemd/transient in test mode
Zbigniew Jędrzejewski-Szmek [Sun, 25 Sep 2016 13:58:29 +0000 (09:58 -0400)] 
core: do not try to create /run/systemd/transient in test mode

This prevented systemd-analyze from unprivileged operation on older systemd
installations, which should be possible.
Also, we shouldn't touch the file system in test mode even if we can.

7 years agoanalyze-verify: honour $SYSTEMD_UNIT_PATH, allow system paths to be ignored
Zbigniew Jędrzejewski-Szmek [Sun, 25 Sep 2016 13:55:26 +0000 (09:55 -0400)] 
analyze-verify: honour $SYSTEMD_UNIT_PATH, allow system paths to be ignored

SYSTEMD_UNIT_PATH=foobar: systemd-analyze verify barbar/unit.service
will load units from barbar/, foobar/, /etc/systemd/system/, etc.

SYSTEMD_UNIT_PATH= systemd-analyze verify barbar/unit.service
will load units only from barbar/, which is useful e.g. when testing
systemd's own units on a system with an older version of systemd installed.

7 years agocore: complain if Before= dep on .device is declared
Zbigniew Jędrzejewski-Szmek [Sun, 25 Sep 2016 12:34:30 +0000 (08:34 -0400)] 
core: complain if Before= dep on .device is declared

[Unit]
Before=foobar.device

[Service]
ExecStart=/bin/true
Type=oneshot

$ systemd-analyze verify before-device.service
before-device.service: Dependency Before=foobar.device ignored (.device units cannot be delayed)

7 years agosystemctl: Add --wait option to wait until started units terminate again
Martin Pitt [Mon, 5 Sep 2016 11:14:36 +0000 (13:14 +0200)] 
systemctl: Add --wait option to wait until started units terminate again

Fixes #3830

7 years agoman: update mx record example (#4257)
Stefan Schweter [Sat, 1 Oct 2016 15:11:38 +0000 (17:11 +0200)] 
man: update mx record example (#4257)

7 years agoMerge pull request #4164 from martinpitt/nss-resolve
Zbigniew Jędrzejewski-Szmek [Sat, 1 Oct 2016 15:09:51 +0000 (17:09 +0200)] 
Merge pull request #4164 from martinpitt/nss-resolve

nss-resolve: return NOTFOUND instead of UNAVAIL for DNSSEC validation failures

7 years agonss-resolve: return NOTFOUND instead of UNAVAIL on resolution errors 4164/head
Martin Pitt [Fri, 16 Sep 2016 06:27:39 +0000 (08:27 +0200)] 
nss-resolve: return NOTFOUND instead of UNAVAIL on resolution errors

It needs to be possible to tell apart "the nss-resolve module does not exist"
(which can happen when running foreign-architecture programs) from "the queried
DNS name failed DNSSEC validation" or other errors. So return NOTFOUND for these
cases too, and only keep UNAVAIL for the cases where we cannot handle the given
address family.

This makes it possible to configure a fallback to "dns" without breaking
DNSSEC, with "resolve [!UNAVAIL=return] dns". Add this to the manpage.

This does not change behaviour if resolved is not running, as that already
falls back to the "dns" glibc module.

Fixes #4157

7 years agoman: drop myhostname from recommended nsswitch host configuration
Martin Pitt [Sat, 1 Oct 2016 14:54:45 +0000 (16:54 +0200)] 
man: drop myhostname from recommended nsswitch host configuration

resolve includes myhostname functionality, so there is no need to add it again.

7 years agonss-resolve: simplify error handling
Martin Pitt [Fri, 16 Sep 2016 08:57:06 +0000 (10:57 +0200)] 
nss-resolve: simplify error handling

Handle general errors from the resolved call in _nss_resolve_gethostbyaddr2_r()
the same say as in the other variants: Just "goto fail" as that does exactly
the same.

7 years agocore: update warning message
Zbigniew Jędrzejewski-Szmek [Fri, 30 Sep 2016 11:35:07 +0000 (13:35 +0200)] 
core: update warning message

"closing all" might suggest that _all_ fds received with the notification message
will be closed. Reword the message to clarify that only the "unused" ones will be
closed.

7 years agocore: get rid of unneeded state variable
Zbigniew Jędrzejewski-Szmek [Fri, 30 Sep 2016 11:34:10 +0000 (13:34 +0200)] 
core: get rid of unneeded state variable

No functional change.

7 years agonetworkd: fix "parametres" typo (#4244)
Elias Probst [Fri, 30 Sep 2016 11:25:25 +0000 (13:25 +0200)] 
networkd: fix "parametres" typo (#4244)

7 years agoMerge pull request #4225 from keszybz/coredump
Martin Pitt [Fri, 30 Sep 2016 09:16:51 +0000 (11:16 +0200)] 
Merge pull request #4225 from keszybz/coredump

coredump: remove Storage=both support, various fixes for sd-coredump and coredumpctl

7 years agoresolved: don't query domain-limited DNS servers for other domains (#3621)
Martin Pitt [Fri, 30 Sep 2016 07:30:08 +0000 (09:30 +0200)] 
resolved: don't query domain-limited DNS servers for other domains (#3621)

DNS servers which have route-only domains should only be used for
the specified domains. Routing queries about other domains there is a privacy
violation, prone to fail (as that DNS server was not meant to be used for other
domains), and puts unnecessary load onto that server.

Introduce a new helper function dns_server_limited_domains() that checks if the
DNS server should only be used for some selected domains, i. e. has some
route-only domains without "~.". Use that when determining whether to query it
in the scope, and when writing resolv.conf.

Extend the test_route_only_dns() case to ensure that the DNS server limited to
~company does not appear in resolv.conf. Add test_route_only_dns_all_domains()
to ensure that a server that also has ~. does appear in resolv.conf as global
name server. These reproduce #3420.

Add a new test_resolved_domain_restricted_dns() test case that verifies that
domain-limited DNS servers are only being used for those domains. This
reproduces #3421.

Clarify what a "routing domain" is in the manpage.

Fixes #3420
Fixes #3421

7 years agopid1: more informative error message for ignored notifications
Zbigniew Jędrzejewski-Szmek [Thu, 29 Sep 2016 14:07:41 +0000 (16:07 +0200)] 
pid1: more informative error message for ignored notifications

It's probably easier to diagnose a bad notification message if the
contents are printed. But still, do anything only if debugging is on.

7 years agopid1: process zero-length notification messages again
Zbigniew Jędrzejewski-Szmek [Thu, 29 Sep 2016 14:06:02 +0000 (16:06 +0200)] 
pid1: process zero-length notification messages again

This undoes 531ac2b234. I acked that patch without looking at the code
carefully enough. There are two problems:
- we want to process the fds anyway
- in principle empty notification messages are valid, and we should
  process them as usual, including logging using log_unit_debug().

7 years agopid1: don't return any error in manager_dispatch_notify_fd() (#4240)
Franck Bui [Thu, 29 Sep 2016 17:44:34 +0000 (19:44 +0200)] 
pid1: don't return any error in manager_dispatch_notify_fd() (#4240)

If manager_dispatch_notify_fd() fails and returns an error then the handling of
service notifications will be disabled entirely leading to a compromised system.

For example pid1 won't be able to receive the WATCHDOG messages anymore and
will kill all services supposed to send such messages.

7 years agoIf the notification message length is 0, ignore the message (#4237)
Jorge Niedbalski [Wed, 28 Sep 2016 21:25:50 +0000 (18:25 -0300)] 
If the notification message length is 0, ignore the message (#4237)

Fixes #4234.

Signed-off-by: Jorge Niedbalski <jnr@metaklass.org>
7 years agocoredump,catalog: give better notice when a core file is truncated 4225/head
Zbigniew Jędrzejewski-Szmek [Tue, 27 Sep 2016 10:40:54 +0000 (12:40 +0200)] 
coredump,catalog: give better notice when a core file is truncated

coredump had code to check if copy_bytes() hit the max_bytes limit,
and refuse further processing in that case.
But in 84ee0960443, the return convention for copy_bytes() was changed
from -EFBIG to 1 for the case when the limit is hit, so the condition
check in coredump couldn't ever trigger.
But it seems that *do* want to process such truncated cores [1].
So change the code to detect truncation properly, but instead of
returning an error, give a nice log entry.

[1] https://github.com/systemd/systemd/issues/3883#issuecomment-239106337

Should fix (or at least alleviate) #3883.

7 years agocoredump: log if the core is too large to store or generate backtrace
Zbigniew Jędrzejewski-Szmek [Tue, 27 Sep 2016 09:32:36 +0000 (11:32 +0200)] 
coredump: log if the core is too large to store or generate backtrace

Another fix for #4161.

7 years agocoredumpctl: delay the "on tty" refusal until as late as possible
Zbigniew Jędrzejewski-Szmek [Mon, 26 Sep 2016 22:32:42 +0000 (00:32 +0200)] 
coredumpctl: delay the "on tty" refusal until as late as possible

For the user, if the core file is missing or inaccessible, it is
more interesting that the fact that they forgot to pipe to a file.
So delay the failure from the check until after we have verified
that the file or the COREDUMP field are present.

Partially fixes #4161.

Also, error reporting on failure was duplicated. save_core() now
always prints an error message (because it knows the paths involved,
so can the most useful message), and the callers don't have to.

7 years agocoredumpctl: tighten print_field() code
Zbigniew Jędrzejewski-Szmek [Tue, 27 Sep 2016 08:52:10 +0000 (10:52 +0200)] 
coredumpctl: tighten print_field() code

Propagate errors properly, so that if we hit oom or an error in the
journal, the whole command will fail. This is important when using
the output in scripts.

Support the output of multiple values for the same field with -F.
The journal supports that, and our official commands should too, as
far as it makes sense. -F can be used to print user-defined fields
(e.g. somebody could use a TAG field with multiple occurences), so
we should support that too. That seems better than silently printing
the last value found as was done before.

We would iterate trying to match the same field with all possible
field names. Once we find something, cut the loop short, since we
know that nothing else can match.

7 years agocoredumpctl: rework presence reporting
Zbigniew Jędrzejewski-Szmek [Mon, 26 Sep 2016 23:41:38 +0000 (01:41 +0200)] 
coredumpctl: rework presence reporting

The column for "present" was easy to miss, especially if somebody had no
coredumps present at all, in which case the column of spaces of width one
wasn't visually distinguished from the neighbouring columns. Replace this
with an explicit text, one of: "missing", "journal", "present", "error".

$ coredumpctl
TIME                            PID   UID   GID SIG COREFILE EXE
Mon 2016-09-26 22:46:31 CEST   8623     0     0  11 missing  /usr/bin/bash
Mon 2016-09-26 22:46:35 CEST   8639  1001  1001  11 missing  /usr/bin/bash
Tue 2016-09-27 01:10:46 CEST  16110  1001  1001  11 journal  /usr/bin/bash
Tue 2016-09-27 01:13:20 CEST  16290  1001  1001  11 journal  /usr/bin/bash
Tue 2016-09-27 01:33:48 CEST  17867  1001  1001  11 present  /usr/bin/bash
Tue 2016-09-27 01:37:55 CEST  18549     0     0  11 error    /usr/bin/bash

Also, use access(…, R_OK), so that we can report a present but inaccessible
file different than a missing one.

7 years agocoredumpctl: report corefile presence properly
Zbigniew Jędrzejewski-Szmek [Mon, 26 Sep 2016 23:19:01 +0000 (01:19 +0200)] 
coredumpctl: report corefile presence properly

In 'list', show present also for coredumps stored in the journal.

In 'status', replace "File" with "Storage" line that is always present.
Possible values:
   Storage: none
   Storage: journal
   Storage: /path/to/file (inacessible)
   Storage: /path/to/file

Previously the File field be only present if the file was accessible, so users
had to manually extract the file name precisely in the cases where it was
needed, i.e. when coredumpctl couldn't access the file. It's much more friendly
to always show something. This output is designed for human consumption, so
it's better to be a bit verbose.

The call to sd_j_set_data_threshold is moved, so that status is always printed
with the default of 64k, list uses 4k, and coredump retrieval is done with the
limit unset. This should make checking for the presence of the COREDUMP field
not too costly.

7 years agocoredumpctl: report user unit properly
Zbigniew Jędrzejewski-Szmek [Mon, 26 Sep 2016 23:18:48 +0000 (01:18 +0200)] 
coredumpctl: report user unit properly

7 years agocoredumpctl: fix spurious "more than one entry matches" warning
Zbigniew Jędrzejewski-Szmek [Mon, 26 Sep 2016 22:40:55 +0000 (00:40 +0200)] 
coredumpctl: fix spurious "more than one entry matches" warning

sd_journal_previous() returns 0 if it didn't do any move, so the
warning was stupidly always printed.

7 years agocoredumpctl: fix handling of files written to fd
Zbigniew Jędrzejewski-Szmek [Mon, 26 Sep 2016 22:10:04 +0000 (00:10 +0200)] 
coredumpctl: fix handling of files written to fd

Added in 9fe13294a9 (by me :[```), and later obfuscated in d0c8806d4ab, if an
uncompressed external file or an internally stored coredump was supposed to be
written to a file descriptor, nothing would be written.

7 years agocoredump: remove Storage=both option
Zbigniew Jędrzejewski-Szmek [Mon, 26 Sep 2016 21:40:20 +0000 (23:40 +0200)] 
coredump: remove Storage=both option

Back when external storage was initially added in 34c10968cb, this mode of
storage was added. This could have made some sense back when XZ compression was
used, and an uncompressed core on disk could be used as short-lived cache file
which does require costly decompression. But now fast LZ4 compression is used
(by default) both internally and externally, so we have duplicated storage,
using the same compression and same default maximum core size in both cases,
but with different expiration lifetimes. Even the uncompressed-external,
compressed-internal mode is not very useful: for small files, decompression
with LZ4 is fast enough not to matter, and for large files, decompression is
still relatively fast, but the disk-usage penalty is very big.

An additional problem with the two modes of storage is that it complicates
the code and makes it much harder to return a useful error message to the user
if we cannot find the core file, since if we cannot find the file we have to
check the internal storage first.

This patch drops "both" storage mode. Effectively this means that if somebody
configured coredump this way, they will get a warning about an unsupported
value for Storage, and the default of "external" will be used.
I'm pretty sure that this mode is very rarely used anyway.

7 years agoman: remove duplicate "the" for systemctl --plain (#4230)
Alfie John [Wed, 28 Sep 2016 09:10:26 +0000 (09:10 +0000)] 
man: remove duplicate "the" for systemctl --plain (#4230)

7 years agojournal: add stdout_stream_scan() comment (#4102)
Vito Caputo [Wed, 28 Sep 2016 05:35:48 +0000 (22:35 -0700)] 
journal: add stdout_stream_scan() comment (#4102)

When s->length is zero this function doesn't do anything, note that in a
comment.

7 years agoMerge pull request #4185 from endocode/djalal-sandbox-first-protection-v1
Evgeny Vereshchagin [Wed, 28 Sep 2016 01:50:30 +0000 (04:50 +0300)] 
Merge pull request #4185 from endocode/djalal-sandbox-first-protection-v1

core:sandbox: Add new ProtectKernelTunables=, ProtectControlGroups=, ProtectSystem=strict and fixes

7 years agoMerge pull request #4220 from keszybz/show-and-formatting-fixes
Martin Pitt [Tue, 27 Sep 2016 14:25:27 +0000 (16:25 +0200)] 
Merge pull request #4220 from keszybz/show-and-formatting-fixes

Show and formatting fixes

7 years agobasic: fix for IPv6 status (#4224)
Susant Sahani [Tue, 27 Sep 2016 13:55:13 +0000 (19:25 +0530)] 
basic: fix for IPv6 status (#4224)

Even if
```
   cat /proc/sys/net/ipv6/conf/all/disable_ipv6
1
```

is disabled

cat /proc/net/sockstat6

```
TCP6: inuse 2
UDP6: inuse 1
UDPLITE6: inuse 0
RAW6: inuse 0
FRAG6: inuse 0 memory 0
 ```

Looking for /proc/net/if_inet6 is the right choice.

7 years agotest: make sure that {readonly|inaccessible|readwrite}paths disconnect mount propagation 4185/head
Djalal Harouni [Sun, 25 Sep 2016 17:50:25 +0000 (19:50 +0200)] 
test: make sure that {readonly|inaccessible|readwrite}paths disconnect mount propagation

Better safe.

7 years agotest: add tests for simple ReadOnlyPaths= case
Djalal Harouni [Sun, 25 Sep 2016 17:24:25 +0000 (19:24 +0200)] 
test: add tests for simple ReadOnlyPaths= case

7 years agotest-bus-creds: are more debugging info 4220/head
Zbigniew Jędrzejewski-Szmek [Mon, 26 Sep 2016 20:22:28 +0000 (22:22 +0200)] 
test-bus-creds: are more debugging info

This test sometimes fails in semaphore, but not when run interactively,
so it's hard to debug.

7 years agoudev/path_id: introduce support for NVMe devices (#4169)
Keith Busch [Mon, 26 Sep 2016 19:01:07 +0000 (13:01 -0600)] 
udev/path_id: introduce support for NVMe devices (#4169)

This appends the nvme name and namespace identifier attribute the the
PCI path for by-path links. Symlinks like the following are now present:

lrwxrwxrwx. 1 root root 13 Sep 16 12:12 pci-0000:01:00.0-nvme-1 -> ../../nvme0n1
lrwxrwxrwx. 1 root root 15 Sep 16 12:12 pci-0000:01:00.0-nvme-1-part1 -> ../../nvme0n1p1

Cc: Michal Sekletar <sekletar.m@gmail.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
7 years agocore: Fix USB functionfs activation and clarify its documentation (#4188)
Paweł Szewczyk [Mon, 26 Sep 2016 16:45:47 +0000 (18:45 +0200)] 
core: Fix USB functionfs activation and clarify its documentation (#4188)

There was no certainty about how the path in service file should look
like for usb functionfs activation. Because of this it was treated
differently in different places, which made this feature unusable.

This patch fixes the path to be the *mount directory* of functionfs, not
ep0 file path and clarifies in the documentation that ListenUSBFunction should be
the location of functionfs mount point, not ep0 file itself.

7 years agomachinectl: prefer user@ to --uid=user for shell (#4006)
Zbigniew Jędrzejewski-Szmek [Mon, 26 Sep 2016 15:45:31 +0000 (11:45 -0400)] 
machinectl: prefer user@ to --uid=user for shell (#4006)

It seems to me that the explicit positional argument should have higher
priority than "an option".

7 years agojournald,ratelimit: fix wrong calculation of burst_modulate() (#4218)
HATAYAMA Daisuke [Mon, 26 Sep 2016 15:36:20 +0000 (00:36 +0900)] 
journald,ratelimit: fix wrong calculation of burst_modulate() (#4218)

This patch fixes wrong calculation of burst_modulate(), which now calculates
the values smaller than really expected ones if available disk space is
strictly more than 1MB.

In particular, if available disk space is strictly more than 1MB and strictly
less than 16MB, the resulted value becomes smaller than its original one.

>>> (math.log2(1*1024**2)-16) / 4
1.0
>>> (math.log2(16*1024**2)-16) / 4
2.0
>>> (math.log2(256*1024**2)-16) / 4
3.0
→ This matches the comment in the function.

7 years agocoredump: initialize coredump_size in submit_coredump() (#4219)
Matej Habrnal [Mon, 26 Sep 2016 15:28:58 +0000 (17:28 +0200)] 
coredump: initialize coredump_size in submit_coredump() (#4219)

If ulimit is smaller than page_size(), function save_external_coredump()
returns -EBADSLT and this causes skipping whole core dumping part in
submit_coredump(). Initializing coredump_size to UINT64_MAX prevents
evaluating a condition with uninitialized varialbe which leads to
calling allocate_journal_field() with coredump_fd = -1 which causes
aborting.

Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
7 years agotreewide: fix typos (#4217)
Torstein Husebø [Mon, 26 Sep 2016 09:32:47 +0000 (11:32 +0200)] 
treewide: fix typos (#4217)

7 years agotest: add CAP_MKNOD tests for PrivateDevices=
Djalal Harouni [Sun, 25 Sep 2016 11:04:30 +0000 (13:04 +0200)] 
test: add CAP_MKNOD tests for PrivateDevices=

7 years agocore: Use @raw-io syscall group to filter I/O syscalls when PrivateDevices= is set
Djalal Harouni [Sun, 25 Sep 2016 10:52:27 +0000 (12:52 +0200)] 
core: Use @raw-io syscall group to filter I/O syscalls when PrivateDevices= is set

Instead of having a local syscall list, use the @raw-io group which
contains the same set of syscalls to filter.