]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
7 years agostart putting together a NEWS entry for 233
Lennart Poettering [Tue, 21 Feb 2017 12:59:12 +0000 (13:59 +0100)] 
start putting together a NEWS entry for 233

7 years agosystemctl: suffix cmdline options that take arguments with =
Lennart Poettering [Tue, 21 Feb 2017 10:17:24 +0000 (11:17 +0100)] 
systemctl: suffix cmdline options that take arguments with =

Just to clarify, that these options expect arguments, following our
usual style.

7 years agoMerge pull request #5131 from keszybz/environment-generators
Lennart Poettering [Tue, 21 Feb 2017 10:11:44 +0000 (11:11 +0100)] 
Merge pull request #5131 from keszybz/environment-generators

Environment generators

7 years agocoredumpctl: print a hint if any coredumps are in flight (#5393)
Zbigniew Jędrzejewski-Szmek [Tue, 21 Feb 2017 10:08:35 +0000 (05:08 -0500)] 
coredumpctl: print a hint if any coredumps are in flight (#5393)

Fixes #4685.

7 years agoMerge pull request #5390 from keszybz/coverity
Lennart Poettering [Tue, 21 Feb 2017 09:49:49 +0000 (10:49 +0100)] 
Merge pull request #5390 from keszybz/coverity

Clarifications to make coverity happy

7 years agotest-env-util: add more tests for "extended syntax" 5131/head
Zbigniew Jędrzejewski-Szmek [Tue, 21 Feb 2017 04:21:26 +0000 (23:21 -0500)] 
test-env-util: add more tests for "extended syntax"

This is only the tip of the iceberg. It would be great to test all kinds of nesting, handling
of invalid syntax, etc., but I'm leaving that for later.

7 years agobasic: support default and alternate values for env expansion
Ray Strode [Tue, 9 Aug 2016 14:20:22 +0000 (10:20 -0400)] 
basic: support default and alternate values for env expansion

Sometimes it's useful to provide a default value during an environment
expansion, if the environment variable isn't already set.

For instance $XDG_DATA_DIRS is suppose to default to:

/usr/local/share/:/usr/share/

if it's not yet set. That means callers wishing to augment
XDG_DATA_DIRS need to manually add those two values.

This commit changes replace_env to support the following shell
compatible default value syntax:

XDG_DATA_DIRS=/foo:${XDG_DATA_DIRS:-/usr/local/share/:/usr/share}

Likewise, it's useful to provide an alternate value during an
environment expansion, if the environment variable isn't already set.

For instance, $LD_LIBRARY_PATH will inadvertently search the current
working directory if it starts or ends with a colon, so the following
is usually wrong:

LD_LIBRARY_PATH=/foo/lib:${LD_LIBRARY_PATH}

To address that, this changes replace_env to support the following
shell compatible alternate value syntax:

LD_LIBRARY_PATH=/foo/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

[zj: gate the new syntax under REPLACE_ENV_ALLOW_EXTENDED switch, so
existing callers are not modified.]

7 years agobasic: add replace_env_n function
Ray Strode [Tue, 9 Aug 2016 14:20:22 +0000 (10:20 -0400)] 
basic: add replace_env_n function

It's like replace_env, but lets you pass in a substring.

7 years agobuild-sys: make environment.d support conditional
Zbigniew Jędrzejewski-Szmek [Sat, 18 Feb 2017 16:28:12 +0000 (11:28 -0500)] 
build-sys: make environment.d support conditional

We have ./configure switches for various parts of non-essential functionality,
let's add one for this new stuff too. Support for environment generators is
not conditional — if you don't want them, just don't install any.

7 years agoTighten checking for variable validity
Zbigniew Jędrzejewski-Szmek [Sat, 18 Feb 2017 03:56:28 +0000 (22:56 -0500)] 
Tighten checking for variable validity

In the future we might want to allow additional syntax (for example
"unset VAR". But let's check that the data we're getting does not contain
anything unexpected.

7 years agoAllow braceless variables to be expanded
Zbigniew Jędrzejewski-Szmek [Sat, 11 Feb 2017 19:05:10 +0000 (14:05 -0500)] 
Allow braceless variables to be expanded

(Only in environment.d files.)

We have only basic compatibility with shell syntax, but specifying variables
without using braces is probably more common, and I think a lot of people would
be surprised if this didn't work.

7 years agobasic/env-util: use _cleanup_ in replace_env()
Zbigniew Jędrzejewski-Szmek [Sat, 11 Feb 2017 18:22:13 +0000 (13:22 -0500)] 
basic/env-util: use _cleanup_ in replace_env()

7 years agobuild-sys,man: load /etc/environment and describe the new environment.d syntax
Ray Strode [Fri, 29 Jul 2016 17:52:55 +0000 (13:52 -0400)] 
build-sys,man: load /etc/environment and describe the new environment.d syntax

Add support for /etc/environment and document the changes to the user manager
to automatically import environment *.conf files from:

        ~/.config/environment.d/
        /etc/environment.d/
        /run/environment.d/
        /usr/local/lib/environment.d/
        /usr/lib/environment.d/
        /etc/environment

7 years agoenvironment-generator: new generator to peruse environment.d
Zbigniew Jędrzejewski-Szmek [Sat, 11 Feb 2017 16:32:17 +0000 (11:32 -0500)] 
environment-generator: new generator to peruse environment.d

Why the strange name: the prefix is necessary to follow our own advice that
environment generators should have numerical prefixes. I also put -d- in the
name because otherwise the name was very easy to mistake with
systemd.environment-generator. This additional letter clarifies that this
on special generator that supports environment.d files.

7 years agobasic: add new merge_env_file function
Ray Strode [Thu, 4 Aug 2016 16:00:00 +0000 (12:00 -0400)] 
basic: add new merge_env_file function

merge_env_file is a new function, that's like load_env_file, but takes a
pre-existing environment as an input argument. New environment entries are
merged. Variable expansion is performed.

Falling back to the process environment is supported (when a flag is set).
Alternatively this could be implemented as passing an additional fallback
environment array, but later on we're adding another flag to allow braceless
expansion, and the two flags can be combined in one arg, so there's less
stuff to pass around.

7 years agobasic: drop unnecessary strempty() call in replace_env
Ray Strode [Tue, 9 Aug 2016 14:39:15 +0000 (10:39 -0400)] 
basic: drop unnecessary strempty() call in replace_env

strempty() converts a NULL value to empty string, so
that it can be passed on to functions that don't support NULL.

replace_env calls strempty before passing its value on to strappend.

strappend supports NULL just fine, though, so this commit drops the
strempty call.

7 years agobasic: fix strv_env_get_n for unclean arrays
Ray Strode [Wed, 3 Aug 2016 18:35:50 +0000 (14:35 -0400)] 
basic: fix strv_env_get_n for unclean arrays

If an environment array has duplicates, strv_env_get_n returns
the results for the first match. This is wrong, because later
entries in the environment are supposed to replace earlier
entries.

7 years agoman: add systemd.environment-generator(7) with two examples
Zbigniew Jędrzejewski-Szmek [Mon, 23 Jan 2017 06:11:45 +0000 (01:11 -0500)] 
man: add systemd.environment-generator(7) with two examples

v2:
  - add example files to EXTRA_DIST
v3:
  - rework for the new scheme where nothing is written to disk
v4:
  - use separate dirs for system and user env generators

7 years agomanager: run environment generators
Zbigniew Jędrzejewski-Szmek [Sun, 22 Jan 2017 06:13:47 +0000 (01:13 -0500)] 
manager: run environment generators

Environment file generators are a lot like unit file generators, but not
exactly:

1. environment file generators are run for each manager instance, and their
   output is (or at least can be) individualized.

   The generators themselves are system-wide, the same for all users.

2. environment file generators are run sequentially, in priority order.

Thus, the lifetime of those files is tied to lifecycle of the manager
instance. Because generators are run sequentially, later generators can use or
modify the output of earlier generators.

Each generator is run with no arguments, and the whole state is stored in the
environment variables. The generator can echo a set of variable assignments to
standard output:

  VAR_A=something
  VAR_B=something else

This output is parsed, and the next and subsequent generators run with those
updated variables in the environment. After the last generator is done, the
environment that the manager itself exports is updated.

Each generator must return 0, otherwise the output is ignored.

The generators in */user-env-generator are for the user session managers,
including root, and the ones in */system-env-generator are for pid1.

7 years agoexec-util: implement a set of callbacks to pass variables around
Zbigniew Jędrzejewski-Szmek [Sat, 11 Feb 2017 02:49:01 +0000 (21:49 -0500)] 
exec-util: implement a set of callbacks to pass variables around

Only tests are added, otherwise the new code is unused.

7 years agobasic/env-util: drop _pure_ from static function
Zbigniew Jędrzejewski-Szmek [Sat, 18 Feb 2017 21:23:03 +0000 (16:23 -0500)] 
basic/env-util: drop _pure_ from static function

7 years agoenv-util,fileio: immediately replace variables in load_env_file_push()
Zbigniew Jędrzejewski-Szmek [Sat, 11 Feb 2017 04:08:53 +0000 (23:08 -0500)] 
env-util,fileio: immediately replace variables in load_env_file_push()

strv_env_replace was calling env_match(), which in effect allowed multiple
values for the same key to be inserted into the environment block. That's
pointless, because APIs to access variables only return a single value (the
latest entry), so it's better to keep the block clean, i.e. with just a single
entry for each key.

Add a new helper function that simply tests if the part before '=' is equal in
two strings and use that in strv_env_replace.

In load_env_file_push, use strv_env_replace to immediately replace the previous
assignment with a matching name.

Afaict, none of the callers are materially affected by this change, but it
seems like some pointless work was being done, if the same value was set
multiple times. We'd go through parsing and assigning the value for each
entry. With this change, we handle just the last one.

7 years agobasic/fileio: add helper function for a set of two common checks
Zbigniew Jędrzejewski-Szmek [Sat, 11 Feb 2017 03:14:03 +0000 (22:14 -0500)] 
basic/fileio: add helper function for a set of two common checks

7 years agocore/manager: move environment serialization out to basic/env-util.c
Zbigniew Jędrzejewski-Szmek [Sat, 11 Feb 2017 02:44:21 +0000 (21:44 -0500)] 
core/manager: move environment serialization out to basic/env-util.c

This protocol is generally useful, we might just as well reuse it for the
env. generators.

The implementation is changed a bit: instead of making a new strv and freeing
the old one, just mutate the original. This is much faster with larger arrays,
while in fact atomicity is preserved, since we only either insert the new
entry or not, without being in inconsistent state.

v2:
- fix confusion with return value

7 years agocore/manager: fix grammar in comment
Zbigniew Jędrzejewski-Szmek [Fri, 10 Feb 2017 20:41:42 +0000 (15:41 -0500)] 
core/manager: fix grammar in comment

7 years agobasic/exec-util: add support for synchronous (ordered) execution
Zbigniew Jędrzejewski-Szmek [Sun, 22 Jan 2017 20:22:37 +0000 (15:22 -0500)] 
basic/exec-util: add support for synchronous (ordered) execution

The output of processes can be gathered, and passed back to the callee.
(This commit just implements the basic functionality and tests.)

After the preparation in previous commits, the change in functionality is
relatively simple. For coding convenience, alarm is prepared *before* any
children are executed, and not before. This shouldn't matter usually, since
just forking of the children should be pretty quick. One could also argue that
this is more correct, because we will also catch the case when (for whatever
reason), forking itself is slow.

Three callback functions and three levels of serialization are used:
- from individual generator processes to the generator forker
- from the forker back to the main process
- deserialization in the main process

v2:
- replace an structure with an indexed array of callbacks

7 years agocore/manager: split out creation of serialization fd out to a helper
Zbigniew Jędrzejewski-Szmek [Sat, 11 Feb 2017 23:33:16 +0000 (18:33 -0500)] 
core/manager: split out creation of serialization fd out to a helper

There is a slight change in behaviour: the user manager for root will create a
temporary file in /run/systemd, not /tmp. I don't think this matters, but
simplifies implementation.

7 years agotree-wide: add man: to manpage references (#5402)
Lucas Werkmeister [Mon, 20 Feb 2017 23:45:35 +0000 (00:45 +0100)] 
tree-wide: add man: to manpage references (#5402)

Found with:

    git grep '"[^"]*[a-z0-9]([0-9]\+p\?)' src/ | grep -vF man:

7 years agoSyntax for defines that is also unterstood by the GNU C/C++ compilers. (#5397)
pyBlob [Mon, 20 Feb 2017 21:24:45 +0000 (22:24 +0100)] 
Syntax for defines that is also unterstood by the GNU C/C++ compilers. (#5397)

7 years agosystemctl: Fix condition in start_special() (#5399)
Benjamin Robin [Mon, 20 Feb 2017 21:11:34 +0000 (22:11 +0100)] 
systemctl: Fix condition in start_special() (#5399)

7 years agosd-device: replace lstat() + open() with open(O_NOFOLLOW) 5390/head
Zbigniew Jędrzejewski-Szmek [Sun, 19 Feb 2017 19:17:19 +0000 (14:17 -0500)] 
sd-device: replace lstat() + open() with open(O_NOFOLLOW)

Coverity was complaining about TOCTOU (CID #745806). Indeed, it seems better
to open the file and avoid the stat altogether:

- O_NOFOLLOW means we'll get ELOOP, which we can translate to EINVAL as before,
- similarly, open(O_WRONLY) on a directory will fail with EISDIR,
- and finally, it makes no sense to check access mode ourselves: just let
  the kernel do it and propagate the error.

v2:
- fix memleak, don't clober input arg

7 years agoshared/pager: abort if we cannot set environment variables
Zbigniew Jędrzejewski-Szmek [Sun, 19 Feb 2017 18:52:18 +0000 (13:52 -0500)] 
shared/pager: abort if we cannot set environment variables

This most likely means oom, it's better to exit than to run less with
incomplete settings.

CID #714383.

7 years agocore/execute: add (void)
Zbigniew Jędrzejewski-Szmek [Sun, 19 Feb 2017 18:48:59 +0000 (13:48 -0500)] 
core/execute: add (void)

CID #778045.

7 years agologind: check return value from lseek
Zbigniew Jędrzejewski-Szmek [Sun, 19 Feb 2017 18:43:22 +0000 (13:43 -0500)] 
logind: check return value from lseek

In practice this doesn't matter much because the read that follows will
likely fail, but we'll get a better error message.

CID #1368233.

7 years agoimportd: check setenv return value
Zbigniew Jędrzejewski-Szmek [Sun, 19 Feb 2017 18:39:08 +0000 (13:39 -0500)] 
importd: check setenv return value

CID #1368235.

7 years agocore/killall: add (void)
Zbigniew Jędrzejewski-Szmek [Sun, 19 Feb 2017 18:36:17 +0000 (13:36 -0500)] 
core/killall: add (void)

CID #1368238.

7 years agofirewall-util: add an assert that we're not overwriting a buffer
Zbigniew Jędrzejewski-Szmek [Sun, 19 Feb 2017 18:19:50 +0000 (13:19 -0500)] 
firewall-util: add an assert that we're not overwriting a buffer

Check for CID #1368267.

7 years agoMerge pull request #5392 from keszybz/systemctl-edit
Lennart Poettering [Mon, 20 Feb 2017 15:30:58 +0000 (16:30 +0100)] 
Merge pull request #5392 from keszybz/systemctl-edit

systemctl edit & reboot fixlets

7 years agoInclude 'vendor class identifier option' into DHCPREQUEST message (#5380)
Alexander Galanin [Mon, 20 Feb 2017 09:15:58 +0000 (13:15 +0400)] 
Include 'vendor class identifier option' into DHCPREQUEST message (#5380)

7 years agosystemctl: give a hint about --force --force when communication with manager fails 5392/head
Zbigniew Jędrzejewski-Szmek [Sun, 19 Feb 2017 23:53:10 +0000 (18:53 -0500)] 
systemctl: give a hint about --force --force when communication with manager fails

The hint is not too explicit, and just refers to the man page, because this
option is slightly dangereous. This was we don't have to discuss the limitation
in the hint itself.

Fixes #4002.

7 years agosystemctl: fix hint with edit --global/--user
Zbigniew Jędrzejewski-Szmek [Sun, 19 Feb 2017 22:41:38 +0000 (17:41 -0500)] 
systemctl: fix hint with edit --global/--user

7 years agosystemctl: fix editing of units with no fragment
Zbigniew Jędrzejewski-Szmek [Sun, 19 Feb 2017 22:30:53 +0000 (17:30 -0500)] 
systemctl: fix editing of units with no fragment

"systemctl --user edit --force --full tmp.mount" would crash, when we'd do
basename(NULL). Fix this by creating a new unit or a new override even if
not path is found.

Tested with:
systemctl --user edit --force --full tmp.mount
systemctl --user edit --force tmp.mount
systemctl --user edit foo@.service
systemctl --user edit foo@bar.service
systemctl --user edit --full foo@.service
systemctl --user edit --full foo@bar.service

7 years agosystemctl: when told to edit an instance, do not edit the template
Zbigniew Jędrzejewski-Szmek [Sun, 19 Feb 2017 21:52:09 +0000 (16:52 -0500)] 
systemctl: when told to edit an instance, do not edit the template

Fixes #5383.

7 years agosystemctl: fix error messages (#5389)
Lucas Werkmeister [Sun, 19 Feb 2017 17:03:15 +0000 (18:03 +0100)] 
systemctl: fix error messages (#5389)

7 years agotest: re-drop assumption that /run is a mount point, part 2 (#5386)
Martin Pitt [Sun, 19 Feb 2017 15:15:06 +0000 (16:15 +0100)] 
test: re-drop assumption that /run is a mount point, part 2 (#5386)

Commit cc3901613 only fixed one place, fix the other one too.

7 years agoudev-builtin-net_id: fix warning about discarded "const" attribute (#5385)
Zbigniew Jędrzejewski-Szmek [Sun, 19 Feb 2017 08:00:42 +0000 (03:00 -0500)] 
udev-builtin-net_id: fix warning about discarded "const" attribute (#5385)

7 years agojournalctl: add reference to sd-id128(3) to output (#5382)
Lucas Werkmeister [Sat, 18 Feb 2017 21:36:25 +0000 (22:36 +0100)] 
journalctl: add reference to sd-id128(3) to output (#5382)

SD_ID128_MAKE is clearly not a standard C macro, so let’s point the user
to its documentation to let them know which header they need and what
they can then do with MESSAGE_XYZ.

7 years agoman: sd-id128: fix journalctl option name (#5381)
Lucas Werkmeister [Sat, 18 Feb 2017 21:34:28 +0000 (22:34 +0100)] 
man: sd-id128: fix journalctl option name (#5381)

--new-id works because it’s an unambiguous prefix, but the full option
name is --new-id128.

7 years agoMerge pull request #5369 from poettering/nspawn-resolved
Zbigniew Jędrzejewski-Szmek [Sat, 18 Feb 2017 16:54:34 +0000 (11:54 -0500)] 
Merge pull request #5369 from poettering/nspawn-resolved

fixes for running nspawn+resolved in combination

7 years agounits: order systemd-nspawn@.service after systemd-resolved.service 5369/head
Lennart Poettering [Thu, 16 Feb 2017 16:57:30 +0000 (17:57 +0100)] 
units: order systemd-nspawn@.service after systemd-resolved.service

This way, the nspawn internal check whether resolved is running will
succeed if it is enabled.

Fixes: #4649
7 years agonspawn: tweak check whether resolved is around a bit
Lennart Poettering [Thu, 16 Feb 2017 16:56:10 +0000 (17:56 +0100)] 
nspawn: tweak check whether resolved is around a bit

Let's check D-Bus instead of files in /run to see if resolved is
running. This is a bit nicer as bus names are automatically cleaned up
when resolved dies, which is not the case for files in /run.

See: #4649

7 years agounits: enable resolved bus activation though a symlink in /etc
Lennart Poettering [Thu, 16 Feb 2017 16:48:48 +0000 (17:48 +0100)] 
units: enable resolved bus activation though a symlink in /etc

The change:
-/usr/lib/systemd/system/dbus-org.freedesktop.resolve1.service
+/etc/systemd/system/dbus-org.freedesktop.resolve1.service

If resolved is disabled, without this, talking to the resolved bus API will
activate it regardless whether it is enabled or not, let's fix that.

7 years agotest: re-drop assumption that /run is a mount point (#5377)
Martin Pitt [Fri, 17 Feb 2017 20:29:02 +0000 (21:29 +0100)] 
test: re-drop assumption that /run is a mount point (#5377)

Commit 436e916ea introduced the assumption into test-stat-util that /run
is a tmpfs mount point. This is not the case in build chroots such as
Fedora's mock or Debian's sbuild. So only assert that /run is a tmpfs
and not a btrfs if /run is actually a mount point. This will then still
be asserted with installed tests.

7 years agosystemctl: show extra args if defined (#5379)
Adrián López [Fri, 17 Feb 2017 20:27:45 +0000 (21:27 +0100)] 
systemctl: show extra args if defined (#5379)

7 years agoMerge pull request #5373 from poettering/coredump-timestamp-fixes
Zbigniew Jędrzejewski-Szmek [Fri, 17 Feb 2017 20:23:52 +0000 (15:23 -0500)] 
Merge pull request #5373 from poettering/coredump-timestamp-fixes

various coredump fixes

7 years agoMerge pull request #5347 from poettering/local-nta
Zbigniew Jędrzejewski-Szmek [Fri, 17 Feb 2017 20:00:36 +0000 (15:00 -0500)] 
Merge pull request #5347 from poettering/local-nta

more resolved fixes

7 years agomissing: add renameat2() definition for 64bit arm (#5378)
Lennart Poettering [Fri, 17 Feb 2017 18:10:09 +0000 (19:10 +0100)] 
missing: add renameat2() definition for 64bit arm (#5378)

Following a similar commit in casync:

https://github.com/systemd/casync/pull/10

7 years agoMerge pull request #5275 from ssahani/fix-dropin-net-section
Lennart Poettering [Fri, 17 Feb 2017 17:03:04 +0000 (18:03 +0100)] 
Merge pull request #5275 from ssahani/fix-dropin-net-section

networkd: fix drop-in conf directory configs overwriting each other

7 years agoudev: fix id_net_name_path for virtio-ccw interfaces (#5357)
Viktor Mihajlovski [Fri, 17 Feb 2017 15:18:01 +0000 (16:18 +0100)] 
udev: fix id_net_name_path for virtio-ccw interfaces (#5357)

The CCW id_net_name_path detection didn't account for virtio
interfaces on the CCW bus. As a result the default interface
names for virtio-ccw interfaces would use the old eth<x>
format instead of enc<busid>.

Since virtio-pci interface naming follows the naming rules
of the parent bus, the names_ccw() logic was changed to apply
the CCW interface naming rules to virtio interfaces as well,
e.g. enc2000 for an interface with a CCW bus id 0.0.2000.
As virtio interfaces are apt to get the otherwise unusual
CCW bus id 0.0.0000, the last '0' is now preserved in this
case.

The virtio subsystem skipping loop has been moved from
names_pci() into a function skip_virtio() that can be reused
for all bus types with virtio network devices.

Since virtio-ccw interfaces use single CCW addresses the ccwgroup
requirement was relaxed and the C definitions were changed
accordingly.

7 years agonetwork: change condition in if testing section presence 5275/head
Zbigniew Jędrzejewski-Szmek [Fri, 17 Feb 2017 14:34:25 +0000 (09:34 -0500)] 
network: change condition in if testing section presence

section_line and filename should be set together or not at all. Change the
if to test filename, since it's the first of the pair and it seems more natural
to test that.

7 years agonetworkd: immediately transfer ownership of route->section
Zbigniew Jędrzejewski-Szmek [Fri, 17 Feb 2017 14:26:10 +0000 (09:26 -0500)] 
networkd: immediately transfer ownership of route->section

The code was not incorrect previously, but I think it's easier to follow the
ownership (and the code is more likely to remain correct when updated later on),
if freeing of NetworkConfigSection* is immediately made the responsibility of
route_free(), so instead of relying on route_free() not freeing ->section
if adding to the network hashmap failed, make this freeing unconditional.

7 years agoMerge pull request #5333 from poettering/machined-copy-files-userns
Lennart Poettering [Fri, 17 Feb 2017 12:51:58 +0000 (13:51 +0100)] 
Merge pull request #5333 from poettering/machined-copy-files-userns

machined userns fixes

7 years agoMerge pull request #5366 from poettering/default-hostname-fix
Lennart Poettering [Fri, 17 Feb 2017 12:51:27 +0000 (13:51 +0100)] 
Merge pull request #5366 from poettering/default-hostname-fix

fallback hostname fixes

7 years agoman: document that user namespacing complicates file copies 5333/head
Lennart Poettering [Thu, 16 Feb 2017 13:38:05 +0000 (14:38 +0100)] 
man: document that user namespacing complicates file copies

7 years agocoredump: store the full coredump kernel context in xattrs on the coredump file 5373/head
Lennart Poettering [Fri, 17 Feb 2017 10:34:29 +0000 (11:34 +0100)] 
coredump: store the full coredump kernel context in xattrs on the coredump file

We didn't include the resource limit field, add it.

7 years agocoredump: when reconstructing original kernel coredump context, chop off trailing...
Lennart Poettering [Fri, 17 Feb 2017 10:31:07 +0000 (11:31 +0100)] 
coredump: when reconstructing original kernel coredump context, chop off trailing zeroes

Our coredump handler operates on a "context" supplied by the kernel via
the core_pattern arguments. When we pass off a coredump for processing
to coredumpd we pass along enough information for this context to be
reconstructed. This information is passed in the usual journal fields,
and that means we extended the 1s granularity timestamp to 1µs
granularity by appending 6 zeroes. We need to chop them off again when
reconstructing the original kernel context.

Fixes: #4779
7 years agoudevd: use signal_to_string() instead of strsignal() at one place
Lennart Poettering [Fri, 17 Feb 2017 10:18:22 +0000 (11:18 +0100)] 
udevd: use signal_to_string() instead of strsignal() at one place

strsignal() sucks, as it tries to generate human readable strings from
something that isn't really human readable by concept. Let's use
signal_to_string() instead, making this more grokkable. Difference is:
SIGINT gets translated → "SIGINT" rather than → "Interrupted".

7 years agocoredump: include signal name in journal metadata
Lennart Poettering [Fri, 17 Feb 2017 10:10:35 +0000 (11:10 +0100)] 
coredump: include signal name in journal metadata

(Note that we only do this for the journal metadata, not for the xattrs,
as the xattrs are only supposed to store the original 1:1 info we
acquired from the kernel.)

7 years agocoredump: fix handling of special crashes
Lennart Poettering [Fri, 17 Feb 2017 09:59:21 +0000 (10:59 +0100)] 
coredump: fix handling of special crashes

When we encounter a "special" crash we should not continue processing it
the usual way.

7 years agoresolved: try to authenticate SOA on negative replies 5347/head
Lennart Poettering [Wed, 15 Feb 2017 19:05:27 +0000 (20:05 +0100)] 
resolved: try to authenticate SOA on negative replies

For caching negative replies we need the SOA TTL information. Hence,
let's authenticate all auxiliary SOA RRs through DS requests on all
negative requests.

7 years agoresolved: extend various timeouts
Lennart Poettering [Wed, 15 Feb 2017 18:56:59 +0000 (19:56 +0100)] 
resolved: extend various timeouts

Let's increase a number of timeouts as they apparently are too short for
some real-world lookups.

See:

https://github.com/systemd/systemd/issues/4003#issuecomment-279842616

In particular we change the following timeouts:

1) The first UDP retry we increase 500ms → 750ms. This is a good idea,
   since some servers need relatively long responses for trivial lookups,
   and giving up our first attempt also has the effect of trying a
   different server for the next attempt which has the side effect that
   we'll run two down-grade iterations in parallel, on both servers.
   Hence, let's give servers a bit more time in the first iteration.

2) Permit 24 retries instead of just 16 per transactions. If we end up
   downgrading all the way down to UDP for a lookup we already need 5
   iterations for that. If we want permit a couple of lost packages for
   each (let's say 4), then we already need 20 iterations.

3) Increase the overall query timeout on the service side to 60s (from
   45s), simply because very long and slow DNSSEC + CNAME chains (such as
   us.ynuf.alipay.com) hit this boundary too easily. The client side
   timeout for the bus method call is increased to 90s, in order to have
   room for the dbus reply to go through

7 years agoresolved: initialize all return values on successful exit of dns_cache_lookup()
Lennart Poettering [Wed, 15 Feb 2017 18:55:34 +0000 (19:55 +0100)] 
resolved: initialize all return values on successful exit of dns_cache_lookup()

Following our coding style on success we should initialize all return
parameters of a function. We missed to cases for dns_cache_lookup() (but
covered all others), fix them too.

7 years agoresolved: show rcode in debug output for incoming replies
Lennart Poettering [Wed, 15 Feb 2017 18:54:32 +0000 (19:54 +0100)] 
resolved: show rcode in debug output for incoming replies

This is the most important piece of information of replies, hence show
this in the first log message about it.

(Wireshark shows it too in the short summary, hence this definitely
makes sense...)

7 years agoresolved: don't downgrade feature level if we get RCODE on UDP level
Lennart Poettering [Wed, 15 Feb 2017 17:53:25 +0000 (18:53 +0100)] 
resolved: don't downgrade feature level if we get RCODE on UDP level

Retrying a transaction via TCP is a good approach for mitigating
packet loss. However, it's not a good away way to fix a bad RCODE if we
already downgraded to UDP level for it. Hence, don't do this.

This is a small tweak only, but shortens the time we spend on
downgrading when a specific domain continously returns a bad rcode.

7 years agoresolved: cache SERVFAIL responses for 30s
Lennart Poettering [Wed, 15 Feb 2017 17:28:23 +0000 (18:28 +0100)] 
resolved: cache SERVFAIL responses for 30s

Some domains (such as us.ynuf.alipay.com) almost appear as if they actively
want to sabotage our DNSSEC work. Specifically, they unconditionally
return SERVFAIL on SOA lookups and always only after a 1s delay (at
least). This is pretty bad for our validation logic, as we use SOA
lookups to distuingish zones from non-terminal names. Moreover, SERVFAIL
is an error that is typically returned if we send requests a server
doesn't grok, and thus is reason for us to downgrade our protocol and
try again. In case of these zones this means we'll accept the SERVFAIL
response only after a full iterative downgrade to our lowest feature
level: TCP. In combination with the 1s delays this has the effect of
making us hit our transaction timeout way to easily.

As first attempt to improve the situation: let's start caching SERVFAIL
responses in our cache, after the full downgrade for a short period of
time.

Conceptually this is exposed as "weird rcode" caching, but for now we
only consider SERVFAIL a "weird rcode" worthy of caching. Later on we
might want to add more.

7 years agoresolved: lengthen timeout for TCP transactions
Lennart Poettering [Wed, 15 Feb 2017 17:24:46 +0000 (18:24 +0100)] 
resolved: lengthen timeout for TCP transactions

When we are doing a TCP transaction the kernel will automatically resend
all packets for us, there's no need to do that ourselves. Hence:
increase the timeout for TCP transactions substantially, to give the
kernel enough time to connect to the peer, without interrupting it when
we become impatient.

7 years agoresolved: when DNSSEC mode is disabled, don't go beyond EDNS0 feature level
Lennart Poettering [Wed, 15 Feb 2017 15:01:53 +0000 (16:01 +0100)] 
resolved: when DNSSEC mode is disabled, don't go beyond EDNS0 feature level

There's no point in talking to a server in DNSSEC mode when we don't
actually want to verify anything.

See: #5352

7 years agoresolved: when accepted a query candidate as final answer, propagate authentication...
Lennart Poettering [Wed, 15 Feb 2017 14:29:05 +0000 (15:29 +0100)] 
resolved: when accepted a query candidate as final answer, propagate authentication bool even on failure

Let's make sure that if we accept a query candidate, then let's also
propagate the authenticated flag for it, so that we can properly report
back to the clients whether lookups failed due to non-existance that can
be proven.

7 years agoresolved: propagate AD bit for NXDOMAIN into stub replies
Lennart Poettering [Wed, 15 Feb 2017 14:13:32 +0000 (15:13 +0100)] 
resolved: propagate AD bit for NXDOMAIN into stub replies

When we managed to prove non-existance of a name, then we should
properly propagate this to clients by setting the AD bit on NXDOMAIN.

See: #4621

7 years agoresolved: automatically downgrade reply bits on send
Lennart Poettering [Tue, 14 Feb 2017 18:25:47 +0000 (19:25 +0100)] 
resolved: automatically downgrade reply bits on send

Doesn't really change anything, but makes things a bit simpler to read.

7 years agoresolved: when the dns server feature level grace period elapses, flush caches
Lennart Poettering [Tue, 14 Feb 2017 17:20:34 +0000 (18:20 +0100)] 
resolved: when the dns server feature level grace period elapses, flush caches

The cache might contain all kinds of unauthenticated data that we really
shouldn't be using if we upgrade our feature level and suddenly are able
to get authenticated data again.

Might fix: #4866

7 years agoresolved: fix NSEC proofs for missing TLDs
Lennart Poettering [Tue, 14 Feb 2017 16:54:30 +0000 (17:54 +0100)] 
resolved: fix NSEC proofs for missing TLDs

For the wildcard NSEC check we need to generate an "asterisk" domain, by
prepend the common ancestor with "*.". So far we did that with a simple
strappenda() which is fine for most domains, but doesn't work if the
common ancestor is the root domain as we usually write that as "." in
normalized form, and "*." joined with "." is "*.." and not "*." as it
should be.

Hence, use the clean way out, let's just use dns_name_concat() which
only exists precisely for this reason, to properly concatenate labels.

There's a good chance this actually fixes #5029, as this NSEC proof is
triggered by lookups in the TLD "example", which doesn't exist in the
Internet.

7 years agoresolved: make sure configured NTAs affect subdomains too
Lennart Poettering [Tue, 14 Feb 2017 16:28:17 +0000 (17:28 +0100)] 
resolved: make sure configured NTAs affect subdomains too

This ensures that configured NTAs exclude not only the listed domain but
also all domains below it from DNSSEC validation -- except if a positive
trust anchor is defined below (as suggested by RFC7647, section 1.1)

Fixes: #5048
7 years agomachined: refuse bind mounts on containers that have user namespaces applied
Lennart Poettering [Thu, 16 Feb 2017 12:59:13 +0000 (13:59 +0100)] 
machined: refuse bind mounts on containers that have user namespaces applied

As the kernel won't map the UIDs this is simply not safe, and hence we
should generate a clean error and refuse it.

We can restore this feature later should a "shiftfs" become available in
the kernel.

7 years agomachined: properly propagate long-running operation errors
Lennart Poettering [Mon, 13 Feb 2017 18:39:31 +0000 (19:39 +0100)] 
machined: properly propagate long-running operation errors

Actually initialize the "error" structure with the error we got

7 years agomachined: when copying files from/to userns containers chown to root
Lennart Poettering [Mon, 13 Feb 2017 18:24:01 +0000 (19:24 +0100)] 
machined: when copying files from/to userns containers chown to root

This changes the file copy logic of machined to set the UID/GID of all
copied files to 0 if the host and container do not share the same user
namespace.

Fixes: #4078
7 years agocopy: change the various copy_xyz() calls to take a unified flags parameter
Lennart Poettering [Mon, 13 Feb 2017 18:00:22 +0000 (19:00 +0100)] 
copy: change the various copy_xyz() calls to take a unified flags parameter

This adds a unified "copy_flags" parameter to all copy_xyz() function
calls, replacing the various boolean flags so far used. This should make
many invocations more readable as it is clear what behaviour is
precisely requested. This also prepares ground for adding support for
more modes later on.

7 years agomachinectl: tweak address output in "machinectl status"
Lennart Poettering [Mon, 13 Feb 2017 16:23:58 +0000 (17:23 +0100)] 
machinectl: tweak address output in "machinectl status"

With this change we'll not show an "Addresses" field for machines that
we don't know any addresses for.

This changes print_addresses() to never suffix its output with a
newline, leaving that to the caller. That's a good idea since depending
on who the caller is, different rules apply: if no addresses are found,
then the list view still wants a newline, but the status view does not.

This also changes the function to return the number of found addresses,
which can be used to decide when to add a newline or not.

7 years agomachined: expose "UID shift" concept for containers
Lennart Poettering [Fri, 10 Feb 2017 18:44:09 +0000 (19:44 +0100)] 
machined: expose "UID shift" concept for containers

UID/GID mapping with userns can be arbitrarily complex. Let's break this
down to a single admin-friendly parameter: let's expose the UID/GID
shift of a container via a new bus call for each container, and let's
show this as part of "machinectl status" if it is not 0.

This should work for pretty much all real-life full OS container setups
(i.e. the stuff machined is suppose to be useful for).  For everything
else we generate a clean error, clarifying that we can't expose the
mapping.

7 years agoresolved: default to the compile-time fallback hostname 5366/head
Lennart Poettering [Thu, 16 Feb 2017 11:04:51 +0000 (12:04 +0100)] 
resolved: default to the compile-time fallback hostname

This changes resolved to use the compile-time fallback hostname the
configured one is not set. Note that if the local hostname is set to
"localhost" then we'll instead default to "linux" here, as for
mDNS/LLMNR exposing "localhost" is actively dangerous.

7 years agocore: when booting up, initialize hostname to compile-time fallback hostname
Lennart Poettering [Thu, 16 Feb 2017 11:03:39 +0000 (12:03 +0100)] 
core: when booting up, initialize hostname to compile-time fallback hostname

When /etc/hostname isn't set, default to the configured compile-time
fallback hostname instead of "localhost" for the kernel hostname.

7 years agohostname-util: default to the compile time default hostname in gethostname_malloc()
Lennart Poettering [Thu, 16 Feb 2017 11:02:17 +0000 (12:02 +0100)] 
hostname-util: default to the compile time default hostname in gethostname_malloc()

Currently, if the hostname is not set gethostname_malloc() defaults to
the "sysname", which is "linux" on Linux. Let's change that to also
honour the compile-time fallback hostname as specified on the configure
command line.

7 years agoMerge pull request #5338 from mbiebl/fix-install-tests-target
Evgeny Vereshchagin [Fri, 17 Feb 2017 08:38:23 +0000 (11:38 +0300)] 
Merge pull request #5338 from mbiebl/fix-install-tests-target

Fix "make install-tests" when srcdir != builddir, fix valgrind-tests

7 years agoExport NVMe WWID udev attribute (#5348)
Keith Busch [Fri, 17 Feb 2017 07:46:06 +0000 (00:46 -0700)] 
Export NVMe WWID udev attribute (#5348)

We need this for multipath support without relying on NVMe to SCSI
translations.

Signed-off-by: Keith Busch <keith.busch@intel.com>
7 years agovirt: Update cache if the detected vm is virtualbox (#5364)
Benjamin Robin [Fri, 17 Feb 2017 07:45:30 +0000 (08:45 +0100)] 
virt: Update cache if the detected vm is virtualbox (#5364)

7 years agoman: mention machines.target in systemd.special(7) (#5371)
Zbigniew Jędrzejewski-Szmek [Fri, 17 Feb 2017 07:44:26 +0000 (02:44 -0500)] 
man: mention machines.target in systemd.special(7) (#5371)

Also sort <refsynopsisdiv>.

7 years agobuild-sys: drop now-unneeded $SYSTEMD_TEST_DATA when running tests 5338/head
Zbigniew Jędrzejewski-Szmek [Fri, 17 Feb 2017 04:00:03 +0000 (23:00 -0500)] 
build-sys: drop now-unneeded $SYSTEMD_TEST_DATA when running tests

7 years agotest: drop TEST_DATA_DIR, fold into get_testdata_dir()
Martin Pitt [Wed, 15 Feb 2017 22:37:25 +0000 (23:37 +0100)] 
test: drop TEST_DATA_DIR, fold into get_testdata_dir()

Drop the TEST_DATA_DIR macro as this was using alloca() within a
function call which is allegedly unsafe. So add a "suffix" argument to
get_testdata_dir() instead and call that directly.

7 years agotest: show error message if $SYSTEMD_TEST_DATA does not exist
Martin Pitt [Wed, 15 Feb 2017 07:52:17 +0000 (08:52 +0100)] 
test: show error message if $SYSTEMD_TEST_DATA does not exist

Rename get_exe_relative_testdata_dir() to get_testdata_dir() and move
the env var check into that, so that everything interesting happens at
the same place.

7 years agotests: look for tests relative to source dir when running from build dir
Zbigniew Jędrzejewski-Szmek [Wed, 15 Feb 2017 00:43:51 +0000 (19:43 -0500)] 
tests: look for tests relative to source dir when running from build dir

automake helpfully sets a few variables for during build. When our executable
is in a directory underneath $(abs_top_builddir), we know that we're in the
build environment $(abs_top_srcdir) contains the sources, and test data is
under $(abs_top_srcdir)/test. This remains true no matter where the build
directory is relative to the source directory. It also works if the test
executable is invoked as ./test-whatever or .libs/test-whatever, since the
relative path is not used at all.

When running from outside of the build directory, we should be running from the
installed location and we can look for ../testdata relative to the location of
the exe file.

Of course, $SYSTEMD_TEST_DATA always overrides this logic.