Commit Graph

31673 Commits

Author SHA1 Message Date
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
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
Dimitri John Ledkov 1f1580139e resolved.service: set DefaultDependencies=no
On systems that only use resolved for name resolution, there are usecases that
require resolved to be started before sysinit target, such that network name
resolution is available before network-online/sysinit targets. For example,
cloud-init for some datasources hooks into the boot process ahead of sysinit
target and may need network name resolution at that point already.

systemd-resolved already starts pretty early in the process, thus starting it
slightly earlier should not have negative side effects.

However, this depends on resolved ability to connect to system DBus once that
is up.
2018-01-11 12:40:44 +01:00
Split7fire 27c1decf31 Fix Mount Matrix for Chuwi HiBook 2018-01-11 12:37:25 +01:00
Samuel Dionne-Riel c61111123c hwdb: Add accelerometer orientation entry for Chuwi Hi10 Pro 2018-01-11 12:36:49 +01:00
Michal Koutný 4848b1f91a test-dnssec: Allow builds without libgcrypt (#7850) (#7850)
Fixes: #7845
2018-01-11 12:28:32 +01:00
Marek Čermák 99127d20ce Integration of Travis CI and Coverity Scan Analysis (#7691)
- Coverity scan analysis tasks run as scheduled cron jobs

- Stage separation for Build, Test and Coverity scan phase
- Travis CI now uses Fedora container to build and run tests

- Containers are accessible from Docker Hub and failed builds
  can be reproduced and examined

- coverity.sh: separate build and upload
2018-01-11 11:41:35 +01:00
Franck Bui d8dab75789 tmpfiles: consider /etc uninitialized also when /etc/machine-id is present but empty (#7849) 2018-01-10 23:28:44 +01:00
Zbigniew Jędrzejewski-Szmek a9883559e3
Merge pull request #7846 from poettering/nobody-getenv
some assorted fixes and additions, in particular a way to turn off "nobody" synthesizing on a specific system
2018-01-10 20:18:51 +01:00
Lennart Poettering 5a2dadf1bb sd-netlink: let's make things compile on certain old glibc's and kernel headers again (#7848)
Let's include netinet/in.h instead of linux/in6.h, as the former is the
official libc location for these definitions, and the latter is a
linux-specific version that conflicts.

This hopefully makes systemd compile on current Semaphore again.

This takes e410b07d2a into consideration,
but makes us use glibc rather than kernel headers.

While we are at it, let's also sort our #include lines. Since kernel
headers are notoriously crappy we won't strictly order them globally,
but first include non-kernel headers in a sorted way, and then include
kernel headers in a somewhat sorted way (i.e. generic stuff first and
somewhat alphabetical, and specific stuff last)
2018-01-10 20:08:18 +01:00
Jan Klötzke e73c54b838 shutdown: make kill timeout configurable (#7835)
By default systemd-shutdown will wait for 90s after SIGTERM was sent
for all processes to exit. This is way too long and effectively defeats
an emergency watchdog reboot via "reboot-force" actions. Instead now
use DefaultTimeoutStopSec which is configurable.
2018-01-10 19:00:20 +01:00
Lennart Poettering 0a7eed95dd
Merge pull request #7843 from hbakken/work/old-kernel-support
Work/old kernel support
2018-01-10 18:59:14 +01:00
Lennart Poettering e557b1a655 util: minor tweaks to disable_core_dumps()
First, let's rename it to disable_coredumps(), as in the rest of our
codebase we spell it "coredump" rather than "core_dump", so let's stick
to that.

However, also log about failures to turn off core dumpling on LOG_DEBUG,
because debug logging is always a good idea.
2018-01-10 18:44:09 +01:00
Lennart Poettering 47cf8ff206 manager: rework manager_clean_environment()
Let's rename it manager_sanitize_environment() which is a more precise
name. Moreover, sort the environment implicitly inside it, as all our
callers do that anyway afterwards and we can save some code this way.

Also, update the list of env vars to drop, i.e. the env vars we manage
ourselves and don't want user code to interfear with. Also sort this
list to make it easier to update later on.
2018-01-10 18:30:06 +01:00
Lennart Poettering 24eccc3414 nss-systemd,user-util: add a way how synthesizing "nobody" can be turned off
This is quite ugly, but provides us with an avenue for moving
distributions to define the "nobody" user properly without breaking legacy
systems that us the name for other stuff.

The idea is basically, that the distribution adopts the new definition
of "nobody" (and thus recompiles systemd with it) and then touches
/etc/systemd/dont-synthesize-nobody on legacy systems to turn off
possibly conflicting synthesizing of the nobody name by systemd.
2018-01-10 18:26:03 +01:00
Lennart Poettering f1ff734fad tmpfiles: modernize load_unix_sockets() a bit
Let's log in case of error.

Let's use read_line() instead of a fixed-size buffer

Let's make use of set_free_free()'s return value.
2018-01-10 17:29:15 +01:00
Lennart Poettering dfd14786b5 util-lib: save/restore errno in cleanup calls
We should be careful with errno in cleanup functions, and not alter it
under any circumstances. In the safe_close cleanup handlers we are
already safe in that regard, but let's add similar protections on other
cleanup handlers that invoke system calls.

Why bother? Cleanup handlers insert code at function return in
non-obvious ways. Hence, code that sets errno and returns should not be
confused by us overrding the errno from a cleanup handler.

This is a paranoia fix only, I am not aware where this actually mattered
in real-life situations.
2018-01-10 17:21:15 +01:00
Lennart Poettering ad5d4b1703 cocci: use strempty() at more places
This shortens the code by a few lines.
2018-01-10 17:11:19 +01:00
Lennart Poettering 4631116dd9
Merge pull request #7836 from jkloetzke/shutdown-no-coredumps
shutdown: prevent core dumps in final shutdown stage
2018-01-10 15:15:07 +01:00
Lennart Poettering 2de9740c1c
Merge pull request #7837 from yuwata/coverity-20170110
fix defects reported by Coverity Scan
2018-01-10 15:13:07 +01:00
Yu Watanabe f011fcfdec timesync: fix typo 2018-01-10 20:52:59 +09:00
Yu Watanabe 0a664f1b15 exec-util: cast to void when return value is ignored
CID 1384262.
2018-01-10 20:52:55 +09:00
Yu Watanabe 78e2f089fd test: free after use
CID 1384238.
2018-01-10 20:52:51 +09:00
Yu Watanabe a41f6217ba process-util: initialize block_signals
CID 1384240.
2018-01-10 20:52:46 +09:00
Hans-Christian Noren Egtvedt 8a2b193a55 sd-radv: avoid redefinition of struct in6_addr
Both netinet/icmp6.h and linux/in6.h will define struct in6_addr, and in
user space we want to use the netinet/icmp6.h variant.

Fixes build problem:
In file included from src/libsystemd-network/sd-radv.c:23:0:
/home/hegtvedt/work/os/product/sunrise/root/_build/v2/include/linux/in6.h:30:8:
error: redefinition of 'struct in6_addr'
2018-01-10 12:32:03 +01:00
Hans-Christian Noren Egtvedt d07ba5d790 missing: add bpf() define for ARM definition 2018-01-10 12:31:39 +01:00
Zbigniew Jędrzejewski-Szmek edd50d5e24 timesyncd: avoid signed/unsigned comparison (#7842)
be32toh() returns uint32_t, and m->trans_time.tv_nsec is defined as long in struct timespec.
Let's add a cast to avoid the warning.

Fixes #7789.
2018-01-10 11:35:00 +01:00
Hans-Christian Noren Egtvedt 66ffb275fa missing: fix bpf() define for Tilera
__NR_bpf syscall uses the default generic value for Tilera, e.g. 280.
2018-01-10 10:59:01 +01:00
Jan Klötzke 27b372c1c2 shutdown: prevent core dumps in final shutdown stage
If the system is finally shutting down it makes no sense to write core
dumps as the last remaining processes are terminated / killed. This is
especially significant in case of a "force reboot" where all processes
are hit concurrently with a SIGTERM and no orderly shutdown of
processes takes place.
2018-01-10 10:54:40 +01:00
Jan Klötzke 9ce1759311 tree-wide: introduce disable_core_dumps helper and port existing users
Changes the core_pattern to prevent any core dumps by the kernel. Does
nothing if we're in a container environment as this is system wide
setting.
2018-01-10 10:54:40 +01:00
Ewout van Mansom 05da675a5a hwdb: Add workaround for backslash hardware issue in Purism Librem 13 V2 (#7826) 2018-01-09 16:42:54 +01:00
Zbigniew Jędrzejewski-Szmek 2269954112 Merge pull request #7191 from Mic92/systemd
The change in netdev.c done in the merge is necessary to avoid crashing in
cleanup. This is a follow-up for f3c33b234d.
2018-01-09 14:35:54 +01:00
Jörg Thalheim e5719363f5 networkd: add support for wireguard interface type
More information may be found at wireguard.com.
2018-01-09 14:00:49 +01:00
Jörg Thalheim 05d0c2e3cf sd-netlink: add generic netlink support
This also adds the ability to incorporate arrays into netlink messages
and to determine when a netlink message is too big, used by some generic
netlink protocols.
2018-01-09 14:00:49 +01:00
Susant Sahani 27c34f732e networkd: call link_set_routing_policy_rule before setting routes (#7815)
commit 7715629 (networkd: Fix race condition in [RoutingPolicyRule] handling (#7615)).
Does not fix race. Still there is a race in case of bride because the
bride goes down and up .

calling route_configure then link_set_routing_policy_rule and the
link_check_ready makes a race between routing_policy_rule_messages and route_messages.
While bride comes up and we call the call again route_configure if finds
it self in the callback function LINK_STATE_CONFIGURED networkd dies.
Let's handle first routing policy rules then route_configure. This fixes
the crash.
Closes #7797
2018-01-09 09:13:06 +01:00
Lennart Poettering 009e9fbcfd
Merge pull request #7740 from yuwata/fix-7676
sd-device: support the case that /sys is a symlink
2018-01-08 15:15:57 +01:00