Commit Graph
80242 Commits
Author SHA1 Message Date
Mike Yuan b062cf19f4 memory-util: make mempcpy_typesafe nestable 2025-03-20 17:31:54 +01:00
hsu zangmen 0ffd176bf7 po: Translated using Weblate (Chinese (Traditional) (zh_TW))
Currently translated at 88.7% (228 of 257 strings)

Co-authored-by: hsu zangmen <chzang55@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/zh_TW/
Translation: systemd/main
2025-03-20 22:51:41 +09:00
Lennart Poettering 6fd253753c vmspawn: allow TPM state to be persistent + rework runtime dir logic
When using vmspawn on particleos image we really want that the TPM state
is retained between invocation, since the encryption key is locked to
the TPM after all. Hence let's support that.

This adds --tpm-state= which can be used to configure a path to store
the TPM state in. It can also be used to force tpm state to be transient
or to let vmpsawn pick the path automatically.

While we are at it, let's also revamp the runtime dir handling in
vmspawn: let's no longer place the sockets the auxiliary services listen
on within their own runtime directories. Instead, just drop the runtime
directories for them entirely (since neither virtiofsd, nor swtpm
actually use them). Also, let systemd clean up the sockets
automatically.
2025-03-20 14:30:00 +01:00
Erik Larsson 6e529860ba networkd: add support for externally managed vxlan devices
With this a vxlan interface can be created which is managed by
for example a EVPN control plane.
2025-03-20 20:29:47 +09:00
Lennart Poettering 9d37b8f690 namespace: use EBADF where appropriate 2025-03-20 12:26:06 +01:00
Daan De Meyer a0063ac988 packit: Enable use_target_repo_for_fmf_url option (#36794)
Currently this is picked up from the main branch of the fork which is
suboptimal. The packit folks implemented this new option for us which
should fix the problem.
2025-03-20 09:24:41 +01:00
Daan De Meyer 314ea2ec7b fmf: Use mkosi -f together with ToolsTreePackageDirectories=
There's no need to build various systemd tools from source again to
build the mkosi image when we can just install the packages that were
already built from source into the tools tree so let's do that to avoid
unnecessary compiling.
2025-03-20 09:24:07 +01:00
Daan De Meyer f5cf72b566 fmf: Drop -f from subsequent mkosi sandbox calls
Only required for the first call to mkosi sandbox, after that we can
assume the tools tree has already been built.
2025-03-20 09:24:07 +01:00
Daan De Meyer 1f3bf2a9a2 fmf: Allow overriding the mkosi distribution and release used 2025-03-20 09:24:07 +01:00
Daan De Meyer a3b8fee46e fmf: Download rpms manually instead of going via repositories
This both makes the script more independent, and allows us to add support
for CBS (CentOS Community Build System) at the same time.
2025-03-20 09:24:03 +01:00
Yu Watanabe db4b4e0cd3 core: Make DelegateNamespaces= work for user managers with CAP_SYS_ADMIN (#36771)
Currently DelegateNamespaces= only works for services spawned by the
system manager. User managers will always unshare the user namespace
first even if they're running with CAP_SYS_ADMIN.

Let's add support for DelegateNamespaces= for user managers if they're
running with CAP_SYS_ADMIN. By default, we'll still delegate all
namespaces
for user managers, but this can now be overridden by explicitly passing
DelegateNamespaces=.

If a user manager is running without CAP_SYS_ADMIN, the user manager is
still always unshared first just like before.
2025-03-20 06:28:18 +09:00
Lennart Poettering b0fe8df5a9 Several fixlets for Coverity (#36791) 2025-03-19 22:27:00 +01:00
Yu Watanabe bb8c74d7f2 Introduce ConditionVersion (#36468)
Add a new condition which can check against systemd version.

        $ systemctl --version
        systemd 258 (258~devel-g53ca5f6)

        $ systemd-analyze condition 'ConditionVersion=systemd>255'
        test.service: ConditionVersion=>255 succeeded.

        $ systemd-analyze condition 'ConditionVersion=systemd>260'
        test.service: ConditionVersion=>260 failed.

        $ systemd-analyze condition 'ConditionVersion=systemd>=258'
        test.service: ConditionVersion=>=258 succeeded.

        $ systemd-analyze condition 'ConditionVersion=systemd>=257.1'
        test.service: ConditionVersion=>=257.1 succeeded.

        $ uname -r
        6.12.13-200.fc41.aarch64

        $ systemd-analyze condition 'ConditionVersion=kernel > 4.4'
        test.service: ConditionVersion=kernel > 4.4 succeeded.

        $ systemd-analyze condition 'ConditionVersion=kernel > 6.20'
        test.service: ConditionVersion=kernel > 6.20 failed.

        $ systemd-analyze condition 'ConditionVersion=kernel < 9.0'
        test.service: ConditionVersion=kernel < 9.0 succeeded.
2025-03-20 06:15:35 +09:00
Lennart Poettering bb160976b0 cgroup: whenever we migrate a PID to a unit, explicitly drop unit from empty notification queue
A unit might be pending in the empty queue still when we add a PID to
the cgroup. At that point, let's explicitly remove the unit from that
queue.

Fixes: #36781
2025-03-19 21:40:33 +01:00
Lennart Poettering 0015502168 tpm2-util: return better errors if we try to unlock a tpm key on the wrong tpm
Let's improve error handling in case one tries to unlock a TPM2 locked
volume on a different machine via TPM than it was originally enrolled
on. Let's recognize this case and print a clearer error message.
2025-03-19 21:27:54 +01:00
Daan De Meyer 0e0f4cc60c various verity generator tweaks (#36802) 2025-03-19 19:26:03 +01:00
Lennart Poettering f21090d217 generator: skip fsck early for non-blockdev file systems, or file systems that are always read-only 2025-03-19 18:18:43 +01:00
Lennart Poettering 179dcf924f sd-event: make pidfd copy in event_add_child_pidref()
So far we'd directly use the pidfd passed into event_add_child_pidref(),
hoping it would not be closed by the caller before we are done. This was
violated by vmspawn however.

Let's make this safe, and simply duplicate the fd, and make us
independent of the caller.
2025-03-19 18:14:24 +01:00
Lennart Poettering bed546d187 veritysetup-generator: repeat format string arguments a bit less 2025-03-19 16:32:02 +01:00
Lennart Poettering 64f8df2f31 veritysetup-generator: specify source for generator_open_unit_file() 2025-03-19 16:32:02 +01:00
Lennart Poettering eedd0b9886 veritysetup-generator: exit on first error 2025-03-19 16:32:02 +01:00
Lennart Poettering 0ec1a83eea veritysetup: automatically generate unit name, instead of hardcoding it 2025-03-19 16:32:02 +01:00
Daan De Meyer da42c1441b fmf: Drop support for dist-git-source: true
In preparation for moving the fmf stuff to the fedora spec repo instead
of maintaining it upstream, let's drop support for dist-git-source: true
which won't be needed anymore when we move the fmf stuff to the Fedora
spec repository.
2025-03-19 13:01:24 +01:00
Daan De Meyer 91418656e8 fmf: Stop creating /etc/pacman.d/gnupg mountpoint
Not needed anymore with latest versions of mkosi.
2025-03-19 13:01:24 +01:00
Daan De Meyer 3f2700287f fmf: Drop btrfs workaround
We switched to ext4 in mkosi.repart itself, so drop the workaround
in the fmf integration test script.
2025-03-19 13:01:24 +01:00
Daan De Meyer 33bcafe6d1 packit: Use same specfile revision as mkosi uses 2025-03-19 13:01:17 +01:00
Daan De Meyer 197e3b5a8c packit: Enable use_target_repo_for_fmf_url option
Currently this is picked up from the main branch of the fork which is
suboptimal. The packit folks implemented this new option for us which
should fix the problem.
2025-03-19 12:34:31 +01:00
Daan De Meyer 511bf79b4e userdb: Add userdb.user.* and userdb.group.* credentials (#36740)
Let's allow providing extra userdb users and groups via credentials.
Similarly to systemd-udev-load-credentials.service, we ship
systemd-userdb-load-credentials.service which transform the JSON
user/group records provided via the corresponding credentials to static
userdb dropins in /run/userdb.
2025-03-19 10:30:52 +01:00
Daan De Meyer 38748596f0 core: Make DelegateNamespaces= work for user managers with CAP_SYS_ADMIN
Currently DelegateNamespaces= only works for services spawned by the
system manager. User managers will always unshare the user namespace
first even if they're running with CAP_SYS_ADMIN.

Let's add support for DelegateNamespaces= for user managers if they're
running with CAP_SYS_ADMIN. By default, we'll still delegate all namespaces
for user managers, but this can now be overridden by explicitly passing
DelegateNamespaces=.

If a user manager is running without CAP_SYS_ADMIN, the user manager is
still always unshared first just like before.
2025-03-19 10:01:19 +01:00
Daan De Meyer b281686b4f test: Fix formatting 2025-03-19 10:01:19 +01:00
Daan De Meyer a2425e8a8b run: Stop agents before we drop privileges
After dropping privileges, we won't be able to stop agents anymore
as our signals will get ignored.
2025-03-19 10:01:19 +01:00
Daan De Meyer 9e34c34b7b sd_bus_open_user_machine(): Don't shortcut without necessary env
Don't shortcut if we don't have the necessary environment variables
set in sd_bus_open_user_machine().
2025-03-19 10:01:19 +01:00
Daan De Meyer f49b7404b2 capability-util: Ignore unknown capabilities instead of aborting
capability_ambient_set_apply() can be called with capability sets
containing unknown capabilities. Let's not crash when this is the
case but instead ignore the unknown capabilities.

This fixes a crash when running the following command:

"systemd-run -p "AmbientCapabilities=~" --wait --pipe id"

Fixes d5e12dc75e
2025-03-19 10:01:19 +01:00
Daan De Meyer 87ddf5188b TEST-07-PID1.private-pids: Use --machine=testuser@.host instead of runas
Let's use the systemd way to run systemd-run as a different user instead
of setpriv.
2025-03-19 10:01:19 +01:00
Daan De Meyer 9a78b5eb7e TEST-07-PID1.delegate-namespaces: Actually run the testcases 2025-03-19 10:01:19 +01:00
Daan De Meyer b7602662cb TEST-07-PID1.delegate-namespaces: Fix testcase_pid()
Make sure the test has its own /proc and skip it in containers as
MountAPIVFS=yes in a container always results in a read-only /proc/sys
which means the test can't write to /proc/sys/kernel/ns_last_pid.
2025-03-19 10:01:16 +01:00
Daan De Meyer aae4748464 TEST-07-PID1.delegate-namespaces: Make sure fully visible procfs is available
To be able to mount /proc inside an unprivileged user namespace, we have
to make sure a fully visible procfs is available on the host, so let's make
sure that's the case.
2025-03-19 10:00:45 +01:00
Daan De Meyer 918a188fda core: Also check if we can mount /proc if pid namespace is delegated
If the pid namespace is delegated, it doesn't matter if we have CAP_SYS_ADMIN,
we'll still fail to mount /proc if part of it is masked on the host so also
check if we can mount /proc if the pid namespace is delegated.
2025-03-19 10:00:45 +01:00
Daan De Meyer c8912e3d83 TEST-07-PID1.delegate-namespaces: Fix testcase_network() 2025-03-19 10:00:45 +01:00
Daan De Meyer ad9b5d4732 bus-unit-util: Fix DelegateNamespaces= parser
Similarly to the config file parse method, let's fix the systemd-run
parser as well.

Follow up for 11b982053b
2025-03-19 10:00:45 +01:00
Daan De Meyer af6a8b6969 exec-invoke: Rename various variables from has_ to have_
All of these encode information of the current process, so have_ is
more approriate than has_, which refers to something else.
2025-03-19 10:00:45 +01:00
Daan De Meyer 04a44e25b9 units: Add systemd-machined.socket 2025-03-19 09:28:12 +01:00
Yu Watanabe 707bea6a48 ptyfwd: use usec_add()
Fixes CID#1548038.
2025-03-19 11:41:25 +09:00
Yu Watanabe 4b4181f4ac io-util: add one more assertion for Coverity
Fixes CID#1548067.
2025-03-19 11:41:25 +09:00
Yu Watanabe 91c4d1affd nspawn-oci: update overflow check
Fixes CID#1548072.
2025-03-19 11:41:25 +09:00
Yu Watanabe 816c6ec883 sd-dhcp-client: use event_reset_time_relative()
Fixes CID#1548073.
2025-03-19 11:41:25 +09:00
Yu Watanabe 11065c598c logs-show: comment out dead code
Follow-up for 280e85224e.
Fixes CID#1548921 and CID#1548922.
2025-03-19 11:41:12 +09:00
Yu Watanabe e8784005a6 logind-action: use BIT_SET() and SET_BIT()
Hopefully fixes CID#1529417.
2025-03-19 10:47:34 +09:00
Yu Watanabe b0282ecf45 journal: fix indentation 2025-03-19 10:41:29 +09:00
Yu Watanabe 6a6cc56125 bus-unit-procs: add one more assertion for Coverity
Hopefully fixes CID#1562447.
2025-03-19 10:41:29 +09:00