Commit Graph
82015 Commits
Author SHA1 Message Date
Lennart Poettering 6d83b6afbb resolvectl: --raw improvements (#37743)
Fixes: #37737
2025-06-05 14:02:00 +02:00
Mike Yuan 199ccd70f6 core: rework how we track cgroup realized state (#37733) 2025-06-05 12:56:31 +02:00
Lennart Poettering 231a0417cd resolvectl: improve error message if we do not support dumping payload of RR 2025-06-05 12:43:36 +02:00
Lennart Poettering 317054365e man: reword --raw= explanation a bit
Explain what we mean by "payload", and for which RR types this is
intended.

And don#t claim we'd output a full packet, because we don't. We output
only the RR in binary.

Fixes: #37737
2025-06-05 12:38:28 +02:00
Lennart Poettering 141894f53a resolvectl: output slightly more data when --raw=payload is used
Let's also show A/AAAA data in binary form if --raw=payload is used. For
these RR types there's only a single data field, hence it's obbviously
meant.

Inspired by: #37737
2025-06-05 12:38:28 +02:00
Daan De Meyer 770489c1e0 meson: Remove unnecessary deps from libsystemd-static build
blkid, libmount and openssl are not used in src/basic or src/libsystemd,
and so shouldn't be required as deps of libsystemd static, so let's drop
them.
2025-06-05 12:09:54 +02:00
Yu Watanabe 23f9ff4724 ptyfwd: introduce pty_forward_set_window_title() helper function 2025-06-05 19:06:02 +09:00
tytan652 1c814f3500 hwdb: add support for Loupedeck devices
Razer has partnered with Loupedeck to develop some devices.

Add support for the following devices:
- Loupedeck CT
- Loupedeck Live
- Loupedeck Live S
- Razer Stream Controller
- Razer Stream Controller X
2025-06-05 19:05:20 +09:00
Lennart Poettering f27d1bfdce sd-daemon: add sd_pidfd_get_inode_id() (#37679) 2025-06-05 09:31:48 +02:00
Sam Leonard 305e58936f vmspawn: fix call to GetUnitByPID
This commit also adds a handler for SIGRTMIN+4 which is another signal
used to shutdown systemd.
2025-06-05 08:44:20 +09:00
Mike Yuan b8194aa8b7 test-daemon: add test case for sd_pidfd_get_inode_id() 2025-06-05 01:35:08 +02:00
Mike Yuan 46b0844743 sd-daemon: add sd_pidfd_get_inode_id()
We nowadays expose pidfdid at various places, e.g. envvars
and dbus properties. Also the sd_notify() MAINPID= message
has been complemented with MAINPIDFDID=. But acquiring
pidfdid is actually non-trivial especially considering
the 32-bit case, hence let's introduce a public helper
in sd-daemon specifically for that purpose.
2025-06-05 01:35:08 +02:00
Mike Yuan a842c26be3 pidfd-util: extract pidfd_get_inode_id_impl() and make it thread safe
Preparation for later commits.
2025-06-05 00:28:01 +02:00
Mike Yuan e09b7ced65 pidfd-util: open an internal pidfd if none is passed in pidfd_check_pidfs()
I'd like to introduce a libsystemd helper for acquiring pidfd
inode id, which however means the fd passed to pidfd_check_pidfs()
can no longer be trusted. Let's add back the logic of allocating
a genuine pidfd allocated internally, which was remove in
5dc9d5b4ea.
2025-06-05 00:28:01 +02:00
Mike Yuan dbb28f7b24 man/sd_pid_get_owner_uid: don't limit -EBADF to socket fds 2025-06-05 00:28:01 +02:00
Mike Yuan 68db777ae2 sd-login: reject invalid pidfd with -EBADF consistently
We got it mostly right except for one function, fix it.
2025-06-05 00:28:00 +02:00
Lennart Poettering 4f4113ee33 sd-login: various modernizations (#37728) 2025-06-04 22:24:57 +02:00
Lennart Poettering 874c4beb24 io-util: protect against INT_MAX overflow in flush_fd() 2025-06-04 22:06:52 +02:00
Mike Yuan ea763af4a9 core/cgroup: make various functions static
Not used externally anymore with previous commits.
2025-06-04 22:03:48 +02:00
Mike Yuan 9fe837d529 core/unit-printf: port to unit_get_cgroup_path_with_fallback() 2025-06-04 22:03:48 +02:00
Mike Yuan 23ac08115a core: rework how we track cgroup realized state
Prompted by https://github.com/systemd/systemd/pull/37646#discussion_r2126882561

Follow-up for 879952a853

Currently, almost all cgroup attr getters check cgroup_path for whether
cgroup is around. This is actually great, because we never want to expose
a non-existent cgroup path via IPC and such. However, it is spuriously
initialized at places where it shouldn't be, e.g. in unit_warn_leftover_processes().
This matters especially to units that *may* carry processes to run, but
not *always*, notably socket units. unit_warn_leftover_processes() is supposed
to be informative only and not try to set cgroup tracking to realized in
a half-assed way.

Hence, let's kill cgroup_realized field, and make sure cgroup_path is set
only if cgroup has been created. Be extra careful with deserialization
though, since the previous versions don't follow this rule and we need
to patch cgroup_path manually based on cgroup_realized we got from deserialization.

Calls to unit_watch_cgroup*() are dropped in cgroup_runtime_deserialize_one(),
because unit_deserialize_state() will invalidate cgroup realized state and
reapply later.
2025-06-04 22:03:47 +02:00
Mike Yuan 50f2ee4576 core/cgroup: don't ever try to get SPECIAL_ROOT_SLICE from Manager.cgroup_unit
This tries to query unit name in cgroup_unit hashmap, which
always returns NULL. Just return NULL directly instead.
2025-06-04 22:03:47 +02:00
Mike Yuan 73d7bee852 core/unit-serialize: drop deserialization compat for state_change_timestamp
This was from v228, i.e. before cgroup v2 got introduced.
Nowadays cgroup v1 is outright rejected during initialization,
i.e. upgrading isn't possible whatsoever. Remove the compat glue there.
2025-06-04 22:03:47 +02:00
Lennart Poettering 46ab6b63e5 journal: make journal_file_copy_entry() robust towards copying invalid/half-written source journal files (#37732) 2025-06-04 20:51:24 +02:00
Lennart Poettering 9151a60a4e journal-file: let's make journal_file_copy_entry() robust against concurrent writing of the source
As usual, we need to protect ourselves against concurrent modification
of journal files. We a pretty good at that these days when reading
journal files. But journal_file_copy_entry() so far wasn't too good with
that. journal_file_append_data() so far returned EINVAL when you pass
invalid data to it. Since we pass the source data as-is in there, it's
going to fail if the journal source file is slightly invalid due to a
concurrent update.

Hence, we need to validate data gracefully here that we think comes from
a safe place, because actually it doesn't, it's directly copied from an
unsafe journal file.

Hence, let's introduce a clear error code here, and look for it in
journal_file_copy_entry(), and handle it gracefully.

Pretty sure this fixes #33372, but it's a race, so I don't know for
sure. If this remains reproducible we need to look at this again.

Fixes: #33372
2025-06-04 18:05:58 +02:00
Lennart Poettering e74c1e1cac compress: get rid of a bunch of 'else' 2025-06-04 18:04:27 +02:00
Lennart Poettering eb78010898 sd-login: port sd_peer_get_cgroup() to SO_PEERPIDFD 2025-06-04 17:58:44 +02:00
Lennart Poettering e2af482f0a sd-login: place inner part of sd_login_monitor_new() by a table 2025-06-04 17:58:43 +02:00
Lennart Poettering eac4a028df sd-login: modernize return parameter handling
Let's rename the return parameters as "ret_xyz" systematically in
sd-login.

Also, let's make the return parameters systematically optional, like we
typically do these days. So far some where optional, other's weren't.
Let's clean this up.
2025-06-04 17:58:42 +02:00
Yu Watanabe 356e9bc018 test-network: extend comments how to run the test 2025-06-04 16:46:41 +01:00
Yu Watanabe b21483720c Several follow-ups for userdb lookup from udevd and networkd (#37719) 2025-06-04 23:32:24 +09:00
Lennart Poettering 8e6ceee38b update TODO 2025-06-04 16:28:52 +02:00
Yu Watanabe ca783b43b8 doc: tweaks to root storage daemon docs (#37727) 2025-06-04 22:34:28 +09:00
Yu Watanabe 6e47959685 Bugprone argument comment 9 (#37712)
Follow up from https://github.com/systemd/systemd/pull/37678
2025-06-04 22:33:51 +09:00
Allison Karlitskaya 137a2b1208 copy: return immediately on fs-verity failures
Since 8065d02e26 ("copy: Fix error handling in fd_copy_directory()")
we immediately abort recursive copy operations on ENOSPC.  Let's also
abort on the common case of filesystems not supporting fs-verity: if
it's unsupported for one file, it's unlikely to work for the 1000s that
follow it.

We do this by mapping the two fs-verity "not supported" errors (ENOTTY,
EOPNOTSUPP) to ESOCKTNOSUPPORT as a special "fs-verity not supported
here" error.  When we see that error at the top level we exit
immediately.

This prevents us from having to see the same error message literally
thousands of time when using fsverity=copy with systemd-repart on a
filesystem which lacks the proper support.

Adjust the test-copy test case to expect the new errno.  Previously this
test case would output multiple failure lines per `copy_tree_at()`
invocation (for the failing cases) but now it only outputs one.
2025-06-04 22:32:52 +09:00
Lennart Poettering d1bacb0b8d doc: clarify that root storage daemons need unit files
Fixes: #37700
2025-06-04 15:07:34 +02:00
Lennart Poettering 59fe8d74b5 doc: mention 'exitrd' term 2025-06-04 15:07:34 +02:00
Yu Watanabe a4dae8e42f Revert "github/mkosi: tentatively disable mkosi(opensuse) job"
This reverts commit 48a092afbb.
2025-06-04 21:54:37 +09:00
Luca Boccassi aba73b88a2 mkosi: install util-linux-systemd in SUSE
Some tools (findmnt, logger, lsblk, lslogins) got moved to a
new util-linux-systemd package in Tumbleweed so install it explicitly
2025-06-04 21:54:37 +09:00
Yu Watanabe d2b41bd69e TEST-17-UDEV: acquire SYS_UID_MAX/SYS_GID_MAX from userdbctl
Suse build systemd with -Dsystem-uid-max=499 -Dsystem-gid-max=499,
and seems to not provide /etc/login.defs file. See
https://github.com/bmwiedemann/openSUSE/blob/2dc224ae5d446e928519315f4d46f76d1e34b8a8/packages/s/systemd/systemd.spec
2025-06-04 21:54:32 +09:00
Yu Watanabe b24e4f34cc network: skip loading /etc/shadow
We only require UID/GID, hence not necessary to load information from shadow.
2025-06-04 21:50:12 +09:00
Yu Watanabe 8c57161d65 udev-rules: skip loading /etc/shadow
We only require UID/GID, hence not necessary to load information from shadow.
2025-06-04 21:50:12 +09:00
Yu Watanabe 937a355d6b userdb: make ENOEXEC wins over ESRCH
Both ENOEXEC and ESRCH is a kind of error that indicate successful
lookup. ENOEXEC means the server found an entry but it does not
pass filter. ESRCH means the server could not find an entry.
Hence, ENOEXEC should have more information, and should be propagated to
the caller.
2025-06-04 21:50:12 +09:00
Yu Watanabe 8bfcfa17fe userdb: use RET_GATHER() at one more place and update comment 2025-06-04 21:50:12 +09:00
Yu Watanabe bf4d6c3d51 userdb: fix definition of USERDB_SYNTHESIZE_NUMERIC
Otherwise, we always synthesize numeric IDs.

Follow-up for e4d07d1a2d.
2025-06-04 21:50:12 +09:00
Lennart Poettering 959d7f1759 resolved: honour SD_RESOLVED_NO_CNAME flag when processing cache
Fixes: #33300
Replaces: #35102
2025-06-04 12:52:11 +01:00
Jelle van der Waa ac3a403486 treewide: correct argument comments for sd_event_add_time 2025-06-04 13:32:24 +02:00
Jelle van der Waa 095031683f treewide: correct argument comments for sd_netlink_call 2025-06-04 13:32:24 +02:00
Jelle van der Waa 1cce9d930a treewide: correct argument comment to 'ret' where applicable
For functions with one return argument prefer 'ret' as argument comment.
2025-06-04 13:32:24 +02:00
Jelle van der Waa d7e986b7f0 ask-password-api: correct argument comment 2025-06-04 13:32:23 +02:00