Lennart Poettering [Wed, 10 Jan 2018 17:26:03 +0000 (18:26 +0100)]
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.
Lennart Poettering [Wed, 10 Jan 2018 16:28:03 +0000 (17:28 +0100)]
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.
Lennart Poettering [Wed, 10 Jan 2018 16:21:15 +0000 (17:21 +0100)]
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.
Lennart Poettering [Wed, 10 Jan 2018 16:11:19 +0000 (17:11 +0100)]
cocci: use strempty() at more places
This shortens the code by a few lines.
Lennart Poettering [Wed, 10 Jan 2018 14:15:07 +0000 (15:15 +0100)]
Merge pull request #7836 from jkloetzke/shutdown-no-coredumps
shutdown: prevent core dumps in final shutdown stage
Lennart Poettering [Wed, 10 Jan 2018 14:13:07 +0000 (15:13 +0100)]
Merge pull request #7837 from yuwata/coverity-
20170110
fix defects reported by Coverity Scan
Yu Watanabe [Wed, 10 Jan 2018 02:27:15 +0000 (11:27 +0900)]
timesync: fix typo
Yu Watanabe [Wed, 10 Jan 2018 01:25:32 +0000 (10:25 +0900)]
exec-util: cast to void when return value is ignored
CID 1384262.
Yu Watanabe [Wed, 10 Jan 2018 01:24:06 +0000 (10:24 +0900)]
test: free after use
CID 1384238.
Yu Watanabe [Wed, 10 Jan 2018 01:22:35 +0000 (10:22 +0900)]
process-util: initialize block_signals
CID 1384240.
Zbigniew Jędrzejewski-Szmek [Wed, 10 Jan 2018 10:35:00 +0000 (11:35 +0100)]
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.
Jan Klötzke [Mon, 23 Oct 2017 06:57:09 +0000 (08:57 +0200)]
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.
Jan Klötzke [Wed, 10 Jan 2018 09:36:14 +0000 (10:36 +0100)]
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.
Ewout van Mansom [Tue, 9 Jan 2018 15:42:54 +0000 (15:42 +0000)]
hwdb: Add workaround for backslash hardware issue in Purism Librem 13 V2 (#7826)
Zbigniew Jędrzejewski-Szmek [Tue, 9 Jan 2018 13:01:05 +0000 (14:01 +0100)]
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
f3c33b234d9f0256805722f02c7b4c4b59fd6de6.
Jörg Thalheim [Mon, 18 Dec 2017 14:20:34 +0000 (15:20 +0100)]
networkd: add support for wireguard interface type
More information may be found at wireguard.com.
Jörg Thalheim [Mon, 18 Dec 2017 14:17:06 +0000 (15:17 +0100)]
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.
Susant Sahani [Tue, 9 Jan 2018 08:13:06 +0000 (13:43 +0530)]
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
Lennart Poettering [Mon, 8 Jan 2018 14:15:57 +0000 (15:15 +0100)]
Merge pull request #7740 from yuwata/fix-7676
sd-device: support the case that /sys is a symlink
Peter Hutterer [Mon, 8 Jan 2018 05:26:21 +0000 (15:26 +1000)]
hwdb: add touchpad override for Asus F3Sg
https://bugs.freedesktop.org/show_bug.cgi?id=104469
Thomas Huth [Mon, 8 Jan 2018 09:49:15 +0000 (10:49 +0100)]
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.
Yu Watanabe [Sun, 7 Jan 2018 16:36:08 +0000 (01:36 +0900)]
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.
Yu Watanabe [Sun, 7 Jan 2018 16:35:44 +0000 (01:35 +0900)]
sd-device: use chase_symlinks()
Zbigniew Jędrzejewski-Szmek [Fri, 5 Jan 2018 18:46:38 +0000 (19:46 +0100)]
Merge pull request #7714 from poettering/sd-bus-watch-connect
many sd-bus improvements
rkolchmeyer [Fri, 5 Jan 2018 18:28:23 +0000 (10:28 -0800)]
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
Lennart Poettering [Thu, 4 Jan 2018 10:36:58 +0000 (11:36 +0100)]
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.
Lennart Poettering [Thu, 4 Jan 2018 10:36:35 +0000 (11:36 +0100)]
logind: fix user_object_find()
The logic was completely borked since
e4d2984bf8514ab576a66d5ac1f1cde746bb32a3, correct that.
CID #1384234
Lennart Poettering [Wed, 20 Dec 2017 18:48:23 +0000 (19:48 +0100)]
update TODO
Lennart Poettering [Wed, 20 Dec 2017 15:31:58 +0000 (16:31 +0100)]
man: document all the new APIs we added
Lennart Poettering [Wed, 20 Dec 2017 11:51:14 +0000 (12:51 +0100)]
meson: resurrect API documentation target
We had this functionality back in Automake times, let's resurrect it.
Lennart Poettering [Wed, 20 Dec 2017 18:48:39 +0000 (19:48 +0100)]
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.
Lennart Poettering [Wed, 20 Dec 2017 18:43:05 +0000 (19:43 +0100)]
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.
Lennart Poettering [Wed, 20 Dec 2017 18:41:06 +0000 (19:41 +0100)]
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.
Lennart Poettering [Wed, 20 Dec 2017 18:38:15 +0000 (19:38 +0100)]
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.
Lennart Poettering [Wed, 20 Dec 2017 17:13:23 +0000 (18:13 +0100)]
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.
Lennart Poettering [Wed, 20 Dec 2017 17:02:16 +0000 (18:02 +0100)]
sd-bus: drop some unused fields from the sd_bus_message structure
Lennart Poettering [Wed, 20 Dec 2017 15:40:47 +0000 (16:40 +0100)]
tree-wide: make the Subscribe() method calls asynchronous too
Lennart Poettering [Wed, 20 Dec 2017 18:45:09 +0000 (19:45 +0100)]
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.
Lennart Poettering [Wed, 20 Dec 2017 11:50:43 +0000 (12:50 +0100)]
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
Lennart Poettering [Tue, 19 Dec 2017 14:54:30 +0000 (15:54 +0100)]
networkd,resolved: make use of watch_bind feature to connect to the bus
The changes both networkd and resolved to make use of the watch_bind
feature of sd-bus to connect to the system bus. This way, both daemons
can be started during early boot, and automatically and instantly
connect to the system bus as it becomes available.
This replaces prior code that used a time-based retry logic to connect
to the bus.
Lennart Poettering [Tue, 19 Dec 2017 14:50:05 +0000 (15:50 +0100)]
sd-bus: add new sd_bus_set_connected_signal() API
With this new API sd-bus can synthesize a local "Connected" signal when
the connection is fully established. It mirrors the local "Disconnected"
signal that is already generated when the connection is terminated. This
is useful to be notified when connection setup is done, in order to
start method calls then, in particular when using "slow" connection
methods (for example slow TCP, or most importantly the "watch_bind"
inotify logic).
Note that one could also use hook into the initial NameAcquired signal
received from the bus broker, but that scheme works only if we actually
connect to a bus. The benefit of "Connected" OTOH is that it works with
any kind of connection.
Ideally, we'd just generate this message unconditionally, but in order
not to break clients that do not expect this message it is opt-in.
Lennart Poettering [Tue, 19 Dec 2017 14:47:09 +0000 (15:47 +0100)]
sd-bus: add new sd_bus_is_ready() API
This new call is much light sd_bus_is_open(), but returns true only if
the connection is fully set up, i.e. after we finished with the
authentication and Hello() phase. This API is useful for clients in
particular when using the "watch_bind" feature, as that way it can be
determined in advance whether it makes sense to sync on some operation.
Lennart Poettering [Tue, 19 Dec 2017 14:45:30 +0000 (15:45 +0100)]
sd-bus: modernize how we generate the match string in sd-bus-track
strjoina() FTW!
Lennart Poettering [Tue, 19 Dec 2017 14:41:58 +0000 (15:41 +0100)]
sd-bus: drop references to legacy /var/run D-Bus socket
Let's directly reference /run instead, so that we can work without /var
being around, or with /var/run being incorrectly set up.
Note that we keep the old socket path in place when referencing the
system bus of containers, as they might be foreign operating systems,
that still don't have adopted /run, and where it makes sense to use the
standardized name instead. On local systems, we insist on /run being set
up properly however, hence this limitation does not apply.
Also, get rid of the UNIX_SYSTEM_BUS_ADDRESS and
UNIX_USER_BUS_ADDRESS_FMT defines. They had a purpose when we still did
kdbus, as we then had to support two different backends. But since
that's gone, we don't need this indirection anymore, hence settle on a
one define only.
Lennart Poettering [Tue, 19 Dec 2017 14:39:44 +0000 (15:39 +0100)]
man: let's drop references to /var/run in public man pages
/var/run is a legacy compatibility feature, let's avoid mentioning it.
Lennart Poettering [Tue, 19 Dec 2017 11:29:04 +0000 (12:29 +0100)]
tree-wide: install matches asynchronously
Let's remove a number of synchronization points from our service
startups: let's drop synchronous match installation, and let's opt for
asynchronous instead.
Also, let's use sd_bus_match_signal() instead of sd_bus_add_match()
where we can.
Lennart Poettering [Mon, 18 Dec 2017 21:10:11 +0000 (22:10 +0100)]
tree-wide: make name requesting asynchronous in all our services
This optimizes service startup a bit, and makes it less prone to
deadlocks.
Lennart Poettering [Mon, 18 Dec 2017 20:58:14 +0000 (21:58 +0100)]
sd-bus: when disconnecting a slot, also reset its memory
Yes, we aren#t accessing this anymore after, but it's still nicer if
this is actually guaranteed.
Lennart Poettering [Mon, 18 Dec 2017 20:52:50 +0000 (21:52 +0100)]
sd-bus: add new API sd_bus_match_signal() + sd_bus_match_signal_asnyc()
These are convenience helpers that hide the match string logic (which we
probably should never have exposed), and instead just takes regular C
arguments.
Lennart Poettering [Mon, 18 Dec 2017 20:37:03 +0000 (21:37 +0100)]
sd-bus: add asynchronous version of sd_bus_match()
We usually enqueue a number of these calls on each service
initialization. Let's do this asynchronously, and thus remove
synchronization points. This improves both performance behaviour and
reduces the chances to deadlock.
Lennart Poettering [Mon, 18 Dec 2017 19:50:26 +0000 (20:50 +0100)]
sd-bus: when removing a server-side match, do so in "fire and forget" fashion
We currently wait for the RemoveMatch() reply, but then ignore what it
actually says. Let's optimize this a bit, and not even ask for an answer
back: just enqueue the RemoveMatch() operation, and do not request not
wait for any answer.
Lennart Poettering [Mon, 18 Dec 2017 19:45:35 +0000 (20:45 +0100)]
sd-bus: remove bus_remove_match_by_string() helper which is unused
Lennart Poettering [Mon, 18 Dec 2017 19:34:21 +0000 (20:34 +0100)]
sd-bus: drop unused parameters from bus_add_match_internal()
We don't need the match components anymore, since kdbus is gone, hence
drop it.
Lennart Poettering [Mon, 18 Dec 2017 19:10:13 +0000 (20:10 +0100)]
sd-bus: add APIs to request/release names asynchronously
They do the same thing as their synchronous counterparts, but only
enqueue the operation, thus removing synchronization points during
service initialization.
If the callback function is passed as NULL we'll fallback to generic
implementations of the reply handlers, that terminate the connection if
the requested name cannot be acquired, under the assumption that not
being able to acquire the name is a technical problem.
Lennart Poettering [Mon, 18 Dec 2017 13:48:16 +0000 (14:48 +0100)]
bus-control: remove kdbus indirection cruft
When kdbus was still around we always had two implementations of the
various control calls: one for dbus1 and one for kdbus. Let'sget rid of
this, simplify things, and just merge the wrappers that used to
multiplex this with the implementations.
No change in behaviour, just some merging of functions
Lennart Poettering [Mon, 18 Dec 2017 13:21:34 +0000 (14:21 +0100)]
sd-bus: get rid of kdbus flags cruft
We only need three bits from the old kdbus flags cruft, hence let's make
them proper booleans.
Lennart Poettering [Fri, 15 Dec 2017 21:19:34 +0000 (22:19 +0100)]
busctl: add a new --watch-bind switch
This is useful for testing, and early-boot scripting.
Lennart Poettering [Mon, 18 Dec 2017 12:53:12 +0000 (13:53 +0100)]
sd-bus: start reply callback timeouts only when the connection is established
Currently, reply callback timeouts are started the instant the method
calls are enqueued, which can be very early on. For example, the Hello()
method call is enqueued right when sd_bus_start() is called, i.e. before
the socket connection and everything is established.
With this change we instead start the method timeout the moment we
actually leave the authentication phase of the connection. This way, the
timeout the kernel applies on socket connecting, and we apply on the
authentication phase no longer runs in parallel to the Hello() method
call, but all three run serially one after the other, which is
definitely a cleaner approach.
Moreover, this makes the "watch bind" feature a lot more useful, as it
allows enqueuing method calls while we are still waiting for inotify
events, without them timeouting until the connection is actually
established, i.e. when the method call actually has a chance of being
actually run.
This is a change of behaviour of course, but I think the new behaviour
is much better than the old one, since we don't race timeouts against
each other anymore...
Lennart Poettering [Fri, 15 Dec 2017 21:24:52 +0000 (22:24 +0100)]
sd-bus: optionally, use inotify to wait for bus sockets to appear
This adds a "watch-bind" feature to sd-bus connections. If set and the
AF_UNIX socket we are connecting to doesn't exist yet, we'll establish
an inotify watch instead, and wait for the socket to appear. In other
words, a missing AF_UNIX just makes connecting slower.
This is useful for daemons such as networkd or resolved that shall be
able to run during early-boot, before dbus-daemon is up, and want to
connect to dbus-daemon as soon as it becomes ready.
Lennart Poettering [Wed, 27 Dec 2017 17:22:31 +0000 (18:22 +0100)]
bus: touch() the AF_UNIX sockets we listen() on after the fact
We'd like to use inotify to get notified when AF_UNIX sockets become
connectable. That happens at the moment of listen(), but this is doesn't
necessarily create in a watchable inotify event. Hence, let's synthesize
one whenever we generically create a socket, or when we know we created
it for a D-Bus server.
Ideally we wouldn't have to do this, and the kernel would generate an
event anyway for this. Doing this explicitly isn't too bad however, as
the event is still nicely associated with the AF_UNIX socket node, and
we generate all D-Bus sockets in our code hence it's safe.
Lennart Poettering [Wed, 27 Dec 2017 16:18:02 +0000 (17:18 +0100)]
socket-util: explicitly ensure there's one trailing NUL byte on AF_UNIX socket addresses
AF_UNIX socket addresses aren't necessarily NUL terminated, however
they are usually used as strings which are assumed to be NUL terminated.
Let's hence add an extra byte to the end of the sockaddr_un structure,
that contains this NUL byte, simply for safety reasons.
Note that actually this patch changes exactly nothing IRL, as the other
sockaddr structures already are large enough to accomodate for an extra
NUL byte. The size of the union hence doesn't change at all by doing
this. The entire value of this patch is hence in the philosophical
feeling of safety, and by making something explicit that before was
implicit.
Lennart Poettering [Wed, 27 Dec 2017 16:02:36 +0000 (17:02 +0100)]
socket-util: use parse_ip_port() for parsing IP ports
Let's unify some code here, and also use parse_ip_port() for all our IP
port parsing needs in socket_address_parse().
Lennart Poettering [Wed, 27 Dec 2017 15:59:44 +0000 (16:59 +0100)]
socket-label: tweak socket_address_listen() a bit
This changes two things when binding to AF_UNIX file system sockets:
1. When wethe socket already exists in the fs, and unlink() on it fails,
don't bother to bind() a second time: since nothing changed it won't
work either.
2. Also use SELinux-aware bind() for the second attempt.
Lennart Poettering [Wed, 27 Dec 2017 15:50:24 +0000 (16:50 +0100)]
socket-label: simplify things a bit by using socket_address_get_path()
Let's make this more generic and descriptive, and let's reuse our
existing utility functions.
Lennart Poettering [Wed, 27 Dec 2017 15:20:28 +0000 (16:20 +0100)]
fs-util: rework touch_file() so that it can touch socket file nodes
Let's rework touch_file() so that it works correctly on sockets, fifos,
and device nodes: let's open an O_PATH file descriptor first and operate
based on that, if we can. This is usually the better option as it this
means we can open AF_UNIX nodes in the file system, and update their
timestamps and ownership correctly. It also means we can correctly touch
symlinks and block/character devices without triggering their drivers.
Moreover, by operating on an O_PATH fd we can make sure that we
operate on the same inode the whole time, and it can't be swapped out in
the middle.
While we are at it, rework the call so that we try to adjust as much as
we can before returning on error. This is a good idea as we call the
function quite often without checking its result, and hence it's best to
leave the files around in the most "correct" fashion possible.
Lennart Poettering [Fri, 15 Dec 2017 21:24:16 +0000 (22:24 +0100)]
sd-bus: when attached to an sd-event loop, disconnect on processing errors
If we can't process the bus for some reason we shouldn't just disable
the event source, but log something and give up on the connection. Hence
do that, and disconnect.
Lennart Poettering [Tue, 12 Dec 2017 22:26:36 +0000 (23:26 +0100)]
sd-bus: propagate handling errors for Hello method reply directly
Currently, when sd-bus is used to issue a method call, and we get a
reply and the specified reply handler fails, we log this locally at
debug priority and proceed. The idea is that a bad server-side reply
should not be fatal for the program, except when the developer
explicitly terminates the event loop.
The reply to the initial Hello() method call we issue when joining a bus
should not be handled like that however. Instead, propagate the error
immediately, as anything that is wrong with the Hello() reply should be
considered a fatal connection problem.
Lennart Poettering [Tue, 12 Dec 2017 22:26:08 +0000 (23:26 +0100)]
sd-bus: minor coding style fix
Lennart Poettering [Tue, 12 Dec 2017 22:24:44 +0000 (23:24 +0100)]
sd-bus: cast some syscall invocations explicitly to (void)
Let's clarify that we knowingly ignore the return values.
Lennart Poettering [Tue, 12 Dec 2017 22:23:25 +0000 (23:23 +0100)]
sd-bus: when debug logging about messages, show the same bits of it everywhere
Also, include the message signature everywhere.
Lennart Poettering [Tue, 12 Dec 2017 22:21:09 +0000 (23:21 +0100)]
io-util: make flush_fd() return how many bytes where flushed
This is useful so that callers know whether anything at all and how much
was flushed.
This patches through users of this functions to ensure that the return
values > 0 which may be returned now are not propagated in public APIs.
Also, users that ignore the return value are changed to do so explicitly
now.
John Lin [Fri, 5 Jan 2018 12:15:42 +0000 (20:15 +0800)]
install: search preset files in /run (#7715)
According to systemd.preset(5), presets files in /run should take
effect. However, before this patch, preset files in /run were
ignored.
Zbigniew Jędrzejewski-Szmek [Fri, 5 Jan 2018 11:38:29 +0000 (12:38 +0100)]
Merge pull request #7763 from yuwata/fix-7761
Revert "core/execute: RuntimeDirectory= or friends requires mount namespace"
Bruce A. Johnson [Fri, 5 Jan 2018 09:02:38 +0000 (04:02 -0500)]
systemd-udevd: fix speed/duplex processing with valid .link files (#7808)
Including BitsPerSecond or Duplex values in .link files did not work when
set_slinksettings was called because the routine was not copying the base
parameters to the structure given to ioctl. As a result, EINVAL was always
reported, and no change occurred on the Ethernet device.
Alexis Deruelle [Fri, 5 Jan 2018 00:17:17 +0000 (01:17 +0100)]
Touchpad range : add another Macbook4,1 variant (#7749)
#Add "Early 2008 Core 2 Duo/Penryn" Macbook4,1 match string to the existing touchpad range definition
##Symptoms
* Jerky/Jumpy cursor motion using touchpad
* "Axis value outside expected range" message in Xorg.0.log
##Fix
I followed the instructions described here :https://wayland.freedesktop.org/libinput/doc/latest/absolute_coordinate_ranges.html and came up with the following :
evdev:input:b0003v05ACp022A*
EVDEV_ABS_00=256:1469:12
EVDEV_ABS_01=256:829:12
The ranges and resolutions are the same as stated in the existing definition (+/- 2) so only add the match string.
Hans de Goede [Thu, 4 Jan 2018 18:43:27 +0000 (19:43 +0100)]
hwdb: Add accel mount settings for Asus T200TA 2-in-1 (#7810)
Add accel mount settings for the INVN6500 accelerometer found in
Asus T200TA 2-in-1 devices to 60-sensor.hwdb.
Zbigniew Jędrzejewski-Szmek [Thu, 4 Jan 2018 14:25:07 +0000 (15:25 +0100)]
Merge pull request #7767 from poettering/fork-wait
A variety of smaller improvements all over the place
Lennart Poettering [Thu, 4 Jan 2018 14:20:29 +0000 (15:20 +0100)]
Merge pull request #7805 from keszybz/coverity-prep
Two small workarounds to help coverity
Lennart Poettering [Thu, 4 Jan 2018 12:52:50 +0000 (13:52 +0100)]
NEWS: add in a missing change back from 229 (#7804)
See:
https://lists.freedesktop.org/archives/systemd-devel/2017-July/039255.html
http://fromthecodefront.blogspot.de/2017/07/systemd-pitfalls.html
Zbigniew Jędrzejewski-Szmek [Thu, 4 Jan 2018 08:45:23 +0000 (09:45 +0100)]
coverity: don't use (void)0 under coverity
I'm not sure why this is needed, but apparrently coverity doesn't like
(void)0. With this change, coverity can (almost) build systemd:
CFLAGS='-D_Float128="long double"' meson cov-build -Dman=false && \
CCACHE_DISABLE=1 COVERITY_UNSUPPORTED=1 cov-build --dir cov-int ninja -C cov-build
Patch originially by Marek Cermak <macermak@redhat.com>.
Zbigniew Jędrzejewski-Szmek [Thu, 4 Jan 2018 12:27:51 +0000 (13:27 +0100)]
test-routing-policy-rule: split out fd assignment from assert_se
It's ugly that parentheses need to be used. Let's just split it out.
Incidentally, this will make coverity happy, because it doesn't grok
assert_se().
Lennart Poettering [Sat, 30 Dec 2017 14:21:12 +0000 (15:21 +0100)]
update TODO
Lennart Poettering [Sat, 30 Dec 2017 14:44:29 +0000 (15:44 +0100)]
fileio: minor tweak to executable_is_script()
If read_line() returns ENOBFUS this means the line was overly long. When
we use this for checking whether an executable is a script, then this
shouldn't be propagated as-is, but simply as "this is not a script".
Lennart Poettering [Sat, 30 Dec 2017 14:42:03 +0000 (15:42 +0100)]
fileio: tweak write_string_stream_ts() to write out trailing \n in one go even if buffering is off
This tweaks write_string_stream_ts() in one minor way: when stdio
buffering has been turned off, let's append the newline we shall append
to the buffer we write ourselves so that the kernel only gets one
syscall for the result. When buffering is enabled stdio will take care
of that anyway.
Follow-up for #7750.
Lennart Poettering [Sat, 30 Dec 2017 14:20:38 +0000 (15:20 +0100)]
sd-bus: port one use of SO_PEERCRED by getpeercred()
Lennart Poettering [Sat, 30 Dec 2017 14:19:53 +0000 (15:19 +0100)]
sd-bus: let's use mfree() where we can
Lennart Poettering [Sat, 30 Dec 2017 14:19:15 +0000 (15:19 +0100)]
sd-bus: use SO_PEERGROUPS when available to identify groups of peer
Lennart Poettering [Sat, 30 Dec 2017 14:17:39 +0000 (15:17 +0100)]
journald: introduce new uid_for_system_journal() helper
We use the same check at two places, let's add a tiny helper function
for it, since it's not entirely trivialy, and we changes this before
multiple times, and it's a good thing if we can change it at one place
only instead of multiple.
Lennart Poettering [Sat, 30 Dec 2017 14:15:44 +0000 (15:15 +0100)]
socket-util: slight rework of getpeersec()
Let's call getsockopt() in a loop, so that we can deal correctly with
the label changing while we are trying to read it.
(also, while we are at it, let's make sure that there's always one
trailing NUL byte at the end of the buffer, after all SO_PEERSEC has
zero documentation, and multiple implementing backends, hence let's
better be safe than sorry)
Lennart Poettering [Sat, 30 Dec 2017 14:15:03 +0000 (15:15 +0100)]
tree-wide: use {pid,uid,gid}_is_valid() where appropriate
Also, drop UID/GID validity checks from getpeercred() as the kernel will
never pass us invalid UID/GID on userns, but the overflow UID/GID
instead. Add a comment about this.
Lennart Poettering [Sat, 30 Dec 2017 13:07:33 +0000 (14:07 +0100)]
calenderspec: when normalizing, flush out UTC timezone
Lennart Poettering [Sat, 30 Dec 2017 13:05:41 +0000 (14:05 +0100)]
user-util: minor updates of in_gid()
Let's use newa() and use the right type for storing sysconf() return
values.
Lennart Poettering [Sat, 30 Dec 2017 13:02:36 +0000 (14:02 +0100)]
socket-util: add new getpeergroups() call
It's a wrapper around the new SO_PEERGROUPS sockopt, similar in style as
getpeersec() and getpeercred().
Lennart Poettering [Fri, 29 Dec 2017 20:21:54 +0000 (21:21 +0100)]
tree-wide: in all threads we fork off in library code, block all signals
This ensures that in all threads we fork off in the background in our
code we mask out all signals, so that our thread won't end up getting
signals delivered the main process should be getting.
We always set the signal mask before forking off the thread, so that the
thread has the right mask set from its earliest existance on.
Lennart Poettering [Fri, 29 Dec 2017 17:52:20 +0000 (18:52 +0100)]
process-util: add new FORK_NEW_MOUNTNS flag to safe_fork()
That way we can move one more code location to use safe_fork()
Lennart Poettering [Fri, 29 Dec 2017 17:14:37 +0000 (18:14 +0100)]
pager: let's move static variables up, to the rest of them
let's keep static variables together, and before the function
definitions.
Lennart Poettering [Fri, 29 Dec 2017 17:13:38 +0000 (18:13 +0100)]
pager,agent: insist that we are called from the main thread
We maintain static process-wide variables in these subsystems without
locking, hence let's refuse operation unless we are called from the main
thread (which we do anyway) just as a safety precaution.
Lennart Poettering [Fri, 29 Dec 2017 17:12:30 +0000 (18:12 +0100)]
tree-wide: use EXIT_SUCCESS when comparing child process exit statuses
When we check the exit status of a subprocess, let's compare it with
EXIT_SUCCESS rather than 0 when looking for success.
This clarifies in code what kind of variable we are looking at and what
we are doing.
Lennart Poettering [Fri, 29 Dec 2017 17:09:16 +0000 (18:09 +0100)]
tree-wide: unify the process name we pass to wait_for_terminate_and_check() with the one we pass to safe_fork()
Lennart Poettering [Fri, 29 Dec 2017 17:07:00 +0000 (18:07 +0100)]
tree-wide: make use of wait_for_terminate_and_check() at various places
Using wait_for_terminate_and_check() instead of wait_for_terminate()
let's us simplify, shorten and unify the return value checking and
logging of waitid(). Hence, let's use it all over the place.