Commit Graph

34849 Commits

Author SHA1 Message Date
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
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
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
Lennart Poettering a3c1168ac2 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.
2018-08-10 16:19:01 +02:00
Zbigniew Jędrzejewski-Szmek b257b19e6b
Merge pull request #9848 from yuwata/fix-9835-9844
core: namespace fixes
2018-08-10 15:36:34 +02:00
Evgeny Vereshchagin 937b117137 journald: take leading spaces into account in syslog_parse_identifier
This is a kind of follow-up to e88baee88f which should finally fix
the issue which that commit was supposed to fix.
2018-08-10 13:35:06 +00:00
Evgeny Vereshchagin 30eddcd51b journald: free the allocated memory before returning from dev_kmsg_record
This fixes a minor memory leak.
2018-08-10 13:35:06 +00:00
Evgeny Vereshchagin 1e0c5fc2a7 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 3b3154df7e).
2018-08-10 13:34:24 +00:00
Yu Watanabe 4c3a2b84d8 core/execute: fix dump format for Limit*=
Fixes #9846.
2018-08-10 11:59:16 +02:00
Yu Watanabe 8595102d3d 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 a6aadf4ae0.
2018-08-10 10:31:29 +03:00
Yu Watanabe ef454fd193 util: bind_remount_recursive_with_mountinfo(): ignore submounts which cannot be accessed
Fixes #9844.
2018-08-10 14:30:55 +09:00
Yu Watanabe 763a260ae7 core/namespace: add more log messages
Suggested by #9835.
2018-08-10 14:30:35 +09:00
Benedikt Morbach a95696e33d 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
2018-08-10 11:59:54 +09:00
Yu Watanabe cf3872bd28 timedate: emit property changed signal after all jobs are completed
Follow-up for 3af0a96c0f (#9684).
2018-08-08 14:32:28 +02:00
Lennart Poettering 9e888a9c5b
Merge pull request #9827 from yuwata/fix-9795-9820
journal: fixes issues reported by ASan
2018-08-08 14:07:40 +02:00
Franck Bui f17a8d6178 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.
2018-08-08 12:37:35 +02:00
Yu Watanabe b2776a60f3 resolve: do not compress target names in SRV records
Fixes #9793.
2018-08-08 12:24:32 +02:00
Lennart Poettering eb84f3596b
Merge pull request #9830 from yuwata/journalctl-help
journal: do not hide options in help message
2018-08-08 12:23:58 +02:00
Lennart Poettering cacf99152e test: make TEST-22 easier to debug, by outputting to /dev/console 2018-08-08 11:59:39 +02:00
Lennart Poettering 721474fe79 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.
2018-08-08 11:59:39 +02:00
Lennart Poettering c3e03778d6 tmpfiles: return correct error variable after fd_reopen() 2018-08-08 11:59:39 +02:00
Lennart Poettering 2e6e616887 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...
2018-08-08 11:59:39 +02:00