platform/upstream/systemd.git
5 years agolibudev: accept NULL as the argument 'struct udev*' for udev_monitor_new() or friends
Yu Watanabe [Wed, 22 Aug 2018 04:15:46 +0000 (13:15 +0900)]
libudev: accept NULL as the argument 'struct udev*' for udev_monitor_new() or friends

As udev_monitor struct or friends are now almost independent of udev
struct. So, generating these objects without udev struct is reasonable.

5 years agocore: add IODeviceLatencyTargetSec
Tejun Heo [Wed, 13 Jun 2018 21:16:35 +0000 (14:16 -0700)]
core: add IODeviceLatencyTargetSec

This adds support for the following proposed latency based IO control
mechanism.

  https://lkml.org/lkml/2018/6/5/428

5 years agoselinux-util: drop unused variables
Yu Watanabe [Wed, 22 Aug 2018 14:19:32 +0000 (23:19 +0900)]
selinux-util: drop unused variables

Follow-up for 7e531a5265687aef5177b070c36ca4ceab42e768.

5 years agoman: correct journald field name
Chris Morin [Wed, 22 Aug 2018 13:04:27 +0000 (15:04 +0200)]
man: correct journald field name

5 years agoMerge pull request #9903 from yuwata/fuzzer-10007
Yu Watanabe [Wed, 22 Aug 2018 13:25:38 +0000 (22:25 +0900)]
Merge pull request #9903 from yuwata/fuzzer-10007

Fixes issue 10007 by oss-fuzz

5 years agotest: add testcase for issue 10007 by oss-fuzz
Yu Watanabe [Wed, 22 Aug 2018 03:39:40 +0000 (12:39 +0900)]
test: add testcase for issue 10007 by oss-fuzz

5 years agoutil: do not use stack frame for parsing arbitrary inputs
Yu Watanabe [Wed, 22 Aug 2018 03:33:27 +0000 (12:33 +0900)]
util: do not use stack frame for parsing arbitrary inputs

This replaces strndupa() by strndup() in socket_address_parse(),
as input string may be too long.

Fixes issue 10007 by ClusterFuzz-External:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10007

5 years agoMerge pull request #9852 from poettering/namespace-errno
Yu Watanabe [Wed, 22 Aug 2018 02:16:29 +0000 (11:16 +0900)]
Merge pull request #9852 from poettering/namespace-errno

namespace: be more careful when handling namespacing failures

5 years agorandom-util: use RDRAND for randomness if the kernel doesn't want to give us any
Lennart Poettering [Thu, 26 Jul 2018 08:42:01 +0000 (10:42 +0200)]
random-util: use RDRAND for randomness if the kernel doesn't want to give us any

Pretty much all intel cpus have had RDRAND in a long time. While
CPU-internal RNG are widely not trusted, for seeding hash tables it's
perfectly OK to use: we don't high quality entropy in that case, hence
let's use it.

This is only hooked up with 'high_quality_required' is false. If we
require high quality entropy the kernel is the only source we should
use.

5 years agoman: document that most sandboxing options are best effort only
Lennart Poettering [Fri, 10 Aug 2018 13:26:32 +0000 (15:26 +0200)]
man: document that most sandboxing options are best effort only

5 years agonamespace: be more careful when handling namespacing failures gracefully
Lennart Poettering [Fri, 10 Aug 2018 13:07:14 +0000 (15:07 +0200)]
namespace: be more careful when handling namespacing failures gracefully

This makes two changes to the namespacing code:

1. We'll only gracefully skip service namespacing on access failure if
   exclusively sandboxing options where selected, and not mount-related
   options that result in a very different view of the world. For example,
   ignoring RootDirectory=, RootImage= or Bind= is really probablematic,
   but ReadOnlyPaths= is just a weaker sandbox.

2. The namespacing code will now return a clearly recognizable error
   code when it cannot enforce its namespacing, so that we cannot
   confuse EPERM errors from mount() with those from unshare(). Only the
   errors from the first unshare() are now taken as hint to gracefully
   disable namespacing.

Fixes: #9844 #9835

5 years agoumount: Don't use options from fstab on remount
aszlig [Mon, 20 Aug 2018 03:33:58 +0000 (05:33 +0200)]
umount: Don't use options from fstab on remount

The fstab entry may contain comment/application-specific options, like
for example x-systemd.automount or x-initrd.mount.

With the recent switch to libmount, the mount options during remount are
now gathered via mnt_fs_get_options(), which returns the merged fstab
options with the effective options in mountinfo.

Unfortunately if one of these application-specific options are set in
fstab, the remount will fail with -EINVAL.

In systemd 238:

  Remounting '/test-x-initrd-mount' read-only in with options
  'errors=continue,user_xattr,acl'.

In systemd 239:

  Remounting '/test-x-initrd-mount' read-only in with options
  'errors=continue,user_xattr,acl,x-initrd.mount'.
  Failed to remount '/test-x-initrd-mount' read-only: Invalid argument

So instead of using mnt_fs_get_options(), we're now using both
mnt_fs_get_fs_options() and mnt_fs_get_vfs_options() and merging the
results together so we don't get any non-relevant options from fstab.

Signed-off-by: aszlig <aszlig@nix.build>
5 years agotmpfiles: use fd_get_path() even less excessively
Franck Bui [Mon, 20 Aug 2018 15:23:12 +0000 (17:23 +0200)]
tmpfiles: use fd_get_path() even less excessively

A follow-up for commit 9d874aec451b591401d9b14cf8743b9d179159b2.

This patch makes "path" parameter mandatory in fd_set_*() helpers removing the
need to use fd_get_path() when NULL was passed. The caller is supposed to pass
the fd anyway so assuming that it also knows the path should be safe.

Actually, the only case where this was useful (or used) was when we were
walking through directory trees (in item_do()). But even in those cases the
paths could be constructed trivially, which is still better than relying on
fd_get_path() (which is an ugly API).

A very succinct test case is also added for 'z/Z' operators so the code dealing
with recursive operators is tested minimally.

5 years agoMerge pull request #9712 from filbranden/socket1
Zbigniew Jędrzejewski-Szmek [Tue, 21 Aug 2018 17:45:44 +0000 (19:45 +0200)]
Merge pull request #9712 from filbranden/socket1

socket-util: Introduce send_one_fd_iov() and receive_one_fd_iov()

5 years agoMerge pull request #9783 from poettering/get-user-creds-flags
Zbigniew Jędrzejewski-Szmek [Tue, 21 Aug 2018 08:09:33 +0000 (10:09 +0200)]
Merge pull request #9783 from poettering/get-user-creds-flags

beef up get_user_creds() a bit and other improvements

5 years agoMerge pull request #9811 from poettering/random-seed-tweaks
Zbigniew Jędrzejewski-Szmek [Tue, 21 Aug 2018 08:08:58 +0000 (10:08 +0200)]
Merge pull request #9811 from poettering/random-seed-tweaks

some random seed handling tweaks

5 years agoMerge pull request #9853 from poettering/uneeded-queue
Zbigniew Jędrzejewski-Szmek [Tue, 21 Aug 2018 08:06:30 +0000 (10:06 +0200)]
Merge pull request #9853 from poettering/uneeded-queue

rework StopWhenUnneeded=1 logic

5 years agomeson: rename -Ddebug to -Ddebug-extra
Zbigniew Jędrzejewski-Szmek [Sun, 19 Aug 2018 17:11:30 +0000 (19:11 +0200)]
meson: rename -Ddebug to -Ddebug-extra

Meson added -Doptimization and -Ddebug options, which obviously causes
a conflict with our -Ddebug options. Let's rename it.

Fixes #9883.

5 years agoRename USER_CREDS_SYNTHESIZE_FALLBACK to …_PREFER_NSS
Zbigniew Jędrzejewski-Szmek [Mon, 20 Aug 2018 14:06:41 +0000 (16:06 +0200)]
Rename USER_CREDS_SYNTHESIZE_FALLBACK to …_PREFER_NSS

5 years agouser-util: rework get_user_creds()
Lennart Poettering [Thu, 2 Aug 2018 16:36:47 +0000 (18:36 +0200)]
user-util: rework get_user_creds()

Let's fold get_user_creds_clean() into get_user_creds(), and introduce a
flags argument for it to select "clean" behaviour. This flags parameter
also learns to other new flags:

- USER_CREDS_SYNTHESIZE_FALLBACK: in this mode the user records for
  root/nobody are only synthesized as fallback. Normally, the synthesized
  records take precedence over what is in the user database.  With this
  flag set this is reversed, and the user database takes precedence, and
  the synthesized records are only used if they are missing there. This
  flag should be set in cases where doing NSS is deemed safe, and where
  there's interest in knowing the correct shell, for example if the
  admin changed root's shell to zsh or suchlike.

- USER_CREDS_ALLOW_MISSING: if set, and a UID/GID is specified by
  numeric value, and there's no user/group record for it accept it
  anyway. This allows us to fix #9767

This then also ports all users to set the most appropriate flags.

Fixes: #9767

[zj: remove one isempty() call]

5 years agonetworkd: add O_CLOEXEC where it's missing
Lennart Poettering [Thu, 2 Aug 2018 17:10:01 +0000 (19:10 +0200)]
networkd: add O_CLOEXEC where it's missing

5 years agonspawn: add two missing OOM checks
Lennart Poettering [Thu, 2 Aug 2018 15:57:56 +0000 (17:57 +0200)]
nspawn: add two missing OOM checks

5 years agonspawn: make sure to create /dev/char/x:y symlinks in nspawn containers too
Lennart Poettering [Thu, 2 Aug 2018 15:58:13 +0000 (17:58 +0200)]
nspawn: make sure to create /dev/char/x:y symlinks in nspawn containers too

On the host udev creates these, but they are useful API, hence create
them in nspawn containers too.

5 years agonamespace: when creating device nodes, also create /dev/char/* symlinks
Lennart Poettering [Thu, 2 Aug 2018 15:43:49 +0000 (17:43 +0200)]
namespace: when creating device nodes, also create /dev/char/* symlinks

On the host these symlinks are created by udev, and we consider them API
and make use of them ourselves at various places. Hence when running a
private /dev, also create these symlinks so that lookups by major/minor
work in such an environment, too.

5 years agoMerge pull request #9801 from yuwata/analyze-cleanups
Zbigniew Jędrzejewski-Szmek [Mon, 20 Aug 2018 11:12:53 +0000 (13:12 +0200)]
Merge pull request #9801 from yuwata/analyze-cleanups

analyze: several improvements

5 years agoMerge pull request #9809 from poettering/tmpfiles-cleanup
Zbigniew Jędrzejewski-Szmek [Mon, 20 Aug 2018 10:51:57 +0000 (12:51 +0200)]
Merge pull request #9809 from poettering/tmpfiles-cleanup

various tmpfiles fixes

5 years agorandom-seed: write the machine ID into /dev/urandom as well
Lennart Poettering [Mon, 6 Aug 2018 13:58:16 +0000 (15:58 +0200)]
random-seed: write the machine ID into /dev/urandom as well

This is some extra protection for sloppy "golden master" systems, where
images are duplicated many times but the random seed is not
deleted (or reset for each copy). That golden master systems have to
reset /etc/machine-id is better known, and easier to notice (as having
the same ID will result in address conflicts and suchlike quite often).
Hence let's write the machine ID into /dev/urandom, in case it has been
initialized and unlikely the stored random seed has been provisioned
differently on each image.

Note that we don't credit the entropy either way, hence in the case
there's a cycle of a) generating the machine-id early at boot and b)
writing it back into /dev/urandom late at boot it shouldn't matter. It's
never going to make things worse, just in a few cases better.

5 years agocore: when setting up PAM, try to get tty of STDIN_FILENO if not set explicitly
Lennart Poettering [Fri, 3 Aug 2018 19:30:16 +0000 (21:30 +0200)]
core: when setting up PAM, try to get tty of STDIN_FILENO if not set explicitly

When stdin/stdout/stderr is initialized from an fd, let's read the tty
name of it if we can, and pass that to PAM.

This makes sure that "machinectl shell" sessions have proper TTY fields
initialized that "loginctl" then shows.

5 years agotree-wide: add clickable man page link to all --help texts
Lennart Poettering [Thu, 9 Aug 2018 08:32:31 +0000 (10:32 +0200)]
tree-wide: add clickable man page link to all --help texts

This is a bit like the info link in most of GNU's --help texts, but we
don't do info but man pages, and we make them properly clickable on
terminal supporting that, because awesome.

I think it's generally advisable to link up our (brief) --help texts and
our (more comprehensive) man pages a bit, so this should be an easy and
straight-forward way to do it.

5 years agocore: rename function to better reflect semantics
Zbigniew Jędrzejewski-Szmek [Mon, 20 Aug 2018 08:43:31 +0000 (10:43 +0200)]
core: rename function to better reflect semantics

5 years agoutil: improve comments why we ignore EACCES and EPERM
Yu Watanabe [Sat, 11 Aug 2018 13:47:22 +0000 (22:47 +0900)]
util: improve comments why we ignore EACCES and EPERM

Follow-up for ef454fd1936813fa45d3e3b459d43fa30be7bf49 (#9848).

5 years agohwdb: explicitly label the XP-PEN STAR 06 as tablet
Peter Hutterer [Tue, 14 Aug 2018 02:59:06 +0000 (12:59 +1000)]
hwdb: explicitly label the XP-PEN STAR 06 as tablet

Exports BTN_LEFT...BTN_FORWARD, BTN_TOUCH, REL_X/Y/WHEEL/MISC and
ABS_X/Y/PRESSURE. Rather than figure out what builtin-input_id tweak we need
for this device, just add the tablet bit.

https://gitlab.freedesktop.org/xorg/driver/xf86-input-libinput/issues/8

5 years agohwdb: Fix wlan keycode for all Dell Latitude and Precision systems
Shih-Yuan Lee (FourDollars) [Tue, 14 Aug 2018 10:40:37 +0000 (18:40 +0800)]
hwdb: Fix wlan keycode for all Dell Latitude and Precision systems

Removing this line is because cab01e9ecf1c69656785e64f5fc94cd4ed09e57f
has contained the wlan keycode fix.

This line will only break the wlan keycode for all Dell Latitude and
Precision systems after cab01e9ecf1c69656785e64f5fc94cd4ed09e57f.

5 years agoshell-completion: replace "gdb" verb with "debug" for coredumpctl
Jan Pokorný [Thu, 16 Aug 2018 16:23:16 +0000 (18:23 +0200)]
shell-completion: replace "gdb" verb with "debug" for coredumpctl

Also offer --debugger option.  Both to reflect changes in v239.

5 years agoRevert "sysctl.d: request ECN on both in and outgoing connections"
Thomas Hindoe Paaboel Andersen [Fri, 17 Aug 2018 19:31:05 +0000 (21:31 +0200)]
Revert "sysctl.d: request ECN on both in and outgoing connections"

Turning on ECN still causes slow or broken network on linux. Our tcp
is not yet ready for wide spread use of ECN.

This reverts commit 919472741dba6ad0a3f6c2b76d390a02d0e2fdc3.

5 years agoMerge pull request #9879 from evverx/get-rid-of-workaround
Yu Watanabe [Fri, 17 Aug 2018 15:11:58 +0000 (00:11 +0900)]
Merge pull request #9879 from evverx/get-rid-of-workaround

 oss-fuzz.sh: just install the shared library

5 years agoresolvectl: free the block of memory 'hashed' points to before reusing it
Evgeny Vereshchagin [Thu, 16 Aug 2018 06:48:06 +0000 (06:48 +0000)]
resolvectl: free the block of memory 'hashed' points to before reusing it

This fixes a memory leak:
```
d5070e2f67ededca022f81f2941900606b16f3196b2268e856295f59._openpgpkey.gmail.com: resolve call failed: 'd5070e2f67ededca022f81f2941900606b16f3196b2268e856295f59._openpgpkey.gmail.com' not found

=================================================================
==224==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 65 byte(s) in 1 object(s) allocated from:
    #0 0x7f71b0878850 in malloc (/usr/lib64/libasan.so.4+0xde850)
    #1 0x7f71afaf69b0 in malloc_multiply ../src/basic/alloc-util.h:63
    #2 0x7f71afaf6c95 in hexmem ../src/basic/hexdecoct.c:62
    #3 0x7f71afbb574b in string_hashsum ../src/basic/gcrypt-util.c:45
    #4 0x56201333e0b9 in string_hashsum_sha256 ../src/basic/gcrypt-util.h:30
    #5 0x562013347b63 in resolve_openpgp ../src/resolve/resolvectl.c:908
    #6 0x562013348b9f in verb_openpgp ../src/resolve/resolvectl.c:944
    #7 0x7f71afbae0b0 in dispatch_verb ../src/basic/verbs.c:119
    #8 0x56201335790b in native_main ../src/resolve/resolvectl.c:2947
    #9 0x56201335880d in main ../src/resolve/resolvectl.c:3087
    #10 0x7f71ad8fcf29 in __libc_start_main (/lib64/libc.so.6+0x20f29)

SUMMARY: AddressSanitizer: 65 byte(s) leaked in 1 allocation(s).
```

5 years agooss-fuzz.sh: just install the shared library
Evgeny Vereshchagin [Thu, 16 Aug 2018 02:06:35 +0000 (02:06 +0000)]
oss-fuzz.sh: just install the shared library

The workaround is no longer necessary, because the scripts
checking fuzzers have stopped going down to the subdirectories
of $OUT and started to look for the string "LLVMFuzzerTestOneInput"
to tell fuzzers and random binaries apart. Some more details can be
found at https://github.com/google/oss-fuzz/issues/1566.

5 years agoMerge pull request #9863 from evverx/issues-found-by-journald-fuzzer
Yu Watanabe [Mon, 13 Aug 2018 11:57:25 +0000 (20:57 +0900)]
Merge pull request #9863 from evverx/issues-found-by-journald-fuzzer

A few fixes for several issues uncovered with a home-brew fuzzer for journald

5 years agoresolved: do not keep dns_server to dns_stream ref if tls connection failed (#9855)
Iwan Timmer [Mon, 13 Aug 2018 06:20:25 +0000 (08:20 +0200)]
resolved: do not keep dns_server to dns_stream ref if tls connection failed (#9855)

The references to the dns_server are now setup after the tls connection is setup.
This ensures that the stream got fully stopped when the initial tls setup failed
instead of having the unref being blocked by the reference to the stream by the server.
Therefore on_stream_io would no longer be called with a half setup encrypted connection.

Fixes the issue reported in #9838.

5 years agoresolve: do not hit CNAME or DNAME entry in NODATA cache (#9836)
Yu Watanabe [Mon, 13 Aug 2018 05:32:33 +0000 (14:32 +0900)]
resolve: do not hit CNAME or DNAME entry in NODATA cache (#9836)

Fixes #9833.

5 years agofsck: use our usual syntax for defining bit masks
Lennart Poettering [Fri, 10 Aug 2018 13:12:14 +0000 (15:12 +0200)]
fsck: use our usual syntax for defining bit masks

5 years agoupdate TODO
Lennart Poettering [Fri, 10 Aug 2018 14:20:42 +0000 (16:20 +0200)]
update TODO

5 years agocore: rework StopWhenUnneeded= logic
Lennart Poettering [Thu, 9 Aug 2018 14:26:27 +0000 (16:26 +0200)]
core: rework StopWhenUnneeded= logic

Previously, we'd act immediately on StopWhenUnneeded= when a unit state
changes. With this rework we'll maintain a queue instead: whenever
there's the chance that StopWhenUneeded= might have an effect we enqueue
the unit, and process it later when we have nothing better to do.

This should make the implementation a bit more reliable, as the unit notify event
cannot immediately enqueue tons of side-effect jobs that might
contradict each other, but we do so only in a strictly ordered fashion,
from the main event loop.

This slightly changes the check when to consider a unit "unneeded".
Previously, we'd assume that a unit in "deactivating" state could also
be cleaned up. With this new logic we'll only consider units unneeded
that are fully up and have no job queued. This means that whenever
there's something pending for a unit we won't clean it up.

5 years agoMerge pull request #9848 from yuwata/fix-9835-9844
Zbigniew Jędrzejewski-Szmek [Fri, 10 Aug 2018 13:36:34 +0000 (15:36 +0200)]
Merge pull request #9848 from yuwata/fix-9835-9844

core: namespace fixes

5 years agojournald: take leading spaces into account in syslog_parse_identifier
Evgeny Vereshchagin [Fri, 10 Aug 2018 12:55:09 +0000 (12:55 +0000)]
journald: take leading spaces into account in syslog_parse_identifier

This is a kind of follow-up to e88baee88fad8bc59d3 which should finally fix
the issue which that commit was supposed to fix.

5 years agojournald: free the allocated memory before returning from dev_kmsg_record
Evgeny Vereshchagin [Fri, 10 Aug 2018 12:52:07 +0000 (12:52 +0000)]
journald: free the allocated memory before returning from dev_kmsg_record

This fixes a minor memory leak.

5 years agojournald: make it clear that dev_kmsg_record modifies the string passed to it
Evgeny Vereshchagin [Fri, 10 Aug 2018 12:45:42 +0000 (12:45 +0000)]
journald: make it clear that dev_kmsg_record modifies the string passed to it

The function replaces a couple commas, a semicolon and the final newline with
zero bytes in the string passed to it. The 'const' seems to have been added
by accident during a bulk edit (more specifically 3b3154df7e2773332bb814).

5 years agocore/execute: fix dump format for Limit*=
Yu Watanabe [Fri, 10 Aug 2018 04:03:02 +0000 (13:03 +0900)]
core/execute: fix dump format for Limit*=

Fixes #9846.

5 years agojournal: do not remove multiple spaces after identifier in syslog message
Yu Watanabe [Fri, 10 Aug 2018 02:07:54 +0000 (11:07 +0900)]
journal: do not remove multiple spaces after identifier in syslog message

Single space is used as separator.
C.f. discussions in #156.

Fixes #9839 introduced by a6aadf4ae0bae185dc4c414d492a4a781c80ffe5.

5 years agoutil: bind_remount_recursive_with_mountinfo(): ignore submounts which cannot be accessed
Yu Watanabe [Fri, 10 Aug 2018 05:30:55 +0000 (14:30 +0900)]
util: bind_remount_recursive_with_mountinfo(): ignore submounts which cannot be accessed

Fixes #9844.

5 years agocore/namespace: add more log messages
Yu Watanabe [Fri, 10 Aug 2018 04:50:54 +0000 (13:50 +0900)]
core/namespace: add more log messages

Suggested by #9835.

5 years agomeson: actually honor pkgconfig*dir options (#9841)
Benedikt Morbach [Fri, 10 Aug 2018 02:59:54 +0000 (04:59 +0200)]
meson: actually honor pkgconfig*dir options (#9841)

both were silently ignored leading to some of the pkg-config files
ending up in the wrong place

6 years agotimedate: emit property changed signal after all jobs are completed
Yu Watanabe [Thu, 26 Jul 2018 16:32:12 +0000 (01:32 +0900)]
timedate: emit property changed signal after all jobs are completed

Follow-up for 3af0a96c0fcc623bd16649fc3640396a657cf9ef (#9684).

6 years agoMerge pull request #9827 from yuwata/fix-9795-9820
Lennart Poettering [Wed, 8 Aug 2018 12:07:40 +0000 (14:07 +0200)]
Merge pull request #9827 from yuwata/fix-9795-9820

journal: fixes issues reported by ASan

6 years agotmpfiles: don't adjust qgroups on existing subvolumes
Franck Bui [Mon, 6 Aug 2018 10:29:54 +0000 (12:29 +0200)]
tmpfiles: don't adjust qgroups on existing subvolumes

The qgroup logic (types 'q' and 'Q') only has an effect if there's no previous
setup at all, and any explicitly configured subvolumes with their qgroups are
left entirely unmodified.

The idea is that if users want a different logic than the one we set up by
default, then by all means they should do that before hand, and tmpfiles won't
override their logic.

6 years agoresolve: do not compress target names in SRV records
Yu Watanabe [Wed, 8 Aug 2018 05:30:40 +0000 (14:30 +0900)]
resolve: do not compress target names in SRV records

Fixes #9793.

6 years agoMerge pull request #9830 from yuwata/journalctl-help
Lennart Poettering [Wed, 8 Aug 2018 10:23:58 +0000 (12:23 +0200)]
Merge pull request #9830 from yuwata/journalctl-help

journal: do not hide options in help message

6 years agotest: make TEST-22 easier to debug, by outputting to /dev/console
Lennart Poettering [Mon, 6 Aug 2018 18:57:26 +0000 (20:57 +0200)]
test: make TEST-22 easier to debug, by outputting to /dev/console

6 years agotest: don't use "nobody:nogroup" for tests
Lennart Poettering [Mon, 6 Aug 2018 18:56:45 +0000 (20:56 +0200)]
test: don't use "nobody:nogroup" for tests

This user/group doesn't apply to Fedora.

Let's use daemon:daemon instead like the other tests, as it actually
tends to exist everywhere.

6 years agotmpfiles: return correct error variable after fd_reopen()
Lennart Poettering [Mon, 6 Aug 2018 18:19:52 +0000 (20:19 +0200)]
tmpfiles: return correct error variable after fd_reopen()

6 years agobtrfs-util: unfuck tmpfiles' subvol creation
Lennart Poettering [Mon, 6 Aug 2018 17:32:00 +0000 (19:32 +0200)]
btrfs-util: unfuck tmpfiles' subvol creation

tmpfiles now passes an O_PATH fd to btrfs_subvol_make_fd() under the
assumption it will accept it like mkdirat() does. So far this assumption
was wrong, let's correct that.

Without that tmpfiles' on btrfs file systems failed systematically...

6 years agotmpfiles: reindent one comment less weirdly
Lennart Poettering [Mon, 6 Aug 2018 13:46:32 +0000 (15:46 +0200)]
tmpfiles: reindent one comment less weirdly

6 years agotmpfiles: use correct error variable
Lennart Poettering [Mon, 6 Aug 2018 13:46:01 +0000 (15:46 +0200)]
tmpfiles: use correct error variable

6 years agotmpfiles: clarify that we ignore file attribute setting errors
Lennart Poettering [Mon, 6 Aug 2018 13:44:47 +0000 (15:44 +0200)]
tmpfiles: clarify that we ignore file attribute setting errors

6 years agotmpfiles: add log message where we previously failed silently
Lennart Poettering [Mon, 6 Aug 2018 13:44:24 +0000 (15:44 +0200)]
tmpfiles: add log message where we previously failed silently

6 years agotmpfiles: use fd_get_path() less excessively
Lennart Poettering [Mon, 6 Aug 2018 13:40:16 +0000 (15:40 +0200)]
tmpfiles: use fd_get_path() less excessively

fd_get_path() is an ugly API, as it creates ambiguities related to the
" (deleted)" suffix /proc/$PID/fd/$FD shows. Let's use it a bit less
excessively, and whenever we have a good valid path already, let's
simply pass that along, instead of forgetting it in one stackframe and
reacquiring it in the next.

6 years agosyslog: fix segfault in syslog_parse_priority()
Yu Watanabe [Wed, 8 Aug 2018 09:27:15 +0000 (18:27 +0900)]
syslog: fix segfault in syslog_parse_priority()

6 years agokernel-install: don't try to run depmod when kernel doesn't support modules
Marc-Antoine Perennou [Tue, 7 Aug 2018 08:19:29 +0000 (10:19 +0200)]
kernel-install: don't try to run depmod when kernel doesn't support modules

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
6 years agojournal: fix size of buffer
Yu Watanabe [Wed, 8 Aug 2018 03:48:47 +0000 (12:48 +0900)]
journal: fix size of buffer

6 years agoresolve: use memcmp_safe() and memcpy_safe()
Yu Watanabe [Wed, 8 Aug 2018 07:23:20 +0000 (16:23 +0900)]
resolve: use memcmp_safe() and memcpy_safe()

As the length of salt in NSEC3 may be zero.

Fixes #9757.

6 years agoutil: introduce memcmp_safe()
Yu Watanabe [Wed, 8 Aug 2018 07:22:55 +0000 (16:22 +0900)]
util: introduce memcmp_safe()

6 years agocore: use memcpy_safe()
Yu Watanabe [Wed, 8 Aug 2018 06:52:46 +0000 (15:52 +0900)]
core: use memcpy_safe()

Fixes #9738.

6 years agojournal: fix syslog_parse_identifier()
Yu Watanabe [Wed, 8 Aug 2018 06:06:36 +0000 (15:06 +0900)]
journal: fix syslog_parse_identifier()

Fixes #9829.

6 years agojournal: do not use newa() or strjoina() for message
Yu Watanabe [Wed, 8 Aug 2018 03:50:39 +0000 (12:50 +0900)]
journal: do not use newa() or strjoina() for message

Fixes another issue reported in #9795.

6 years agojournal: do not hide options in help message
Yu Watanabe [Wed, 8 Aug 2018 06:29:07 +0000 (15:29 +0900)]
journal: do not hide options in help message

Even if built without gcrypt, show the relevant options in help message.
Otherwise, the help message diverges from the man page or suggestions
by the shell completion.

6 years agobash-completion: journalctl: add --grep and --case-sensitive
Yu Watanabe [Wed, 8 Aug 2018 01:47:44 +0000 (10:47 +0900)]
bash-completion: journalctl: add --grep and --case-sensitive

6 years agojournal: do not pass a negative value to memcpy()
Yu Watanabe [Wed, 8 Aug 2018 03:40:44 +0000 (12:40 +0900)]
journal: do not pass a negative value to memcpy()

The message may contains only whitespaces.

Fixes #9795.

6 years agolink: fix type for link-config's "features" array of tristates
Thomas Haller [Tue, 7 Aug 2018 06:55:07 +0000 (08:55 +0200)]
link: fix type for link-config's "features" array of tristates

The "features" fields is parsed as a tristate value. The values
are thus not of type NetDevFeature enum but int. The NetDevFeature
enum is instead the index for the features array.

Adjust the type. In practice, this had no impact because NetDevFeature
enum commonly has size of int.

Also, don't use memset() 0xFF to initilize the int with -1. While
it works correctly in practice, it feels ugly.

6 years agotest: cast values in proper type to suppress warnings
Yu Watanabe [Tue, 7 Aug 2018 09:25:00 +0000 (18:25 +0900)]
test: cast values in proper type to suppress warnings

Follow-up for #9789.

6 years agoMerge pull request #9817 from yuwata/shorten-error-logging
Lennart Poettering [Tue, 7 Aug 2018 08:44:44 +0000 (10:44 +0200)]
Merge pull request #9817 from yuwata/shorten-error-logging

tree-wide: Shorten error logging and several code cleanups

6 years agoMerge pull request #9744 from yuwata/fix-9737
Lennart Poettering [Tue, 7 Aug 2018 07:55:07 +0000 (09:55 +0200)]
Merge pull request #9744 from yuwata/fix-9737

Make RootImage= work with PrivateDevices=

6 years agohwdb: redefine Lenovo ThinkPad X140e touchpad dimensions (#9818)
Michael 'pbone' Pobega [Tue, 7 Aug 2018 07:41:49 +0000 (03:41 -0400)]
hwdb: redefine Lenovo ThinkPad X140e touchpad dimensions (#9818)

The default setup for the Lenovo ThinkPad X140e is 104x104mm, and the kernel
claims that it's 64x21. The default 104x104mm dimensions causes the vertical
axis to act oddly, causing random vertical jitters and higher vertical
sensitivity.

Measuring it showed that it was 74x32, and these touchpad dimensions provide
a better (if a little bit slower) experience but a consistent sensitivity
in all directions.

These values were obtained using the `touchpad-edge-detector` tool.

6 years agoMerge pull request #9789 from filbranden/cmp1
Lennart Poettering [Tue, 7 Aug 2018 07:39:26 +0000 (09:39 +0200)]
Merge pull request #9789 from filbranden/cmp1

Add new CMP(a, b) macro

6 years agosystemctl: add support for --wait to is-system-running
Filipe Brandenburger [Sat, 4 Aug 2018 06:10:54 +0000 (23:10 -0700)]
systemctl: add support for --wait to is-system-running

This makes it possible to wait until boot is finished without having to poll
for this command repeatedly, instead using the syntax:

  $ systemctl is-system-running --wait

Waiting is implemented by waiting for the StartupFinished signal to be posted
on the bus.

Register the matcher before checking for the property to avoid race conditions.

Tested by artificially delaying startup with a oneshot service and calling this
command, checked that it emitted `running` and exited with a 0 return code as
soon as the delay service completed startup.

Also tested that booting to degraded state unblocks the command.

Inserted a delay between getting the property and waiting for the signal and
confirmed this seems to work free of race conditions.

Updated the --help text (under --wait) and the man page to document the new
feature.

6 years agotree-wide: use returned value from log_*_errno()
Yu Watanabe [Tue, 7 Aug 2018 06:48:37 +0000 (15:48 +0900)]
tree-wide: use returned value from log_*_errno()

6 years agodns-domain: use CMP() in dns_name_compare_func
Filipe Brandenburger [Tue, 7 Aug 2018 02:23:41 +0000 (19:23 -0700)]
dns-domain: use CMP() in dns_name_compare_func

6 years agoresolve: use CMP() in dns_resource_record_compare_func
Filipe Brandenburger [Tue, 7 Aug 2018 02:21:38 +0000 (19:21 -0700)]
resolve: use CMP() in dns_resource_record_compare_func

This function doesn't really implement ordering, but CMP() is still fine to use
there. Keep the comment in place, just update it slightly to indicate that.

6 years agotree-wide: Convert compare_func's to use CMP() macro wherever possible.
Filipe Brandenburger [Thu, 2 Aug 2018 23:43:37 +0000 (16:43 -0700)]
tree-wide: Convert compare_func's to use CMP() macro wherever possible.

Looked for definitions of functions using the *_compare_func() suffix.

Tested:
- Unit tests passed (ninja -C build/ test)
- Installed this build and booted with it.

6 years agonetwork: Use CMP() macro for comparison.
Filipe Brandenburger [Thu, 2 Aug 2018 23:00:53 +0000 (16:00 -0700)]
network: Use CMP() macro for comparison.

Follow up for PRs #9764 and #9760.

6 years agomacros: add CMP(a, b) macro.
Filipe Brandenburger [Thu, 2 Aug 2018 21:37:42 +0000 (14:37 -0700)]
macros: add CMP(a, b) macro.

Macro returns -1, 0, 1 depending on whether a < b, a == b or a > b.

It's safe to use on unsigned types.

Add tests to confirm corner cases are properly covered.

6 years agomacro: drop __extension__, reformat and reindent
Filipe Brandenburger [Tue, 7 Aug 2018 02:15:02 +0000 (19:15 -0700)]
macro: drop __extension__, reformat and reindent

Drop __extension__, since we don't use gcc -Wpedantic or -ansi.

Reformat code for spacing. Add spaces after commas almost everywhere.
Reindent code blocks in macro definitions, for consistency.

6 years agotree-wide: shorten error logging a bit
Yu Watanabe [Tue, 7 Aug 2018 01:14:30 +0000 (10:14 +0900)]
tree-wide: shorten error logging a bit

Continuation of 4027f96aa08c73f109aa46b89842ca0e25c9c0e9.

6 years agoresolve: use _cleanup_ attribute
Yu Watanabe [Tue, 7 Aug 2018 01:13:44 +0000 (10:13 +0900)]
resolve: use _cleanup_ attribute

6 years agomachine: use free_and_replace() and TAKE_PTR()
Yu Watanabe [Tue, 7 Aug 2018 01:11:56 +0000 (10:11 +0900)]
machine: use free_and_replace() and TAKE_PTR()

6 years agologin: use free_and_replace() and TAKE_PTR()
Yu Watanabe [Tue, 7 Aug 2018 01:10:12 +0000 (10:10 +0900)]
login: use free_and_replace() and TAKE_PTR()

6 years agoinitctl: do not ignore errors in function
Yu Watanabe [Tue, 7 Aug 2018 01:06:49 +0000 (10:06 +0900)]
initctl: do not ignore errors in function

6 years agomachinectl: shorten error logging a bit
Lennart Poettering [Mon, 6 Aug 2018 13:47:03 +0000 (15:47 +0200)]
machinectl: shorten error logging a bit

6 years agorandom-seed: read the full seed file, even if it is larger than 512 byte
Lennart Poettering [Mon, 6 Aug 2018 13:52:45 +0000 (15:52 +0200)]
random-seed: read the full seed file, even if it is larger than 512 byte

Previously, we'd only ever read 512 byte from the random seed file,
under the assumption we won't need more. With this change we'll read the
full file, even if it is larger.

The idea behind htis change is that people can dump additional data into the
random seed file offline if they like, and it can be low quality, and
we'll seed the pool with it anyway. Moreover, if people are paranoid and
want us to save/restore a bigger seed, it's easy to do: just truncate
the file to the right size and we'll save/restore as much in the future.

This also reworks the file a bit, introducing two clear if blocks that
load and that save the random seed, and that each are conditionalized
more carefully.

6 years agotest-resolved: fix whitespace issue
Lennart Poettering [Thu, 2 Aug 2018 16:00:36 +0000 (18:00 +0200)]
test-resolved: fix whitespace issue