Commit Graph

84881 Commits

Author SHA1 Message Date
Yu Watanabe
bf9bc5beb0 musl: meson: add libutmps support
musl only provides fake functions, hence even with -Dutmp=true,
utmp/wtmp functionalities do not work. Let's allow to build with
libutmps.
2025-11-17 12:18:44 +09:00
Yu Watanabe
3ae7d8fd87 musl: utmpx: add several missing definitions 2025-11-17 11:27:07 +09:00
Lennart Poettering
1240ba1807 iovec-util: drop redundant () 2025-11-16 23:36:11 +01:00
Lennart Poettering
08d75cfb99 dissect-image,execute: switch root hash/root hash sig storage to struct iovec
let's go one step further on our iovec'ification journey.

No change in behaviour, just rework to make struct iovec used
everywhere.
2025-11-16 23:36:11 +01:00
Yu Watanabe
ddc9677c4f test-network: several tweaks (#39752) 2025-11-17 06:39:45 +09:00
Yu Watanabe
d7cf08b735 test-network: drop two overly verbose outputs
Follow-up for 7f9c0c31d2.
2025-11-16 22:15:44 +09:00
Yu Watanabe
3632d7322f test-network: set TimeoutStopFailureMode=abort when running with sanitizers
Hopefully this provides useful data for issue #39631.
2025-11-16 22:15:43 +09:00
Yu Watanabe
c43585bc30 Revert "test-network: disable several more sandbox features when running with sanitizers"
This reverts commit 454ce42305.

Unfortunately, it does not work.
2025-11-16 22:15:43 +09:00
David Tardon
8fc02a8cfd logind-dbus: avoid assertion on HandlePowerKey=factory-reset
The factory-reset action is handled together with the various
sleep/shutdown actions, but its not either one.

Fixes #39385
2025-11-16 17:00:53 +09:00
Chris Down
77a92e97eb tree-wide: several cleanups (#39746) 2025-11-16 15:40:39 +08:00
Chris Down
92cbc95e7a network/dhcp: several follow-ups for recent change (#39744)
Follow-ups for 7f9c0c31d2
2025-11-16 15:39:56 +08:00
Yu Watanabe
4f9f6a8517 resolve: voidify one function call
Fixes CID#1643235.
2025-11-16 14:06:26 +09:00
Yu Watanabe
a112c7646b tree-wide: swap arguments for streq()
We usually set a variable first, then constant.
2025-11-16 14:01:56 +09:00
Yu Watanabe
33b2dc77bd test-network: migrate to use ASSERT_OK() and friends 2025-11-16 14:01:39 +09:00
Yu Watanabe
5a943bae12 network-internal: do not save partially parsed values 2025-11-16 14:01:28 +09:00
Yu Watanabe
8c236eca78 resolve: fix typo
Follow-up for 8209f4adcd.
2025-11-16 11:13:56 +09:00
Yu Watanabe
e7254f9f4e efivars: fix typo
Follow-up for ab69a04600.
2025-11-16 11:12:10 +09:00
Yu Watanabe
af70b7521f sd-dhcp-lease: use the last hostname option when multiple hostname is specified 2025-11-16 10:50:34 +09:00
Yu Watanabe
a6c61b4adc sd-dhcp-lease: drop ret_ prefixes from the parsers 2025-11-16 10:49:59 +09:00
Yu Watanabe
f28bc48434 network: unify log messages 2025-11-16 10:44:37 +09:00
Daan De Meyer
6de1c68924 sd-event: several follow-ups for recent change (#39743) 2025-11-15 22:47:42 +01:00
Yu Watanabe
de8ea7e219 test: add missing assertion
Follow-up for 5a5cb6ba50.
Fixes CID#1643217.
2025-11-16 05:51:22 +09:00
Yu Watanabe
8e4ef4a18c sd-event: do not ignore result of callbacks
Follow-up for 4c8b6d636c and
6aff6d3ffc.
Fixes CID#1643218 and friends.
2025-11-16 05:44:35 +09:00
Yu Watanabe
c9fc7eb87e nspawn: Prevent invalid UIDs propagating in bind mounts (#39729)
Commit 88fce09026 modified the
mount_bind() function, causing it to perform arithmetic on the uid_shift
parameter. However, it performs this arithmetic even when uid_shift was
UID_INVALID, which was not intended. This typically occurred when
mount_custom() was called for a simple bind mount without user
namespaces (and thus no rootidmap mount option).

This arithmetic (e.g., uid_shift + m->destination_uid) then wraps
around, resulting in the invalid ID 4294967295 ((uid_t)-1).

This bug manifests for users running systemd-nspawn with
--link-journal=host and --volatile=yes (but without --private-users),
causing systemd-tmpfiles to fail.

Make mount_bind() robust by checking if uid_shift is valid before using
it in arithmetic. If it is UID_INVALID, it defaults to a shift of 0 for
the ownership calculation, restoring correct behavior for plain bind
mounts while preserving the intended logic for ID-mapped mounts.

Fixes: #39714
2025-11-16 04:46:18 +09:00
Chris Down
bb49e719d9 test: Add nspawn regression test for --link-journal --volatile 2025-11-15 22:01:46 +08:00
Lennart Poettering
c15bd80eb9 resolved: add ability for external programs to hook into name resolution (for machined+networkd to synthesize records) (#39293)
Fixes: #8518
2025-11-15 12:12:37 +01:00
Lennart Poettering
a719802ca3 test: add workaround for networkd downgrade issue 2025-11-15 07:52:42 +01:00
Lennart Poettering
6850f7f510 update TODO 2025-11-15 07:52:42 +01:00
Lennart Poettering
5ba49cc834 units: let's set a socket name for networkd rtnl socket
Let's make our networkd sockets recognizable purely by name. It hink
already for debugging it's a good idea to always set socket names, in
particular for services that have multiple sockets they listen on.

This adds a name to the rtnl socket, which so far missed one. Note that
the C code won't look for it, for compat with older versions, but at
least things are a bit more debuggable.
2025-11-15 07:52:42 +01:00
Lennart Poettering
ec9ec7fa3a network: make use of LocalLeaseDomain= by default
Let's expose local VMs/containers under ._dhcp by default. Let's also
expose WIFI AP clients under .home.arpa (i.e. the RFC8375 domain for
home networks).
2025-11-15 07:52:42 +01:00
Lennart Poettering
5615ac1f0d networkd: rename manager_connect_varlink() → manager_varlink_init()
This function doesn't "connect" to Varlink (i.e. it isn't a client) but
it binds a Varlink socket (i.e. it is server), hence let's remove the
verb "connect" from its name. let's copy how machined/resolved name the
counterpart for this function: manager_varlink_init()
2025-11-15 07:52:42 +01:00
Lennart Poettering
a7fa29b1b5 networkd: add support for resolved hook for DHCP server
Let's synthesize DNS RRs for leases handed out by our DHCP server. This
way local VMs can have resolvable hostnames locally.

This does not implement reverse look ups for now. We can add this
later in similar fashion.
2025-11-15 07:52:42 +01:00
Luca Boccassi
f041d40dee test: always create networkd mock tmpfs for networkd-test.py
Match the behaviour of the other test classes that use sd-run and
always create the mock tmpfs runtime dirs.
This will be needed as the new resolve.hook directory won't exist
on boot but will be needed by the test case.
2025-11-15 07:48:29 +01:00
Lennart Poettering
4408db6908 sd-dhcp-server: add api to get address from hostname, based on lease data 2025-11-15 07:44:24 +01:00
Lennart Poettering
3cd929f837 machined: implement resolve hook in machined
This basically implements nss-myhostname, but natively in
systemd-resolved, so that the logic becomes available also for clients
using the local DNS stub for resolution or the D-Bus or Varlink APIs.
2025-11-15 07:44:24 +01:00
Lennart Poettering
594352611b machine: minor refactoring, making machine_send_signal() invocations more readable 2025-11-15 07:44:24 +01:00
Lennart Poettering
8209f4adcd resolved: add hook api
This introduces /run/systemd/resolve.hook/ as a new directory that local
(privileged) programs can bind a Varlink socket into. If they do they'll
get a method call for each attempted resolved lookup, which they can
then either process themselves (and generate new records for, or return
errors to block stuff) or let pass so that the regular resolution is
done.

Usecase for this is primarily two things:

1. in machined we can add local resolution of machine names to their IP
   addresses, similar in fashion to nss-mymachines, but working also if
   the non-NSS interfaces to name resolution are used, i.e. the local
   DNS responder. In fact, I think we should eventually remove
   nss-mymachines from our tree, as soon as this code in resolved is
   setlled.

2. in networkd we can add local resolution of names specified in DHCP
   leases we hand out.

But beyond that there should be many other uses, for example people
could write "dns firewalls" with this if they like where they
dynamically block certain names from resolution.

Fixes: #8518
2025-11-15 07:44:24 +01:00
Yu Watanabe
fe9bccb2b7 Make new sd-path configuration search functionality generic (#39684)
Reverts systemd/systemd#38680

After taking a closer look I'm not convinced by the approach, see below.

First of all, all other SD_PATH_SEARCH_* are either somewhat generic,
i.e. encode the common prefix for configurations, binaries, etc., or are
subdirectories under systemd/ hence in our own "domain". The
tmpfiles/sysctl/binfmt we don't prefix with "systemd" precisely because
the concept is generic and there're actually other impls of them. A
specific SD_PATH_SEARCH_SYSCTL doesn't fit into our existing scheme.
Instead something along the lines of "SEARCH_SYSTEM_CONFIGURATION" shall
be introduced, and consumers will just suffix
sysctl.d/tmpfiles.d/binfmt.d for the final result.

And secondly, I don't grok why systemd-sysctl now unnecessarily calls
into sd-path to obtain the fixed search path. None of our other tools do
that.

-----------

An alternate approach, SD_PATH_SYSTEM_SEARCH_CONFIGURATION, which does
exactly above, will be introduced instead. It provides a universal
interface for querying any system config with our idiomatic
/etc/:/run/:/usr/local/lib/:/usr/lib/ hierarchy.
2025-11-15 10:09:19 +09:00
Yu Watanabe
6412e540bc path-util: add generic ignore extension to the hidden files (#39554) 2025-11-15 10:05:38 +09:00
Luca Boccassi
555d878749 varlink: say which socket failed to bind in log message
Makes it a lot easier to debug failures
2025-11-15 10:02:10 +09:00
Yu Watanabe
c7b31a64ee fd-util: do not block O_TMPFILE with -EISDIR (#39736) 2025-11-15 10:01:19 +09:00
Lennart Poettering
89fdab0475 5 TPM tweaks (#39712)
Fixes: #38939
Fixes: #39150
2025-11-14 23:54:45 +01:00
Lennart Poettering
a1865d8470 update TODO 2025-11-14 23:47:56 +01:00
Luca Boccassi
2e939baaf3 Try to make TEST-75-RESOLVED less flaky (#39733)
These tests unfortunately rely on polling in several areas. In some
cases, it appears the timeouts are too short (e.g. #39602, or
https://github.com/systemd/systemd/actions/runs/19369869943/job/55422626427?pr=39731#logs).

Try to adjust the timeouts to see if this makes things more reliable.
2025-11-14 21:27:24 +00:00
Lennart Poettering
45c305f9b8 man: add pcrproduct to man page header, too 2025-11-14 22:22:39 +01:00
Lennart Poettering
d51599bbed units: systemd-pcrproduct.service measures into an NvPCR, fix that in Description=
Follow-up for: 0196abbd10
2025-11-14 22:22:39 +01:00
Lennart Poettering
a84202edc5 man: document that ConditionSecurity=tpm2 means full UEFI/PC Client profile support
TPM2 support is not too useful if the firmware doesn't actually use it
for the boot chain, hence we require the full PC client profile support.
Let's make that clear in the docs.

Fixes: #38939
2025-11-14 22:22:39 +01:00
Lennart Poettering
b2b8fb8105 boot: report missing GetActivePcrBanks() call in formware as UINT32_MAX PCR bank mask
Fixes: #39150
2025-11-14 22:22:39 +01:00
Lennart Poettering
7643e4a89c tpm2-util: use LoaderTpm2ActivePcrBanks efi var when figuring out best+good banks to use
We nowadays have clear reporting which PCR banks the firmware is using
via LoaderTpm2ActivePcrBanks, hence rely on that.
2025-11-14 22:22:39 +01:00
Lennart Poettering
867e64737a units: measure a separator event into PCR 9 after completing NvPCR initialization
We do this in a separate service (rather than inside of
systemd-tpm2-setup), since we want failures of this measurement to
result in an instant reboot, like for most our measurements.

Failures to initialize nvpcrs, or allocate an SRK are somewhat OK (and
more likely), as long as this separator communicates clearly where they
have to have taken place, if they worked.
2025-11-14 22:22:39 +01:00