Commit Graph

40149 Commits

Author SHA1 Message Date
Lennart Poettering 77c45ce336 logind: convert ENXIO into 0, to signal 'not found' cleanly 2019-05-24 15:05:27 +02:00
Lennart Poettering ed179418ae logind: support self/auto seats for AttachDevice(), too 2019-05-24 15:05:27 +02:00
Lennart Poettering bda0613072 logind: validate /sys fs path a bit more strictly 2019-05-24 15:05:27 +02:00
Lennart Poettering b0bd159f67 logind: prefer hashmap_contains() over hashmap_get() 2019-05-24 15:05:27 +02:00
Lennart Poettering 544c4e1eda loginctl: drop $XDG_SESSION_ID env var magic
The server side can do something similar, but better on its own, let's
hence rely on that.
2019-05-24 15:05:27 +02:00
Lennart Poettering 3b92c086a8 logind: make "self" and "auto" magic strings when operating on seats + sessions
Most of the operations one can do on sessions so far accepted an empty
session name as a shortcut for the caller's session. This is quite
useful traditionally, but much less useful than it used to be, since
most user code now (rightfully) runs in --user context, not in a
session.

With this change we tweak the logic a bit: we introduce the two special
session and seat names "self" and "auto". The former refers to the
session/seat the client is in, and is hence mostly equivalent to te
empty string "" as before. However, the latter refers to the
session/seat the client is in if that exists, with a fallback of the
user's display session if not. Clients can hence reference "auto"
instead of the empty string if they really don't want to think much
about sessions.

Why "self" btw? Previously, we'd already expose a special dbus object
with the path /org/freedesktop/login1/session/self (and similar for the
seat), matching what the empty string did for bus calls that took a
session name. With this scheme we reuse this identifier and introduce
"auto" in a similar way.

Of course this means real-life seats and sessions can never be named
"self" or "auto", but they aren't anyway: valid seat names have to start
with "seat" anyway, and sessions are generated server-side as either a
numeric value or "c" suffixed with a counter ID.

Fixes: #12399
2019-05-24 15:05:27 +02:00
Lennart Poettering 469df514c7 logind: make a constant array static 2019-05-24 15:05:27 +02:00
Lennart Poettering a2dcb1d787 logind: consider "greeter" sessions suitable as "display" sessions of a user
Interestingly, elect_display_compare() already ordered "user" sessions
before "greeter" sessions, though nothing other than "user" sessions
where ever considered anyway.

Fixes: #12399
2019-05-24 15:05:27 +02:00
Lennart Poettering 19483c60bb logind: make sure the service gets access to the linger directory
Fixes: #12401
2019-05-24 15:05:27 +02:00
Lennart Poettering 2a66c2a1ed logind: add SetBrightness() bus call for setting brightness of leds/backlight devices associated with a seat
This augments the drm/input device management by adding a single method
call for setting the brightness of an "leds" or "backlight" kernel class
device.

This method call requires no privileges to call, but a caller can only
change the brightness on sessions that are currently active, and they
must own the session.

This does not do enumeration of such class devices, feature or range
probing, chnage notification; it doesn't help associating graphics or
input devices with their backlight or leds devices. For all that clients
should go directly to udev/sysfs. The SetBrightness() call is just for
executing the actual change operation, that is otherwise privileged.

Example line:

   busctl call org.freedesktop.login1 /org/freedesktop/login1/session/self org.freedesktop.login1.Session SetBrightness ssu "backlight" "intel_backlight" 200

The parameter the SetBrightness() call takes are the kernel subsystem
(i.e. "leds" or "backlight"), the device name, and the brightness
value.

On some hw setting the brightness is slow, and implementation and write
access to the sysfs knobs exposes this slowness. Due to this we'll fork
off a writer process in the background so that logind doesn't have to
block. Moreover, write requestes are coalesced: when a write request is
enqueued while one is already being executed it is queued. When another
write reques is then enqueued the earlier one is replaced by the newer
one, so that only one queued write request per device remains at any
time. Method replies are sent as soon as the first write request that
happens after the request was received is completed.

It is recommended that bus clients turn off the "expect_reply" flag on
the dbus messages they send though, that relieves logind from sending
completion notification and is particularly a good idea if clients
implement reactive UI sliders that send a quick secession of write
requests.

Replaces: #12413
2019-05-24 15:05:27 +02:00
Lennart Poettering e83b8b6bc2 logind: small simplification 2019-05-24 15:05:27 +02:00
Lennart Poettering 3841f57b87 udev: tag "leds" and "backlight" devices for association to a seat
These devices do not become user-accessible this way, but they are
logically assigned to a seat, which makes a lot of sense, since they are
human-facing output devices, and such should belong to one.
2019-05-24 15:05:27 +02:00
Lennart Poettering 2570578d90 machine-image: openat() doesn't operate on the cwd if the first argument is specified
A fix-up for bcb846f30f.
2019-05-24 14:39:19 +02:00
Zbigniew Jędrzejewski-Szmek de26d715e3
Merge pull request #12430 from poettering/seccomp-kill-process
use SCMP_ACT_KILL_PROCESS for SystemCallFilters=
2019-05-24 12:17:53 +02:00
Lennart Poettering a429223d17 test-execute: turn off coredump generation in test services
These services are likely to coredump, and we expect that but aren't
interested in the coredump. Hence let's turn off processing by setting
RLIMIT_CORE to 0/0.
2019-05-24 10:48:28 +02:00
Lennart Poettering c3ab2c389e test-execute: let's ignore the difference between CLD_KILLED and CLD_DUMPED
Depending on system configuration and whether SCMP_ACT_KILL_PROCESS or
SCMP_ACT_KILL_THREAD is available/used processes might coredump on
specific coredumps or are just plain killed. For our test case the
difference doesn't really matter, hence let's hide it away.
2019-05-24 10:48:28 +02:00
Lennart Poettering 18f8c5d466 test-execute: check exit code before exit status
The meaning of the status changes depending on the code, hence let's
always compare the code first, status second.
2019-05-24 10:48:28 +02:00
Lennart Poettering 727a1a0607 service: tweak capitalization of unit description 2019-05-24 10:48:28 +02:00
Lennart Poettering 4cd8263166 NEWS: document the new SystemCallFilter= behaviour 2019-05-24 10:48:28 +02:00
Lennart Poettering f9a3d8e2f3 nspawn: expose the new seccomp actions in the OCI logic 2019-05-24 10:48:28 +02:00
Lennart Poettering 7bbc229cf7 test: use the new action in our tests
This way, we know that it works as intended.
2019-05-24 10:48:28 +02:00
Lennart Poettering ccc16c7842 core: prefer SCMP_ACT_KILL_PROCESS for SystemCallFilter= behaviour
If we have it, use it. It makes a ton more sense.

Fixes: #11967
2019-05-24 10:48:28 +02:00
Lennart Poettering 915fb32438 seccomp: add scmp_act_kill_process() helper that returns SCMP_ACT_KILL_PROCESS if supported 2019-05-24 10:48:28 +02:00
Lennart Poettering d631a760e0
Merge pull request #12601 from keszybz/two-log-color-adjustments
Two log color adjustments
2019-05-24 10:43:07 +02:00
Lennart Poettering 05332e243c
Merge pull request #12590 from keszybz/unicode-cmdlines
Use unicode for cmdline printing
2019-05-24 10:41:30 +02:00
Michael Biebl 4450894653 Drop support for /usr/sbin/halt.local
/usr/sbin/halt.local is a Fedora/Red Hat anachronism from pre-systemd
times.
2019-05-23 10:19:01 +02:00
Jóhann B. Guðmundsson ff807cbb29 mkosi: update to Fedora30 (#12642) 2019-05-23 09:39:07 +02:00
Zbigniew Jędrzejewski-Szmek ed55dc6084
Merge pull request #12645 from poettering/journal-mmap-einval
journald: output a proper error message when the journal is used on f…
2019-05-23 09:37:54 +02:00
Mike Gilbert bcb846f30f shared/machine-image: avoid passing NULL to log_debug_errno
Fixes: https://github.com/systemd/systemd/issues/12534
2019-05-23 09:36:50 +02:00
Yu Watanabe a43b1f8267
Merge pull request #12618 from yuwata/test-network-improvements
network: several cleanups
2019-05-23 11:17:33 +09:00
root 12e982425c login: fixup button_open() fd 2019-05-23 11:16:11 +09:00
Chris Down 94b0b1566a
Merge pull request #12647 from cdown/dup
test: Remove superfluous error check
2019-05-22 16:44:30 -04:00
Chris Down 3062dddabd test: Remove superfluous error check
This is already checked above before we set any manager attributes,
immediately after manager_new().
2019-05-22 15:27:26 -04:00
Lennart Poettering 93d70b6cf2
Merge pull request #12631 from keszybz/doc-and-error-message-tweaks
Doc and error message tweaks
2019-05-22 19:00:10 +02:00
Lennart Poettering 5087825ea7 journald: output a proper error message when the journal is used on fs that doesn't do mmap() properly
Prompted by:

https://lists.freedesktop.org/archives/systemd-devel/2019-May/042708.html
2019-05-22 18:56:24 +02:00
Zbigniew Jędrzejewski-Szmek 9e099c9fd8
Merge pull request #12431 from poettering/tmpfiles-chmod-chown-order
tmpfiles: run chown() before chmod()
2019-05-22 17:23:28 +02:00
Zbigniew Jędrzejewski-Szmek 847af199e5 man: reword systemd.socket(5) description to avoid "file" when talking about services
This text was written a long time ago, when we mostly talked about "service
files".  Strictly speaking, we don't need a "file", because the service might
be just an instance of a template, or an alias to another service. So let's use
the more modern parlance of "service units".

https://bugzilla.redhat.com/show_bug.cgi?id=1623781#c21
2019-05-22 16:28:02 +02:00
Zbigniew Jędrzejewski-Szmek 7cc5ef5f18 pid1: improve message when setting up namespace fails
I covered the most obvious paths: those where there's a clear problem
with a path specified by the user.

Prints something like this (at error level):
May 21 20:00:01.040418 systemd[125871]: bad-workdir.service: Failed to set up mount namespacing: /run/systemd/unit-root/etc/tomcat9/Catalina: No such file or directory
May 21 20:00:01.040456 systemd[125871]: bad-workdir.service: Failed at step NAMESPACE spawning /bin/true: No such file or directory

Fixes #10972.
2019-05-22 16:28:02 +02:00
Zbigniew Jędrzejewski-Szmek 35b966ca23 man: tweak description of #12247 a bit
It wasn't really wrong, but maybe we can make it a bit clearer.

Fixes #12247.
2019-05-22 16:28:02 +02:00
Zbigniew Jędrzejewski-Szmek b4e2407716 man: add note that %h/%u/%U are mostly useless
Fixes #12389.
2019-05-22 16:28:02 +02:00
Zbigniew Jędrzejewski-Szmek 9d48671c62 core: unset HOME=/ that the kernel gives us
Partially fixes #12389.

%h would return "/" in a machine, but "/root" in a container. Let's fix
this by resetting $HOME to the expected value.
2019-05-22 16:28:02 +02:00
Zbigniew Jędrzejewski-Szmek 8da24acad5 sd-bus: improve error message for invalid org.freedesktop.DBus.Properties.Set signature
Fixes #12551.
2019-05-22 16:28:02 +02:00
Zbigniew Jędrzejewski-Szmek 727036325a man: add note which tmpfiles services read which files
Fixes #12596.
2019-05-22 16:28:02 +02:00
Zbigniew Jędrzejewski-Szmek 92c605796d login: use _cleanup_ to simplify error handling
When logging about a device, try to include the path to it everywhere in
messages. Also fixes an invalid assert(fd).

Inspired by b2774a3ae6.
2019-05-22 15:17:24 +02:00
Lennart Poettering 0f6519d43c loop-util: invoke LOOP_CTL_GET_FREE in a loop
if we don't call it in a loop the device it tells us to open might
already be gone, taken by somebody else racing against us. Hence try a
few times.
2019-05-22 13:04:26 +02:00
Yu Watanabe 17bcf0a09f test-network: drop wait_online() from test_ip6gre_tunnel() 2019-05-22 18:02:20 +09:00
Yu Watanabe 910feb787f network: unify link_ipv4ll_enabled() and link_ipv4ll_fallback_enabled() 2019-05-22 17:59:39 +09:00
Yu Watanabe be0e1ef9b5 test-network: wait for bridge slave to be enslaved in test_bridge_ignore_carrier_loss_frequent_loss_and_gain() 2019-05-22 17:59:39 +09:00
Yu Watanabe a0ae96149a network: drop unused variable 2019-05-22 17:59:39 +09:00
Yu Watanabe bb262ef02b network: update master's ifindex in link_update()
And use it in link_is_enslaved().
2019-05-22 17:59:39 +09:00