Commit Graph
85481 Commits
Author SHA1 Message Date
Mike Yuan ecd677bcc9 core/cgroup: no need to handle empty bind_network_interface
We always normalize empty setting to NULL, hence per our usual
coding style a simply NULL check would suffice.
2025-12-27 23:47:55 +01:00
Mike Yuan 705d2c527f core/dbus-cgroup: actually allow empty assignment for BindNetworkInterface= 2025-12-27 23:47:55 +01:00
Mike Yuan 5af2df38df core/cgroup: fix bpf-bind-iface serialization
Follow-up for c1c787651b

The commit added serialization, but deserialization wasn't in place.
Follow the usual practice of pinning the bpf link fd until we install
the new instance.
2025-12-27 23:44:53 +01:00
Mike Yuan e78f615763 core/cgroup: fix potential bpf link fd leak during deserialization
Also add a comment explaining the deserialization mechanism, as requested
in https://github.com/systemd/systemd/pull/40202#discussion_r2649274628
2025-12-27 20:51:05 +01:00
Mike Yuan d90cfb7e30 core/bpf-restrict-ifaces: avoid duplicate unit_get_cgroup_runtime() call 2025-12-27 20:14:57 +01:00
Mike Yuan e4c43ca7d6 core/cgroup: CGContext must be available if Unit has CGRuntime
Follow-up for e03e5056db
2025-12-27 20:14:56 +01:00
Tobias Stoeckmann 0afbf1a8aa nss-systemd: fix typo in comment
"likely" should be "like" in this context.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2025-12-27 16:28:25 +01:00
DaanDeMeyer 664f211c9e mkosi: update mkosi commit reference to e3642f81d3a7f8f9310c0c734b2ba9dd41e50e14
* e3642f81d3 kmod: Only use --modname if available
* ddea81d81e arch: Download archlinux-keyring with pacman
* 4a44e1831b Remove unneeded lambdas
* 9c3d23757c Configure pyright included files
* 5e037d514c qemu: Register with systemd-machined in user session
* c4c3d793d0 Create package cache dir before invoking pacman
* d53761c4dd distribution: do not default to release=VERSION_ID for openSUSE Tumbleweed
* c5bc9138fc Wrap build_microcode_initrd in complete_step
* 635159975d Fix typo in manpage
* 59f5f0741e mkosi-addon: drop Output=addon, addon.py already has a default
* be85b8ca0b sandbox: return raw error code from the kernel and friends on failure
* 56f25c1a41 config: replace deprecated sandbox verb with box in help message
* ae24c527d7 sandbox: fix wrong errno passed to OSError()
* e7b9612760 verity: do not copy signing cert in addons/portables/extensions
* f3a029b736 Bump version to 27~devel
* 84af20892b Release 26
* 3fcd3a0fde Adjust logging messages for kmod/fw resolution
* d44aae12b4 Revert "Do not try to install packages that are listed in RemovePackages="
* 1873ad0184 portable: Make sure mountpoints exist in the image
* 5dc693feb0 initrd: Inherit keymap, timezone, hostname and rootpw by default
2025-12-26 22:49:26 +01:00
Luca Boccassi 9463b3b51c man: document version for BindNetworkInterface instead of using ignore list
The ignore list is for older stuff, all new interfaces must be documented
with a version.

Follow-up for c1c787651b
2025-12-24 19:25:21 +01:00
DaanDeMeyer 11f47cb700 bootctl-install: Fix OpenSSL UI
Follow up for a86a366eb0.
2025-12-24 18:04:57 +01:00
Lennart Poettering ceaa36c21e terminal-util: use the right ANSI ST sequence
There are multiple ways to encode ANSI ST, and we generally prefer ESC \
for it, for reasons explained in terminal-util.h. Hence, let's actually
follow this rule in the terminal reset logic, and use the ANSI_ST macro.

This will change the byte sequence generated (as it means we use ESC \
rather than BEL), but it doesn't change behaviour, as the two sequences
should be equivalent.
2025-12-24 09:40:43 +01:00
Mike Yuan 22eb3a6bd9 ptyfwd: turn off O_NONBLOCK on output after soft reset
Follow-up for 3d97db8f3c

terminal_reset_ansi_req() would try to put terminal in nonblocking
mode temporarily again, hence just avoid the back and forth
and reset nonblocking as last step.
2025-12-24 08:07:59 +01:00
Jörg Behrmann 1afe5c7b4b terminal-util: also send ANSI_NORMAL in terminal_reset_ansi_seq
Certain terminal emulators (alacritty, ghostty and kitty) require ANSI_NORMAL
to be sent to reset the colours.

Followup for 3d97db8f3c.

Fixes: #40163
2025-12-24 07:59:42 +01:00
Lennart Poettering 1978e42197 update TODO 2025-12-24 07:38:28 +01:00
Lennart Poettering 77639f179b update TODO 2025-12-24 07:38:15 +01:00
Luiz Amaral c1c787651b Add support for binding a unit to a network iface 2025-12-24 07:37:58 +01:00
DaanDeMeyer 875b568f56 repart: Fix OpenSSL UI
Follow up for 0158eabb01
2025-12-23 20:55:32 +01:00
Daan De Meyer 738bad8f35 mkosi: Use initrd as exitrd
Let's speed up image builds by avoiding building
an exitrd and instead reusing the initrd image for
the same purpose.
2025-12-21 20:31:24 +01:00
Daan De Meyer 64991b2148 repart: Fix --defer-partitions-empty= docs
Fixes #40176
2025-12-21 19:30:06 +00:00
Luca Boccassi 8d1e58f9fd test: fix (again) race condition in TEST-80-NOTIFYACCESS
Even with the previous fix, it can still happen that pid1
sends SIGHUP to the script after 'sdnotify --ready' but before
'wait', so the test can still get stuck:

[ 2444.373448] reload-timeout.sh[158]: + set -o pipefail
[ 2444.373502] reload-timeout.sh[158]: + COUNTER=0
[ 2444.373590] reload-timeout.sh[158]: + trap sighup_handler SIGHUP
[ 2444.373639] reload-timeout.sh[158]: + export SYSTEMD_LOG_LEVEL=debug
[ 2444.373670] reload-timeout.sh[158]: + SYSTEMD_LOG_LEVEL=debug
[ 2444.373790] reload-timeout.sh[158]: + wait_for_signal 1
[ 2444.373871] reload-timeout.sh[158]: + local notify=1
[ 2444.373912] reload-timeout.sh[158]: + local p
[ 2444.374079] reload-timeout.sh[158]: + p=159
[ 2444.374123] reload-timeout.sh[159]: + sleep infinity
[ 2444.375358] systemd[1]: reload-timeout.service: Got notification message from PID 158: READY=1
[ 2444.375363] systemd[1]: reload-timeout.service: Changed start -> running
[ 2444.375368] systemd[1]: reload-timeout.service: Job 294 reload-timeout.service/start finished, result=done
[ 2444.375374] systemd[1]: Started reload-timeout.service.
[ 2444.375766] systemd[1]: reload-timeout.service: Failed to send unit change signal for reload-timeout.service: Connection reset by peer
[ 2444.376464] reload-timeout.sh[158]: + '[' 1 -eq 1 ']'
[ 2444.376464] reload-timeout.sh[158]: + systemd-notify --ready
[ 2444.376518] TEST-80-NOTIFYACCESS.sh[157]: Job for reload-timeout.service finished.
[ 2444.376518] TEST-80-NOTIFYACCESS.sh[157]: Got result done/Success for job reload-timeout.service.
[ 2444.376518] TEST-80-NOTIFYACCESS.sh[157]: Bus n/a: changing state RUNNING → CLOSED
[ 2444.376952] TEST-80-NOTIFYACCESS.sh[92]: + systemctl reload --no-block reload-timeout.service
[ 2444.379548] TEST-80-NOTIFYACCESS.sh[161]: Bus n/a: changing state UNSET → OPENING
[ 2444.379548] TEST-80-NOTIFYACCESS.sh[161]: sd-bus: starting bus by connecting to /run/systemd/private...
[ 2444.379548] TEST-80-NOTIFYACCESS.sh[161]: Bus n/a: changing state OPENING → AUTHENTICATING
[ 2444.379548] TEST-80-NOTIFYACCESS.sh[161]: Executing dbus call org.freedesktop.systemd1.Manager ReloadUnit(reload-timeout.service, replace)
[ 2444.379548] TEST-80-NOTIFYACCESS.sh[161]: Bus n/a: changing state AUTHENTICATING → RUNNING
[ 2444.379910] systemd-notify[160]: Notify message sent to '/run/systemd/notify': "READY=1"
[ 2444.379931] systemd-notify[160]: Notify message sent to '/run/systemd/notify': "BARRIER=1"
[ 2444.382218] systemd[1]: reload-timeout.service: Trying to enqueue job reload-timeout.service/reload/replace
[ 2444.382241] systemd[1]: reload-timeout.service: Installed new job reload-timeout.service/reload as 366
[ 2444.382248] systemd[1]: reload-timeout.service: Enqueued job reload-timeout.service/reload as 366
[ 2444.383905] systemd[1]: reload-timeout.service: Service has no extensions to reload.
[ 2444.384925] systemd[1]: reload-timeout.service: Changed running -> reload-signal
[ 2444.384935] systemd[1]: Reloading reload-timeout.service...
[ 2444.386410] reload-timeout.sh[158]: ++ sighup_handler
[ 2444.386410] reload-timeout.sh[158]: ++ echo hup1
[ 2444.386455] TEST-80-NOTIFYACCESS.sh[161]: Bus n/a: changing state RUNNING → CLOSED
[ 2444.386555] TEST-80-NOTIFYACCESS.sh[92]: + timeout 10 bash -c 'until [[ $(systemctl show reload-timeout.service -P SubState) == "reload-signal" ]]; do sleep .5; done'
[ 2444.395566] TEST-80-NOTIFYACCESS.sh[165]: Bus n/a: changing state UNSET → OPENING
[ 2444.395566] TEST-80-NOTIFYACCESS.sh[165]: sd-bus: starting bus by connecting to /run/systemd/private...
[ 2444.396041] TEST-80-NOTIFYACCESS.sh[165]: Bus n/a: changing state OPENING → AUTHENTICATING
[ 2444.396041] TEST-80-NOTIFYACCESS.sh[165]: Showing one /org/freedesktop/systemd1/unit/reload_2dtimeout_2eservice
[ 2444.401911] TEST-80-NOTIFYACCESS.sh[165]: Bus n/a: changing state AUTHENTICATING → RUNNING
[ 2444.401911] TEST-80-NOTIFYACCESS.sh[165]: Bus n/a: changing state RUNNING → CLOSED
[ 2444.403806] TEST-80-NOTIFYACCESS.sh[92]: + sync_in hup1
[ 2444.403806] TEST-80-NOTIFYACCESS.sh[92]: + read -r x
[ 2444.403964] reload-timeout.sh[158]: + wait 159
[ 2444.403988] TEST-80-NOTIFYACCESS.sh[92]: + test hup1 = hup1
[ 2444.403988] TEST-80-NOTIFYACCESS.sh[92]: + timeout 10 bash -c 'until [[ $(systemctl show reload-timeout.service -P SubState) == "reload-notify" ]]; do sleep .5; done'

Try to check if the signal handler has ran by checking the counter,
and avoid waiting and immediately return if it has changed

Fixes https://github.com/systemd/systemd/issues/39581

Follow-up for 8fba2ed258
2025-12-21 19:29:55 +01:00
Daan De Meyer 5b830eda79 signal-util: Use act instead of __act in comment
The clang-tidy check ignores trailing and
preceeding underscores, so let's just use act
instead of __act.
2025-12-21 19:21:08 +01:00
Daan De Meyer b295c166f9 mkosi: update fedora commit reference to 67538c79f250eecbd904aa87e72a44cb3b5ef6f4
* 67538c79f2 Make dbus and systemd-pam recommended dependencies
* c052029197 Drop libcap-devel BuildRequires
2025-12-21 11:43:00 +00:00
Daan De Meyer f9708c53aa Follow ups for #39806
We drop the optimization for verify_sigchld as the
check differs based on the options passed and the
extra syscalls are certainly not going to matter
compared to the cost of forking a child process.

Fixes #40166
2025-12-21 08:16:03 +01:00
Lennart Poettering 471fe52d57 preparatory work from the OCI PR (#40149)
This adds 11 commits with minor preparatory commits for PR #39621. That
PR has tests that cover all this, even if this one doesn't, but the bits
added here are relatively minor.
2025-12-21 07:38:29 +01:00
Lennart Poettering 9cfefbf983 dissect-image: automatically convert O_PATH fd to proper fd in mountfsd client
Let's make the mountfsd client code a bit easier to use, and convert an
O_PATH fd to a real one if necessary, automatically.
2025-12-21 07:04:42 +01:00
Lennart Poettering b7d1d17b9c dissect-image: teach mountfsd_make_directory() the new access mode parameter 2025-12-21 07:04:42 +01:00
Lennart Poettering a9b60de478 mountfsd: return a better error when invalid file flags are specified on image fd
We already defined an error for this that we return for invalid dir fds
passed in, let's add the same niceness to the image fds.
2025-12-21 07:04:42 +01:00
Lennart Poettering d4f8be786c mountfsd: allow O_NONBLOCK on image fds
Let's accept O_NONBLOCK on image fds. It's usually wise to open block
device with O_NONBLOCK as it means that drivers with removable media
won't block until a medium is inserted. Otherwise it has no effect. It
also has no effect when opening regular files. Since block devices and
raw devices are the only two things we accept in mountfsd, it's hence
safe to allow it.
2025-12-21 07:04:42 +01:00
Lennart Poettering 46341769b7 mountfsd: optionally accept an access mode for the dir created by MakeDirectory()
So far we expected the client to access the access mode themselves, and
set a restrictive 0700 server-side.

However, in some scenarios it's handy if the inode is created
server-side already with the right mode, in particular when the client
doesn't do anything with the dir just yet, and just needs it to be there
with the right mode. If it has to adjust the mode client-side it might
otherwise need to fork something off, join the selected userns, adjust
the mode, and kill the child off again.
2025-12-21 07:04:42 +01:00
Lennart Poettering 6e07fc6bcc json-util: add a generic parser for parsing access mode/umask
Let's move this from user-record.c into generic code and let's beef it
up a bit: allow parsing octal strings. This is particular relevant given
json_variant_new_stat() generates the mode in that format, and we
probably should be able to parse our own fields (even though we
currently don't do that for the data from json_variant_new_stat()).
2025-12-21 07:04:42 +01:00
Lennart Poettering 00421e3166 dissect-image: make verity params for mountfsd_mount_image() optional 2025-12-21 07:04:42 +01:00
Lennart Poettering 468cfd25a0 dissect-image: add fd-based flavour of mountfsd_mount_image() 2025-12-21 07:04:42 +01:00
Lennart Poettering e742d749d3 dissect-image: make mountfsd_make_directory_fd() return param optional 2025-12-21 07:04:42 +01:00
Lennart Poettering 7e3bdf90d9 iovec-util: add iovec_done_many_and_free() 2025-12-21 07:04:42 +01:00
Lennart Poettering b6aa78f707 recursedir: introduce new RECURSE_DIR_UNLINK callback return value
This introduces RECURSE_DIR_UNLINK + RECURSE_DIR_UNLINK_GRACEFUL as new
return values for recurse_dir() callbacks. If either is returned the
inode currently processed will be removed and iteration continues with
the next item.

This is useful to have in the recurse_dir() mechanism itself (rather
than implement in the callback itself), due to ordering: we want to pin
the inodes via an fd while calling the callbacks, but we have to close
it before removal of the inodes. By moving this into the recurse_dir()
infra, we can implement this easily.
2025-12-21 07:04:42 +01:00
Mike Yuan 65d173a02d core/socket: modernize listen/accept_in_cgroup 2025-12-20 22:56:33 +01:00
Daan De Meyer 6dcc937568 Several follow-ups for recent PRs (#40167) 2025-12-20 22:55:25 +01:00
Mike Yuan 8a10293e5d shutdown: restore error handling 2025-12-20 21:41:01 +01:00
Mike Yuan f3c6660b9c pidref: several follow-ups for pidref_wait_for_terminate_full()
Follow-up for e74b571004

* Do not reuse si
* Refuse timeout == 0
* Use usec_add()
* Rename ret to ret_si - unlike others this one is not so obvious
2025-12-20 21:41:01 +01:00
Mike Yuan 72ce1046e8 core/exec-invoke: log about name of CPU sched policy
Follow-up for 4dcbfbb1ad

Also, do not encode errno in log if we know the precise cause,
i.e. unsupported.
2025-12-20 21:40:56 +01:00
Mike Yuan eb17c37df7 process-util: drop unused sched_priority_is_valid() 2025-12-20 18:38:56 +01:00
Matt Fleming 4dcbfbb1ad process-util: Add support SCHED_EXT scheduling policy
Allow CPUSchedulingPolicy to be set to "ext". SCHED_EXT is a new
scheduling policy in Linux v6.12 that allows processes to be scheduled
using custom BPF schedulers instead of the default in-kernel ones.

Selectively setting the SCHED_EXT policy is useful for systems running
in "partial mode" where not all processes are run using a custom
scheduler.

Fallback to SCHED_OTHER and print an error message for systems where
SCHED_EXT isn't available.
2025-12-20 18:31:55 +01:00
Daan De Meyer 84dcbc3fd2 meson: Deduplicate sources before clang-tidy
Let's make sure we don't define the same clang-tidy
test multiple times by deduplicating sources beforehand.
We end up with the same sources in a few cases because
e.g. we reuse the same fuzz-main.c for each fuzz target.
2025-12-20 17:58:19 +01:00
Daan De Meyer 27de9c391d sd-event: Don't require blocking SIGCHLD for WEXITED (#39806)
We watch for WEXITED via pidfd instead of signalfd, so no need to insist
on blocking SIGCHLD anymore if we're only watching for WEXITED.

This also removes SIGCHLD blocking tree-wide where it's not required
anymore.
2025-12-20 17:35:47 +01:00
Daan De Meyer 29d1df4b03 tree-wide: Remove unnecessary SIGCHLD blocking
Now that sd-event doesn't insist on blocking
SIGCHLD anymore when watching for process exit,
let's stop blocking SIGCHLD tree-wide where not
required anymore.
2025-12-20 15:50:47 +01:00
Daan De Meyer fbd276cb86 tree-wide: Use pidref_wait_for_terminate_and_check()
Let's use the pidref variants for waiting and
checking a process everywhere and get rid of the
non pidref variants.
2025-12-20 15:50:47 +01:00
Daan De Meyer e74b571004 pidref: Add pidref_wait_for_terminate_full()
We can use this to replace wait_for_terminate_with_timeout(). Because
we poll a pidfd, we don't need to block SIGCHLD anymore in umount.c.
2025-12-20 15:49:26 +01:00
Daan De Meyer 9bd833ee6e test-pidref: Migrate to new assertion macros 2025-12-20 15:44:36 +01:00
Daan De Meyer 8c367868ee process-util: Use pidref_wait_for_terminate_and_check in pidref_safe_fork()
Note that we still have to block SIGCHLD so that
we can be certain the process is not reaped before
we get the pidfd to it. safe_fork() and friends are
used in libsystemd where we don't control how the
SIGCHLD signal is configured. Specifically, kernel
autoreaping could be enabled which is why we have
to block SIGCHLD until we get the pidfd so that the
kernel cannot autoreap the process before we get
the pidfd.
2025-12-20 15:44:20 +01:00
Daan De Meyer a1e5d7f865 sd-event: Clean up SIGCHLD conditions for sd_event_add_child()
First, don't require blocking SIGCHLD for WEXITED. We watch for WEXITED
via pidfd instead of signalfd, so no need to insist on blocking SIGCHLD
anymore if we're only watching for WEXITED.

Second, do a proper check to see if the kernel autoreaping logic is
enabled. That has nothing to do with SIGCHLD being blocked for the current
thread or not. Instead, the kernel autoreaping logic is enabled either if
the disposition is set to SIG_IGN or if the SA_NOCLDWAIT flag is enabled.
2025-12-20 15:27:22 +01:00