Commit Graph

31653 Commits

Author SHA1 Message Date
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
Peter Hutterer fd007b3b52 hwdb: add touchpad override for Asus F3Sg
https://bugs.freedesktop.org/show_bug.cgi?id=104469
2018-01-08 12:03:10 +01:00
Thomas Huth d35d6249d5 rules: Mark the kvm device as static_node (for s390x and ppc64) (#7795)
On s390x and ppc64, the permissions of the /dev/kvm device are currently
not right as long as the kvm kernel module has not been loaded yet. The
kernel module is using MODULE_ALIAS("devname:kvm") there, so the module
will be loaded on the first access to /dev/kvm. In that case, udev needs
to apply the permission to the static node already (which was created via
devtmpfs), i.e. we have to specify the option "static_node=kvm" in the
udev rule.

Note that on x86, the kvm kernel modules are loaded early instead (via the
MODULE_DEVICE_TABLE(x86cpu, ...) feature checking), so that the right module
is loaded for the Intel or AMD hypervisor extensions right from the start.
Thus the "static_node=kvm" is not required on x86 - but it also should not
hurt here (and using it here even might be more future proof in case the
module loading is also done delayed there one day), so we just add the new
option to the rule here unconditionally.
2018-01-08 10:49:15 +01:00
Yu Watanabe 2e1ec12ec3 sd-device: support the case that /sys is a symlink
When /sys is a symlink to the sysfs mountpoint, e.g. /path/to/sysfs.
Then, device->syspath was set to like /path/to/sysfs/devices/foo/baz.
This converts the path to /sys/devices/foo/baz.

Fixes #7676.
2018-01-08 01:36:08 +09:00
Yu Watanabe 5bbe8eab34 sd-device: use chase_symlinks() 2018-01-08 01:35:44 +09:00
Zbigniew Jędrzejewski-Szmek 2df4611205
Merge pull request #7714 from poettering/sd-bus-watch-connect
many sd-bus improvements
2018-01-05 19:46:38 +01:00
rkolchmeyer 65d36b4950 core: Fix edge case when processing /proc/self/mountinfo (#7811)
Currently, if there are two /proc/self/mountinfo entries with the same
mount point path, the mount setup flags computed for the second of
these two entries will overwrite the mount setup flags computed for
the first of these two entries. This is the root cause of issue #7798.
This patch changes mount_setup_existing_unit to prevent the
just_mounted mount setup flag from being overwritten if it is set to
true. This will allow all mount units created from /proc/self/mountinfo
entries to be initialized properly.

Fixes: #7798
2018-01-05 19:28:23 +01:00
Lennart Poettering f3c33b234d networkd: fix memory corruption
When loading .netdev files we parse them twice: first we do one parsing
iteration to figure out their "kind", and then we do it again to parse
out the kind's parameters. The first iteration is run with a "short"
NetDev structure, that only covers the generic NetDev properties. Which
should be enough, as we don't parse the per-kind properties. However,
before this patch we'd still try to destruct the per-kind properties
which resulted in memory corruption. With this change we distuingish the
two iterations by the state field, so that the destruction only happens
when the state signals we are running with a full NetDev structure.

Since this is not obvious, let's add a lot of comments.
2018-01-05 13:59:12 +01:00
Lennart Poettering 2ac0ab5921 logind: fix user_object_find()
The logic was completely borked since
e4d2984bf8, correct that.

CID #1384234
2018-01-05 13:59:12 +01:00
Lennart Poettering c3cd7cc929 update TODO 2018-01-05 13:59:12 +01:00
Lennart Poettering d97eac36d8 man: document all the new APIs we added 2018-01-05 13:58:33 +01:00
Lennart Poettering 51b13863a2 meson: resurrect API documentation target
We had this functionality back in Automake times, let's resurrect it.
2018-01-05 13:58:33 +01:00
Lennart Poettering 66baf8c644 sd-bus: remove 'hint_sync_call' parameter from various function calls
This is unused since kdbus is gone, hence remove this too. This permits
us to get rid of sd_bus_send_internal() and just implement sd_bus_send()
directly.
2018-01-05 13:58:33 +01:00
Lennart Poettering a5ea30b75b pid1: set org.freedesktop.systemd1 as sender service name for direct connections
This way, clients can install the very same match on direct and broker
connections as in both cases the messages will originate from the o.f.s1
service.
2018-01-05 13:58:33 +01:00
Lennart Poettering 48ef41a335 sd-bus: add API to optionally set a sender field on all outgoing messages
This is useful on direct connections to generate messages with valid
sender fields.

This is particularly useful for services that are accessible both
through direct connections and the broker, as it allows clients to
install matches on the sender service name, and they work the same in
both cases.
2018-01-05 13:58:33 +01:00
Lennart Poettering c944ca8e82 verbs: suppress debug log message if SYSTEMD_OFFLINE is not set
If SYSTEMD_OFFLINE is not set getenv_bool() for it will return -ENXIO,
which is nothing we should log about, not even at LOG_DEBUG level.
2018-01-05 13:58:33 +01:00
Lennart Poettering 2767027bb7 test: fix condition test if there are no controllers
As an optimization cg_mask_to_string() returns NULL if there are no
controllers available. We need to handle that.
2018-01-05 13:58:32 +01:00
Lennart Poettering 0f08647120 sd-bus: drop some unused fields from the sd_bus_message structure 2018-01-05 13:58:32 +01:00
Lennart Poettering 31b2cd5d23 tree-wide: make the Subscribe() method calls asynchronous too 2018-01-05 13:58:32 +01:00
Lennart Poettering dbc526f0bc sd-bus: accept NULL callbacks in sd_bus_call_async()
This way sd_bus_call_method_async() (which is just a wrapper around
sd_bus_call_async()) can be used to put method calls together that
expect no reply.
2018-01-05 13:58:32 +01:00
Lennart Poettering 3e0e196efd sd-bus: log about bus state changes
Let's unify all state changes in a new helper function, from which we
can then debug log all state changes
2018-01-05 13:58:32 +01:00