]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 months agonspawn: Use in_child_chown() in one more place 38152/head
DaanDeMeyer [Fri, 4 Jul 2025 19:21:35 +0000 (21:21 +0200)] 
nspawn: Use in_child_chown() in one more place

3 months agonspawn: Improve log message
DaanDeMeyer [Fri, 4 Jul 2025 19:21:25 +0000 (21:21 +0200)] 
nspawn: Improve log message

3 months agozsh-completion: generate completion for systemd-run from systemd-analyze
Eisuke Kawashima [Wed, 28 May 2025 10:25:17 +0000 (19:25 +0900)] 
zsh-completion: generate completion for systemd-run from systemd-analyze

continuation of #37641

3 months agonews: fix typo
Jörg Behrmann [Thu, 10 Jul 2025 07:52:42 +0000 (09:52 +0200)] 
news: fix typo

3 months agoman: clean up list of literals
Christian Hesse [Wed, 9 Jul 2025 10:26:39 +0000 (12:26 +0200)] 
man: clean up list of literals

3 months agoci: also set TEST_RUNNER environment variable in coverage test
Yu Watanabe [Wed, 9 Jul 2025 06:36:05 +0000 (15:36 +0900)] 
ci: also set TEST_RUNNER environment variable in coverage test

Otherwise, integration-test-wrapper.py will fail.
```
Traceback (most recent call last):
  File "/home/runner/work/systemd/systemd/test/integration-tests/integration-test-wrapper.py", line 693, in <module>
    main()
    ~~~~^^
  File "/home/runner/work/systemd/systemd/test/integration-tests/integration-test-wrapper.py", line 677, in main
    runner = os.environ['TEST_RUNNER']
             ~~~~~~~~~~^^^^^^^^^^^^^^^
  File "<frozen os>", line 717, in __getitem__
KeyError: 'TEST_RUNNER'
```

Follow-up for c0a5801f7b034f3473c10f627d54671e1588963b.

3 months agoman: fix typo
Yu Watanabe [Thu, 10 Jul 2025 05:01:01 +0000 (14:01 +0900)] 
man: fix typo

Follow-up for 7baf4034304e2e658473a48a0ccbe0656da7f2f6.

3 months agoukify: fix version detection for aarch64 zboot kernels with gzip or lzma compression
Zbigniew Jędrzejewski-Szmek [Wed, 9 Jul 2025 21:02:28 +0000 (23:02 +0200)] 
ukify: fix version detection for aarch64 zboot kernels with gzip or lzma compression

Fixes https://github.com/systemd/systemd/issues/34780. The number in the header
is the size of the *compressed* data, so for gzip we'd read the initial part of
the decompressed data (equal to the size of the compressed data) and not find
the version string. Later on, Fedora switched to zstd compression, and there we
correctly use the number as the size of the compressed data, so we stopped
hitting the issue, but we should still fix it for older kernels.

I verified that the fix works for gzip-compressed kernels. I also made the same
change for the code for lzma compression. I'm pretty sure it is the right thing,
even though I don't have such a kernel at hand to test.

>>> ukify.Uname.scrape('/lib/modules/6.12.0-0.rc2.24.fc42.aarch64/vmlinuz')
Real-Mode Kernel Header magic not found
+ readelf --notes /lib/modules/6.12.0-0.rc2.24.fc42.aarch64/vmlinuz
readelf: Error: Not an ELF file - it has the wrong magic bytes at the start
Found uname version: 6.12.0-0.rc2.24.fc42.aarch64

3 months agoTEST-04-JOURNAL: drop unexpected whitespace
Zbigniew Jędrzejewski-Szmek [Tue, 8 Jul 2025 14:42:29 +0000 (16:42 +0200)] 
TEST-04-JOURNAL: drop unexpected whitespace

3 months agocore: followups for the recent subgroup killing commits
Lennart Poettering [Wed, 9 Jul 2025 14:27:28 +0000 (16:27 +0200)] 
core: followups for the recent subgroup killing commits

This is a follow-up for 0f23564ad4a191a92bc5544edf800bb2cfbb3513 and
6b02854f508be3f27b45353dd1d12de7d93cab5f, as suggested here:

https://github.com/systemd/systemd/pull/37855#pullrequestreview-2997596953

3 months agogenerate-bpf-delegate-configs: fix compatibility with Python 3.7
Antonio Alvarez Feijoo [Wed, 9 Jul 2025 08:08:34 +0000 (10:08 +0200)] 
generate-bpf-delegate-configs: fix compatibility with Python 3.7

- Operator ":=" requires Python 3.8 or newer.
- list[str] requires Python 3.9 or newer.

Follow-up for ea9826eb946d57aaba7e6bfa2d6b120136c6b20f

3 months agocore: add 'DefaultRestrictSUIDSGID' config option (#38126)
Yu Watanabe [Thu, 10 Jul 2025 04:30:07 +0000 (13:30 +0900)] 
core: add 'DefaultRestrictSUIDSGID' config option (#38126)

closes #37602, see there for extra motivation and considered
alternatives.

On typical systems, only few services need to create SUID/SGID files.
This often is limited to the user explicitly setting suid/sgid, the
`systemd-tmpfiles*` services, and the package manager. Allowing a
default to globally restrict creation of suid/sgid files makes it easier
to apply this restriction precisely.

## testing done
- built on aarch64-linux and x86_64-linux
- ran a VM test on x86_64-linux, checking for:
    - VM system boots successfully
    - defaults apply (both `yes`, `no`, and undefined)
    - systemd tmpfiles can set suid/sgid on journal log path
- Other services explicitly defining `RestrictSUIDSGID=no` can create
suid files

3 months agoman/systemd.exec: update documentation for PrivateBPF= (#38142)
Yu Watanabe [Thu, 10 Jul 2025 04:13:54 +0000 (13:13 +0900)] 
man/systemd.exec: update documentation for PrivateBPF= (#38142)

Follow-up for #36134

Add a short description about what PrivateBPF=yes does and how it can be
useful.

3 months agoman/systemd.exec: update documentation for PrivateBPF= 38142/head
Matteo Croce [Wed, 9 Jul 2025 22:12:36 +0000 (00:12 +0200)] 
man/systemd.exec: update documentation for PrivateBPF=

Add a short description about what PrivateBPF=yes does
and how it can be useful.

3 months agoman/systemd.exec: use constant instead of literal
Matteo Croce [Wed, 9 Jul 2025 23:25:48 +0000 (01:25 +0200)] 
man/systemd.exec: use constant instead of literal

Use <constant> instead of <literal> otherwise every configuration item
is wrapped in double quotes.

3 months agoupdate TODO
Lennart Poettering [Wed, 9 Jul 2025 20:32:18 +0000 (22:32 +0200)] 
update TODO

3 months agocore: document 'DefaultRestrictSUIDSGID' 38126/head
Grimmauld [Tue, 8 Jul 2025 19:39:06 +0000 (21:39 +0200)] 
core: document 'DefaultRestrictSUIDSGID'

3 months agocore/varlink-manager: Support 'DefaultRestrictSUIDSGID' option
Grimmauld [Wed, 9 Jul 2025 09:28:10 +0000 (11:28 +0200)] 
core/varlink-manager: Support 'DefaultRestrictSUIDSGID' option

3 months agocore/dbus-manager: Support 'DefaultRestrictSUIDSGID' option
Grimmauld [Wed, 9 Jul 2025 09:46:01 +0000 (11:46 +0200)] 
core/dbus-manager: Support 'DefaultRestrictSUIDSGID' option

3 months agocgroup: handle ENODEV on cg_read_pid() gracefully
Lennart Poettering [Wed, 9 Jul 2025 12:28:28 +0000 (14:28 +0200)] 
cgroup: handle ENODEV on cg_read_pid() gracefully

The recently added test case TEST-07-PID1.subgroup-kill.sh surfaced a
race: if we enumerate PIDs in a cgroup, and the cgroup is unlinked at
the very same time reading will result in ENODEV. We need to handle that
gracefully. Hence let's do so.

Noticed while looking at:

https://github.com/systemd/systemd/actions/runs/16143084441/job/45554929264?pr=38120

3 months agorecurse-dir: coding style cleanups; mount-util: teach open_tree_attr_fallback() our...
Yu Watanabe [Wed, 9 Jul 2025 18:32:33 +0000 (03:32 +0900)] 
recurse-dir: coding style cleanups; mount-util: teach open_tree_attr_fallback() our usual AT_EMPTY_PATH trick (#38130)

3 months agocore: add 'DefaultRestrictSUIDSGID' config option
Grimmauld [Tue, 8 Jul 2025 19:21:25 +0000 (21:21 +0200)] 
core: add 'DefaultRestrictSUIDSGID' config option

closes #37602

On typical systems, only few services need to create SUID/SGID files.
This often is limited to the user explicitly setting suid/sgid, the
`systemd-tmpfiles*` services, and the package manager. Allowing a default
to globally restrict creation of suid/sgid files makes it easier to apply
this restriction precisely.

3 months agounits/systemd-tmpfiles-setup.service: explicitly set RestrictSUIDSGID=no
Grimmauld [Tue, 8 Jul 2025 20:02:46 +0000 (22:02 +0200)] 
units/systemd-tmpfiles-setup.service: explicitly set RestrictSUIDSGID=no

The tmpfiles service is used to set file permissions, e.g. for setting
suid bit on the journal log directory [1].

[1] https://github.com/systemd/systemd/blob/48e0f7bc2f94e74d15eed5c9e70b1c0269a495ec/tmpfiles.d/systemd.conf.in#L24-L25

3 months agounits/initrd-cleanup.service: Conflict with emergency.target
Fabian Vogt [Tue, 8 Jul 2025 11:02:47 +0000 (13:02 +0200)] 
units/initrd-cleanup.service: Conflict with emergency.target

This is very similar to 327cd2d3db703555f8d572b4cd055fbe55e1068b:

If emergency.target is started while initrd-cleanup.service/start is queued,
the initrd-cleanup job did not get canceled. In parallel to the emergency
units, it eventually runs the service, which in turn isolates and starts
initrd-switch-root.target. This stops the emergency units and effectively
starts the initrd boot process again, which likely fails again like the
initial attempt. The system is thus stuck in a loop, never really reaching
emergency.target.

This can be triggered if a service in between initrd-parse-etc.service
and initrd.target fails.

With this conflict added, starting emergency.target automatically cancels
initrd-cleanup.service/start, avoiding the loop.

3 months agomount-util: teach open_tree_attr_fallback() our usual AT_EMPTY_PATH trick 38130/head
Mike Yuan [Wed, 9 Jul 2025 08:07:07 +0000 (10:07 +0200)] 
mount-util: teach open_tree_attr_fallback() our usual AT_EMPTY_PATH trick

While at it, rename it to _with_fallback following
the naming scheme we use elsewhere.

3 months agomount-util: regroup functions
Mike Yuan [Wed, 9 Jul 2025 07:19:50 +0000 (09:19 +0200)] 
mount-util: regroup functions

3 months agorecurse-dir: switch to FOREACH_ARRAY
Mike Yuan [Wed, 9 Jul 2025 07:55:15 +0000 (09:55 +0200)] 
recurse-dir: switch to FOREACH_ARRAY

3 months agorecurse-dir: use -EBADF as placeholder for invalid fd
Mike Yuan [Wed, 9 Jul 2025 07:35:40 +0000 (09:35 +0200)] 
recurse-dir: use -EBADF as placeholder for invalid fd

As per our coding style.

3 months agoAdd support for BPF tokens (#36134)
Yu Watanabe [Wed, 9 Jul 2025 06:12:22 +0000 (15:12 +0900)] 
Add support for BPF tokens (#36134)

Add a new option `PrivateBPF=` to mount a private instance of bpffs.
Add also four configuration options
`BPFDelegate{Commands,Maps,Programs,Attachments}=` which set the
corresponding bpffs mount options in order to create BPF tokens:
https://lwn.net/Articles/947173/

Closes#35108.

3 months agocore: add options to delegate BPFFS token creation 36134/head
Matteo Croce [Thu, 15 May 2025 14:32:46 +0000 (16:32 +0200)] 
core: add options to delegate BPFFS token creation

Add four new options BPFDelegate{Commands,Maps,Programs,Attachments}=
in order to delegate to a BPFFS instance the permission to create tokens.

The value is a list of options taken from:
https://github.com/torvalds/linux/blob/v6.14/include/uapi/linux/bpf.h#L922-L1121
The special value "any" means to allow every possible values.

More informations about BPF tokens here:
https://lwn.net/Articles/947173/

3 months agocore: Introduce PrivateBPF= to mount a private BPFFS
Matteo Croce [Fri, 27 Jun 2025 12:17:00 +0000 (14:17 +0200)] 
core: Introduce PrivateBPF= to mount a private BPFFS

Add a new option PrivateBPF= to mount a new instance of bpffs within a
namespace.
PrivateBPF= can be set to "no" to use the host bpffs in readonly mode
and "yes" to do a new mount.
The mount is done with the new fsopen()/fsmount() API because in future
we'll hook some commands between the two calls.

3 months agocore: split out setup_private_users_child()
Matteo Croce [Tue, 26 Nov 2024 10:54:29 +0000 (11:54 +0100)] 
core: split out setup_private_users_child()

Drop support for kernels older than 3.19, as this is where
/proc/<pid>/setgroups was added.

https://github.com/torvalds/linux/commit/9cc46516ddf497ea16e8d7cb986ae03a0f6b92f8

3 months agotests: run test with CAP_BPF
Matteo Croce [Wed, 25 Jun 2025 12:42:48 +0000 (14:42 +0200)] 
tests: run test with CAP_BPF

Add CAP_BPF to tests run with nspawn, so we don't have to use a VM
to test BPF calls.

3 months agonspawn: create mountpoint for bpffs
Matteo Croce [Thu, 5 Jun 2025 08:00:05 +0000 (10:00 +0200)] 
nspawn: create mountpoint for bpffs

When we mount a tmpfs as /sys, create a mountpoint for bpf, as we
already do for cgroup

3 months agocore: fix owner check of PIDFile=, and update document (#38115)
Yu Watanabe [Tue, 8 Jul 2025 14:58:19 +0000 (23:58 +0900)] 
core: fix owner check of PIDFile=, and update document (#38115)

Closes #38108.

3 months agoA few changes related to linking and bitfields (#38118)
Yu Watanabe [Tue, 8 Jul 2025 14:57:44 +0000 (23:57 +0900)] 
A few changes related to linking and bitfields (#38118)

3 months agomeson: drop -ffunction-sections -fdata-sections 38118/head
Zbigniew Jędrzejewski-Szmek [Tue, 8 Jul 2025 11:18:07 +0000 (13:18 +0200)] 
meson: drop -ffunction-sections -fdata-sections

I added them in 41afb5eb7214727301132aedc381831fbfc78e37 without too
much explanation. Most likely the idea was to get rid of unused code
in libsystemd.so [1]. But now that I'm testing this, it doesn't seem
to have an effect. LTO is needed to get rid of unused functions, and
it's enough to have LTO without those options. Those options might have
some downsides [2], so let's disable them since there are doubts and no
particularly good reason to have them.

But keep the -Wl,--gc-sections option. Without this, libsystemd.so
grows a little:
-rwxr-xr-x 1 zbyszek zbyszek 5532424 07-08 13:24 build/libsystemd.so.0.40.0-orig
-rwxr-xr-x 1 zbyszek zbyszek 5614472 07-08 13:26 build/libsystemd.so.0.40.0-no-sections
-rwxr-xr-x 1 zbyszek zbyszek 5532392 07-08 13:27 build/libsystemd.so.0.40.0

Let's apply the --gc-sections option always to make the debug and final
builds more similar.

We need to verify that distro packages don't unexpectedly grow after this.

[1] https://unix.stackexchange.com/a/715901
[2] https://stackoverflow.com/a/36033811

4 months agobasic/stdio-util: use a fixed message in xsprintf
Zbigniew Jędrzejewski-Szmek [Tue, 8 Jul 2025 10:44:06 +0000 (12:44 +0200)] 
basic/stdio-util: use a fixed message in xsprintf

We put the name of the variable in the message, but it is a local variable
and the name does not have global meaning. We end up with pointless copies
of the error string:

$ strings build/libsystemd.so.0.40.0 | grep 'big enough'
xsprintf: p[] must be big enough
xsprintf: error[] must be big enough
xsprintf: prefix[] must be big enough
xsprintf: pty[] must be big enough
xsprintf: mode[] must be big enough
xsprintf: t[] must be big enough
xsprintf: s[] must be big enough
xsprintf: spid[] must be big enough
xsprintf: header_priority[] must be big enough
xsprintf: header_pid[] must be big enough
xsprintf: path[] must be big enough
xsprintf: buf[] must be big enough

The error message already shows the file, line, and function name, which
is enough to identify the problem:

  Assertion 'xsprintf: buffer too small' failed at src/test/test-string-util.c:20, function test_xsprintf(). Aborting.

4 months agotest-string-util: add a small test for xsprintf
Zbigniew Jędrzejewski-Szmek [Tue, 8 Jul 2025 10:55:17 +0000 (12:55 +0200)] 
test-string-util: add a small test for xsprintf

4 months agoMerge shared/exec-directory-util.? into basic/unit-def.?
Zbigniew Jędrzejewski-Szmek [Tue, 8 Jul 2025 10:09:31 +0000 (12:09 +0200)] 
Merge shared/exec-directory-util.? into basic/unit-def.?

Suggested in
https://github.com/systemd/systemd/pull/35892#discussion_r2180322856.

This is a tiny amount of code and does not warrant having a separate file
and spawning a separate instance of the compiler during the build.

Note: it took me a while to confirm that the contents of that table and
function don't end up in libsystemd.so. The issue is that they _are_ present in
it, unless LTO is used. We actually use link_whole[libbasic_static] for
libsystemd, so we end up with all that code there. LTO is needed to clean
that up.

4 months agoman: mention relative PIDFile= in user service is prefixed with $XDG_RUNTIME_DIR 38115/head
Yu Watanabe [Tue, 8 Jul 2025 08:49:52 +0000 (17:49 +0900)] 
man: mention relative PIDFile= in user service is prefixed with $XDG_RUNTIME_DIR

4 months agocore: allow to use PIDFile= in user session services
Yu Watanabe [Tue, 8 Jul 2025 08:37:33 +0000 (17:37 +0900)] 
core: allow to use PIDFile= in user session services

Fixes #38108.

Co-authored-by: 铝箔 <38349409+Sodium-Aluminate@users.noreply.github.com>
4 months agoupdate TODO
Lennart Poettering [Tue, 8 Jul 2025 08:53:51 +0000 (10:53 +0200)] 
update TODO

4 months agoshared/open-file: add line break
Zbigniew Jędrzejewski-Szmek [Mon, 7 Jul 2025 09:13:26 +0000 (11:13 +0200)] 
shared/open-file: add line break

We don't generally parenthesize additions, so drop that too.

4 months agoAdjust bitfields in struct Condition
Zbigniew Jędrzejewski-Szmek [Tue, 1 Jul 2025 11:39:00 +0000 (13:39 +0200)] 
Adjust bitfields in struct Condition

As is usually the case, the bitfields don't create the expected space savings,
because the field that follows needs to be aligned. But we don't want to fully
drop the bitfields here, because then ConditionType and ConditionResult are
each 4 bytes, and the whole struct grows from 32 to 40 bytes (on amd64). We
potentially have lots of little Conditions and that'd waste some memory.

Make each of the four fields one byte. This still allows the compiler to
generate simpler code without changing the struct size:

E.g. in condition_test:
                 c->result = CONDITION_ERROR;
-   78fab:      48 8b 45 e8             mov    -0x18(%rbp),%rax
-   78faf:      0f b6 50 01             movzbl 0x1(%rax),%edx
-   78fb3:      83 e2 03                and    $0x3,%edx
-   78fb6:      83 ca 0c                or     $0xc,%edx
-   78fb9:      88 50 01                mov    %dl,0x1(%rax)
+   78f8b:      48 8b 45 e8             mov    -0x18(%rbp),%rax
+   78f8f:      c6 40 03 03             movb   $0x3,0x3(%rax)

4 months agoupdate TODO
Lennart Poettering [Tue, 8 Jul 2025 07:56:24 +0000 (09:56 +0200)] 
update TODO

4 months agotest: invoke systemd-nspawn properly from a session
Lennart Poettering [Wed, 2 Jul 2025 13:22:35 +0000 (15:22 +0200)] 
test: invoke systemd-nspawn properly from a session

Let's not run user code outside of user context, that's not how things
are deployed, and means we cannot test the session setup properly

4 months agominor fixes to nspawn, machined, vmspawn (#38110)
Yu Watanabe [Tue, 8 Jul 2025 06:54:49 +0000 (15:54 +0900)] 
minor fixes to nspawn, machined, vmspawn (#38110)

Nothing earth shattering. Just clean-ups.

4 months agonspawn: Support idmapped mounts on homed managed home directories (#38069)
Lennart Poettering [Tue, 8 Jul 2025 04:51:41 +0000 (06:51 +0200)] 
nspawn: Support idmapped mounts on homed managed home directories (#38069)

Christian made this possible in Linux 6.15 with a new system call
open_tree_attr() that combines open_tree() and mount_setattr(). Because
idmapped mounts are (rightfully) not nested, we have to do some extra
shenanigans to make source we're putting the right source uid in the
userns for any idmapped mounts that we do in nspawn.

Of course we also add the necessary boilerplate to make open_tree_attr()
available in our code and wrap open_tree_attr() and the corresponding
fallback in a new function which we then use everywhere else.

4 months agovmspawn: tighten parser of EXIT_STATUS= 38110/head
Lennart Poettering [Mon, 16 Jun 2025 08:52:26 +0000 (10:52 +0200)] 
vmspawn: tighten parser of EXIT_STATUS=

The EXIT_STATUS is supposed to encapuslate an ANSI C process exit
status, which is 8bit unsigned. Hence parse it as such, do not accept
negative values, or values > 255.

4 months agonspawn: fix parser of --notify-ready=
Lennart Poettering [Mon, 16 Jun 2025 08:45:47 +0000 (10:45 +0200)] 
nspawn: fix parser of --notify-ready=

This switch takes a bool only, not an enum, hence don't claim otherwise
in the error log message.

4 months agonspawn: add argument comments to various calls
Lennart Poettering [Thu, 12 Jun 2025 15:38:04 +0000 (17:38 +0200)] 
nspawn: add argument comments to various calls

4 months agonspawn: don't use strjoina() for user controlled strings
Lennart Poettering [Thu, 12 Jun 2025 15:37:45 +0000 (17:37 +0200)] 
nspawn: don't use strjoina() for user controlled strings

4 months agomachinectl: fix status output indentation
Lennart Poettering [Mon, 30 Jun 2025 21:12:36 +0000 (23:12 +0200)] 
machinectl: fix status output indentation

All other status output lines use tabs, use that for the ID shift line
too. otherwise output will appear unaligned if log viewers have fixed
tab stop positions.

4 months agoadd api to kill subcgroups of units (#38102)
Lennart Poettering [Tue, 8 Jul 2025 04:33:32 +0000 (06:33 +0200)] 
add api to kill subcgroups of units (#38102)

4 months agotree-wide: switch a bunch of sd_bus_error_setf() to sd_bus_error_set()
Lennart Poettering [Tue, 8 Jul 2025 01:08:56 +0000 (03:08 +0200)] 
tree-wide: switch a bunch of sd_bus_error_setf() to sd_bus_error_set()

4 months agotest: add testcase for subcgroup killing 38102/head
Lennart Poettering [Mon, 30 Jun 2025 12:54:36 +0000 (14:54 +0200)] 
test: add testcase for subcgroup killing

4 months agosystemctl: add --kill-subgroup= switch for killing subcgroup
Lennart Poettering [Mon, 30 Jun 2025 12:54:12 +0000 (14:54 +0200)] 
systemctl: add --kill-subgroup= switch for killing subcgroup

4 months agopid1: add ability to kill processes in a subgroup of a unit
Lennart Poettering [Mon, 19 May 2025 15:38:26 +0000 (17:38 +0200)] 
pid1: add ability to kill processes in a subgroup of a unit

This is useful for things like machined, where the system machined wants
to manage a machine owned by the user somewhere down the tree.

4 months agopid1: properly report if we managed to kill a process by cgroup
Lennart Poettering [Mon, 30 Jun 2025 12:53:30 +0000 (14:53 +0200)] 
pid1: properly report if we managed to kill a process by cgroup

4 months agocore: add quota support for State, Cache, and Log exec directories (#35892)
Yu Watanabe [Tue, 8 Jul 2025 00:18:20 +0000 (09:18 +0900)] 
core: add quota support for State, Cache, and Log exec directories (#35892)

Based on https://github.com/systemd/systemd/issues/7820, this adds support for
quota enforcement to State, Cache, and Log exec directories.
* Add new directives, StateDirectoryQuota=, CacheDirectoryQuota=, and
  LogDirectoryQuota=, to define quotas as percentages (hard limits for
  blocks and inodes) or absolute values (hard limits for blocks only).
* Add new directives, StateDirectoryQuotaAccounting=,
  CacheDirectoryQuotaAccounting= and LogDirectoryQuotaAccounting= to keep
  track of storage quotas but not enforce them (effectively just assigning
  a project ID to defined exec directories).

Example:
```
StateDirectory=quotadir
StateDirectoryQuota=1%

Jan 06 22:55:46 abeltran: Storage quotas set for /var/lib/private/quotadir. Block limit = 2639404, inode limit = 671088

root@abeltran:/var/lib/private# lsattr -pR
3153000189 --------------e----P-- ./quotadir

root@abeltran:/var/lib/private# repquota  -P /datadrive
*** Report for project quotas on device /dev/sdc1
Block grace time: 7days; Inode grace time: 7days
                        Block limits                File limits
Project         used    soft    hard  grace    used  soft  hard  grace
----------------------------------------------------------------------
#0        --  213200       0       0           4086     0     0
#3153000189 -- 2639404       0 2639404              2     0 671088
```

4 months agobootspec: fix string table naming for BootEntryType/BootEntrySource (#38106)
Yu Watanabe [Tue, 8 Jul 2025 00:11:30 +0000 (09:11 +0900)] 
bootspec: fix string table naming for BootEntryType/BootEntrySource (#38106)

This was all very confusing and not matching our coding style
recommendations. Let's fix that.

Prompted by #37897, which really should make use of BootEntryType, but
we better clean it up first.

4 months agoman: also use title case in systemd.service(5)
Lennart Poettering [Mon, 7 Jul 2025 16:11:03 +0000 (18:11 +0200)] 
man: also use title case in systemd.service(5)

Follow-up for: 172dd81e92198d4903a52001e20f0da7f0b9d8b2

4 months agocore/cgroup: prepare for removal of tracking/bookkeeping logic specific to cgroup...
Yu Watanabe [Mon, 7 Jul 2025 23:37:01 +0000 (08:37 +0900)] 
core/cgroup: prepare for removal of tracking/bookkeeping logic specific to cgroup v1 (#38099)

4 months agotest: add test for quotas on Exec directories 35892/head
Andres Beltran [Mon, 16 Jun 2025 23:44:35 +0000 (23:44 +0000)] 
test: add test for quotas on Exec directories

4 months agoAdd quota support for systemctl
Andres Beltran [Tue, 1 Jul 2025 17:41:31 +0000 (17:41 +0000)] 
Add quota support for systemctl

4 months agoAdd quota support for DBus
Andres Beltran [Tue, 1 Jul 2025 17:40:47 +0000 (17:40 +0000)] 
Add quota support for DBus

4 months agocore: add quota support for State, Cache, and Log exec directories
Andres Beltran [Tue, 1 Jul 2025 17:37:48 +0000 (17:37 +0000)] 
core: add quota support for State, Cache, and Log exec directories

4 months agoshared: add exec-directory-util.ch
Andres Beltran [Tue, 1 Jul 2025 17:24:56 +0000 (17:24 +0000)] 
shared: add exec-directory-util.ch

4 months agoquota-util: add methods to read and set project IDs
Andres Beltran [Mon, 16 Jun 2025 23:39:25 +0000 (23:39 +0000)] 
quota-util: add methods to read and set project IDs

4 months agochattr-util: add helpers to read and set project IDs
Andres Beltran [Mon, 16 Jun 2025 23:38:25 +0000 (23:38 +0000)] 
chattr-util: add helpers to read and set project IDs

4 months agobootspec: boot_entry_source_to_json_string() to boot_entry_source_to_string() 38106/head
Lennart Poettering [Mon, 7 Jul 2025 16:26:59 +0000 (18:26 +0200)] 
bootspec: boot_entry_source_to_json_string() to boot_entry_source_to_string()

As with the previous changes for BootEntryType, let's also clean up the
naming for BootEntrySource.

4 months agobootspec: rename boot_entry_source_to_string() to boot_entry_source_description_to_st...
Lennart Poettering [Mon, 7 Jul 2025 16:25:22 +0000 (18:25 +0200)] 
bootspec: rename boot_entry_source_to_string() to boot_entry_source_description_to_string()

Similar to the previous changes, let's make clear this string table
contains *descriptive*, i.e. meaningful human-readable strings.

4 months agobootspec: rename BootEntryType values
Lennart Poettering [Mon, 7 Jul 2025 16:10:13 +0000 (18:10 +0200)] 
bootspec: rename BootEntryType values

So we exposed different names for the entry types in JSON than we named
our enum values. Which is very confusing. Let's unify that. Given that
the JSON fields are externally visible let's stick to that naming, even
though I think "unified" and "conf" would have been more descriptive.

This ensures we follow our usual logic that the enum identifiers and the
strings they map to use the same naming.

4 months agobootspec: include 'UKI' in descriptive name for type #2
Lennart Poettering [Mon, 7 Jul 2025 13:54:17 +0000 (15:54 +0200)] 
bootspec: include 'UKI' in descriptive name for type #2

I am pretty sure that "UKI" is the best known name for type #2 boot
loader spec entries, hence we really should put it in the name.

4 months agobootspec: rename boot_entry_type_to_string() to boot_entry_type_description_to_string()
Lennart Poettering [Mon, 7 Jul 2025 13:52:17 +0000 (15:52 +0200)] 
bootspec: rename boot_entry_type_to_string() to boot_entry_type_description_to_string()

This helper does not translate BootEntryType to a string matching the
enum's value names, but instead returns a human readable descriptive
string. Let's make it clearer what this, by including "description" in
the name.

4 months agoTODO: add future deprecation of DefaultMemoryMin/Low= 38099/head
Mike Yuan [Sun, 6 Jul 2025 10:41:29 +0000 (12:41 +0200)] 
TODO: add future deprecation of DefaultMemoryMin/Low=

4 months agocore/cgroup: unit_realize_cgroup_now_disable() is NOP for non-slice units
Mike Yuan [Sat, 5 Jul 2025 23:24:29 +0000 (01:24 +0200)] 
core/cgroup: unit_realize_cgroup_now_disable() is NOP for non-slice units

4 months agocore/cgroup: make unit_get_ancestor_disable_mask() static
Mike Yuan [Sat, 5 Jul 2025 22:18:40 +0000 (00:18 +0200)] 
core/cgroup: make unit_get_ancestor_disable_mask() static

4 months agocore/cgroup: tweak unit_invalidate_cgroup_bpf() a bit
Mike Yuan [Tue, 27 May 2025 23:02:04 +0000 (01:02 +0200)] 
core/cgroup: tweak unit_invalidate_cgroup_bpf() a bit

- Rename to unit_invalidate_cgroup_bpf_firewall() to make it clear
  that this is about CGROUP_CONTROLLER_BPF_FIREWALL only
- Report whether things changed in unit_invalidate_cgroup()
  to avoid duplicate checks

4 months agocore/cgroup: dial down "controller" noise
Mike Yuan [Sun, 6 Jul 2025 00:04:10 +0000 (02:04 +0200)] 
core/cgroup: dial down "controller" noise

Add some missing assertions while at it.

4 months agocore/cgroup: workaround for kernel < 5.4 is now irrelevant
Mike Yuan [Sat, 5 Jul 2025 23:57:51 +0000 (01:57 +0200)] 
core/cgroup: workaround for kernel < 5.4 is now irrelevant

4 months agocore/cgroup: remove any reference to cgv1 controllers
Mike Yuan [Sat, 5 Jul 2025 21:50:48 +0000 (23:50 +0200)] 
core/cgroup: remove any reference to cgv1 controllers

4 months agocore/cgroup: regroup functions
Mike Yuan [Sat, 5 Jul 2025 23:54:45 +0000 (01:54 +0200)] 
core/cgroup: regroup functions

4 months agocore/cgroup: drop unneeded cast
Mike Yuan [Sat, 5 Jul 2025 23:46:59 +0000 (01:46 +0200)] 
core/cgroup: drop unneeded cast

4 months agocore/cgroup: introduce cgroup_context_has_device_policy() helper
Mike Yuan [Sat, 5 Jul 2025 21:47:06 +0000 (23:47 +0200)] 
core/cgroup: introduce cgroup_context_has_device_policy() helper

4 months agocore/cgroup: drop dangling cgroup_context_copy() prototype
Mike Yuan [Sat, 5 Jul 2025 21:39:46 +0000 (23:39 +0200)] 
core/cgroup: drop dangling cgroup_context_copy() prototype

Follow-up for 8c35e8a9d2b0c26453108d51873991af7ec7dfe1

4 months agocore/cgroup: constify CGROUP_TASKS_MAX_UNSET
Mike Yuan [Sat, 5 Jul 2025 21:27:54 +0000 (23:27 +0200)] 
core/cgroup: constify CGROUP_TASKS_MAX_UNSET

4 months agoman/supported-controllers: refresh list
Mike Yuan [Sun, 6 Jul 2025 00:40:13 +0000 (02:40 +0200)] 
man/supported-controllers: refresh list

4 months agonspawn: Support idmapped mounts on homed managed home directories 38069/head
DaanDeMeyer [Fri, 4 Jul 2025 18:19:26 +0000 (20:19 +0200)] 
nspawn: Support idmapped mounts on homed managed home directories

Christian made this possible in Linux 6.15 with a new system call
open_tree_attr() that combines open_tree() and mount_setattr().
Because idmapped mounts are (rightfully) not nested, we have to do
some extra shenanigans to make source we're putting the right source
uid in the userns for any idmapped mounts that we do in nspawn.

Of course we also add the necessary boilerplate to make open_tree_attr()
available in our code and wrap open_tree_attr() and the corresponding
fallback in a new function which we then use everywhere else.

4 months agoforward: Add struct mount_attr forward declaration
DaanDeMeyer [Fri, 4 Jul 2025 18:19:06 +0000 (20:19 +0200)] 
forward: Add struct mount_attr forward declaration

4 months agobasic: Add open_tree_attr() syscall wrapper
DaanDeMeyer [Fri, 4 Jul 2025 18:18:39 +0000 (20:18 +0200)] 
basic: Add open_tree_attr() syscall wrapper

4 months agobasic: Use Static_assert() in missing_syscall_def.h
DaanDeMeyer [Fri, 4 Jul 2025 16:56:42 +0000 (18:56 +0200)] 
basic: Use Static_assert() in missing_syscall_def.h

Let's use Static_assert() so we don't have to include forward.h in
missing_syscall_def.h.

4 months agoman: improve Description= documentation (#38101)
Zbigniew Jędrzejewski-Szmek [Mon, 7 Jul 2025 09:56:09 +0000 (11:56 +0200)] 
man: improve Description= documentation (#38101)

Fixes: #36165
4 months agoman: improve Description= documentation 38101/head
Lennart Poettering [Mon, 7 Jul 2025 08:10:29 +0000 (10:10 +0200)] 
man: improve Description= documentation

This is an attempt to address the issues raised in #36165.

Fixes: #36165
4 months agotree-wide: "human readable" → "human-readable"
Lennart Poettering [Mon, 7 Jul 2025 07:48:42 +0000 (09:48 +0200)] 
tree-wide: "human readable" → "human-readable"

Apparently, the spelling with a hyphen is better style in the English
language.

Suggested by: #36165

4 months agobuild(deps): bump github/codeql-action from 3.28.18 to 3.29.2
dependabot[bot] [Tue, 1 Jul 2025 11:21:37 +0000 (11:21 +0000)] 
build(deps): bump github/codeql-action from 3.28.18 to 3.29.2

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.18 to 3.29.2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/ff0a06e83cb2de871e5a09832bc6a81e7276941f...181d5eefc20863364f96762470ba6f862bdef56b)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 3.29.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
4 months agoUnify error messages for transient settings, fix handling of Ex variants (#38083)
Lennart Poettering [Mon, 7 Jul 2025 07:39:40 +0000 (09:39 +0200)] 
Unify error messages for transient settings, fix handling of Ex variants (#38083)

4 months agoExplicitly include more headers (#38100)
Daan De Meyer [Mon, 7 Jul 2025 06:26:46 +0000 (08:26 +0200)] 
Explicitly include more headers (#38100)

Continuation of 4f18ff2e29b8054f30b084abcabf5f689f4b340b.

4 months agotimesync,test: explicitly include sys/timex.h when struct timex is used 38100/head
Yu Watanabe [Mon, 7 Jul 2025 03:40:11 +0000 (12:40 +0900)] 
timesync,test: explicitly include sys/timex.h when struct timex is used

struct timex is defined by sys/timex.h -> bits/timex.h.
Glibc includes the header in time.h, but let's explicitly include it
when the struct is used.

Similar to 4f18ff2e29b8054f30b084abcabf5f689f4b340b, but for sys/timex.h.