]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
4 months agoresolved: honour SD_RESOLVED_NO_CNAME flag when processing cache
Lennart Poettering [Wed, 4 Jun 2025 08:53:50 +0000 (10:53 +0200)] 
resolved: honour SD_RESOLVED_NO_CNAME flag when processing cache

Fixes: #33300
Replaces: #35102
(cherry picked from commit 959d7f1759d67994e3bed7b9d2f23e063475a872)

4 months agocompress: avoid a bunch of div-by-zeroes
Lennart Poettering [Tue, 3 Jun 2025 14:26:17 +0000 (16:26 +0200)] 
compress: avoid a bunch of div-by-zeroes

Follow-up for #37706. Implements the same logic for all compression
algorithms we have.

(cherry picked from commit d483ac1d0d26f1df5237d15765a8fa782ed0db08)

4 months agorepart: if partition already exists, required size may not be multiple of grain size
Yu Watanabe [Fri, 18 Apr 2025 18:41:45 +0000 (03:41 +0900)] 
repart: if partition already exists, required size may not be multiple of grain size

See partition_min_size_with_padding().
Fixes #37178.

(cherry picked from commit cb109e00c45c8e92b1020e6249aac4a212e7f72d)

4 months agovmspawn: do not preserve access permissions and xattrs of template OVMF vars
Arian van Putten [Sun, 1 Jun 2025 10:02:55 +0000 (12:02 +0200)] 
vmspawn: do not preserve access permissions and xattrs of template OVMF vars

This makes vmspawn work when /usr/share/qemu/edk2-i386-vars.fd is on
disk with 0444 permissions as is the case on NixOS.

The nix package manager does not store any access permissions, ownership,
timestamps, or extended attributes in its package format to increase
reproducibility. The only meta-data that is stored is the executable bit.

Thus when unpacking a nix package, the executable bit is preserved, but no other
access permissions are preserved and all files in /nix/store end up as
read-only.

This causes the template OVMF vars file to have 0444 permissions. If we preserve
those permissions when copying the template file to /tmp that means QEMU can not
write to the file and fails.

So lets not preserve permissions and keep the 0600 permissions that are set by
default.

(cherry picked from commit 96e481bfbd6c52aabc72116f7ff479f11baeead1)

4 months agocompress: prevent divide-by-zero when no data is read (#37706)
Alex [Tue, 3 Jun 2025 01:51:00 +0000 (21:51 -0400)] 
compress: prevent divide-by-zero when no data is read (#37706)

If the first call to `loop_read()` returns 0 (no input), `total_in`
remains 0, causing `total_out/total_in` to potential divide by zero.

We add a check before logging the compression ratio to skip the
percentage calculation when total_in is zero.

Co-authored-by: jinyaoguo <guo846@purdue.edu>
(cherry picked from commit 2584f745e0509472e68449bd81c60c26056d514a)

4 months agonetwork: fix a potential divide-by-zero (#37705)
Alex [Mon, 2 Jun 2025 22:47:49 +0000 (18:47 -0400)] 
network: fix a potential divide-by-zero (#37705)

In function `tc_init`, hz is parsed from the content of file
`"/proc/net/psched"` and can be 0.
In function `hierarchy_token_bucket_class_verify`, hz is directly used
as a divisor in
`htb->buffer = htb->rate / hz + htb->mtu;` without any check. This adds a check on hz before using it as a divisor.

Co-authored-by: jinyaoguo <guo846@purdue.edu>
(cherry picked from commit 1a596054a0f937bfc244580f07510759a0e45657)

4 months agorepart: fix generation of UUID= line for vfat in fstab entries
Lennart Poettering [Mon, 2 Jun 2025 08:12:10 +0000 (10:12 +0200)] 
repart: fix generation of UUID= line for vfat in fstab entries

Fixes: #36735
(cherry picked from commit 8504721e0e758aadf454141de014fe28d14cefcd)

4 months agobootctl: fix unclosed quote in debug log
Joaquim Monteiro [Sat, 31 May 2025 18:56:28 +0000 (19:56 +0100)] 
bootctl: fix unclosed quote in debug log

(cherry picked from commit c9e614eb256ec2591170c1b840558103dfa3d2b0)

4 months agomount-util: avoid unnecessary mount_setattr() call in make_fsmount()
Lennart Poettering [Sat, 31 May 2025 05:58:30 +0000 (07:58 +0200)] 
mount-util: avoid unnecessary mount_setattr() call in make_fsmount()

If .attr_set is zero (and .att_clr, .propagation too), then there's no
point in calling mount_setattr().

Fixes: #37062
Note that this optimization is not precisely load-bearing anymore, since
3cc23a2c2345eb188551565349c89ec1fa8f650f got merged which removes the
only caller of make_fsmount() that might trigger it. But it's worth
fixing generic code anyway, in case it gets used like this later again.

(cherry picked from commit 249752d1ecd0f8e160d6e8633f71771b51db5a84)

4 months agotest: wait for coredump to appear before parsing
Luca Boccassi [Fri, 30 May 2025 21:08:39 +0000 (22:08 +0100)] 
test: wait for coredump to appear before parsing

A new core was added to the test, but the loop counter was not increased
to wait for it, so the test races against systemd-coredump's processing.

This failed at least once in debci:

8015s [   32.227813] TEST-87-AUX-UTILS-VM.sh[1038]: + coredumpctl info COREDUMP_TIMESTAMP=1679509902000000
8015s [   32.228684] TEST-87-AUX-UTILS-VM.sh[1723]: No coredumps found.

Follow-up for 0c49e0049b7665bb7769a13ef346fef92e1ad4d6

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

(cherry picked from commit 703fbb0bba7f1a1b46342d6efedda30e51d46135)

4 months agosync-docs: add '(latest stable)' next to the latest version in the menu
Luca Boccassi [Fri, 30 May 2025 01:03:08 +0000 (02:03 +0100)] 
sync-docs: add '(latest stable)' next to the latest version in the menu

Add visual indicator of what is the latest version in the
version menu

(cherry picked from commit 90b0222091e23ed21ecf7dacc9f885e72bcdfdc5)

4 months agosync-docs: fix selection menu when opening 'latest' man
Luca Boccassi [Fri, 30 May 2025 01:02:01 +0000 (02:02 +0100)] 
sync-docs: fix selection menu when opening 'latest' man

'devel' will always sort first, so the highest version is the second
entry, not the first one

(cherry picked from commit 1cd995185bcd0ea3612ebaee2c311a5f36b2fa64)

4 months agosync-docs: fix syntax warning
Luca Boccassi [Fri, 30 May 2025 00:59:15 +0000 (01:59 +0100)] 
sync-docs: fix syntax warning

sync-docs.py:94: SyntaxWarning: invalid escape sequence '\d'
  m = re.match("v?(\d+).*", tag)

(cherry picked from commit 34d63ac87930ab64cb0f7b9a956ee91ba29148f0)

4 months agosysupdate: change status once operation has completed
Luca Boccassi [Wed, 28 May 2025 23:36:47 +0000 (00:36 +0100)] 
sysupdate: change status once operation has completed

Otherwise after the service exits it will still show
"Installing 'foobar'" as the status, which is confusing

(cherry picked from commit 5cfc9c34f4a38cc82c233e453373d48231944d81)

4 months agossh-generator: add missing newline before [Service] and trailing NL to generated...
Mike Yuan [Wed, 28 May 2025 20:30:46 +0000 (22:30 +0200)] 
ssh-generator: add missing newline before [Service] and trailing NL to generated service

(cherry picked from commit e72bd8dbc867dbd68fa48b22f258feeb7760caa6)

4 months agossh-generator: fix typo
Mike Yuan [Wed, 28 May 2025 20:30:39 +0000 (22:30 +0200)] 
ssh-generator: fix typo

(cherry picked from commit 0aa4c3f0f90f22b566b3c1002ccdce5ab5fb4062)

4 months agoman: better tags, more links, minor grammar and formatting improvements
Zbigniew Jędrzejewski-Szmek [Wed, 28 May 2025 13:20:50 +0000 (15:20 +0200)] 
man: better tags, more links, minor grammar and formatting improvements

Closes https://github.com/systemd/systemd/issues/35751.

(cherry picked from commit b082968d199976a868fd686340691af112d44c51)

4 months agoman/systemd.network: reword description of MulticastIGMPVersion=
Zbigniew Jędrzejewski-Szmek [Wed, 28 May 2025 13:31:19 +0000 (15:31 +0200)] 
man/systemd.network: reword description of MulticastIGMPVersion=

(cherry picked from commit acf3bdf8132fc2788ca8a992f9353ccfeef2a3d1)

4 months agoman/systemd.timer: change to positive wording
Zbigniew Jędrzejewski-Szmek [Wed, 28 May 2025 13:30:20 +0000 (15:30 +0200)] 
man/systemd.timer: change to positive wording

(cherry picked from commit f56d9b82b14f899e03eb1852a705eb91197a0793)

4 months agoman: reword descriptions of numerical fields
Zbigniew Jędrzejewski-Szmek [Wed, 28 May 2025 13:30:05 +0000 (15:30 +0200)] 
man: reword descriptions of numerical fields

A "string" is a concept in C. In a text-based API, this is implicit, especially
if we say that something was "formatted". So change occurences of "decimal
string" to just "decimal". Similarly, "numerics" is unclear, say "digits".

Also, a "timestamp is in a clock" just sounds wrong. Reword those sentences.

(cherry picked from commit de8d2894b8bd2d77c0f54d0fadd31a67fe1ba822)

4 months agoman/systemd-resolved: update description of routing
Zbigniew Jędrzejewski-Szmek [Wed, 28 May 2025 13:25:47 +0000 (15:25 +0200)] 
man/systemd-resolved: update description of routing

(cherry picked from commit 948369983c8f8729f13799a2adfff8b95d442824)

4 months agoman/systemd-analyze: rewrite "Exit status" section
Zbigniew Jędrzejewski-Szmek [Wed, 28 May 2025 13:25:23 +0000 (15:25 +0200)] 
man/systemd-analyze: rewrite "Exit status" section

(cherry picked from commit 8bfdba3cb1f8148ac9218719bf0a93f371128404)

4 months agoman/pam_systemd: use <constant> consistently
Zbigniew Jędrzejewski-Szmek [Wed, 28 May 2025 13:23:48 +0000 (15:23 +0200)] 
man/pam_systemd: use <constant> consistently

For some reason, <constant> and <literal> were used interchangeably.

(cherry picked from commit 3a23e96b6799589caef547306f5f85f1feaf73dd)

4 months agoman: introduce openssl as man page provider and use it for ukify.1
Zbigniew Jędrzejewski-Szmek [Wed, 28 May 2025 13:23:03 +0000 (15:23 +0200)] 
man: introduce openssl as man page provider and use it for ukify.1

(cherry picked from commit 001ae86a739b13e987419af1e3e13a3caaafa8c3)

4 months agotest-network: add test case for issue #37629
Yu Watanabe [Tue, 27 May 2025 14:31:48 +0000 (23:31 +0900)] 
test-network: add test case for issue #37629

(cherry picked from commit b1bed07d84d76f3ab2f11a42fefce2685dbbe685)

4 months agonetwork/link: update state file when master ifindex is changed
Yu Watanabe [Tue, 27 May 2025 17:09:52 +0000 (02:09 +0900)] 
network/link: update state file when master ifindex is changed

If master ifindex is non-zero, then the carrier state and operational
state of the interface may be the enslaved state.
As the operational state is saved in link state file, and read by
wait-online, we need to update the state file when the master ifindex is
changed.

(cherry picked from commit 7dde00ca57cf20a5d71e580d0bc6173f454095e5)

4 months agonetwork/link: ENODATA from reading IFLA_MASTER when an interface has no master
Yu Watanabe [Tue, 27 May 2025 14:17:40 +0000 (23:17 +0900)] 
network/link: ENODATA from reading IFLA_MASTER when an interface has no master

When an interface leaved from the master interface, then reading
IFLA_MASTER attribute causes ENODATA. When the interface was previously
enslaved to another interface, we need to remove reference to the
interface from the previous master interface.

This is especially important when
```
ip link set dev eth0 nomaster
```
is called.

Fixes a bug introduced by 0d411b7f8f5407e9ce84dcb4ede0b029ade7fede (v249).
Fixes #37629.

(cherry picked from commit f44b20b7b6c6b0a089a3ec2392ac85e4772e0357)

4 months agoman/systemd.timer: Correct inaccuracy in man page
Adrian Vovk [Tue, 18 Feb 2025 20:59:03 +0000 (15:59 -0500)] 
man/systemd.timer: Correct inaccuracy in man page

The docs previously stated that RandomizedDelaySec is applied onto the
next scheduled time, but after 9fa326b18aef0c1e5c80e23a5b41de02155e6f7e
this is no longer the case.

I also reworded FixedRandomDelay= slightly, to make it a bit clearer

(cherry picked from commit fca20a1be69d0ffe3067e5c8676d75b5f8af1a5d)

4 months agomeson: Stop doing nested build when fuzzers are enabled
Daan De Meyer [Sun, 11 May 2025 07:42:28 +0000 (09:42 +0200)] 
meson: Stop doing nested build when fuzzers are enabled

Currently, when fuzzers are enabled, we run meson from within meson
to build the fuzzer executables with sanitizers. The idea is that
we can build the fuzzers with different kinds of sanitizers
independently from the main build.

The issue with this setup is that we don't actually make use of it.
We only build the fuzzers with one set of sanitizers (address,undefined)
so we're adding a bunch of extra complexity without any benefit as we
can just setup the top level meson build with these sanitizers and get
the same result.

The other issue with this setup is that we don't pass on all the options
passed to the top level meson build to the nested meson build. The only things
we pass on are extra compiler arguments and the value of the auto_features
option, but none of the individual feature options if overridden are passed on,
which can lead to very hard to debug issues as an option enabled in the top
level build is not enabled in the nested build.

Since we're not getting anything useful out of this setup, let's simplify
and get rid of the nested meson build. Instead, sanitizers should be enabled
for the top level meson.build. This currently didn't work as we were overriding
the sanitizers passed to the meson build with the fuzzer sanitizer, so we
fix that as well by making sure we combine the fuzzer sanitizer with the ones
passed in by the user.

We also drop support for looking up libFuzzer as a separate library as
it has been shipped builtin in clang since clang 6.0, so we can assume
that -fsanitize=fuzzer is available.

To make sure we still run the fuzzing tests, we enable the fuzz-tests option
by default now to make sure they still always run (without instrumentation unless
one of llvm-fuzz or oss-fuzz is enabled).

(cherry picked from commit d8def5dc8745c3d77cf49ad5abbb6719ffd94035)

4 months agomkosi: install util-linux-systemd in SUSE
Luca Boccassi [Tue, 3 Jun 2025 17:54:52 +0000 (18:54 +0100)] 
mkosi: install util-linux-systemd in SUSE

Some tools (findmnt, logger, lsblk, lslogins) got moved to a
new util-linux-systemd package in Tumbleweed so install it explicitly

(cherry picked from commit aba73b88a224f03c9fdddb2a410bbb29a4d395aa)

4 months agomkosi: update mkosi commit reference to 5e739ef1ed02a4f3b6ae64e50a8ee186cbcb21c2...
Daan De Meyer [Tue, 27 May 2025 16:31:48 +0000 (18:31 +0200)] 
mkosi: update mkosi commit reference to 5e739ef1ed02a4f3b6ae64e50a8ee186cbcb21c2 (#37632)

5e739ef1ed mkosi-initrd: Optionally match t64 suffix for tss2
libraries
*   ec70393077 Merge pull request https://github.com/systemd/mkosi/pull/3742 from DaanDeMeyer/man
|\
| * 94cc136fbe mkosi-tools: Install man tool and pages as part of misc
profile
| * eda2ed533d Enforce C.UTF-8 locale for all commands we run
* | 9821e9a3e3 sandbox: Support using mkosi-sandbox as a library
* | 4145382edf Serialize pid in state and check if still exists on load
* |   3d119cba07 Merge pull request https://github.com/systemd/mkosi/pull/3736 from DaanDeMeyer/rpm-gpgkey
|\ \
| |/
|/|
| * 0a5d87b7bb Only pick up /etc/pki/tls and /etc/pki/ca-trust as
certificate dirs
| * c30eee187f Look for rpm gpg keys from inside the sandbox
|/
ef2842dfea Fix version bump check if image version was passed on CLI
12b6251153 apt: Install apt sources if apt was installed via base tree
a0b4e1af9a Make sure git doesn't fail when running as root
585a47705d repart: use --append-fstab=auto if available
cec6ae1dda sandbox: handle case where dev node for tty doesn't exist
a60dade823 initrd: shadow-utils removal is only necessary on old
Fedora
ca11acbd5b Use SPDX identifier instead of file path for license in
pyproject.toml
4d031bc57d Revert license-files property
*   c80dd09008 Merge pull request https://github.com/systemd/mkosi/pull/3722 from behrmann/versiontweaks
|\
| * c76e5dc4bc make version test more readable
| * 90ba99dde1 version: add __repr__ to GenericVersion
|/
dd794ec832 Fix licenses path in pyproject.toml
*   7eeb749840 Merge pull request https://github.com/systemd/mkosi/pull/3702 from aafeijoo-suse/initrd-kmp
|\
| * 565b905aa1 mkosi-initrd: handle symlinks under weak-updates
| * a83ccc10c7 mkosi-initrd: perform basic checks on the kernel dir
before calling mkosi
| * 73cad79c9e mkosi-initrd: --kernel-modules-include ->
--kernel-modules
bac76904c3 build(deps): bump github/codeql-action from 3.28.13 to
3.28.16
44161624a2 Supress ssh unit generation if sshd is not present
b8758dac28 Partially revert 640000a861e9cd9a3807e4158e110a098c74d078
6f11937dc6 Don't use default value if optional settings are set to
none
640000a861 Use a default tools tree by default if mkosi.tools.conf
exists
63d91cc285 mkosi: Override misconfigured gitconfig HTTP/HTTPS proxy
with ProxyUrl
a859b5eb13 Make sure we create the default workspace directory as well

(cherry picked from commit 3366807bf2dd4f9837b596acac7aa5d48b541989)

4 months agomkosi: Run clangd within the tools tree instead of the build container
Daan De Meyer [Wed, 23 Apr 2025 15:31:20 +0000 (17:31 +0200)] 
mkosi: Run clangd within the tools tree instead of the build container

Running within the build sandbox has a number of disadvantages:
- We have a separate clangd cache for each distribution/release combo
- It requires to build the full image before clangd can be used
- It breaks every time the image becomes out of date and requires a
  rebuild
- We can't look at system headers as we don't have the knowledge to map
  them from inside the build sandbox to the corresponding path on the host

Instead, let's have mkosi.clangd run clangd within the tools tree. We
already require building systemd for both the host and the target anyway,
and all the dependencies to build systemd are installed in the tools tree
already for that, as well as clangd since it's installed together with the
other clang tooling we install in the tools tree. Unlike the previous approach,
this approach only requires the mkosi tools tree to be built upfront, which has
a much higher chance of not invalidating its cache. We can also trivially map
system header lookups from within the sandbox to the path within mkosi.tools
on the host so that starts working as well.

(cherry picked from commit bde994efcc45d4e612a15fbd61de42b3149dea20)

4 months agoci: Use mkosi in linter workflow
Daan De Meyer [Wed, 23 Apr 2025 13:17:33 +0000 (15:17 +0200)] 
ci: Use mkosi in linter workflow

Let's reuse the mkosi tools tree to get all the tools we need instead
of pulling them from pypi.

(cherry picked from commit 9e3d048bd0ce74b6285b47c8328de60d0ae63827)

4 months agomkosi: Add clang tools and iwyu to tools tree
Daan De Meyer [Fri, 18 Apr 2025 14:03:09 +0000 (16:03 +0200)] 
mkosi: Add clang tools and iwyu to tools tree

(cherry picked from commit 46833d6c8fbd9ae4379043e54edb1009b9829e0e)

4 months agomkosi: Replace base-devel with base in arch tools packages
Daan De Meyer [Fri, 18 Apr 2025 13:59:41 +0000 (15:59 +0200)] 
mkosi: Replace base-devel with base in arch tools packages

base-devel pulls in a bit too much, especially for NO_BUILD builds
so let's use base instead.

(cherry picked from commit 8ffacf8efa97a8c375dda46dc6d9c4a1940b6fa2)

4 months agomkosi: update mkosi commit reference to dbb4020beee2cdf250f93a425794f1cf8b0fe693
Daan De Meyer [Thu, 17 Apr 2025 14:02:47 +0000 (16:02 +0200)] 
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

(cherry picked from commit d9826d303bda2cb90437ad3a003d12a298805c58)

4 months agoRevert "mkosi: temporarily disable panic_on_warn"
Luca Boccassi [Fri, 4 Apr 2025 12:48:31 +0000 (13:48 +0100)] 
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 930d65ccca8193a8cb635099c55852b677f5d58a.

(cherry picked from commit 10ed8cda58f8b4c5ceea305ecf41f3f8103458ea)

4 months agomkosi: Rename mkosi.prepare scripts for systemd deps to systemd.prepare
Daan De Meyer [Thu, 17 Apr 2025 10:40:17 +0000 (12:40 +0200)] 
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.

(cherry picked from commit e8881f09c5a48408b545140c3ed822cec0365f86)

4 months agomkosi: Reuse main image prepare scripts in subimages
Daan De Meyer [Wed, 16 Apr 2025 12:04:33 +0000 (14:04 +0200)] 
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.

(cherry picked from commit 52a82bcfc9ea627c12ae32f3065b1582dfbf864b)

4 months agomkosi: Make sure coreutils is installed in initrd/exitrd
Daan De Meyer [Wed, 16 Apr 2025 12:20:41 +0000 (14:20 +0200)] 
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.

(cherry picked from commit 0ac6fc2917704e1bddedde95cf1e899811e5f581)

4 months agodocs: fix mkosi section for Environment= setting
Yu Watanabe [Tue, 15 Apr 2025 23:30:25 +0000 (08:30 +0900)] 
docs: fix mkosi section for Environment= setting

(cherry picked from commit f477751b10178d2a5b8c6a186b03fcc04479cbd9)

4 months agomkosi: enable autologin also with --console=gui
Luca Boccassi [Thu, 10 Apr 2025 22:30:50 +0000 (23:30 +0100)] 
mkosi: enable autologin also with --console=gui

(cherry picked from commit 988fae80245ca8891ebde168e3fdd9d968705fa0)

4 months agomkosi: Move TEST-24-CRYPTSETUP files to mkosi/ directory
Daan De Meyer [Wed, 9 Apr 2025 13:31:21 +0000 (15:31 +0200)] 
mkosi: Move TEST-24-CRYPTSETUP files to mkosi/ directory

If the integration tests have been installed in the systemd-tests
package, the path to these in mkosi.postinst.chroot will be wrong.
Let's fix the issue by moving these files into the mkosi/ directory
as they're only used by mkosi regardless so they make more sense to
be there anyway.

(cherry picked from commit e2b01571d01dd120584f7be93e2cfdd7f87296d3)

4 months agomkosi: update mkosi commit reference to 7e4ec15aee6b98300b2ee14265bc647a716a9f8a
Daan De Meyer [Wed, 9 Apr 2025 14:25:49 +0000 (16:25 +0200)] 
mkosi: update mkosi commit reference to 7e4ec15aee6b98300b2ee14265bc647a716a9f8a

7e4ec15aee Generate key-cert pair in config directory (fixes #3655)
5793e64958 Don't use gen_kernel_images() in run_depmod()
bc497f1d17 Fix typing due to recent changes in typeshed
e6a603a21a Add "plymouth" initrd profile

(cherry picked from commit c7bb07fff5cf4356e4b633cf93a460d1beb92b6e)

4 months agomkosi: Set time-epoch= to fixed value
Daan De Meyer [Wed, 9 Apr 2025 14:12:30 +0000 (16:12 +0200)] 
mkosi: Set time-epoch= to fixed value

Turns out makepkg sets $SOURCE_DATE_EPOCH= to the current time for
every build if not set explicitly which causes full rebuilds if we
don't set time-epoch explicitly ourselves, so let's do that everywhere
to avoid unnecessary rebuilds.

(cherry picked from commit aba3ef6616d8c91a0b0ef1432d52d814a162fb13)

4 months agomkosi: drop os-release symlink for minimal-base image
Luca Boccassi [Tue, 8 Apr 2025 19:32:32 +0000 (20:32 +0100)] 
mkosi: drop os-release symlink for minimal-base image

[  385s] ERROR: link target doesn't exist (neither in build root nor in installed system):
[  385s]   /usr/lib/systemd/tests/mkosi/mkosi.images/minimal-base/mkosi.extra/etc/os-release -> ../usr/lib/os-release

It shouldn't be even needed, everything should look in /usr/lib/os-release too

Follow-up for a0ce5e642ff4fcfcd7da25a585bfbd83b5737235

(cherry picked from commit 5e5f792193c1bda2684436a46dca45ed487d4f49)

4 months agomkosi: Set mitigations=off
Daan De Meyer [Tue, 8 Apr 2025 16:56:39 +0000 (18:56 +0200)] 
mkosi: Set mitigations=off

Might as well disable mitigations for these VMs. Who knows, maybe it'll
speed something up.

(cherry picked from commit 36645ec255b1508a76e3d07efb129616e89ca3ac)

4 months agomkosi: Make MinimumVersion= a git commit
Daan De Meyer [Tue, 8 Apr 2025 11:02:54 +0000 (13:02 +0200)] 
mkosi: Make MinimumVersion= a git commit

With the latest mkosi it's possible for MinimumVersion= to be a git
commit so let's start making use of that. This will make mkosi fail
if it's executed within the systemd repository and the checked out
commit is too old.

Putting the mkosi commit sha in mkosi/mkosi.conf also allows retrieving
it without having the full source tree available.

We also make a bunch of improvements to the fetch-mkosi.py script.

(cherry picked from commit 278d5bfd7e04d1eacd2996573729193b4396b6c0)

4 months agomkosi: Update to latest
Daan De Meyer [Mon, 7 Apr 2025 08:22:57 +0000 (10:22 +0200)] 
mkosi: Update to latest

(cherry picked from commit a94520dc78c34b5b5f86c2b13f6930d749503e3c)

5 months agomeson: bump version to 257.6 v257.6
Zbigniew Jędrzejewski-Szmek [Thu, 29 May 2025 16:30:31 +0000 (18:30 +0200)] 
meson: bump version to 257.6

5 months agoDefine helper to call PR_SET_DUMPABLE
Zbigniew Jędrzejewski-Szmek [Wed, 28 May 2025 16:31:13 +0000 (18:31 +0200)] 
Define helper to call PR_SET_DUMPABLE

(cherry picked from commit 9ce8e3e449def92c75ada41b7d10c5bc3946be77)

5 months agocoredump: introduce an enum to wrap dumpable constants
Zbigniew Jędrzejewski-Szmek [Tue, 27 May 2025 18:32:30 +0000 (20:32 +0200)] 
coredump: introduce an enum to wrap dumpable constants

Two constants are described in the man page, but are not defined by a header.
The third constant is described in the kernel docs. Use explicit values to
show that those are values are defined externally.

(cherry picked from commit 76e0ab49c47965877c19772a2b3bf55f6417ca39)

5 months agocoredump: when %F/pidfd is used, again allow forwarding to containers
Zbigniew Jędrzejewski-Szmek [Tue, 27 May 2025 08:44:32 +0000 (10:44 +0200)] 
coredump: when %F/pidfd is used, again allow forwarding to containers

(cherry picked from commit e6a8687b939ab21854f12f59a3cce703e32768cf)

5 months agocoredump: add support for new %F PIDFD specifier
Luca Boccassi [Sun, 13 Apr 2025 21:10:36 +0000 (22:10 +0100)] 
coredump: add support for new %F PIDFD specifier

A new core_pattern specifier was added, %F, to provide a PIDFD
to the usermode helper process referring to the crashed process.
This removes all possible race conditions, ensuring only the
crashed process gets inspected by systemd-coredump.

(cherry picked from commit 868d95577ec9f862580ad365726515459be582fc)

5 months agocoredump: get rid of a bogus assertion
Zbigniew Jędrzejewski-Szmek [Mon, 26 May 2025 13:24:04 +0000 (15:24 +0200)] 
coredump: get rid of a bogus assertion

The check looks plausible, but when I started checking whether it needs
to be lowered for the recent changes, I realized that it doesn't make
much sense.

context_parse_iovw() is called from a few places, e.g.:
- process_socket(), where the other side controls the contents of the
  message. We already do other checks on the correctness of the message
  and this assert is not needed.
- gather_pid_metadata_from_argv(), which is called after
  inserting MESSAGE_ID= and PRIORITY= into the array, so there is no
  direct relation between _META_ARGV_MAX and the number of args in the
  iovw.
- gather_pid_metadata_from_procfs(), where we insert a bazillion fields,
  but without any relation to _META_ARGV_MAX.

Since we already separately check if the required stuff was set, drop this
misleading check.

(cherry picked from commit 13902e025321242b1d95c6d8b4e482b37f58cdef)

5 months agocoredump: also stop forwarding non-dumpable processes
Zbigniew Jędrzejewski-Szmek [Mon, 5 May 2025 13:48:40 +0000 (15:48 +0200)] 
coredump: also stop forwarding non-dumpable processes

See the comment in the patch for details.

Suggested-by: Qualys Security Advisory <qsa@qualys.com>
(cherry-picked from 8fc7b2a211eb13ef1a94250b28e1c79cab8bdcb9)

5 months agocoredump: use %d in kernel core pattern
Zbigniew Jędrzejewski-Szmek [Tue, 29 Apr 2025 12:47:59 +0000 (14:47 +0200)] 
coredump: use %d in kernel core pattern

The kernel provides %d which is documented as
"dump mode—same as value returned by prctl(2) PR_GET_DUMPABLE".

We already query /proc/pid/auxv for this information, but unfortunately this
check is subject to a race, because the crashed process may be replaced by an
attacker before we read this data, for example replacing a SUID process that
was killed by a signal with another process that is not SUID, tricking us into
making the coredump of the original process readable by the attacker.

With this patch, we effectively add one more check to the list of conditions
that need be satisfied if we are to make the coredump accessible to the user.

Reportedy-by: Qualys Security Advisory <qsa@qualys.com>
(cherry-picked from 0c49e0049b7665bb7769a13ef346fef92e1ad4d6)

5 months agocoredump: get rid of _META_MANDATORY_MAX
Zbigniew Jędrzejewski-Szmek [Mon, 26 May 2025 10:04:44 +0000 (12:04 +0200)] 
coredump: get rid of _META_MANDATORY_MAX

No functional change. This change is done in preparation for future changes.
Currently, the list of fields which are received on the command line is a
strict subset of the fields which are always expected to be received on a
socket. But when we add new kernel args in the future, we'll have two
non-overlapping sets and this approach will not work. Get rid of the variable
and enumerate the required fields. This set will never change, so this is
actually more maintainable.

The message with the hint where to add new fields is switched with
_META_ARGV_MAX. The new order is more correct.

(cherry-picked from 49f1f2d4a7612bbed5211a73d11d6a94fbe3bb69)

5 months agotest: fix TEST-84-STORAGETM with nvme-cli < 2.7
Luca Boccassi [Wed, 28 May 2025 22:48:27 +0000 (23:48 +0100)] 
test: fix TEST-84-STORAGETM with nvme-cli < 2.7

The -vv parameter was added in version 2.7, check before using it

Follow-up for ebc0514a6507d51e536b269e30a036a7992beeb7

(cherry picked from commit 60491ceb12aac9f2b9423490158bd9291d735b36)

5 months agocore/manager: do not pop gc_unit_queue before unit_gc_sweep()
Mike Yuan [Sat, 17 May 2025 14:59:32 +0000 (16:59 +0200)] 
core/manager: do not pop gc_unit_queue before unit_gc_sweep()

Follow-up for 52e3671bf7e6321c58c6d3a6c8ad8e167259a569

unit_gc_sweep() might try to add the unit to gc queue again.
While that becomes no-op as Unit.in_gc_queue is not cleared
yet, it induces minor inconsistency of states.

(cherry picked from commit 741a184a31127305fb4363833ca9d97a1057fc68)

5 months agotest: fix test_qdisc_tbf regex with iproute2 v6.15
Luca Boccassi [Tue, 27 May 2025 13:56:32 +0000 (14:56 +0100)] 
test: fix test_qdisc_tbf regex with iproute2 v6.15

iproute2 v6.15 fixed some rounding errors in the reported stats:

https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=d947f365602b30657d1b797e7464000d0ab88d5a

so the current regex doesn't work anymore. Fix it to check for both
old and new values.

systemd-networkd-tests.py[523]: FAIL: test_qdisc_tbf (__main__.NetworkdTCTests.test_qdisc_tbf)
systemd-networkd-tests.py[523]: ----------------------------------------------------------------------
systemd-networkd-tests.py[523]: Traceback (most recent call last):
systemd-networkd-tests.py[523]:   File "/usr/lib/systemd/tests/testdata/test-network/systemd-networkd-tests.py", line 5402, in test_qdisc_tbf
systemd-networkd-tests.py[523]:     self.assertRegex(output, 'rate 1Gbit burst 5000b peakrate 100Gbit minburst 987500b lat 70(.0)?ms')
systemd-networkd-tests.py[523]:     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
systemd-networkd-tests.py[523]: AssertionError: Regex didn't match: 'rate 1Gbit burst 5000b peakrate 100Gbit minburst 987500b lat 70(.0)?ms' not found in 'qdisc tbf 35: root refcnt 2 rate 1Gbit burst 5000b peakrate 100Gbit minburst 999200b lat 70ms \nqdisc pfifo 37: parent 35: limit 100000p'

(cherry picked from commit f9a85b74903f5588d08f54ea7d9b53edc639b824)

5 months agohomed: generate proper error if we cannot create mountpoint for homedir
Lennart Poettering [Fri, 23 May 2025 10:15:45 +0000 (12:15 +0200)] 
homed: generate proper error if we cannot create mountpoint for homedir

Let's make this easier to debug. (When this failed for me due to disk
full it took me a bit to figure out what was going on.)

(cherry picked from commit 5b759bf5fd3a915a5b4756590caff7faf43a9693)

5 months agodocs: add man pages for sd_device_enumerator_[new,ref,unref,unrefp] (#37586)
Shubhendra Kushwaha [Sat, 24 May 2025 20:01:27 +0000 (01:31 +0530)] 
docs: add man pages for sd_device_enumerator_[new,ref,unref,unrefp] (#37586)

For #20929.

(cherry picked from commit ac8ed83947237956b867de9cfbf5fcd26de8ea96)

5 months agoboot: do not stop parsing profiles if .cmdline is missing
Luca Boccassi [Thu, 22 May 2025 21:38:11 +0000 (22:38 +0100)] 
boot: do not stop parsing profiles if .cmdline is missing

When profiles were added with a new interation this was left as
a return statement instead of a continue

Follow-up for 382e4da4a5b25ad0c225b4a8092ed24a44c84e18

(cherry picked from commit 7c7aeb9b8d2ba28e8915a6103237da8f39410794)

5 months agocoredump: wrap long lines, fix grammar in comments
Zbigniew Jędrzejewski-Szmek [Wed, 21 May 2025 20:33:50 +0000 (22:33 +0200)] 
coredump: wrap long lines, fix grammar in comments

(cherry picked from commit c673f1f67aa44f99be5fdcb0dc22d7599776e5ed)

5 months agocoredump: restore compatibility with older patterns
Zbigniew Jędrzejewski-Szmek [Tue, 29 Apr 2025 12:47:59 +0000 (14:47 +0200)] 
coredump: restore compatibility with older patterns

This was broken in f45b8015513d38ee5f7cc361db9c5b88c9aae704. Unfortunately
the review does not talk about backward compatibility at all. There are
two places where it matters:
- During upgrades, the replacement of kernel.core_pattern is asynchronous.
  For example, during rpm upgrades, it would be updated a post-transaction
  file trigger. In other scenarios, the update might only happen after
  reboot. We have a potentially long window where the old pattern is in
  place. We need to capture coredumps during upgrades too.
- With --backtrace. The interface of --backtrace, in hindsight, is not
  great. But there are users of --backtrace which were written to use
  a specific set of arguments, and we can't just break compatiblity.
  One example is systemd-coredump-python, but there are also reports of
  users using --backtrace to generate coredump logs.

Thus, we require the original set of args, and will use the additional args if
found.

A test is added to verify that --backtrace works with and without the optional
args.

(cherry picked from commit ded0aac389e647d35bce7ec4a48e718d77c0435b)

5 months agomachined: call pidref_verify() in some cases this was missing
Lennart Poettering [Wed, 21 May 2025 07:20:44 +0000 (09:20 +0200)] 
machined: call pidref_verify() in some cases this was missing

We need to protect us from recycled PIDs here like everywhere else: once
we read data from /proc/$PID/ we need to validate that $PID still points
to the original pidfd.

(cherry picked from commit 3c70cbae0ff15d3dc5877173015187db81e004be)

5 months agojournald: clarify doc for usage-related values cap (#37528)
TheHillBright [Wed, 21 May 2025 10:38:12 +0000 (18:38 +0800)] 
journald: clarify doc for usage-related values cap (#37528)

The old description makes users wrongly assume that the cap of 4G
applied, even when the user specifies a value that will result in higher
than 4G. This commit avoids this misunderstanding.

(cherry picked from commit 33084145315029775748a89da836465783d65bb3)

5 months agoshell-completion: improve completion of systemd-tmpfiles
Eisuke Kawashima [Thu, 15 May 2025 22:46:46 +0000 (07:46 +0900)] 
shell-completion: improve completion of systemd-tmpfiles

(cherry picked from commit b9df3d6447955e59f4e83e2b10ca97d4a484a6a5)

5 months agonetwork: do not drop duplicated entries in loop
Yu Watanabe [Wed, 14 May 2025 21:36:55 +0000 (06:36 +0900)] 
network: do not drop duplicated entries in loop

Fixes #37456.

(cherry picked from commit 6a4fe38f7fed6b1a94caad49c5aa3dd102658df4)

5 months agoman: correct version information when $REMOTE_ADDR/$REMOTE_PORT where added
Lennart Poettering [Thu, 15 May 2025 07:44:02 +0000 (09:44 +0200)] 
man: correct version information when $REMOTE_ADDR/$REMOTE_PORT where added

This was in commit 3b1c524154c876aecebc98787975cc2943100210, i.e. in the
v220 cycle.

(cherry picked from commit 3bdcd994cd707bcf34664edaa21afff6025d15d2)

5 months agoman: don't claim REMOTE_PORT= was initialized to the protocol for AF_RAW sockets
Lennart Poettering [Thu, 15 May 2025 07:06:52 +0000 (09:06 +0200)] 
man: don't claim REMOTE_PORT= was initialized to the protocol for AF_RAW sockets

This claim has no basis in reality, not even in the original commit
where the sentence was added this was true, see
3b1c524154c876aecebc98787975cc2943100210.

Hence removing.

(cherry picked from commit 99d52ab51fc02942f951891fbafcaf7ca5ad1dd0)

5 months agoman/systemd-run: --wait shows more than CPU accounting data
Mike Yuan [Wed, 14 May 2025 16:47:16 +0000 (18:47 +0200)] 
man/systemd-run: --wait shows more than CPU accounting data

(cherry picked from commit 72594d6771a68fbb7d5ebe1d004f4d942a1fac97)

5 months agoTEST-73-LOCALE: skip lv keymap and friends
Yu Watanabe [Fri, 9 May 2025 07:33:12 +0000 (16:33 +0900)] 
TEST-73-LOCALE: skip lv keymap and friends

The following failure should be in libxkbcommon and/or sanitizer.
There is nothing we can do here. Let's skip it.

```
TEST-73-LOCALE.sh[3733]: + assert_rc 0 localectl set-keymap lv
TEST-73-LOCALE.sh[6699]: + set +ex
TEST-73-LOCALE.sh[6700]: Failed to set keymap: Remote peer disconnected
TEST-73-LOCALE.sh[6703]: FAIL: expected: '0' actual: '1'
TEST-73-LOCALE.sh[157]: + rm -f /etc/dbus-1/system.d/systemd-localed-read-only.conf
[FAILED] Failed to start TEST-73-LOCALE.service - TEST-73-LOCALE.
```
```
==3719==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7fa51f161000 at pc 0x7fa521250be4 bp 0x7ffe49130a80 sp 0x7ffe49130240
READ of size 19126 at 0x7fa51f161000 thread T0
    #0 0x7fa521250be3 in strndup (/usr/lib/clang/20/lib/x86_64-redhat-linux-gnu/libclang_rt.asan.so+0x50be3) (BuildId: aa6231e817f72469c44a6c6cee9f0694a87db7fb)
    #1 0x7fa51f128325  (/lib64/libxkbcommon.so.0+0x1c325) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5)
    #2 0x7fa51f121952  (/lib64/libxkbcommon.so.0+0x15952) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5)
    #3 0x7fa51f123d3a  (/lib64/libxkbcommon.so.0+0x17d3a) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5)
    #4 0x7fa51f117c86  (/lib64/libxkbcommon.so.0+0xbc86) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5)
    #5 0x7fa51f12548f  (/lib64/libxkbcommon.so.0+0x1948f) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5)
    #6 0x7fa51f125c9e  (/lib64/libxkbcommon.so.0+0x19c9e) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5)
    #7 0x7fa51f126a59  (/lib64/libxkbcommon.so.0+0x1aa59) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5)
    #8 0x7fa51f12cec6  (/lib64/libxkbcommon.so.0+0x20ec6) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5)
    #9 0x7fa51f12e3c2  (/lib64/libxkbcommon.so.0+0x223c2) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5)
    #10 0x7fa51f12a4e5 in xkb_keymap_new_from_names (/lib64/libxkbcommon.so.0+0x1e4e5) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5)
    #11 0x5574dd63f864 in verify_xkb_rmlvo /usr/src/debug/systemd/src/locale/xkbcommon-util.c:69:14
(snip)
```

(cherry picked from commit 18609909d93a4d17e962b47e51fffe38845e99f5)

5 months agoTEST-73-LOCALE: drop unnecessary workaround
Yu Watanabe [Fri, 9 May 2025 08:09:19 +0000 (17:09 +0900)] 
TEST-73-LOCALE: drop unnecessary workaround

It should be fixed by 157d5b5c30b472c8c70a629a0c609ad240151746.

(cherry picked from commit 7ded7cfb7f260a6bff62b19b43b3224cde5b3284)

5 months agointegration-tests: adjust priorities
Yu Watanabe [Fri, 9 May 2025 07:56:48 +0000 (16:56 +0900)] 
integration-tests: adjust priorities

When running with sanitizers:
```
26/95 systemd:integration-tests / TEST-21-DFUZZER                          OK 1517.75s
40/95 systemd:integration-tests / TEST-85-NETWORK-NetworkdDHCPClientTests  OK  779.18s
42/95 systemd:integration-tests / TEST-04-JOURNAL                          OK  716.17s
```
and without sanitizers:
```
44/95 systemd:integration-tests / TEST-85-NETWORK-NetworkdDHCPClientTests  OK  730.33s
29/95 systemd:integration-tests / TEST-64-UDEV-STORAGE-simultaneous_events OK  701.49s
40/95 systemd:integration-tests / TEST-04-JOURNAL                          OK  348.05s
```

So, let's set higher priorities only on these tests.

(cherry picked from commit 71078275e87ba5a33863ba90a534162f41be692c)

5 months agoTEST-21-DFUZZER: skip test when no sanitizer is enabled
Yu Watanabe [Fri, 9 May 2025 08:45:26 +0000 (17:45 +0900)] 
TEST-21-DFUZZER: skip test when no sanitizer is enabled

(cherry picked from commit 59dd6505012317eea4bb2b9c353dc6d7a1f65064)

5 months agoRevert "core/socket: do not enter failed state when we cannot start service due to...
Zbigniew Jędrzejewski-Szmek [Tue, 20 May 2025 11:02:45 +0000 (13:02 +0200)] 
Revert "core/socket: do not enter failed state when we cannot start service due to conflicting transaction being queued"

This reverts commit 4ebbe41bc09922c47e341549fea9b8462a026dc0.

Post-merge review found problems:
https://github.com/systemd/systemd/pull/37222#pullrequestreview-2848299600

5 months agoRevert "units: stop systemd-udevd before soft-reboot"
Zbigniew Jędrzejewski-Szmek [Tue, 20 May 2025 11:02:37 +0000 (13:02 +0200)] 
Revert "units: stop systemd-udevd before soft-reboot"

This reverts commit af18de3f7f65a22d0dacbb6d35345f5199a56172.

Post-merge review found problems:
https://github.com/systemd/systemd/pull/37222#pullrequestreview-2848299600

5 months agoRevert "TEST-82-SOFTREBOOT: add test case for uevents generated during soft-reboot"
Zbigniew Jędrzejewski-Szmek [Tue, 20 May 2025 11:01:51 +0000 (13:01 +0200)] 
Revert "TEST-82-SOFTREBOOT: add test case for uevents generated during soft-reboot"

This reverts commit bfddf144a878a1632e6aee13306cb2cc95500874.

Post-merge review found problems:
https://github.com/systemd/systemd/pull/37222#pullrequestreview-2848299600

5 months agohwdb: update to main@{2025-05-15}
Zbigniew Jędrzejewski-Szmek [Thu, 15 May 2025 11:26:05 +0000 (13:26 +0200)] 
hwdb: update to main@{2025-05-15}

git restore -s origin/main hwdb.d/ test/hwdb.d

5 months agosd-device: fix sysname check in sd_device_new_from_subsystem_sysname()
Yu Watanabe [Tue, 22 Apr 2025 15:13:51 +0000 (00:13 +0900)] 
sd-device: fix sysname check in sd_device_new_from_subsystem_sysname()

For example, consider the following device:
- syspath: /sys/bus/mdio_bus/drivers/Qualcomm Atheros AR8031!AR8033
- subsystem: "drivers"
- driver subsystem: "mdio_bus"
- sysname: "Qualcomm Atheros AR8031/AR8033"  <-- '!' is replaced with '/'

When sd_device_new_from_subsystem_sysname() is called to get the device,
the arguments to sd_device_new_from_subsystem_sysname() should be
- subsystem: "drivers"
- sysname (concatenated with driver subsystem): "mdio_bus:Qualcomm Atheros AR8031/AR8033"

In that case, we need to pass to device_new_from_path_join() the following:
- subsystem: "drivers"
- driver subsystem: "mdio_bus"
- sysname: "Qualcomm Atheros AR8031/AR8033"
- a: "/sys/bus"
- b: "drivers"
- c: "mdio_bus"
- d: "Qualcomm Atheros AR8031!AR8033"
Here, the important point is that the `sysname` argument and the
last argument `d` are differnt: the `sysname` argument needs to match
the sysname obtained by `sd_device_get_sysname()`, but `d` must be
the last path component of the syspath.

Previously, we passed a wrong sysname to device_new_from_path_join().
This fixes the issue.

Fixes a bug in cd7c71154cd62d3f50c07ce387edd9c20aebd7bc (v257).

(cherry picked from commit 1393c5a2a42d6ff16afcdc3ac39f007921b9cb57)

5 months agopager: also check for $SUDO_UID
Zbigniew Jędrzejewski-Szmek [Tue, 6 May 2025 12:29:02 +0000 (14:29 +0200)] 
pager: also check for $SUDO_UID

This returns to the original approach proposed in
https://github.com/systemd/systemd/pull/17270. After review, the approach was
changed to use sd_pid_get_owner_uid() instead. Back then, when running in a
typical graphical session, sd_pid_get_owner_uid() would usually return the user
UID, and when running under sudo, geteuid() would return 0, so we'd trigger the
secure path.

sudo may allocate a new session if is invoked outside of a session (depending
on the PAM config). Since nowadays desktop environments usually start the user
shell through user units, the typical shell in a terminal emulator is not part
of a session, and when sudo is invoked, a new session is allocated, and
sd_pid_get_owner_uid() returns 0 too. Technically, the code still works as
documented in the man page, but in the common case, it doesn't do the expected
thing.

$ build/test-sd-login |& rg 'get_(owner_uid|cgroup|session)'
sd_pid_get_session(0) → No data available
sd_pid_get_owner_uid(0) → 1000
sd_pid_get_cgroup(0) → /user.slice/user-1000.slice/user@1000.service/app.slice/app-ghostty-transient-5088.scope/surfaces/556FAF50BA40.scope

$ sudo build/test-sd-login |& rg 'get_(owner_uid|cgroup|session)'
sd_pid_get_session(0) → c289
sd_pid_get_owner_uid(0) → 0
sd_pid_get_cgroup(0) → /user.slice/user-0.slice/session-c289.scope

I think it's worth checking for sudo because it is a common case used by users.
There obviously are other mechanims, so the man page is extended to say that
only some common mechanisms are supported, and to (again) recommend setting
SYSTEMD_LESSSECURE explicitly. The other option would be to set "secure mode"
by default. But this would create an inconvenience for users doing the right
thing, running systemctl and other tools directly, because then they can't run
privileged commands from the pager, e.g. to save the output to a file. (Or the
user would need to explicitly set SYSTEMD_LESSSECURE. One option would be to
set it always in the environment and to rely on sudo and other tools stripping
it from the environment before running privileged code. But that is also fairly
fragile and it obviously relies on the user doing a complicated setup to
support a fairly common use case. I think this decreases usability of the
system quite a bit. I don't think we should build solutions that work in
priniciple, but are painfully inconvenient in common cases.)

Fixes https://yeswehack.com/vulnerability-center/reports/346802.

Also see https://github.com/polkit-org/polkit/pull/562, which adds support for
$SUDO_UID/$SUDO_GID to pkexec.

(cherry picked from commit cd93478af8b9dc69478d5667f113b67d175090fa)

5 months agoman: rework the description of $SYSTEMD_PAGER and $PAGER
Zbigniew Jędrzejewski-Szmek [Tue, 6 May 2025 09:37:26 +0000 (11:37 +0200)] 
man: rework the description of $SYSTEMD_PAGER and $PAGER

$PAGER wasn't documented, but actually we treat it same as $SYSTEMD_PAGER,
except for lower priority. And the two variables can be used to disable the
pager, even if $SYSTEMD_PAGERSECURE is not set.

Behaviour is (obviously) not changed by this patch, it intentionally just
updates the docs to match the code.

(cherry picked from commit b6b78170e17727ca0ec320d5703b36d0597d0cc9)

5 months agoman: reword the description of "secure pager" handling
Zbigniew Jędrzejewski-Szmek [Tue, 6 May 2025 09:14:10 +0000 (11:14 +0200)] 
man: reword the description of "secure pager" handling

The existing description was not *wrong*, but it was a bit muddled. Let's
reorder the text to give a short intro and then describe what the options
actually do and the clear "true" and "false" cases first, and then describe
autodetection.

Related to https://yeswehack.com/vulnerability-center/reports/346802.

(cherry picked from commit 718dbdb2ca4458cf91711cd9a7de3a972e46658e)

5 months agosystemct: show all in output of systemctl clean --what=help
Jörg Behrmann [Tue, 13 May 2025 15:21:02 +0000 (17:21 +0200)] 
systemct: show all in output of systemctl clean --what=help

(cherry picked from commit 68b6289a9e4a8a9cc3567f066f921388e99da9d9)

5 months agoman: note for systemctl clean --what that commas separate values
Jörg Behrmann [Tue, 13 May 2025 15:20:37 +0000 (17:20 +0200)] 
man: note for systemctl clean --what that commas separate values

(cherry picked from commit 652e4dd7434d1603866c059aa8a67eaf8b73346f)

5 months agoman, systemctl: document --what=help
Jörg Behrmann [Tue, 13 May 2025 15:19:39 +0000 (17:19 +0200)] 
man, systemctl: document --what=help

(cherry picked from commit 028de7292d6923c4b77c5d03d47097aeda24fc1d)

5 months agoman: add missing fdstore in systemctl clean --what documentation
Jörg Behrmann [Tue, 13 May 2025 15:19:02 +0000 (17:19 +0200)] 
man: add missing fdstore in systemctl clean --what documentation

(cherry picked from commit 5689365a909362d82ad4959d3fec9ebacfd5ec96)

5 months agoshell-completion: fix completion of `systemctl --user unset-environment` (#37409)
Eisuke Kawashima [Tue, 13 May 2025 00:04:52 +0000 (09:04 +0900)] 
shell-completion: fix completion of `systemctl --user unset-environment` (#37409)

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
(cherry picked from commit 6d07d23b022d48898d9a2e7181ab6493d3d61c43)

5 months agolog: fix declaration of log_dispatch_internal()
Antonio Alvarez Feijoo [Mon, 12 May 2025 13:26:32 +0000 (15:26 +0200)] 
log: fix declaration of log_dispatch_internal()

(cherry picked from commit 0425fc5eb72d8a66e3c2634f0d61e50ef2c53e41)

5 months agoflush_ports: flush POSIX message queues properly
Todd C. Miller [Tue, 6 May 2025 22:39:14 +0000 (16:39 -0600)] 
flush_ports: flush POSIX message queues properly

On Linux, read() on a message queue descriptor returns the message
queue statistics, not the actual message queue data.  We need to use
mq_receive() to drain the queues instead.

Fixes a problem where a POSIX message queue socket unit with messages
in the queue at shutdown time could result in a hang on reboot/shutdown.

(cherry picked from commit ffb6adb76367d5ab7d43937ccaac5947717b5b78)

5 months agocore/socket: trivial coding style cleanups
Mike Yuan [Mon, 16 Dec 2024 00:29:35 +0000 (01:29 +0100)] 
core/socket: trivial coding style cleanups

(cherry picked from commit 2fbdfe0b0d355d0bd6ea8b93a000f92bc7f5fe5f)

5 months agoman/systemd.exec: reword description of RestrictAddressFamilies=
Zbigniew Jędrzejewski-Szmek [Tue, 6 May 2025 18:59:59 +0000 (20:59 +0200)] 
man/systemd.exec: reword description of RestrictAddressFamilies=

The text is reordered and broken into more paragraphs.
A recommendation to combine RestrictAddressFamilies= with
SystemCallFilter=@service is added.

(cherry picked from commit 2dc4e87849e2ae2ea93e9ccf6365c44ad1602ac6)

5 months agoman/systemd.exec: reword description of SystemCallFilter=
Zbigniew Jędrzejewski-Szmek [Tue, 6 May 2025 19:04:00 +0000 (21:04 +0200)] 
man/systemd.exec: reword description of SystemCallFilter=

The existing text grew organically as features were added and was
not very organized. Reorder it and break into paragraphs grouped
by topic. The description of the :errno syntax is replaced by a short
reference to the SystemCallErrorNumber= setting. This makes the
text shorter and makes it easier to explain how the two settings combine.

(cherry picked from commit 802d23fcfbcacd3c33f421e0fb1bd372658beeef)

5 months agomeson: Ensure that distribution packages own systemenvgeneratordir
Debarshi Ray [Fri, 2 May 2025 19:08:55 +0000 (21:08 +0200)] 
meson: Ensure that distribution packages own systemenvgeneratordir

Currently, Fedora's systemd RPM doesn't own systemenvgeneratordir
(ie., /usr/lib/systemd/system-environment-generators) [1] because it's
not created when systemd is installed.  In contrast, userenvgeneratordir
(ie., /usr/lib/systemd/user-environment-generators) is created, unless
the environment-d Meson option is explicitly disabled.

While this can be worked around elsewhere, it's better if the upstream
build system created the directories consistently.  It will avoid
repetition, and prevent silly bugs or deviations from creeping in.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=2284085

(cherry picked from commit ab46feb3e28eee0b9be3dece49f5e4c63f21dc37)

5 months agoman/systemctl: add preposition for clarity
Alexander Stepchenko [Mon, 5 May 2025 10:48:30 +0000 (13:48 +0300)] 
man/systemctl: add preposition for clarity

(cherry picked from commit 0cf03a36f287ef898679868a5bc828b17faf797e)

5 months agoman/network: Note .link early boot caveat, and .network .netdev usage.
Tim Small [Fri, 2 May 2025 12:40:00 +0000 (13:40 +0100)] 
man/network: Note .link early boot caveat, and .network .netdev usage.

Document .link .network and .netdev file type distinctions in early
introductory text, and document distro-specific need to sync link files
with early-boot copies, see Debian bug 1005282:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1005282 for an
example.

(cherry picked from commit a50fa2a40f4a91d49503d3588a3dd29ea05e559b)

5 months agovmspawn: don't use vmgenid on aarch64 as it's not supported
Arian van Putten [Thu, 1 May 2025 11:19:24 +0000 (13:19 +0200)] 
vmspawn: don't use vmgenid on aarch64 as it's not supported

fixes:

```
qemu-kvm: -device vmgenid,guid=5f303a47-6fae-4dd7-969c-6c1ea61e816e: 'vmgenid' is not a valid device model name
```

(cherry picked from commit f17247c70181edb1a4b767996021c3589ecace64)

5 months agobusctl: validate argvs on get-property/set-property too
Luca Boccassi [Wed, 30 Apr 2025 14:24:20 +0000 (15:24 +0100)] 
busctl: validate argvs on get-property/set-property too

Otherwise passing invalid data means asserts get hit instead of
handling it gracefully. Other verbs already do the same checks.

busctl get-property org.freedesktop.systemd1 '*' org.freedesktop.systemd1.Manager Version
Assertion 'object_path_is_valid(path)' failed at src/libsystemd/sd-bus/bus-message.c:562, function sd_bus_message_new_method_call(). Aborting.
Aborted (core dumped)

(cherry picked from commit b16e6fd76788e74ce7424404445e822655abd6c9)