Commit Graph

34918 Commits

Author SHA1 Message Date
Yu Watanabe 7c7be5515f libudev: move cleanup functions from udev-util.h to libudev-private.h 2018-08-23 04:57:39 +09:00
Yu Watanabe 3938f568a2 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.
2018-08-23 04:57:39 +09:00
Tejun Heo 6ae4283cb1 core: add IODeviceLatencyTargetSec
This adds support for the following proposed latency based IO control
mechanism.

  https://lkml.org/lkml/2018/6/5/428
2018-08-22 16:46:18 +02:00
Yu Watanabe 71d1700afa selinux-util: drop unused variables
Follow-up for 7e531a5265.
2018-08-22 16:32:35 +02:00
Chris Morin 0367307e27 man: correct journald field name 2018-08-22 16:21:52 +02:00
Yu Watanabe d4ba369289
Merge pull request #9903 from yuwata/fuzzer-10007
Fixes issue 10007 by oss-fuzz
2018-08-22 22:25:38 +09:00
Yu Watanabe a1a605f144 test: add testcase for issue 10007 by oss-fuzz 2018-08-22 15:46:47 +09:00
Yu Watanabe 8d30fcb9b5 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
2018-08-22 15:46:32 +09:00
Yu Watanabe 52e4d62550
Merge pull request #9852 from poettering/namespace-errno
namespace: be more careful when handling namespacing failures
2018-08-22 11:16:29 +09:00
Lennart Poettering 97fa202a61 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.
2018-08-21 20:13:32 +02:00
Lennart Poettering 2d2224e407 man: document that most sandboxing options are best effort only 2018-08-21 20:00:33 +02:00
Lennart Poettering 1beab8b0d0 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
2018-08-21 20:00:33 +02:00
aszlig 66c91c3a23 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>
2018-08-21 19:49:51 +02:00
Franck Bui 4dc7bfdf4f tmpfiles: use fd_get_path() even less excessively
A follow-up for commit 9d874aec45.

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.
2018-08-21 19:48:08 +02:00
Zbigniew Jędrzejewski-Szmek 0566668016
Merge pull request #9712 from filbranden/socket1
socket-util: Introduce send_one_fd_iov() and receive_one_fd_iov()
2018-08-21 19:45:44 +02:00
Zbigniew Jędrzejewski-Szmek 7692fed98b
Merge pull request #9783 from poettering/get-user-creds-flags
beef up get_user_creds() a bit and other improvements
2018-08-21 10:09:33 +02:00
Zbigniew Jędrzejewski-Szmek a795e5a9dd
Merge pull request #9811 from poettering/random-seed-tweaks
some random seed handling tweaks
2018-08-21 10:08:58 +02:00
Zbigniew Jędrzejewski-Szmek 00c4361878
Merge pull request #9853 from poettering/uneeded-queue
rework StopWhenUnneeded=1 logic
2018-08-21 10:06:30 +02:00
Zbigniew Jędrzejewski-Szmek 8f6b442a78 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.
2018-08-20 16:10:57 -07:00
Zbigniew Jędrzejewski-Szmek 43ad3ad7ea Rename USER_CREDS_SYNTHESIZE_FALLBACK to …_PREFER_NSS 2018-08-20 16:06:41 +02:00
Lennart Poettering fafff8f1ff 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]
2018-08-20 15:58:21 +02:00
Lennart Poettering 163a035aa6 networkd: add O_CLOEXEC where it's missing 2018-08-20 15:58:11 +02:00
Lennart Poettering 8967f29169 nspawn: add two missing OOM checks 2018-08-20 15:58:11 +02:00
Lennart Poettering 8dfce114ab 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.
2018-08-20 15:58:11 +02:00
Lennart Poettering b2a60844c4 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.
2018-08-20 15:58:11 +02:00
Zbigniew Jędrzejewski-Szmek a9e241dcb3
Merge pull request #9801 from yuwata/analyze-cleanups
analyze: several improvements
2018-08-20 13:12:53 +02:00
Zbigniew Jędrzejewski-Szmek 5664144bd3
Merge pull request #9809 from poettering/tmpfiles-cleanup
various tmpfiles fixes
2018-08-20 12:51:57 +02:00
Lennart Poettering 8ba12aef04 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.
2018-08-20 12:42:28 +02:00
Lennart Poettering 3cd24c1aa9 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.
2018-08-20 12:28:17 +02:00
Lennart Poettering 37ec0fdd34 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.
2018-08-20 11:33:04 +02:00
Zbigniew Jędrzejewski-Szmek fda09318e3 core: rename function to better reflect semantics 2018-08-20 10:43:31 +02:00
Yu Watanabe 53c442ef63 util: improve comments why we ignore EACCES and EPERM
Follow-up for ef454fd193 (#9848).
2018-08-20 10:16:09 +02:00
Peter Hutterer 06fc4324b8 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
2018-08-20 09:47:53 +02:00
Shih-Yuan Lee (FourDollars) 9e2629919f hwdb: Fix wlan keycode for all Dell Latitude and Precision systems
Removing this line is because cab01e9ecf
has contained the wlan keycode fix.

This line will only break the wlan keycode for all Dell Latitude and
Precision systems after cab01e9ecf.
2018-08-20 09:46:38 +02:00
Jan Pokorný 53956faf74 shell-completion: replace "gdb" verb with "debug" for coredumpctl
Also offer --debugger option.  Both to reflect changes in v239.
2018-08-20 09:43:44 +02:00
Thomas Hindoe Paaboel Andersen 1e190dfd5b 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.
2018-08-20 09:37:41 +02:00
Yu Watanabe cb63114880
Merge pull request #9879 from evverx/get-rid-of-workaround
oss-fuzz.sh: just install the shared library
2018-08-18 00:11:58 +09:00
Evgeny Vereshchagin 670e95aecd 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).
```
2018-08-16 06:48:06 +00:00
Evgeny Vereshchagin 7cd98cc495 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.
2018-08-16 06:45:49 +00:00
Yu Watanabe 9e5f34a639
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
2018-08-13 20:57:25 +09:00
Yu Watanabe 7169cdc8b9 network: prohibit to set MTUBytes= and UseMTU= simultaneously 2018-08-13 16:14:56 +09:00
Yu Watanabe 55dc8c4a82 network: call link_acquire_conf() and link_enter_join_netdev() after MTU is set
Fixes #9831.
2018-08-13 16:12:08 +09:00
Yu Watanabe ee4931068e network: do not re-set MTU when current and requested MTU are same 2018-08-13 15:23:31 +09:00
Yu Watanabe 72c2500b2a network: drop redundant lines
Follow-up for 44b598a1c9.
2018-08-13 15:23:31 +09:00
Iwan Timmer 19feb28fa1 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.
2018-08-13 15:20:25 +09:00
Yu Watanabe 3740146a4c
resolve: do not hit CNAME or DNAME entry in NODATA cache (#9836)
Fixes #9833.
2018-08-13 14:32:33 +09:00
Zbigniew Jędrzejewski-Szmek 7f9f55e1b3 man: add sd_bus_message_read_array(3) 2018-08-11 12:25:54 +02:00
Zbigniew Jędrzejewski-Szmek 58df2afbbf man: add sd_bus_message_skip(3) 2018-08-11 12:25:54 +02:00
Lennart Poettering 5d3bab79e8 fsck: use our usual syntax for defining bit masks 2018-08-10 13:27:43 -07:00
Lennart Poettering 20d4b10116 update TODO 2018-08-10 16:20:48 +02:00