]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
7 months agomeson: rename RC_LOCAL_PATH -> SYSTEM_SYSVRCLOCAL_PATH 36953/head
Yu Watanabe [Wed, 2 Apr 2025 13:10:29 +0000 (22:10 +0900)] 
meson: rename RC_LOCAL_PATH -> SYSTEM_SYSVRCLOCAL_PATH

No functional change, but just for emphasizing that this is for
SysV compatibility.

7 months agomeson: disable rc-local-generator when an empty string is specified to rc-local=...
Yu Watanabe [Wed, 2 Apr 2025 13:09:12 +0000 (22:09 +0900)] 
meson: disable rc-local-generator when an empty string is specified to rc-local= meson option

In such case, the generator is meaningless. Let's kill it.

7 months agocore: delegate mountns implicitly when any of pidns/cgns/netns is in use, clean up...
Yu Watanabe [Wed, 2 Apr 2025 15:15:33 +0000 (00:15 +0900)] 
core: delegate mountns implicitly when any of pidns/cgns/netns is in use, clean up private cgroupfs mount (#36892)

Fixes #36952

7 months agotest: skip TEST-06-SELINUX if not on fedora/centos
Luca Boccassi [Wed, 2 Apr 2025 01:02:17 +0000 (02:02 +0100)] 
test: skip TEST-06-SELINUX if not on fedora/centos

The test skips at runtime on the same condition, but that's already too late
as it often gets stuck on boot in Debian/Ubuntu. Check in the meson
condition directly so that it's not even started.

7 months agohostnamed: fix incorrect usage of device_dmi (#36948)
herbrechtsmeier [Wed, 2 Apr 2025 12:41:44 +0000 (14:41 +0200)] 
hostnamed: fix incorrect usage of device_dmi (#36948)

Fix incorrect usage of device_dmi in context_acquire_device_tree().

Follow-up for 3e91aed6c4e53824adddb5b8ad124ffecb0e0673.

7 months agomkosi: Make sure we set DEB_BUILD_PROFILES when cleaning up with dpkg
Daan De Meyer [Wed, 2 Apr 2025 11:07:36 +0000 (13:07 +0200)] 
mkosi: Make sure we set DEB_BUILD_PROFILES when cleaning up with dpkg

Otherwise we might miss some files that are gated behind one of the
selected profiles.

7 months agodocs/user_record: Put timeZone and resourceLimits in their own paragraph
Andreas Schneider [Wed, 2 Apr 2025 11:33:37 +0000 (13:33 +0200)] 
docs/user_record: Put timeZone and resourceLimits in their own paragraph

7 months agoman/pstore.conf: pstore.conf template is not always installed in /etc
Zbigniew Jędrzejewski-Szmek [Wed, 2 Apr 2025 09:43:04 +0000 (11:43 +0200)] 
man/pstore.conf: pstore.conf template is not always installed in /etc

"Inspired" by 798faa6fefab5f5479455ee241672659cb30f18c ;)

7 months agomkosi: Various improvements and fixes (#36931)
Daan De Meyer [Wed, 2 Apr 2025 11:02:10 +0000 (13:02 +0200)] 
mkosi: Various improvements and fixes (#36931)

7 months agobuild(deps): bump ninja from 1.11.1.2 to 1.11.1.4 in /.github/workflows
dependabot[bot] [Tue, 1 Apr 2025 16:41:06 +0000 (16:41 +0000)] 
build(deps): bump ninja from 1.11.1.2 to 1.11.1.4 in /.github/workflows

Bumps [ninja](https://github.com/scikit-build/ninja-python-distributions) from 1.11.1.2 to 1.11.1.4.
- [Release notes](https://github.com/scikit-build/ninja-python-distributions/releases)
- [Changelog](https://github.com/scikit-build/ninja-python-distributions/blob/master/HISTORY.rst)
- [Commits](https://github.com/scikit-build/ninja-python-distributions/compare/1.11.1.2...1.11.1.4)

---
updated-dependencies:
- dependency-name: ninja
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
7 months agoman: coredump.conf template is not always installed in /etc
wtmpx [Wed, 2 Apr 2025 07:18:52 +0000 (09:18 +0200)] 
man: coredump.conf template is not always installed in /etc

The default installation path can be configured with the -Dconfigfiledir= option

7 months agoTweak log messages around efivarsfs and hibernation (#36921)
Zbigniew Jędrzejewski-Szmek [Wed, 2 Apr 2025 09:30:26 +0000 (11:30 +0200)] 
Tweak log messages around efivarsfs and hibernation (#36921)

7 months agomkosi: Stop passing package environment variables to tools image 36931/head
Daan De Meyer [Tue, 1 Apr 2025 12:57:22 +0000 (14:57 +0200)] 
mkosi: Stop passing package environment variables to tools image

The tools image is not guaranteed to be the same distribution as the
target distribution and so might have different package environment
variables than the main image yet we currently unconditionally use the
same package environment variables for both of them.

Let's fix this by not passing the package environment variables to the
tools image and subimages anymore, and instead having the main, tools and
build images separately include a config file with the required environment
variables.

7 months agomkosi: Use mkosi.tools.conf for tools tree configuration
Daan De Meyer [Tue, 1 Apr 2025 11:25:47 +0000 (13:25 +0200)] 
mkosi: Use mkosi.tools.conf for tools tree configuration

This allows us to use the regular settings instead of having to bother
with ToolsTreeXXX variants. It'll also allow us to share configuration
between the regular images and the tools tree image, which we'll make
use of in the next commit.

7 months agobuild(deps): bump redhat-plumbers-in-action/download-artifact
dependabot[bot] [Tue, 1 Apr 2025 09:28:20 +0000 (09:28 +0000)] 
build(deps): bump redhat-plumbers-in-action/download-artifact

Bumps [redhat-plumbers-in-action/download-artifact](https://github.com/redhat-plumbers-in-action/download-artifact) from 1.1.1 to 1.1.5.
- [Release notes](https://github.com/redhat-plumbers-in-action/download-artifact/releases)
- [Commits](https://github.com/redhat-plumbers-in-action/download-artifact/compare/463ae626ac2dd333491c7beccaa24c12c5c259b8...103e5f882470b59e9d71c80ecb2d0a0b91a7c43b)

---
updated-dependencies:
- dependency-name: redhat-plumbers-in-action/download-artifact
  dependency-version: 1.1.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
7 months agobuild(deps): bump super-linter/super-linter from 7.2.1 to 7.3.0
dependabot[bot] [Tue, 1 Apr 2025 09:28:18 +0000 (09:28 +0000)] 
build(deps): bump super-linter/super-linter from 7.2.1 to 7.3.0

Bumps [super-linter/super-linter](https://github.com/super-linter/super-linter) from 7.2.1 to 7.3.0.
- [Release notes](https://github.com/super-linter/super-linter/releases)
- [Changelog](https://github.com/super-linter/super-linter/blob/main/CHANGELOG.md)
- [Commits](https://github.com/super-linter/super-linter/compare/85f7611e0f7b53c8573cca84aa0ed4344f6f6a4d...4e8a7c2bf106c4c766c816b35ec612638dc9b6b2)

---
updated-dependencies:
- dependency-name: super-linter/super-linter
  dependency-version: 7.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
7 months agoudev-spawn: voidify pidref_kill_and_sigcont()
Yu Watanabe [Wed, 2 Apr 2025 04:20:40 +0000 (13:20 +0900)] 
udev-spawn: voidify pidref_kill_and_sigcont()

Follow-up for cdd2dd2d58f34d32ee3957aa05860a513909d400.
Fixes CID#1596076.

7 months agotest: drop unnecessary '>= 0' in ASSERT_OK()
Yu Watanabe [Wed, 2 Apr 2025 04:23:47 +0000 (13:23 +0900)] 
test: drop unnecessary '>= 0' in ASSERT_OK()

Follow-up for 2351bc991e3a4f1fbdaa2d53900980b6703babbd.
Fixes CID#1596075.

7 months agomkosi: Drop number prefixes from configuration files
Daan De Meyer [Tue, 1 Apr 2025 11:23:02 +0000 (13:23 +0200)] 
mkosi: Drop number prefixes from configuration files

We already removed these in some places, let's migrate the others as
well. There's no ordering required at all between these configuration
files so let's not bother with any numbered prefixes.

7 months agomkosi: Drop orphan_file workaround
Daan De Meyer [Tue, 1 Apr 2025 11:22:29 +0000 (13:22 +0200)] 
mkosi: Drop orphan_file workaround

mkosi now handles this workaround itself internally.

7 months agomkosi: Update to latest
Daan De Meyer [Tue, 1 Apr 2025 11:22:09 +0000 (13:22 +0200)] 
mkosi: Update to latest

7 months agounit: don't bother determining unit install state for transient or perpetual units...
Yu Watanabe [Tue, 1 Apr 2025 18:15:02 +0000 (03:15 +0900)] 
unit: don't bother determining unit install state for transient or perpetual units (#36504)

7 months agobuild(deps): bump meson from 1.6.0 to 1.6.1 in /.github/workflows
dependabot[bot] [Tue, 1 Apr 2025 09:57:05 +0000 (09:57 +0000)] 
build(deps): bump meson from 1.6.0 to 1.6.1 in /.github/workflows

Bumps [meson](https://github.com/mesonbuild/meson) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/mesonbuild/meson/releases)
- [Commits](https://github.com/mesonbuild/meson/compare/1.6.0...1.6.1)

---
updated-dependencies:
- dependency-name: meson
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
7 months agomeson: Set PYTHONDONTWRITEBYTECODE=1 in test environment
Daan De Meyer [Tue, 1 Apr 2025 14:11:14 +0000 (16:11 +0200)] 
meson: Set PYTHONDONTWRITEBYTECODE=1 in test environment

Let's not pollute the source tree with __pycache__ files.

7 months agouser-runtime-dir: correct quota size calculation (#36884)
Yu Watanabe [Tue, 1 Apr 2025 15:59:09 +0000 (00:59 +0900)] 
user-runtime-dir: correct quota size calculation (#36884)

7 months agounit: return a better error state for unit_get_unit_file_preset() if we have no fragm... 36504/head
Lennart Poettering [Wed, 26 Feb 2025 16:59:42 +0000 (17:59 +0100)] 
unit: return a better error state for unit_get_unit_file_preset() if we have no fragment path

We'd previously return what was already set. Let's instead return a
clear ENOEXEC in this case, to make clear what is going on: preset logic
doesn't apply to units which lag a fragment path.

7 months agounit: initialize unit_file_preset field to valid value
Lennart Poettering [Wed, 26 Feb 2025 16:57:19 +0000 (17:57 +0100)] 
unit: initialize unit_file_preset field to valid value

"-1" is not a valid enum value. Use a better one. All code using this
considers negative values error codes anyway, hence the old code was
just a weird way to write -EPERM. Let's clean this up.

7 months agounit: don't bother determining unit install state for transient or perpetual units
Lennart Poettering [Mon, 24 Feb 2025 22:35:57 +0000 (23:35 +0100)] 
unit: don't bother determining unit install state for transient or perpetual units

I noticed that we keep querying the preset database for transient units,
which makes little sense, since transient units are well, transient, and
hence not suject to enablement/disablement. Hence, let's shortcut things
and simply not check the preset database for them.

While we are at it, shortcut unit file state checks for transient units,
too.  We know they are transient already, we can return that directly,
no need to go to disk.

Finally, treat perpetual units like transient units for the the preset
case: also bypass the preset database. (But keep checking for the unit
file state for them, since it *is* relevant to know whether they were
generated or not.)

7 months agonotify-recv: several follow-ups for notify_socket_prepare()
Yu Watanabe [Tue, 1 Apr 2025 10:15:59 +0000 (19:15 +0900)] 
notify-recv: several follow-ups for notify_socket_prepare()

Follow-ups for 2351bc991e3a4f1fbdaa2d53900980b6703babbd.
Addresses post-merge review:
https://github.com/systemd/systemd/pull/36911#pullrequestreview-2732136658

7 months agotest: fix usage of --hostnqn= (#36927)
Luca Boccassi [Tue, 1 Apr 2025 13:04:23 +0000 (14:04 +0100)] 
test: fix usage of --hostnqn= (#36927)

Fixes #36908.

7 months agotest and manpages follow-ups (#36924)
Luca Boccassi [Tue, 1 Apr 2025 12:52:14 +0000 (13:52 +0100)] 
test and manpages follow-ups (#36924)

7 months agoTEST-46-HOMED: conditionally skip usrquota tests 36884/head
Zbigniew Jędrzejewski-Szmek [Mon, 31 Mar 2025 20:50:38 +0000 (22:50 +0200)] 
TEST-46-HOMED: conditionally skip usrquota tests

The tests were failing, because the quota was not enforced.
It seems that we simply don't have privileges to set or display the quota.
The test is running priviled, so this is probably some SELinux:
TEST-46-HOMED.sh[117]: + /usr/lib/systemd/tests/unit-tests/manual/test-display-quota tmpfsquota /dev/shm /tmp
TEST-46-HOMED.sh[1103]: Lacking privileges to query UID quota on /dev/shm: Operation not permitted
TEST-46-HOMED.sh[1103]: Lacking privileges to query UID quota on /tmp: Operation not permitted

If we cannot display the quota, ignore the test results.
In a local run under mkosi, quota is shown and the tests pass. So this is something
about how the testing-farm:fedora-rawhide-x86_64 is configured.

7 months agoTEST-46-HOMED: check for support on /dev/shm and /tmp separately
Zbigniew Jędrzejewski-Szmek [Sat, 29 Mar 2025 08:24:34 +0000 (09:24 +0100)] 
TEST-46-HOMED: check for support on /dev/shm and /tmp separately

The test fails in CI. My guess was this is because the enablement of quota on
/tmp and /dev/shm is independent. The former fs is mounted by systemd in the
host, while the latter is mounted in the initrd, so we can end up with quota
support on one but not the other, which is the situation I had on my laptop.
This wasn't actually the source of the problems in CI, but it's a reasonable
change to make anyway.

While at it, test both mountpoints separately.

7 months agotest-display-quota: add a little helper binary to show quota on tmpfs
Zbigniew Jędrzejewski-Szmek [Fri, 28 Mar 2025 17:45:23 +0000 (18:45 +0100)] 
test-display-quota: add a little helper binary to show quota on tmpfs

quota from quota project fails:
$ quota
quota: Cannot stat() mounted device tmpfs: No such file or directory
quota: Cannot stat() mounted device tmpfs: No such file or directory

Having this helper helped me understand what is going on with the quotas when
the tests failed. I think it'd be useful to keep it around for now, even though
it is not actually connected in the tests.

7 months agotest: replace deprecated --hostid= with --hostnqn= 36927/head
Yu Watanabe [Tue, 1 Apr 2025 10:00:50 +0000 (19:00 +0900)] 
test: replace deprecated --hostid= with --hostnqn=

Fixes #36908.

7 months agoman: add missing conditional 36924/head
Luca Boccassi [Tue, 1 Apr 2025 09:40:45 +0000 (10:40 +0100)] 
man: add missing conditional

Follow-up for d95818f5221d9b9b19648cffa0cb2407f023b27e

man: run 'update-man-rules' again

7 months agotest: use 'exit 0' instead of 'return' in test scripts
Luca Boccassi [Tue, 1 Apr 2025 08:55:52 +0000 (09:55 +0100)] 
test: use 'exit 0' instead of 'return' in test scripts

14385s [   66.896852] TEST-87-AUX-UTILS-VM.sh[3744]: + test -x /usr/lib/systemd/systemd-validatefs
14385s [   66.898544] TEST-87-AUX-UTILS-VM.sh[3744]: + echo 'no systemd-validatefs'
14385s [   66.899115] TEST-87-AUX-UTILS-VM.sh[3744]: no systemd-validatefs
14385s [   66.899699] TEST-87-AUX-UTILS-VM.sh[3744]: + return
14385s [   66.900189] TEST-87-AUX-UTILS-VM.sh[3744]: .//usr/lib/systemd/tests/testdata/units/TEST-87-AUX-UTILS-VM.validatefs.sh: line 13: return: can only `return' from a function or sourced script

Follow-up for 6e003d18bbf5e9f55c08b25d80b138b3a98d5f26

7 months agoRevert "test: call nvme-cli with --hostnqn= instead of the deprecated --hostid="
Yu Watanabe [Tue, 1 Apr 2025 09:58:43 +0000 (18:58 +0900)] 
Revert "test: call nvme-cli with --hostnqn= instead of the deprecated --hostid="

This reverts commit b8942f4ae2d121603544b8527a7faf7fc458562c.

As commented https://github.com/systemd/systemd/issues/36908#issuecomment-2768507373,
the usage of --hostnqn= is different from --hostid=.

7 months agoshared/mount-setup: use '' to signify empty option string 36921/head
Zbigniew Jędrzejewski-Szmek [Tue, 1 Apr 2025 09:08:33 +0000 (11:08 +0200)] 
shared/mount-setup: use '' to signify empty option string

We said:
systemd[1]: Mounting efivarfs to /sys/firmware/efi/efivars of type efivarfs with options n/a.
I think '' is clearer.

7 months agohibernate-resume: restore full message if resume fails
Zbigniew Jędrzejewski-Szmek [Tue, 1 Apr 2025 08:49:12 +0000 (10:49 +0200)] 
hibernate-resume: restore full message if resume fails

We had a INFO message before 760e99bb52dd132aeab14802c9ed2889471e9cdf. Logging
at INFO level made sense back when we didn't have the EFI variable and people
would set resume= on the kernel command line. Nowadays, if we have the
hibernation info, then we expect it to be accurate. Log at WARN level if we
have the EFI variable and the resume fails for any reason, and at INFO
otherwise.

OTOH, we already print errors immediately when that happens, and if the resume
failed in the kernel, the kernel should log on its own. So just use WARN, not
ERR.

7 months agoudev-spawn: manage spawned processes by PidRef
Yu Watanabe [Tue, 1 Apr 2025 06:54:24 +0000 (15:54 +0900)] 
udev-spawn: manage spawned processes by PidRef

7 months agoudev: trivial cleanups (#36916)
Yu Watanabe [Tue, 1 Apr 2025 09:24:34 +0000 (18:24 +0900)] 
udev: trivial cleanups (#36916)

7 months agointroduce notify_socket_prepare() and use it where applicable (#36911)
Yu Watanabe [Tue, 1 Apr 2025 09:20:47 +0000 (18:20 +0900)] 
introduce notify_socket_prepare() and use it where applicable (#36911)

This introduces notify_socket_prepare(), which creates an autobind
notify socket and IO event source for the socket. Then, use it where we
send notification messages from worker processes to their manager
process.

7 months agoman: run 'update-man-rules' again
Lennart Poettering [Tue, 1 Apr 2025 07:26:10 +0000 (09:26 +0200)] 
man: run 'update-man-rules' again

7 months agoudev: update log messages 36916/head
Yu Watanabe [Tue, 1 Apr 2025 06:39:37 +0000 (15:39 +0900)] 
udev: update log messages

7 months agoudev: disable timer event source for cleaning up idle workers when no worker exists
Yu Watanabe [Tue, 1 Apr 2025 06:36:45 +0000 (15:36 +0900)] 
udev: disable timer event source for cleaning up idle workers when no worker exists

No functional change, as the timer event does nothing when there are no
workers.

7 months agotest: call nvme-cli with --hostnqn= instead of the deprecated --hostid=
Luca Boccassi [Mon, 31 Mar 2025 22:05:04 +0000 (23:05 +0100)] 
test: call nvme-cli with --hostnqn= instead of the deprecated --hostid=

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

7 months agoTEST-46-HOMED: write zeros instead of random bytes
Zbigniew Jędrzejewski-Szmek [Fri, 28 Mar 2025 17:00:38 +0000 (18:00 +0100)] 
TEST-46-HOMED: write zeros instead of random bytes

This should be faster, and equivalent for the purposes of quota calculation.

7 months agouser-runtime-dir: correct quota size calculation
Mike Yuan [Mon, 3 Feb 2025 15:18:14 +0000 (16:18 +0100)] 
user-runtime-dir: correct quota size calculation

Follow-up for b1c95fb2e9d11fc190017dec3d64f468f9d378bc

Fixes #36245

7 months agovalidatefs: several follow-ups (#36910)
Yu Watanabe [Mon, 31 Mar 2025 20:35:21 +0000 (05:35 +0900)] 
validatefs: several follow-ups (#36910)

7 months agoudev: trivial cleanups (#36912)
Yu Watanabe [Mon, 31 Mar 2025 20:34:32 +0000 (05:34 +0900)] 
udev: trivial cleanups (#36912)

7 months agosysupdated: use notify_socket_prepare() 36911/head
Yu Watanabe [Mon, 31 Mar 2025 17:16:42 +0000 (02:16 +0900)] 
sysupdated: use notify_socket_prepare()

This also make it use autobind notify socket.

7 months agosysupdate-transfer: use notify_socket_prepare()
Yu Watanabe [Mon, 31 Mar 2025 17:11:06 +0000 (02:11 +0900)] 
sysupdate-transfer: use notify_socket_prepare()

7 months agosysupdate-transfer: fix potential memleak
Yu Watanabe [Mon, 31 Mar 2025 17:07:54 +0000 (02:07 +0900)] 
sysupdate-transfer: fix potential memleak

7 months agonotify: use notify_socket_prepare()
Yu Watanabe [Mon, 31 Mar 2025 16:56:17 +0000 (01:56 +0900)] 
notify: use notify_socket_prepare()

7 months agoimport: use notify_socket_prepare()
Yu Watanabe [Mon, 31 Mar 2025 16:41:19 +0000 (01:41 +0900)] 
import: use notify_socket_prepare()

This also make it use autobind notify socket.

7 months agohomed: use notify_socket_prepare()
Yu Watanabe [Mon, 31 Mar 2025 16:32:03 +0000 (01:32 +0900)] 
homed: use notify_socket_prepare()

This also make it use autobind notify socket.

7 months agoudev-manager: coding style cleanups 36912/head
Yu Watanabe [Wed, 19 Mar 2025 03:38:57 +0000 (12:38 +0900)] 
udev-manager: coding style cleanups

7 months agoudev-manager: use notify_start() and notify_on_cleanup()
Yu Watanabe [Mon, 24 Mar 2025 11:01:48 +0000 (20:01 +0900)] 
udev-manager: use notify_start() and notify_on_cleanup()

No functional change. Just refactoring.

7 months agonotify-recv: introduce notify_socket_prepare()
Yu Watanabe [Thu, 27 Mar 2025 02:10:15 +0000 (11:10 +0900)] 
notify-recv: introduce notify_socket_prepare()

7 months agoac-power: follow-up for recent change
Yu Watanabe [Mon, 31 Mar 2025 10:52:39 +0000 (19:52 +0900)] 
ac-power: follow-up for recent change

Follow-ups for 72586a971b5ee26b6681fc34ba43c0081dbd94da.

- drop 'Options' sections,
- drop underlining for link,
- fix indentation.

Prompted by https://github.com/systemd/systemd/pull/36850#discussion_r2020594171
> the underline stuff we only use for long --help texts that have sections,
> for the section headers. systemctl --help does that for example. This one
> here is not that long, hence doesn't really need section headers, and
> hence no underlining. The clickable links don't need to be explicitly
> underlined, the terminal emulators that supper hyperlinks will underline
> them on their own (for example gnome-terminal uses a dotted line).

Addresses https://github.com/systemd/systemd/pull/36873#discussion_r2017578611

7 months agosocket-util: introduce socket_autobind() helper (#36893)
Yu Watanabe [Mon, 31 Mar 2025 17:55:04 +0000 (02:55 +0900)] 
socket-util: introduce socket_autobind() helper (#36893)

Prompted by https://github.com/systemd/systemd/pull/36858#discussion_r2017719305
and #36833.

7 months agounits/systemd-validatefs@.service: FailureAction= is a [Unit] knob 36910/head
Mike Yuan [Mon, 31 Mar 2025 16:39:42 +0000 (18:39 +0200)] 
units/systemd-validatefs@.service: FailureAction= is a [Unit] knob

7 months agoman/systemd-validatefs@.service: fix typo
Mike Yuan [Mon, 31 Mar 2025 17:04:49 +0000 (19:04 +0200)] 
man/systemd-validatefs@.service: fix typo

7 months agovalidatefs: use fgetxattr_malloc() where appropriate
Mike Yuan [Mon, 31 Mar 2025 17:20:54 +0000 (19:20 +0200)] 
validatefs: use fgetxattr_malloc() where appropriate

7 months agovalidatefs: do not use EXIT_* in run()
Mike Yuan [Mon, 31 Mar 2025 16:43:34 +0000 (18:43 +0200)] 
validatefs: do not use EXIT_* in run()

The plain DEFINE_MAIN_FUNCTION is used, i.e. all >= 0 retvals
are treated as success. No need for EXIT_* annotations.

7 months agovalidatefs: insert empty line after short description in help() text
Mike Yuan [Mon, 31 Mar 2025 16:33:56 +0000 (18:33 +0200)] 
validatefs: insert empty line after short description in help() text

As per our usual coding style.

7 months agoxattr-util: add missing assertions
Mike Yuan [Mon, 31 Mar 2025 16:20:22 +0000 (18:20 +0200)] 
xattr-util: add missing assertions

Follow-up for ed024abac6e4acad5a77943721e7622bb1b10b71
and 9fbe26cfa8fadb58e048aa6a57ad0dacf5de03fc

Also, let's not get too tangled up in the style of defining variables
in between. The functions are short enough, and vars involved are still
effectively at the beginning... Put differently, the separation from
'int r' is too deliberate and brings no actual value in my eyes.

7 months agotest: pass verbose option to nvme-cli
Luca Boccassi [Mon, 31 Mar 2025 14:44:11 +0000 (15:44 +0100)] 
test: pass verbose option to nvme-cli

When the test fails due to nvme-cli/kernel issues it's hard to report it
upstream as there's not enough details, add verbose flags

7 months agointroduce systemd-validatefs@.service that ensures file systems can only be used...
Yu Watanabe [Mon, 31 Mar 2025 16:14:33 +0000 (01:14 +0900)] 
introduce systemd-validatefs@.service that ensures file systems can only be used in the way they were intended (#36714)

If we have multiple trusted fs (i.e. luks or dm-verity) we generate via
repart at boot, we must make sure they cannot be "misappropriated", i.e.
used for a different mount they were intended for.

Hence, let's introduce "mount constraint" data (encoded in xattrs on the
root inode of the fs) that tells us where a file system has to be
mounted, and what the gpt partition metadata has to be for the fs to be
valid.

Inspired by this thread:
https://lists.freedesktop.org/archives/systemd-devel/2025-March/051244.html

7 months agosocket-util: introduce socket_autobind() helper 36893/head
Mike Yuan [Sat, 29 Mar 2025 20:33:58 +0000 (21:33 +0100)] 
socket-util: introduce socket_autobind() helper

Prompted by https://github.com/systemd/systemd/pull/36858#discussion_r2017719305
and #36833

7 months agoSeveral updates for socket option (#36905)
Yu Watanabe [Mon, 31 Mar 2025 16:09:04 +0000 (01:09 +0900)] 
Several updates for socket option (#36905)

7 months agosocket-util: drop SO_BINDTODEVICE fallback in socket_bind_to_ifindex()
Mike Yuan [Sat, 29 Mar 2025 20:29:26 +0000 (21:29 +0100)] 
socket-util: drop SO_BINDTODEVICE fallback in socket_bind_to_ifindex()

Our baseline is v5.4 now.

7 months agotree-wide: extend the comment about the issue in __convert_scm_timestamps() 36905/head
Yu Watanabe [Mon, 31 Mar 2025 14:19:52 +0000 (23:19 +0900)] 
tree-wide: extend the comment about the issue in __convert_scm_timestamps()

7 months agocore/manager: update comment
Yu Watanabe [Mon, 31 Mar 2025 14:02:49 +0000 (23:02 +0900)] 
core/manager: update comment

7 months agoREADME: fix version of SO_BINDTOIFINDEX
Yu Watanabe [Mon, 31 Mar 2025 13:52:40 +0000 (22:52 +0900)] 
README: fix version of SO_BINDTOIFINDEX

Follow-up for 33746caf8fe51fe4e89fd7f2f459f06c34fbd175.

7 months agomissing_socket: drop unnecessary definitions and update comments
Yu Watanabe [Mon, 31 Mar 2025 13:49:37 +0000 (22:49 +0900)] 
missing_socket: drop unnecessary definitions and update comments

- SO_PEERGROUPS is since kernel v4.13
  (28b5ba2aa0f55d80adb2624564ed2b170c19519e),
- SO_BINDTOIFINDEX is since kernel v5.1
  (f5dd3d0c9638a9d9a02b5964c4ad636f06cf7e2c).

7 months agoupdate TODO 36714/head
Lennart Poettering [Wed, 12 Mar 2025 12:34:35 +0000 (13:34 +0100)] 
update TODO

7 months agoci: add test for new validatefs work
Lennart Poettering [Thu, 13 Mar 2025 15:58:59 +0000 (16:58 +0100)] 
ci: add test for new validatefs work

7 months agoci: add -no-xattrs to unsquashfs cmdline
Lennart Poettering [Wed, 19 Mar 2025 08:19:24 +0000 (09:19 +0100)] 
ci: add -no-xattrs to unsquashfs cmdline

If the target dir is tmpfs and we run on old kernels we cannot extract
xattrs and the extracting will fail if there are any. hence add
-no-xattrs to the two remaining unsquashfs invocations that don't have
it.

(Also all other invocations across our test tree spell "-dest" instead
of "-d", hence do so here too.)

7 months agorepart: automatically generate validatefs xattrs
Lennart Poettering [Wed, 12 Mar 2025 08:50:20 +0000 (09:50 +0100)] 
repart: automatically generate validatefs xattrs

Let's automatically generate validatefs xattrs by default, that encode
the intended use of partitions.

This defaults to on, since the structure of repart definition files
tells us enough on use for this to be safe. There's an option however,
to turn this off.

7 months agogenerators: hook in validatefs on gpt-auto and fstab generator mounts
Lennart Poettering [Wed, 12 Mar 2025 08:49:52 +0000 (09:49 +0100)] 
generators: hook in validatefs on gpt-auto and fstab generator mounts

Let's turn on validatefs automatically for all auto-discovered
partitions.

Let's add an x-systemd.validatefs option to optionally turn this on for
fstab listed file systems.

7 months agovalidatefs: add new tool that enforces mount constraints
Lennart Poettering [Wed, 12 Mar 2025 07:37:05 +0000 (08:37 +0100)] 
validatefs: add new tool that enforces mount constraints

This new tool looks for a three xattr on the root inode of a file system
that encode mount constraints of the file system. The tool is supposed
to be hooke into the mount logic and is supposed to protect against
misappropriating trusted file systems in unintended ways.

Consider the following scenario: we boot up on first boot and create a
tpm-locked pair of /var/ and /srv/ partitions via systemd-repart. An
attacker then offline modifies the partition table, exchanging the
metadata of the /var/ and /srv/ partition. So far we'd happily accept
that, honour the modified metadata and boot up. This could be used to
revert changes to /var/ or similar. And all that even though both
partitions are encrypted and locked to TPM!

With this new mechanism we can encode in the protected contents of the
file systems the ways it can be used: the partition type uuid, the
partition label and the intended mount point can be stored in xattrs,
and we can check them automatically on mount, and take action on
mismatch. (action would typically be immediate reboot).

7 months agoxattr-util: add trivial xsetxattr_strv() wrapper
Lennart Poettering [Mon, 31 Mar 2025 12:55:36 +0000 (14:55 +0200)] 
xattr-util: add trivial xsetxattr_strv() wrapper

7 months agoxattr-util: add trivial getxattr_at_strv() helper
Lennart Poettering [Mon, 31 Mar 2025 12:47:22 +0000 (14:47 +0200)] 
xattr-util: add trivial getxattr_at_strv() helper

7 months agoREADME: note min kernerl version for SO_BINDTOIFINDEX
Luca Boccassi [Mon, 31 Mar 2025 13:06:54 +0000 (14:06 +0100)] 
README: note min kernerl version for SO_BINDTOIFINDEX

Prompted by https://github.com/systemd/systemd/pull/36893

7 months agowatchdog: fix typo
Yu Watanabe [Mon, 31 Mar 2025 12:26:57 +0000 (21:26 +0900)] 
watchdog: fix typo

Follow-up for ab596e4cde5d4b55be5182a8d5554e3e97366131.

7 months agoLog message improvements (#35237)
Yu Watanabe [Mon, 31 Mar 2025 12:23:23 +0000 (21:23 +0900)] 
Log message improvements (#35237)

Various improvements to log messages. Inspired by
https://bugzilla.redhat.com/show_bug.cgi?id=2327296.

7 months agohomed: move things over to quotactl_fd() (#36902)
Yu Watanabe [Mon, 31 Mar 2025 12:15:03 +0000 (21:15 +0900)] 
homed: move things over to quotactl_fd() (#36902)

Let's use quotactl_fd() wherever we can, it's 2025. quotactl() is such a
mess after all.

7 months agopcrextend: whenever we fail to extend PCRs, reboot immediately
Lennart Poettering [Tue, 11 Mar 2025 16:28:47 +0000 (17:28 +0100)] 
pcrextend: whenever we fail to extend PCRs, reboot immediately

PCR extensions are supposed to be useful for "destroying" the ability to
access TPM bound secrets. Hence, if for some reason we fail to extend a
PCR, it's safer to just reboot, instead of going on without the
extension, leaving secrets potentially accessible which should not be
accessible.

Note that the services exit gracefully if no TPM is found, hence this
should not be triggered on TPM-less systems. However, this enforces that
if there is a TPM that is accessible to Linux and that works properly,
the PCR measurement must complete too.

Inspired by this thread:

https://lists.freedesktop.org/archives/systemd-devel/2025-March/051244.html

7 months agosocket-proxy: add syntax highlighting to help output
Busayo Dada [Mon, 24 Mar 2025 21:19:41 +0000 (22:19 +0100)] 
socket-proxy: add syntax highlighting to help output

7 months agohomed: don't log error we don't have 36902/head
Lennart Poettering [Mon, 31 Mar 2025 09:51:38 +0000 (11:51 +0200)] 
homed: don't log error we don't have

7 months agohomed: always use quotactl_fd() if its available
Lennart Poettering [Mon, 31 Mar 2025 09:47:17 +0000 (11:47 +0200)] 
homed: always use quotactl_fd() if its available

Let's always prefer quotactl_fd() when it's available and use quotactl()
only as as a fallback on old kernels.

This way we can operate on the fds we typically already have open, or if
needed we can open a new one, and use for multiple fs operation.

In the long run we should really focus on operating exclusively by fd
instead of by path, by device nor or otherwise. This gets us a step
closer to that.

7 months agocore/namespace: remove wonky fallback in mount_private_apivfs() 36892/head
Mike Yuan [Sun, 16 Mar 2025 21:05:41 +0000 (22:05 +0100)] 
core/namespace: remove wonky fallback in mount_private_apivfs()

Let's avoid dropping opts willy-nilly, especially that we already
carry the logic of determining availability prior to mount (but
make sure we respect the result though, and don't assume things
are available if the check fails).

7 months agocore/namespace: stop applying mount options on private cgroupfs mount
Mike Yuan [Sun, 16 Mar 2025 20:55:29 +0000 (21:55 +0100)] 
core/namespace: stop applying mount options on private cgroupfs mount

We always unshare cgroup ns for ProtectControlGroups=private/strict,
while the mount options only apply to the cgroupfs instance
in initial cgns (c.f.
https://github.com/torvalds/linux/blob/b69bb476dee99d564d65d418e9a20acca6f32c3f/kernel/cgroup/cgroup.c#L1984)
Hence let's drop the thing wholesale.

Also, as noted in the comment already, mount_private_apivfs()
internally enforces nosuid/noexec, so drop explicit flags too.

7 months agocore: delegate mountns implicitly when any of pidns/cgns/netns is in use
Mike Yuan [Sat, 29 Mar 2025 20:02:04 +0000 (21:02 +0100)] 
core: delegate mountns implicitly when any of pidns/cgns/netns is in use

7 months agocore/execute: drop unused function param and cg unified check for cgns
Mike Yuan [Sat, 29 Mar 2025 19:53:36 +0000 (20:53 +0100)] 
core/execute: drop unused function param and cg unified check for cgns

While at it, remove TODO about assuming availability of cgns.
We generally want to keep that optional still.

7 months agoTEST-07-PID1: remove bogus test case for DelegateNamespaces=cgroup
Mike Yuan [Sun, 30 Mar 2025 16:45:27 +0000 (18:45 +0200)] 
TEST-07-PID1: remove bogus test case for DelegateNamespaces=cgroup

We enable nsdelegate for cgroupfs, and hence the kernel would
always refuse writes to /sys/fs/cgroup/cgroup.pressure and friends
regardless of whether the cgns is owned by userns:
https://github.com/torvalds/linux/blob/cb82ca153949c6204af793de24b18a04236e79fd/kernel/cgroup/cgroup.c#L4132
This currently works because the mountns (thus cgroupfs) remains
to be non-delegated and we're actually operating on the real root
cgroup.

It appears that cgroupfs generally doesn't care about userns,
so I'm yet to see a way to test this properly. Let's drop this for now,
to unblock fixes in the following commits.

7 months agotest: skip networkd tests if networkd/resolved are disabled at build time
Luca Boccassi [Sat, 29 Mar 2025 17:56:04 +0000 (17:56 +0000)] 
test: skip networkd tests if networkd/resolved are disabled at build time

7 months agotest: skip TEST-75-RESOLVED if resolved is disabled at build time
Luca Boccassi [Sat, 29 Mar 2025 17:55:45 +0000 (17:55 +0000)] 
test: skip TEST-75-RESOLVED if resolved is disabled at build time