Commit Graph

45211 Commits

Author SHA1 Message Date
Lennart Poettering 70d8586365 libsystemd: properly export new sd_notify_barrier() API call
Follow-up for: 4f07ddfa9b
2020-05-28 23:38:21 +02:00
Lennart Poettering 5a7cf2e9d8 hwdb: whitespace fix 2020-05-28 23:38:17 +02:00
Lennart Poettering b0d0e0ef98 start NEWS file for v246 2020-05-28 23:37:43 +02:00
Lennart Poettering 08b8f29a25 tree-wide: remove spurious whitespace 2020-05-28 19:23:47 +02:00
Zbigniew Jędrzejewski-Szmek a4ac27c1af manager: free the jobs hashmap after we have no jobs
After a larger transaction, e.g. after bootup, we're left with an empty hashmap
with hundreds of buckets. Long-term, it'd be better to size hashmaps down when
they are less than 1/4 full, but even if we implement that, jobs hashmap is
likely to be empty almost always, so it seems useful to deallocate it once the
jobs count reaches 0.
2020-05-28 18:54:20 +02:00
Zbigniew Jędrzejewski-Szmek f6173cb955 core: define UnitDependency iterators in loops
Reduced scope of variables is always nice.
2020-05-28 18:53:35 +02:00
Zbigniew Jędrzejewski-Szmek 3fb2326f3e shared/unit-file: make sure the old hashmaps and sets are freed upon replacement
Possibly fixes #15220. (There might be another leak. I'm still investigating.)

The leak would occur when the path cache was rebuilt. So in normal circumstances
it wouldn't be too bad, since usually the path cache is not rebuilt too often. But
the case in #15220, where new unit files are created in a loop and started, the leak
occurs once for each unit file:

$ for i in {1..300}; do cp ~/.config/systemd/user/test0001.service ~/.config/systemd/user/test$(printf %04d $i).service; systemctl --user start test$(printf %04d $i).service;done
2020-05-28 18:51:52 +02:00
Zbigniew Jędrzejewski-Szmek db868d45f9 core: make unit_set_invocation_id static
No functional change.
2020-05-28 18:47:01 +02:00
Lennart Poettering 60daebdec2
Merge pull request #15882 from poettering/pam-sudo-fixes-part4
More pam_systemd fixes split out of #15742
2020-05-28 00:27:51 +02:00
Lennart Poettering 38344f1a79
Merge pull request #15893 from DaanDeMeyer/firstboot-overwrite
systemd-firstboot: Add --force, --delete-root-password and --root-password-is-hashed options
2020-05-27 22:51:02 +02:00
Lennart Poettering e0d70f7691 pam_systemd: set legacy D-Bus path only if the runtime directory is validated 2020-05-27 22:47:30 +02:00
Lennart Poettering 6d06dfad85 pam_systemd: be more thorough when validating runtime paths 2020-05-27 22:47:15 +02:00
Lennart Poettering 08ab18618e resolved: tweak cmsg calculation
We ask for the TTL, then have enough space for it.

We probably can drop the extra cmsg space now, but let's figure that out
another time, since the extra cmsg space is used elsewhere in resolved
as well.
2020-05-27 22:40:59 +02:00
Lennart Poettering 43007b302e networkd: clean up NETLINK_PKTINFO vs. SO_PASSCRED confusion
We actually care for NETLINK_PKTINFO, not for SO_PASSCRED, hence when
allocating the netlink socket, configure things accordingly.

Tracked down by Benjamin Robin, see:

https://github.com/systemd/systemd/pull/15571#issuecomment-633213747
2020-05-27 22:40:56 +02:00
Lennart Poettering a3d19f5d99 core: add new PassPacketInfo= socket unit property 2020-05-27 22:40:38 +02:00
Lennart Poettering 35a3eb9bdc socket-util: add generic socket_pass_pktinfo() helper
The helper turns on the protocol specific "packet info" structure cmsg
for three relevant protocols we know.
2020-05-27 22:39:34 +02:00
Daan De Meyer a5925354bb firstboot: Add --kernel-command-line option 2020-05-27 18:54:26 +02:00
Daan De Meyer 676339a191 firstboot: Add --root-password-hashed option 2020-05-27 18:54:26 +02:00
Daan De Meyer 97a1a1103c Remove systemd-firstboot --force entry from TODO 2020-05-27 18:54:26 +02:00
Daan De Meyer 4926ceaff3 firstboot: Add --delete-root-password option 2020-05-27 18:54:25 +02:00
Daan De Meyer b4909a3fd0 firstboot: Add --force option 2020-05-27 18:54:25 +02:00
Daan De Meyer 2da3dc69e7 fileio: Rename rename_and_apply_smack to rename_and_apply_smack_floor_label. 2020-05-27 18:54:25 +02:00
Daan De Meyer 90c81688ff fileio: Refactor sync_rights to take fds as arguments 2020-05-27 18:54:25 +02:00
Daan De Meyer 494735f3d0 sysusers: Move sync_rights and rename_and_apply_smack to basic 2020-05-27 18:54:25 +02:00
Daan De Meyer 1fbc95d388 firstboot: Don't check twice if /etc/shadow exists 2020-05-27 18:54:25 +02:00
Lennart Poettering bb2294e454
Merge pull request #15669 from andir/systemd-ipv6-pd-subnet-id
networkd: subnet id support for ipv6 prefix delegation
2020-05-27 18:47:26 +02:00
Lennart Poettering 6bce17455e
Merge pull request #15226 from benzea/benzea/xdg-autostart-generator
xdg-autostart-generator: a generator for XDG autostart files
2020-05-27 18:41:01 +02:00
Michael Biebl f978844eb6 man: fix conditional in homed.conf.xml 2020-05-27 16:59:42 +02:00
Lennart Poettering 5abee64ed4 udev: when the BSD lock on a block device is taken, don't complain
if someone implements https://systemd.io/BLOCK_DEVICE_LOCKING/ then we
shouldn't loudly complain about that.

This reverts back to the original behaviour from
3ebdb81ef088afd3b4c72b516beb5610f8c93a0d: when the lock is taken we
silently skip processing the device and sending out the messages for it.
2020-05-27 15:30:48 +02:00
Lennart Poettering 49d5aae503
Merge pull request #15934 from keszybz/docs-and-test-fix
A few sundry documentation and code fixes
2020-05-27 15:16:24 +02:00
Lennart Poettering 6d02412d51
Merge pull request #15928 from poettering/kill-mode-warnings
warn on KillMode=none, inform about left-over processes on stop and warn about sysv services
2020-05-27 15:05:41 +02:00
Chris Kerr 8aa36b1ddd man: Fix typo in suggested permissions
The user and group name is 'systemd-network' not 'systemd-networkd'
2020-05-27 15:03:25 +02:00
Lennart Poettering 2b5f708985 run: when waiting for unit, also check if no job is pending anymore
This is a fix-up for a7c71d214c37797d82de2f66cfe0a0a79c3a5c92: since we
now don't wait for the job to finish anymore right after enqueuing it,
we should not exit our ptyfwd logic before the unit is back to inactive
*and* no job pending anymore.
2020-05-27 15:01:07 +02:00
Lennart Poettering 518a9bd689
Merge pull request #15853 from poettering/tmp-argument
support the Debian-style tmp= argument in crypttab
2020-05-27 14:51:50 +02:00
Frantisek Sumsal ffbb0fb9cb meson: support building fuzzers with meson <0.48.0 2020-05-27 12:27:45 +02:00
Chris Down 4793c31083 service: Display updated WatchdogUSec from sd_notify
Suppose a service has WatchdogSec set to 2 seconds in its unit file. I
then start the service and WatchdogUSec is set correctly:

    % systemctl --user show psi-notify -p WatchdogUSec
    WatchdogUSec=2s

Now I call `sd_notify(0, "WATCHDOG_USEC=10000000")`. The new timer seems
to have taken effect, since I only send `WATCHDOG=1` every 4 seconds,
and systemd isn't triggering the watchdog handler. However, `systemctl
show` still shows WatchdogUSec as 2s:

    % systemctl --user show psi-notify -p WatchdogUSec
    WatchdogUSec=2s

This seems surprising, since this "original" watchdog timer isn't the
one taking effect any more. This patch makes it so that we instead
display the new watchdog timer after sd_notify(WATCHDOG_USEC):

    % systemctl --user show psi-notify -p WatchdogUSec
    WatchdogUSec=10s

Fixes #15726.
2020-05-27 09:09:40 +02:00
Zbigniew Jędrzejewski-Szmek dde5c821bf shared/efi-loader: remove check that uses absolute tick value
sd-boot uses rdtsc to set those timestamps. There is no guarantee that the tsc
has any particular absolute value.

On my VM:
$ head /sys/firmware/efi/efivars/LoaderTime*
==> /sys/firmware/efi/efivars/LoaderTimeExecUSec-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f <==
4397904074
==> /sys/firmware/efi/efivars/LoaderTimeInitUSec-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f <==
4396386839
==> /sys/firmware/efi/efivars/LoaderTimeMenuUSec-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f <==
4396392521

$ build/test-boot-timestamps
...
LoaderTimeExecUSec=4396386839 too large, refusing.
Failed to read EFI loader data: Input/output error
Assertion 'q >= 0' failed at src/test/test-boot-timestamps.c:84, function main(). Aborting.

(with patch)
$ build/test-boot-timestamps
...
EFI Loader: start=1h 13min 16.386s exit=1h 13min 17.904s duration=1.517s
Firmware began 1h 13min 17.904074s before kernel.
Loader began 1.517235s before kernel.
Firmware began Tue 2020-05-26 11:04:13 CEST.
Loader began Tue 2020-05-26 12:17:30 CEST.
Kernel began Tue 2020-05-26 12:17:31 CEST.
2020-05-27 09:02:53 +02:00
Zbigniew Jędrzejewski-Szmek 24b4597064 core: minor simplification 2020-05-27 09:02:53 +02:00
Zbigniew Jędrzejewski-Szmek 40fd0a77c6 userwork: remove trailing comma in message 2020-05-27 09:02:53 +02:00
Zbigniew Jędrzejewski-Szmek 1414090854 core: add forgotten return in error path
If we get an error here, this is most likely oom, and we should not continue.
2020-05-27 09:02:53 +02:00
Benjamin Berg 2ad7597e44 fuzz: Add an XDG desktop file fuzzer
To test the XDG parser used by the xdg-autostart-generator.

Co-authored-by: Evgeny Vereshchagin <evvers@ya.ru>
2020-05-27 09:02:10 +02:00
Benjamin Berg 98e07533a2 test: Add test for XDG desktop file parsing and interpretation 2020-05-27 09:02:10 +02:00
Benjamin Berg 4540e698e8 man: Add systemd-xdg-autostart-generator man page 2020-05-27 09:02:10 +02:00
Benjamin Berg 8feca2472c xdg-autostart-generator: Add a generator for XDG autostart files
This generator can be used by desktop environments to launch autostart
applications and services. The feature is an opt-in, triggered by
xdg-desktop-autostart.target being activated.

Also included is the new binary xdg-autostart-condition. This binary is
used as an ExecCondition to test the OnlyShowIn and NotShowIn XDG
desktop file keys. These need to be evaluated against the
XDG_CURRENT_DESKTOP environment variable which may not be known at
generation time.

Co-authored-by: Henri Chain <henri.chain@enioka.com>
2020-05-27 09:02:10 +02:00
Zbigniew Jędrzejewski-Szmek 3035a7c577 core: update comment about sysv compat
We don't want people to consider that part deprecated.

Follow-up for 6589a56972.
2020-05-27 09:02:09 +02:00
Benjamin Berg 8746820b87 sysv-generator: Downgrade directory listing fails to warning
This is not a fatal error and should therefore be a warning instead.
2020-05-27 08:59:59 +02:00
Frantisek Sumsal 2991fa41e4 test: create public images by default
Let's create new images public by default and then symlink/copy them
into the respective private directories afterwards, not the other way
around. This should fix a nasty race condition in parallel runs where
one tests attempts to copy the backing public image at the same moment
another test is already modifying it.
2020-05-27 08:41:02 +02:00
Evgeny Vereshchagin 9554b8d1d1 fuzzit: switch to -fundefined
Now that https://github.com/systemd/systemd/issues/15907 is gone,
we can simply use "undefined" instead of listing all the possible checks
explicitly.
2020-05-27 08:38:37 +02:00
Frantisek Sumsal 8441ff6886 test: make the systemd-run calls synchronous
Otherwise we might be checking results of such calls before they even
finish, causing nasty races like:

```
[   15.656530] testsuite-43.sh[303]: + su testuser -s /bin/sh -c 'XDG_RUNTIME_DIR=/run/user/$UID exec "$@"' -- sh systemd-run --user --unit=test-unprotected-home -P touch /home/testuser/works.txt
...
[   15.757744] testsuite-43.sh[324]: Running as unit: test-unprotected-home.service
[   15.775611] systemd[296]: Started /usr/bin/touch /home/testuser/works.txt.
[   15.783597] testsuite-43.sh[303]: + test -e /home/testuser/works.txt
[   15.787542] systemd[296]: test-unprotected-home.service: Succeeded.
...
[   15.787684] systemd[1]: Received SIGCHLD from PID 303 (bash).
[   15.787790] systemd[1]: Child 303 (bash) died (code=exited, status=1/FAILURE)
[   15.787881] systemd[1]: testsuite-43.service: Child 303 belongs to testsuite-43.service.
[   15.788040] systemd[1]: testsuite-43.service: Main process exited, code=exited, status=1/FAILURE
[   15.788224] systemd[1]: testsuite-43.service: Failed with result 'exit-code'.
[   15.788333] systemd[1]: testsuite-43.service: Service will not restart (restart setting)
[   15.788421] systemd[1]: testsuite-43.service: Changed start -> failed
[   15.788790] systemd[1]: testsuite-43.service: Job 160 testsuite-43.service/start finished, result=failed
[   15.788995] systemd[1]: Failed to start testsuite-43.service.
```
2020-05-27 08:36:57 +02:00
Lennart Poettering 698564d147 efivars: log whenever an EFI variable read access is slow
This should allow us to detect slowdowns caused by EFI variable read
access a bit.
2020-05-27 08:36:07 +02:00