Commit Graph

80873 Commits

Author SHA1 Message Date
Yu Watanabe
39dd06dbc4 meson: build tests for nspawn even -Dnspawn= is disabled
Follow-up for d95818f522.
Fixes #36880.
2025-04-18 09:03:33 +02:00
Zbigniew Jędrzejewski-Szmek
a30684b983 udev: several follow-ups for recent change about listening fds (#37162) 2025-04-18 08:48:08 +02:00
Yu Watanabe
8e7ef6abb8 NEWS: mention integration-tests meson option is deprecated
Follow-up for 710653d3bc.
2025-04-18 09:36:29 +09:00
Yu Watanabe
f6a2a9ba93 daemon-util: remove existing fds with the same name from fdstore
Currently, all use cases of notify_push_fd()/notify_push_fdf()
assume that the name of each fd in the fdstore is unique.
For safety, let's remove the existing fds before pushing a new one
to avoid multiple fds with the same name stored in the fdstore.
2025-04-18 09:12:43 +09:00
Yu Watanabe
1785961660 udev: re-add unintentionally dropped error log
Follow-up for 9b6bf4e10e.
2025-04-18 09:06:09 +09:00
LuK1337
edc49209f1 rules: Make ADB and fastboot work out-of-the-box
d0db47dcdf/adb.h (199)
7199051aaf/fastboot/fastboot.cpp (244)
2025-04-18 06:06:35 +09:00
Lennart Poettering
2791b2bc3d shutdown: handle gracefully if a device disappears while we detach it
Let's gracefully handle cases where a device disappears in the time we
between our discovery and when we want to detach it, due to "auto-clear"
or a similar logic.

The loopback case already handled this quite OK, do the same for MD and
swap too.

Switch to ERRNO_IS_DEVICE_ABSENT() for all checks, just in case.

Also improve debug logging for all these cases, so we know exactly what
is going on.

This is inspired by #37160, but shouldn't really fix anything there, I
am pretty sure the ENODEV seen in that output stems from the STOP_ARRAY
call, not from the open().

Note that this does not change anything for the device mapper case,
because the DM subsystem does not return useful error codes to
userspace, hence everything is a complete mess there.
2025-04-18 06:03:03 +09:00
Yu Watanabe
7baf24c949 network/manager: hash_ops related cleanups (#37121) 2025-04-18 06:00:15 +09:00
Yu Watanabe
ce921df8d1 network/network: hash_ops related cleanups (#37120) 2025-04-18 05:59:47 +09:00
Yu Watanabe
c96a5d9912 misc: hash_ops related cleanups (#37117) 2025-04-18 05:59:15 +09:00
Yu Watanabe
6858c1fd8b libudev: several trivial cleanups (#37106) 2025-04-18 05:58:41 +09:00
Stefan Hansson
b1236ce38b missing_fcntl: Introduce O_ACCMODE_STRICT
On musl, O_ACCMODE is defined as (03|O_SEARCH), unlike glibc which
defines it as (O_RDONLY|O_WRONLY|O_RDWR). Additionally, O_SEARCH is
simply defined as O_PATH.

This causes problems for systemd on musl, as it changes the
behaviour of open_mkdir_at_full() to return -EINVAL if O_PATH is
included in flags due to the fact that O_ACCMODE includes O_SEARCH
(i.e. O_PATH). Consequently, this makes the test-fs-util test fail.

Upstream musl seems content with this behaviour and doesn't seem
interested in matching glibc's behaviour due to that defining it this
way allows for O_SEARCH to match POSIX better by allowing it to open
directories where read permission is missing. Apparently musl does some
emulation in other places to make this work more consistently as well.

Initially I took the approach of working around this by redefining
O_SEARCH as O_RDONLY if O_SEARCH == O_PATH. This fixes the test and is
the approach taken by both XZ[1] and Gzip[2][3], but was not taken as
redefining system headers potentially could be problematic.

Instead, introduce O_ACCMODE_STRICT which just is a copy of glibc's
O_ACCMODE and use it everywhere. This way we don't have to deal with
unusual definitions of O_ACCMODE from C standard libraries other than
glibc.

 [1]: https://git.tukaani.org/?p=xz.git;a=blob;f=src/xz/file_io.c;h=8c83269b13fa31284f7ea5f3627a1dfbce7d6e14;hb=HEAD#l72
 [2]: https://git.savannah.gnu.org/cgit/gnulib.git/tree/lib/fcntl.in.h
      (lines 380 and 396, commit d7f551b30f3f2a0fa57c1b10c12f4eea41a9b89e)
 [3]: https://lists.gnu.org/archive/html/bug-gzip/2025-01/msg00000.html
2025-04-18 05:22:06 +09:00
Daan De Meyer
710653d3bc test: Use meson add_test_setup() instead of environment variables
We add a default test setup that excludes the integration-tests suite
so that the integration tests don't run by default. This allows us to
get rid of $SYSTEMD_INTEGRATION_TESTS. Then, we add two extra setups:
'integration' and 'shell'. The 'integration' setup does not exclude the
integration-tests suite, and so can be used to run the integration tests.
The 'shell' setup does the same, but additionally sets $TEST_SHELL=1,
allowing to get rid of $TEST_SHELL in the docs.
2025-04-17 20:31:08 +02:00
Daan De Meyer
d9826d303b mkosi: update mkosi commit reference to dbb4020beee2cdf250f93a425794f1cf8b0fe693
* dbb4020bee mkosi: Use tools tree by default in repository config
* a2407a305c dnf: Stop messing around with plugins
* eee382ebc6 Fix mkosi help
* 8d4f9969bb mkosi-obs: simplify generation of signed UEFI auth files
*   364dfc65eb Merge pull request #3661 from septatrix/ssh-runtime
|\
| * ab3b52841c Improve Ssh= documentation
| * 79878d7e6c Add new Ssh=auto and Ssh=runtime options
*   49036322c2 Merge pull request #3682 from DaanDeMeyer/history
|\
| * 96e512fe6e installer: Make sure package manager state is preserved in the image
| * b859a7cf0a Only copy repository metadata from specific subdirs from /var
| * c8bf8e4278 Rename cache_subdirs() to package_subdirs()
* |   54b59c4a2e Merge pull request #3696 from DaanDeMeyer/history-cli
|\ \
| * | 898d89e887 Rework version bumping
| * | cc45fe3bad Only write CLI arguments to history instead of full config
| * | 1def443097 Disallow using --rerun-build-scripts with --force again
| * | 87b03ee264 Rename get_configdir() to finalize_configdir()
| * | 9c1217a217 Get rid of to_json() methods on Args and Config
| |/
* | 124f551e77 mkosi-obs: do not publish roothash
* | fc86100e51 mkosi-obs: append certs from mkosi.uefi.db/ to 'db'
* | 8bee4cb8e2 Make sure sync scripts are executable
|/
* a7e90514fa Simplify tools tree out of date error
* f9956daba7 Fail if --rerun-build-scripts is used and tools is out of date
* d94bf56ae8 mkosi-initrd: add specific configuration for plymouth in Debian
* 8235ddbc5b Take shared lock in copy_ephemeral()
* 19c74d5ba5 Two follow ups for #3678
*   0d6f15e8c3 Merge pull request #3678 from DaanDeMeyer/history
|\
| * 5410c4c7af tests: Require genkey to be run once upfront
| * 86b8c611a1 tests: Drop unused tools field
| * c3d1bd0dde Rework history <=> sandbox integration
* fce4db970f zypper: display debugging output if ARG_DEBUG is set
* 2c052b9d45 Allow PCR signing settings to be overridden in sub-images
* 00c220225b zypper: do not fail if a package configured to be removed is not found
2025-04-17 18:30:17 +01:00
Luca Boccassi
10ed8cda58 Revert "mkosi: temporarily disable panic_on_warn"
The BRTFS issue that caused a spurious WARN has been fixed and
backported to Noble, so we can enable panic_on_warm again.

This reverts commit 930d65ccca.
2025-04-17 17:03:47 +01:00
Lennart Poettering
a035eaa227 netlink-socket: extend comments a bit
Follow-up for 90755dac69.
2025-04-17 14:42:02 +02:00
Daan De Meyer
e8881f09c5 mkosi: Rename mkosi.prepare scripts for systemd deps to systemd.prepare
These scripts are reused by multiple images, so let's give them a
non-standard name to indicate that. Otherwise it's all too easy to add
something to mkosi.prepare for the main image and accidentally have it
included in all the subimages as well even though that's not desired.
2025-04-17 13:33:25 +02:00
Zbigniew Jędrzejewski-Szmek
60bcd98228 sd-netlink: don't fail on netlink message truncation if we pass a zero sized buffer (#37165)
Alternative to #37163
2025-04-17 13:11:13 +02:00
Lennart Poettering
90755dac69 netlink-socket: ignore ECHRNG/EXFULL errors from recvmsg_safe() if we expect truncation
When we receive a netlink messages from userspace we need to drop it
from the queue. Hence we need call recvmsg() on the socket for it. We do
this with a zero-size socket read() buffer, so that the message would be
truncated when copied to userspace, and we do not have to allocate any
memory for it, but it's still dropped.

This was broken in ad501930d7, which
turned datagram truncation into an error (rightfully so I think – for
the common case). That broke this code here, because here we *expect*
truncation, and need to handle it gracefully.

Hence simply check for the two error codes for truncated payload or
cdata, and eat it up.
2025-04-17 08:26:06 +02:00
Lennart Poettering
6d88e4a4b4 Revert "sd-netlink: prepare buffer for dropping unexpected message"
This reverts commit bf478dcffb.

I think we should avoid allocating memory needlessly just to free it
again, in particular if this can be triggered by some rogue peer.
2025-04-17 08:25:40 +02:00
Yu Watanabe
bf478dcffb sd-netlink: prepare buffer for dropping unexpected message
Follow-up for c7460cce79 (v219).

Fixes #35654.
2025-04-17 01:52:17 +01:00
Beniamino Galvani
ec65c29e51 network: fix handling of routing policy rule fwmask
The firewall mask should be applied even if the mark is 0, to allow defining a
value of e.g. 0/255.

Fixes #36973
2025-04-17 09:18:54 +09:00
MaxHearnden
49ff90c70d resolve: query the parent zone for DS records
RFC 4035 Section 4.2 requires that missing DS records are queried for in
the parent zone rather than the child zone, the old behaviour could
cause subdomains under home.arpa (RFC 8375) to fail validation.

This commit assumes that QDCOUNT = 1 as per RFC 9619

Fixes https://github.com/systemd/systemd/issues/19496
2025-04-17 03:24:11 +09:00
Yu Watanabe
76cb6f535e network/netdev: hash_ops related cleanups (#37119) 2025-04-17 03:22:36 +09:00
Yu Watanabe
86aa7cb4b8 network/macsec: use hash_ops with destructor 2025-04-16 23:29:45 +09:00
Yu Watanabe
c64c71fbe5 network/macsec: replace security_association_init() with structured initializer 2025-04-16 23:29:45 +09:00
Yu Watanabe
2af1f13c6f network/wireguard: use hash_ops with destructor for managing WireguardPeer 2025-04-16 23:29:45 +09:00
Yu Watanabe
643f1c1306 network/l2tp: use hash_ops with destructor for managing sessions 2025-04-16 23:29:45 +09:00
Daan De Meyer
1a4c2e8807 mkosi: Two improvements (#37155) 2025-04-16 15:12:15 +02:00
Daan De Meyer
52a82bcfc9 mkosi: Reuse main image prepare scripts in subimages
In the subimages we also want to make sure all dependencies of the
systemd packages are cached so reuse the same prepare scripts from
the main image to do that.

We only want required dependencies in the subimages, not recommended
or suggested dependendencies, so add an environment variable
$SYSTEMD_REQUIRED_DEPS_ONLY which the prepare scripts can check for
and enable it for the subimages.
2025-04-16 14:37:58 +02:00
Daan De Meyer
0ac6fc2917 mkosi: Make sure coreutils is installed in initrd/exitrd
This is already installed but Fedora/CentOS systems are nudged towards
installing coreutils-single which then later causes issues when we try
to install coreutils as a dependency of systemd so let's make sure we
pick coreutils from the beginning.
2025-04-16 14:21:45 +02:00
Lennart Poettering
bbeeea4362 bootctl: replace --no-variables by --variables=BOOL
I think the current behaviour of not doing EFI variables when we are run
in a container makes a ton of sense, but in some cases it's useful to
do EFI var setup even when a set of namespaces is set up for us, for
example to recover a hosed installation from a rescue disk.

While we are at it, let's remove some duplicate checks, and
systematically output information why we skip various operations.

Fixes: #36174 #35005
2025-04-16 13:39:12 +02:00
Daan De Meyer
53628612b7 elf2efi: Add back python 3.7 compat
The walrus operator was introduced in python 3.9 so using it
accidentally bumped the minimum python version to 3.9 from 3.7 and
bluca still cares about keeping this working on 3.8 so let's remove
the usage of the walrus operator.

Follow up for d6a29eee2b
2025-04-16 13:06:27 +02:00
Yu Watanabe
ef79411c31 use hashmap_dump_sorted() and friends at more several places (#37150) 2025-04-16 19:20:19 +09:00
Lennart Poettering
3d3d8f1dd2 update TODO 2025-04-16 10:48:31 +02:00
Yu Watanabe
f477751b10 docs: fix mkosi section for Environment= setting 2025-04-16 08:30:25 +09:00
Yu Watanabe
667fc1d993 conf-files: use hashmap_dump_sorted() at one more place 2025-04-16 08:17:52 +09:00
Yu Watanabe
dcf1c14b95 resolve: use set_dump_sorted() at one more place 2025-04-16 08:16:21 +09:00
Yu Watanabe
a0fa3f1616 resolve: fix memleak
Follow-up for 5c274555c3.
2025-04-15 23:34:49 +01:00
Luca Boccassi
86cfbfae97 xattr: fix assert that breaks importctl (#37146)
getxattr_at_malloc() calls getxattr_pinned_internal() with size 0 to get
the size of the xattr, and then asserts because n > 0
```
Assertion '(size_t) n <= size' failed at src/basic/xattr-util.c:107, function getxattr_pinned_internal().
```

Follow-up for b8df25dcfe
2025-04-16 06:44:24 +09:00
Yu Watanabe
8a05dbb31a core: remove cgroup v1 properties (#37026) 2025-04-16 06:22:46 +09:00
Yu Watanabe
b2b270e1d1 cgroup-setup: use path_join() to get path to cgroup attribute
We already have the path to the cgroup. Hence, it is not necessary to
call cg_get_path() again.
2025-04-16 03:56:04 +09:00
Yu Watanabe
188286eec6 cgroup-setup: drop unnecessary controller argument
This also removes unnecessary cg_{create,attach,trim}_everywhere(),
and rename cg_enable_everywhere() -> cg_enable().
2025-04-16 03:56:04 +09:00
Yu Watanabe
c35a585763 cgroup-setup: drop cgroup v1 support 2025-04-16 03:56:04 +09:00
Yu Watanabe
3988e2489a core: drop several more cgroup version check 2025-04-16 03:56:04 +09:00
Yu Watanabe
3fcb98cbff core/bpf-foreign: drop unnecessary check for cgroup v1 2025-04-16 03:56:04 +09:00
Yu Watanabe
ff7f99db30 core/bpf-devices: drop cgroup v1 support 2025-04-16 03:55:00 +09:00
Yu Watanabe
4ee64e4365 core/cgroup: drop cgroup v1 specific code in unit_update_cgroup() 2025-04-16 03:42:11 +09:00
Yu Watanabe
35f88201f2 core/cgroup: drop unnecessary cgroup version check in several getters
After 2b61489e5a, these checks are not
necessary anymore.
2025-04-16 03:25:46 +09:00
Yu Watanabe
0818300288 core/cgroup: drop unnecessary _unified_ modifier from function names 2025-04-16 03:25:45 +09:00