Commit Graph
41139 Commits
Author SHA1 Message Date
Yu Watanabe f26c38edfa fuzz: sort headers 2022-12-20 11:12:58 +09:00
Yu Watanabe 57e7af551e Merge pull request #25786 from keszybz/ebadf
Use -EBADF for fd initialization
2022-12-20 10:02:10 +09:00
Yu Watanabe 8d8d4b092a Merge pull request #25787 from msekletar/rename-process-cap
units: allow systemd-userdbd to change process name
2022-12-20 09:58:47 +09:00
Michal Sekletar 03ee26168f argv-util: do proper permission check while when changing process name
Process renaming happens very seldomly so we are able to afford proper
permission check, i.e. actually check for CAP_SYS_RESOURCE capability
instead of euid.
2022-12-19 17:29:40 +01:00
Lennart Poettering 34eebf08fa Merge pull request #25783 from keszybz/trivial-cleanups
Trivial cleanups
2022-12-19 17:01:51 +01:00
Zbigniew Jędrzejewski-Szmek e8d2cb0f34 basic/hashmap: add comment
Coverity complains that the check is suspicious. Add a comment to help
the reader.
2022-12-19 15:16:41 +01:00
Zbigniew Jędrzejewski-Szmek a0e475ce6a efi: do not use 'r' as pointer name
'r' should only be used as in 'int r'.
2022-12-19 15:16:33 +01:00
Zbigniew Jędrzejewski-Szmek 98775ae0f7 userdb: fix typo 2022-12-19 15:16:24 +01:00
Zbigniew Jędrzejewski-Szmek ac2300f735 shared/dns-domain: reduce scope of variable declarations 2022-12-19 15:16:09 +01:00
Zbigniew Jędrzejewski-Szmek 351293b3bb basic/fd-util: rearrange variable declarations
Having two blocks of normal variable declarations was unnecessary.
Also 'i' can be narrower in scope.
2022-12-19 15:00:59 +01:00
Zbigniew Jędrzejewski-Szmek 3401477982 tree-wide: use -EBADF also in pipe initializers
In some places, initialization is dropped when unnecesary.
2022-12-19 15:00:59 +01:00
Zbigniew Jędrzejewski-Szmek a5937dcf39 tree-wide: change initialization to use EBADF instead of EBADFD
Those fds never were, so it's not fair to say that they are in "bad state".
Let's use the shorter and more direct errno.
2022-12-19 15:00:59 +01:00
Zbigniew Jędrzejewski-Szmek 254d1313ae tree-wide: use -EBADF for fd initialization
-1 was used everywhere, but -EBADF or -EBADFD started being used in various
places. Let's make things consistent in the new style.

Note that there are two candidates:
EBADF 9 Bad file descriptor
EBADFD 77 File descriptor in bad state

Since we're initializating the fd, we're just assigning a value that means
"no fd yet", so it's just a bad file descriptor, and the first errno fits
better. If instead we had a valid file descriptor that became invalid because
of some operation or state change, the other errno would fit better.

In some places, initialization is dropped if unnecessary.
2022-12-19 15:00:57 +01:00
Zbigniew Jędrzejewski-Szmek cbff793ffb sd-event: never pass negative errnos as signalfd to signalfd
We treat any negative value as "invalid fd", but signalfd only
accepts -1.
2022-12-19 14:56:28 +01:00
Zbigniew Jędrzejewski-Szmek da850694a9 socket-proxyd: do not hardcode -1 in a check for fd validity 2022-12-19 14:56:28 +01:00
Luca Boccassi da035a3a24 p11kit: switch to dlopen() 2022-12-19 14:49:01 +01:00
Lennart Poettering baafb202f8 bootctl: split out "install" verb too 2022-12-19 12:08:02 +01:00
Lennart Poettering da36788f65 bootctl: split out "status" verb too 2022-12-19 12:08:02 +01:00
Lennart Poettering 6d8ca25766 bootctl: split out "set-efivar" verbs, too 2022-12-19 12:06:33 +01:00
Lennart Poettering 6e975890a6 bootctl: also split out 'systemd-efi-options' verb 2022-12-19 11:52:09 +01:00
Lennart Poettering 85f875357b bootctl: split out random seed verb, too 2022-12-19 11:43:19 +01:00
Lennart Poettering 34ea7e0232 bootctl: let's start splitting up bootctl like we did for systemctl and others 2022-12-19 11:43:19 +01:00
Luca Boccassi 4bf277caa5 journal-remote: fix memory leak on initialization error
Follow-up for f12b399dd6 from
https://github.com/systemd/systemd/pull/25076

CID#1501550
2022-12-18 10:58:47 +00:00
Luca Boccassi a4f82d2cd7 journal-remote: fix initialization of vacuum metrics
Follow-up for f12b399dd6 from
https://github.com/systemd/systemd/pull/25076

CID#1501551
2022-12-18 10:57:59 +00:00
berenddeschouwerandBerend De Schouwer f12b399dd6 vacuum journal remote (#25076)
* Support vacuuming for journal-remote

Co-authored-by: Berend De Schouwer <berend@deschouwer.co.za>
2022-12-17 13:54:16 +00:00
Luca Boccassi 2c99e8c6e0 Merge pull request #25221 from enr0n/nic-rename-fallback
udev: set link alternative name if link is already up during rename
2022-12-17 14:51:39 +01:00
Luca Boccassi 896785a7d9 Merge pull request #25387 from yuwata/core-fix-gc-logic
core: fix logic of merging units
2022-12-17 14:49:21 +01:00
Lennart Poettering 4b22c9f19d Merge pull request #25487 from poettering/systemctl-edit-newline-fix
systemctl: simplify trim_edit_markers()
2022-12-15 22:22:32 +01:00
Aidan Dang 8f30c00c50 Implement SYSTEMD_HOME_MKFS_OPTIONS_* envvars to configure mkfs options for homed LUKS directories 2022-12-15 22:22:10 +01:00
Daan De Meyer 15cad3a2ab repart: Always derive fs/luks UUIDs from generated partition UUID
When generating verity partitions, we only know the partition UUID
of the verity data and hash partition after doing the verity
formatting. This means we can't use the verity partition UUID as
input for deriving the filesystem/luks UUIDs. Currently, we derive
the filesystem/luks UUID from the null UUID instead, which isn't
ideal. Instead, let's always generate a partition UUID and use it
to derive the fs/luks UUIDs, but only use it as the actual partition
UUID if we're not doing verity for the partition.
2022-12-15 22:21:17 +01:00
Lennart Poettering 0318d54539 pcrphase: gracefully exit if TPM2 support is incomplete
If everything points to the fact that TPM2 should work, but then the
driver fails to initialize we should handle this gracefully and not
cause failing services all over the place.

Fixes: #25700
2022-12-15 22:20:54 +01:00
Alvin Šipraga 986b2514cc network: wifi: check SSID when AP interfaces go up
When an AP goes up, the kernel may emit a netlink event indicating that
the interface has gained carrier. In that event, we should check if the
SSID has changed before attempting to reconfigure. Not doing so means
that the link->ssid member is not updated, leading to a potential
mismatch if some of the .network configurations match on SSID=.

There are however scenarios where the above heuristic is not enough.
Specifically, if the interface carrier state flip-flops within a short
enough interval, the internal throttling of netlink events inside the
kernel may suppress intermediate linkdown+linkup events (cf. Linux
net/core/link_watch.c). So there is no linkup event to react on.

To improve on the latter scenario, it is proposed to make newer kernels
emit an NL80211_CMD_START_AP multicast event when an AP goes up. This
event will not be dropped by link_watch. systemd-networkd can then react
to such events as well, and optionally reconfigure the link if the SSID
has changed. This will only work with newer kernels though.
2022-12-16 03:38:10 +09:00
Yu Watanabe ed9911630e core/unit: fix log message
As you can see in the below, the dropped dependency Before=issue-24990.service
is not logged, but the dependency Before=test1.service which is not owned by
the units generated by the TEST-26 is logged.

Before:
systemd[1]: issue-24990.service: Dependency After=test1.service dropped, merged into issue-24990.service
systemd[1]: issue-24990.service: Dependency Before=test1.service dropped, merged into issue-24990.service

After:
systemd[1]: issue-24990.service: Dependency After=test1.service is dropped, as test1.service is merged into issue-24990.service.
systemd[1]: issue-24990.service: Dependency Before=issue-24990.service in test1.service is dropped, as test1.service is merged into issue-24990.service.
2022-12-16 03:15:51 +09:00
Lennart Poettering 557bde331b systemctl: don't unlink non-existing temporary files 2022-12-15 17:54:27 +01:00
Lennart Poettering 1ae886fe28 systemctl: if we edit a single file only, jump to the right line 2022-12-15 17:53:49 +01:00
Lennart Poettering d88e1e484a systemctl: stop using basename() at one more place 2022-12-15 17:53:07 +01:00
Lennart Poettering 0ce6f0a35a systemctl: line break string where the newlines are 2022-12-15 17:52:26 +01:00
Lennart Poettering 2865507008 systemctl: minor modernizations/simplifications 2022-12-15 17:51:45 +01:00
Lennart Poettering 8eda5560b0 systemctl: simplify trim_edit_markers()
This is not performance sensitive, don#t try to be smart with realloc()

Follow-up for: #25305
Fixes: #25303
2022-12-15 17:51:11 +01:00
Yu Watanabe 6f3473ca03 Merge pull request #25718 from yuwata/locale-cleanups
locale: avoid TOCTOU in reading config files
2022-12-16 00:51:13 +09:00
Nick Rosbrook b338a8bb40 sd-netlink: add a test for rtnl_set_link_name()
Add a test that verifies a deleted alternative name is restored on error
in rtnl_set_link_name().
2022-12-15 09:39:05 -05:00
Nick Rosbrook 53584e7b61 udev: attempt device rename even if interface is up
Currently rename_netif() will not attempt to rename a device if it is
already up, because the kernel will return -EBUSY unless live renaming
is allowed on the device. This restriction will be removed in a future
kernel version [1].

To cover both cases, always attempt to rename the interface and return 0
if we get -EBUSY.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=bd039b5ea2a9
2022-12-15 09:35:26 -05:00
Nick Rosbrook 4d600667f8 sd-netlink: restore altname on error in rtnl_set_link_name
If a current alternative name is to be used to rename a network
interface, the alternative name must be removed first. If interface
renaming fails, restore the alternative name that was deleted if
necessary.
2022-12-15 09:35:26 -05:00
Luca Boccassi 4895bacccb Manager: also log caller of daemon-reexec 2022-12-15 23:27:06 +09:00
Nick Rosbrook 080afbb57c sd-netlink: do not swap old name and alternative name
Commit 434a348380 ("netlink: do not fail when new interface name is
already used as an alternative name") added logic to set the old
interface name as an alternative name, but only when the new name is
currently an alternative name. This is not the desired outcome in most
cases, and the important part of this commit was to delete the new name
from the list of alternative names if necessary.
2022-12-15 09:21:53 -05:00
Nick Rosbrook d0b31efc1a udev/net: allow new link name as an altname before renaming happens
When configuring a link's alternative names, the link's new name to-be
is not allowed to be included because interface renaming will fail if
the new name is already present as an alternative name. However,
rtnl_set_link_name will delete the conflicting alternative name before
renaming the device, if necessary.

Allow the new link name to be set as an alternative name before the
device is renamed. This means that if the rename is later skipped (i.e.
because the link is already up), then the name can at least still be
present as an alternative name.
2022-12-15 09:21:53 -05:00
Yu Watanabe b3f1afc089 Merge pull request #24058 from qdeslandes/journald_regex_filtering
Allow for journald logs filtering on a per-unit basis
2022-12-15 22:03:33 +09:00
Yu Watanabe cd07f6e8e9 Merge pull request #25224 from poettering/measure-append
add --append= switch to systemd-measure
2022-12-15 21:47:29 +09:00
Yu Watanabe f4128c8d51 Merge pull request #25735 from yuwata/switch-root-follow-ups
mount-util: several follow-ups for recent mount_switch_root() changes
2022-12-15 21:39:40 +09:00
Lennart Poettering a5c690a8b5 measure: add --append= switch for merging signatures
Often it's useful to add multiple signatures in the signature JSON file
to embedd in a single .pcrsig. (For example, a signature by key X for
boot phase "enter-initrd" and one by key Y for
"enter-initrd:leave-initrd" or so). Make this easy, by adding the
ability to append signatures to a previously generated JSON file.
2022-12-15 11:40:21 +01:00