Commit graph

31859 commits

Author SHA1 Message Date
Adam Duskett 08318a2c5a add false option for tests (#7778)
Currently there is no way to prevent tests from building using meson.
This introduces two problems:

1) It adds a extra 381 files to compile.
2) One of these tests explicitly requires libgcrypt to be built even if systemd
   is not using it.
3) It adds C++ to the requirements to build systemd.

When cross-compiling, this is uneccessary.
2018-01-15 15:25:46 +04:00
Lennart Poettering 38edb7674b
Merge pull request #7582 from pfl/dhcp6_prefix_delegation
DHCPv6 prefix delegation
2018-01-15 12:02:37 +01:00
Zbigniew Jędrzejewski-Szmek f94abc667a man: --this-boot is deprecated (#7880)
This removes the last public reference. Follow-up for #7844.
2018-01-15 19:45:40 +09:00
Zbigniew Jędrzejewski-Szmek e0b6d3cabe
Merge pull request #7816 from poettering/chase-pid
Make MAINPID= and PIDFile= handling more restrictive (and other stuff)
2018-01-15 14:14:34 +04:00
Zbigniew Jędrzejewski-Szmek c557fc3e2f
Merge pull request #7844 from yuwata/bash-completion
update bash completions
2018-01-15 13:51:29 +04:00
Zbigniew Jędrzejewski-Szmek 67ddb52432
Merge pull request #7855 from poettering/log-h-includes
log.h #include cleanups
2018-01-15 13:43:09 +04:00
Zbigniew Jędrzejewski-Szmek d04e012ad9
Merge pull request #7871 from sourcejedi/log_mounts
core: fix output (logging) for mount units (#7603)
2018-01-15 13:34:06 +04:00
Zbigniew Jędrzejewski-Szmek e4976acec4
Merge pull request #7872 from mineo/coredumpctl-zsh-completion
Fix the ZSH completion on `coredumpctl gdb <tab>`
2018-01-15 13:28:14 +04:00
Alan Jenkins 3cc9685649 core: prevent spurious retries of umount
Testing the previous commit with `systemctl stop tmp.mount` logged the
reason for failure as expected, but unexpectedly the message was repeated
32 times.

The retry is a special case for umount; it is only supposed to cover the
case where the umount command was _successful_, but there was still some
remaining mount(s) underneath.  Fix it by making sure to test the first
condition :).

Re-tested with and without a preceding `mount --bind /mnt /tmp`,
and using `findmnt` to check the end result.
2018-01-13 17:22:46 +00:00
Wieland Hoffmann a6e4952d56 zsh/coredumpctl: Never sort the completion candidates
That way, they're always sorted by date. I do not know how to make ZSH sort
them by PID through some option, but that doesn't seem very useful in the first
place.
2018-01-13 15:23:28 +01:00
Wieland Hoffmann 83701d75fb zsh/coredumpctl: Fix the completion
An output from coredumpctl list is like

> TIME                            PID   UID   GID SIG COREFILE  EXE
> Sun 2016-05-29 18:44:03 CEST  14578  1000  1000   6 none      /tmp/pacaurtmp-wieland/python33/src/Python-3.3.6/python

  ^1  ^2         ^3       ^4    ^5

, but the previous sub() command turns that into

> TIMEPID   UID   GID SIG COREFILE  EXE
> Sun2016-05-29 18:44:03 CEST  14578  1000  1000   6 none      /tmp/pacaurtmp-wieland/python33/src/Python-3.3.6/python
  ^1            ^2       ^3    ^4     ^5

so the whole pipeline generated entries like

$UID:$DESCRIPTION

but that's not useful and probably not what was supposed to happen.

This now generates entries like

$PID:$DESCRIPTION

which make everything work.

Note that with this commmit, the completions will be sorted by PID by
ZSH.
2018-01-13 15:08:36 +01:00
Alan Jenkins 5804e1b6ff core: fix output (logging) for mount units (#7603)
Documentation - systemd.exec - strongly implies mount units get logging.

It is safe for mounts to depend on systemd-journald.socket.  There is no
cyclic dependency generated.  This is because the root, -.mount, was
already deliberately set to EXEC_OUTPUT_NULL.  See comment in
mount_load_root_mount().  And /run is excluded from being a mount unit.

Nor does systemd-journald depend on /var.  It starts earlier, initially
logging to /run.

Tested before/after using `systemctl stop tmp.mount`.
2018-01-13 13:03:13 +00:00
0xAX aad67b80c5 dbus-execute: define bus_set_transient_errno() only if HAVE_SECCOMP (#7869)
in other way we will get a warning during build:

../src/core/dbus-util.h:55:13: warning: ‘bus_set_transient_errno’
defined but not used [-Wunused-function]

    int bus_set_transient_##function(
2018-01-13 08:48:53 +09:00
Max Harmathy 5bcdbb2249 login: avoid external process call
Use a shell builtin of posix shells insteaf of calling 'which'.
See also http://stackoverflow.com/a/677212
2018-01-12 18:02:57 +01:00
Michal Sekletar 8647283e45 process-util: make our freeze() routine do something useful
When we crash we freeze() our-self (or possibly we reboot the machine if
that is configured). However, calling pause() is very unhelpful thing to
do. We should at least continue to do what init systems being doing
since 70's and that is reaping zombies. Otherwise zombies start to
accumulate on the system which is a very bad thing. As that can prevent
admin from taking manual steps to reboot the machine in somewhat
graceful manner (e.g. manually stopping services, unmounting data
volumes  and calling reboot -f).

Fixes #7783
2018-01-12 17:50:02 +01:00
Lennart Poettering 47e5995a38
Merge pull request #7865 from fbuihuu/restore-termination-of-bus-connection-first
Restore termination of bus connection first
2018-01-12 17:24:56 +01:00
Franck Bui 0a84daa5aa Comment the fact that some tools need to termintate their bus connect first 2018-01-12 16:20:36 +01:00
Franck Bui 3b2f303300 mount: make sure we terminate the bus connection first, and then close the pager
See cf647b69ba commit message for details.
2018-01-12 16:12:14 +01:00
Franck Bui a3c5634573 Revert "tree-wide: use _cleanup_(sd_bus_flush_close_unrefp) at various appropriate places"
This reverts commit 0b3c84eb7d.

The removal of _cleanup_() usages was done on purpose, see
cf647b69ba.

Fixes: #3543
2018-01-12 16:09:21 +01:00
Matthew Thode 59dda97f7f support LZMA concatenated files
The xz format supports concatenated files, images are sometimes created
and shipped with it to increase compression.

https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1742744 is
the source bug for this issue.
2018-01-11 23:38:04 +01:00
Lennart Poettering d62b3f989a
Merge pull request #7851 from msekletar/dbus-error-logging
dbus: propagate errors from bus_init_system() and bus_init_api()
2018-01-11 23:37:04 +01:00
winnerman-pythian cce5b4f106 bootctl: add newline after printf (#7856)
Upon error condition, a newline is not printed, leading to the shell prompt jamming against this line.
2018-01-11 18:01:57 +01:00
Lennart Poettering 4f41c2ae8b
Merge pull request #7833 from keszybz/netdev-relaxed
Avoid spurious warnings about unknown sections in .netdev files
2018-01-11 17:14:49 +01:00
Lennart Poettering 6b44a121c1 cocci: there's not ENOTSUP, there's only EOPNOTSUPP
On Linux the former is a compat alias to the latter, and that's really
weird, as inside the kernel the two are distinct. Which means we really
should stay away from it.
2018-01-11 15:12:16 +01:00
Lennart Poettering 2b44daaa20 ethtool-util: don't pass fds as pointers if we don't have to
Passing them as pointers is just weird, hence don't do it
2018-01-11 15:12:16 +01:00
Lennart Poettering 20d4e99524 ethtool-util: fix weird whitespace 2018-01-11 15:12:16 +01:00
Lennart Poettering ab1263d774 ethtool-util: order includes properly 2018-01-11 15:12:16 +01:00
Lennart Poettering 89e1ba0ab2 ethtool-util: no need for memcpy() where normal assignment works too 2018-01-11 15:12:16 +01:00
Lennart Poettering db256aab13 core: be stricter when handling PID files and MAINPID sd_notify() messages
Let's be more restrictive when validating PID files and MAINPID=
messages: don't accept PIDs that make no sense, and if the configuration
source is not trusted, don't accept out-of-cgroup PIDs. A configuratin
source is considered trusted when the PID file is owned by root, or the
message was received from root.

This should lock things down a bit, in case service authors write out
PID files from unprivileged code or use NotifyAccess=all with
unprivileged code. Note that doing so was always problematic, just now
it's a bit less problematic.

When we open the PID file we'll now use the CHASE_SAFE chase_symlinks()
logic, to ensure that we won't follow an unpriviled-owned symlink to a
privileged-owned file thinking this was a valid privileged PID file,
even though it really isn't.

Fixes: #6632
2018-01-11 15:12:16 +01:00
Lennart Poettering 65c6b99094 notify: add new --uid= command
The new --uid= switch allows selecting the UID from which the
notificaiton messages shall originate.

This is primarily useful for testing purposes, but might have other
uses.
2018-01-11 15:12:16 +01:00
Lennart Poettering 9e1d021ee3 sd-dameon: also sent ucred when our UID differs from EUID
Let's be explicit, and always send the messages from our UID and never
our EUID. Previously this behaviour was conditionalized only on whether
the PID was specified, which made this non-obvious.
2018-01-11 15:12:16 +01:00
Lennart Poettering 15e23e8cdf manager: make use of pid_is_valid() where appropriate 2018-01-11 15:12:16 +01:00
Lennart Poettering 007e4b5490 manager: make use of NEWLINE macro where appropriate 2018-01-11 15:12:16 +01:00
Lennart Poettering d6552eaa6c dbus-util: properly parse timeout values
This makes transient TimeoutStopSec= properties work. After all they are
64bit entitites, not 32bit ones.
2018-01-11 15:12:16 +01:00
Lennart Poettering da5fb86100 manager: swap order in which we ellipsize/escape sd_notify() messages for debugging
If we have to chose between truncated escape sequences and strings
exploded to 4 times the desried length by fully escaping, prefer the
latter.

It's for debug only, hence doesn't really matter much.
2018-01-11 15:12:16 +01:00
Lennart Poettering 1ed34d75d4 fs-util: add new chase_symlinks() flag CHASE_OPEN
The new flag returns the O_PATH fd of the final component, which may be
converted into a proper fd by open()ing it again through the
/proc/self/fd/xyz path.

Together with O_SAFE this provides us with a somewhat safe way to open()
files in directories potentially owned by unprivileged code, where we
want to refuse operation if any symlink tricks are played pointing to
privileged files.
2018-01-11 15:12:16 +01:00
Lennart Poettering f14f1806e3 fs-util: add new CHASE_SAFE flag to chase_symlinks()
When the flag is specified we won't transition to a privilege-owned
file or directory from an unprivileged-owned one. This is useful when
privileged code wants to load data from a file unprivileged users have
write access to, and validates the ownership, but want's to make sure
that no symlink games are played to read a root-owned system file
belonging to a different context.
2018-01-11 15:12:16 +01:00
Lennart Poettering d93f4df40a update TODO 2018-01-11 15:10:29 +01:00
Lennart Poettering 8895eb7815 unit: log when we cannot add a watch on a specific PID 2018-01-11 15:07:14 +01:00
Susant Sahani 6b21ad33ab networkd: initcwn/initwnd use the right parsers
Closes #7765
2018-01-11 15:07:03 +01:00
Samuel Dionne-Riel 28da8a9f1e hwdb: Add accelerometer orientation entry for Asus TP300LA 2018-01-11 15:05:33 +01:00
Lennart Poettering c1e83af84e log: assign the realm to a variable first in log_full_errno_realm()
Let's avoid duplicate evaluation (which might have side-effects) and
assign the realm to an internal variable first, as we need it twice.
2018-01-11 14:44:31 +01:00
Lennart Poettering d04ce5a9c4 log: rework log_syntax_invalid_utf8() a bit
The macro used utf8.h functions without including that. Let's clean this
up, by moving that code inside of log.c.

Let's also make the call return -EINVAL in all cases. This is in line
with log_oom() which also returns a well-defined error code even though
it doesn#t take one.
2018-01-11 14:44:31 +01:00
Lennart Poettering a6ab236595 log: minor modernizations to log_received_signal() 2018-01-11 14:44:31 +01:00
Lennart Poettering 9e4b889366 UIDS-GIDS: document early on, that 32bit uids are a linux 2.4 thing 2018-01-11 14:44:31 +01:00
Lennart Poettering e3e2cf07b1 tty-ask-password-agent: add (void) cast to mkdir/mkfifo calls we knowingly ignore 2018-01-11 14:44:31 +01:00
Lennart Poettering dccca82b1a log: minimize includes in log.h
log.h really should only include the bare minimum of other headers, as
it is really pulled into pretty much everything else and already in
itself one of the most basic pieces of code we have.

Let's hence drop inclusion of:

1. sd-id128.h because it's entirely unneeded in current log.h
2. errno.h, dito.
3. sys/signalfd.h which we can replace by a simple struct forward
   declaration
4. process-util.h which was needed for getpid_cached() which we now hide
   in a funciton log_emergency_level() instead, which nicely abstracts
   the details away.
5. sys/socket.h which was needed for struct iovec, but a simple struct
   forward declaration suffices for that too.

Ultimately this actually makes our source tree larger (since users of
the functionality above must now include it themselves, log.h won't do
that for them), but I think it helps to untangle our web of includes a
tiny bit.

(Background: I'd like to isolate the generic bits of src/basic/ enough
so that we can do a git submodule import into casync for it)
2018-01-11 14:44:31 +01:00
Lennart Poettering 1a86b08513 sd-bus: drop bloom stuff, it's not needed anymore since kdbus is gone 2018-01-11 14:44:31 +01:00
Michal Sekletar dc7118ba09 dbus: propagate errors from bus_init_system() and bus_init_api()
The aim of this change is to make sure that we properly log about all
D-Bus connection problems. After all, we only ever attempt to get on the
bus if dbus-daemon is around, so any failure in the process should be
treated as an error.

bus_init_system() is only called from bus_init() and in
bus_init() we have a bool flag which governs whether we should attempt
to connect to the system bus or not.
Hence if we are in bus_init_system() then it is clear we got called from
a context where connection to the bus is actually required and therefore
shouldn't be treated as the "best effort" type of operation. Same
applies to bus_init_api().

We make use of those error codes in bus_init() and log high level
message that informs admin about what is going on (and is easy to spot
and makes sense to an end user).

Also "retrying later" bit is actually a lie. We won't retry unless we
are explicitly told to reconnect via SIGUSR1 or re-executed. This is
because bus_init() is always called from the context where dbus-daemon
is already around and hence bus_init() won't be called again from
unit_notify().

Fixes #7782
2018-01-11 14:41:34 +01:00
Zbigniew Jędrzejewski-Szmek c599b325b6 bus-socket: slight simplification in bus_get_peercred() 2018-01-11 13:04:11 +01:00