]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
5 months agologind: also save pidfdid as part of session state, even if we don't parse it 37555/head
Lennart Poettering [Mon, 19 May 2025 10:14:25 +0000 (12:14 +0200)] 
logind: also save pidfdid as part of session state, even if we don't parse it

5 months agologind: save/restore inhibitor process pidfdid
Lennart Poettering [Mon, 19 May 2025 10:05:45 +0000 (12:05 +0200)] 
logind: save/restore inhibitor process pidfdid

5 months agologind: always enclose list fields (that may contain spaces) in quotes
Lennart Poettering [Mon, 19 May 2025 09:57:56 +0000 (11:57 +0200)] 
logind: always enclose list fields (that may contain spaces) in quotes

5 months agologind: fix escaping of various fields in state files
Lennart Poettering [Mon, 19 May 2025 09:56:28 +0000 (11:56 +0200)] 
logind: fix escaping of various fields in state files

parse_env_file() applies a certain kind of unescaping, and we really
need to match that when writing out arbitrary strings.

(This gets a bit confusing in the inhibit case, since that already
applied one level of escaping on its own...)

5 months agologind: port logind state files to fopen_tmpfile_linkable()
Lennart Poettering [Mon, 19 May 2025 08:15:25 +0000 (10:15 +0200)] 
logind: port logind state files to fopen_tmpfile_linkable()

This replaces use of fopen_temporary() with fopen_tmpfile_linkable() +
flink_tmpfile(). This both shortens the code and means we use O_TMPFILE
for installing these files, which is always good.

No change in behaviour otherwise.

5 months agoenv-file: add helper for printing a properly escaped env var file assignment
Lennart Poettering [Mon, 19 May 2025 09:02:41 +0000 (11:02 +0200)] 
env-file: add helper for printing a properly escaped env var file assignment

5 months agoportable: Fix comment
Daan De Meyer [Wed, 21 May 2025 12:44:24 +0000 (14:44 +0200)] 
portable: Fix comment

5 months agosystemctl: Clean up includes
Daan De Meyer [Wed, 21 May 2025 12:10:20 +0000 (14:10 +0200)] 
systemctl: Clean up includes

Split out of #37344.

5 months agoudev: Clean up includes
Daan De Meyer [Wed, 21 May 2025 12:07:30 +0000 (14:07 +0200)] 
udev: Clean up includes

Split out of #37344.

5 months agosysupdate: Clean up includes
Daan De Meyer [Wed, 21 May 2025 11:56:03 +0000 (13:56 +0200)] 
sysupdate: Clean up includes

Split out of #37344.

5 months agopretty-print: Add missing fileio.h include
Daan De Meyer [Wed, 21 May 2025 12:35:13 +0000 (14:35 +0200)] 
pretty-print: Add missing fileio.h include

LONG_LINE_MAX comes from fileio.h and is used in pretty-print.h so
pretty-print.h should include it.

5 months agonspawn: Clean up includes
Daan De Meyer [Wed, 21 May 2025 11:56:51 +0000 (13:56 +0200)] 
nspawn: Clean up includes

Split out of #37344.

5 months agoresolve: Clean up includes
Daan De Meyer [Wed, 21 May 2025 11:56:22 +0000 (13:56 +0200)] 
resolve: Clean up includes

Split out of #37344.

5 months agohome: Clean up includes
Daan De Meyer [Wed, 21 May 2025 11:49:13 +0000 (13:49 +0200)] 
home: Clean up includes

Split out of #37344.

5 months agoVarious cleanups (#37531)
Yu Watanabe [Wed, 21 May 2025 14:43:19 +0000 (23:43 +0900)] 
Various cleanups (#37531)

5 months agomkosi: update debian commit reference to 4ed8fd38c7b1579da6343c713adf0c33040cfc33
Luca Boccassi [Wed, 21 May 2025 11:16:23 +0000 (12:16 +0100)] 
mkosi: update debian commit reference to 4ed8fd38c7b1579da6343c713adf0c33040cfc33

4ed8fd38c7 Install new files for upstream build

5 months agomeson: Don't define targets for standalone binaries if option is not enabled 37531/head
Daan De Meyer [Wed, 21 May 2025 11:08:50 +0000 (13:08 +0200)] 
meson: Don't define targets for standalone binaries if option is not enabled

These are built from the same sources as the regular binaries, so we
end up with the same sources multiple times in the compilation database
but with different command line arguments, which trips up tooling that
uses the compilation database. Let's not define the standalone targets if
the option is not enabled to avoid this problem.

5 months agotree-wide: Include <libaudit.h> via libaudit-util.h
Daan De Meyer [Wed, 21 May 2025 10:22:40 +0000 (12:22 +0200)] 
tree-wide: Include <libaudit.h> via libaudit-util.h

Let's keep the ifdeffery for the include in one place.

5 months agotests: Move implementation of DEFINE_HEX_PTR() into source file
Daan De Meyer [Wed, 21 May 2025 09:59:16 +0000 (11:59 +0200)] 
tests: Move implementation of DEFINE_HEX_PTR() into source file

Otherwise we have to add a hexdecoct.h include to tests.h which we
want to avoid.

5 months agotest-tables: Pass enum type to test_table() as well
Daan De Meyer [Wed, 21 May 2025 09:34:41 +0000 (11:34 +0200)] 
test-tables: Pass enum type to test_table() as well

clang-include-cleaner has a hard time figuring out unused includes
with all the macro string concatentation we're doing in test_table().
Let's help it out a little by also passing the enum type into test_table().

While technically not needed, this makes the tests a bit more self-descriptive
and not really much more verbose so it feels like a good chance regardless,
even if the primary purpose is to help clang-include-cleaner figure out
used and unused includes.

5 months agostat-util: Use typeof_field() in one more place
Daan De Meyer [Wed, 21 May 2025 11:24:22 +0000 (13:24 +0200)] 
stat-util: Use typeof_field() in one more place

5 months agoClean up more includes (#37527)
Yu Watanabe [Wed, 21 May 2025 10:43:39 +0000 (19:43 +0900)] 
Clean up more includes (#37527)

Split out of #37344

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.

5 months agoBugprone argument comment 6 (#37507)
Yu Watanabe [Wed, 21 May 2025 10:29:58 +0000 (19:29 +0900)] 
Bugprone argument comment 6 (#37507)

Follow up from https://github.com/systemd/systemd/pull/37481

5 months agobpf-socket-bind: rename 'u' to 'unit' 37507/head
Jelle van der Waa [Sat, 17 May 2025 18:08:16 +0000 (20:08 +0200)] 
bpf-socket-bind: rename 'u' to 'unit'

Follow argument comment naming.

5 months agosd-login: rename sd_seat_get_active arguments
Jelle van der Waa [Sat, 17 May 2025 18:00:52 +0000 (20:00 +0200)] 
sd-login: rename sd_seat_get_active arguments

Follow the argument comment naming.

5 months agosd-bus: rename cookie to ret_cookie
Jelle van der Waa [Sat, 17 May 2025 17:59:40 +0000 (19:59 +0200)] 
sd-bus: rename cookie to ret_cookie

Follow the argument comment naming.

5 months agosd-event: rename 's' -> 'ret'
Jelle van der Waa [Sat, 17 May 2025 17:53:12 +0000 (19:53 +0200)] 
sd-event: rename 's' -> 'ret'

5 months agojournal-sync: rename ss to stream
Jelle van der Waa [Sat, 17 May 2025 17:45:53 +0000 (19:45 +0200)] 
journal-sync: rename ss to stream

Follow the argument comment name.

5 months agoefivars: rename ret -> ret_data
Jelle van der Waa [Sat, 17 May 2025 16:08:38 +0000 (18:08 +0200)] 
efivars: rename ret -> ret_data

Follow the used argument comment naming.

5 months agodbus-manager: correct argument comment
Jelle van der Waa [Sat, 17 May 2025 16:08:19 +0000 (18:08 +0200)] 
dbus-manager: correct argument comment

5 months agopretty-print: correct argument comment
Jelle van der Waa [Sat, 17 May 2025 16:07:58 +0000 (18:07 +0200)] 
pretty-print: correct argument comment

5 months agotreewide: fix header file definitions
Jelle van der Waa [Sat, 17 May 2025 16:01:35 +0000 (18:01 +0200)] 
treewide: fix header file definitions

5 months agocore: rename p -> parameters
Jelle van der Waa [Sat, 17 May 2025 13:32:52 +0000 (15:32 +0200)] 
core: rename p -> parameters

5 months agotimesync: Clean up includes 37527/head
Daan De Meyer [Wed, 21 May 2025 07:42:03 +0000 (09:42 +0200)] 
timesync: Clean up includes

Split out of #37344.

5 months agooom: Clean up includes
Daan De Meyer [Wed, 21 May 2025 07:41:29 +0000 (09:41 +0200)] 
oom: Clean up includes

Split out of #37344.

5 months agoshared: Introduce conf-parser-forward.h
Daan De Meyer [Wed, 21 May 2025 07:20:27 +0000 (09:20 +0200)] 
shared: Introduce conf-parser-forward.h

conf-parser.h pulls in a lot of other headers as needed by all the
macros it defines. We can't easily move the implementations of these
macro to conf-parser.c, so let's instead introduce conf-parser-forward.h
with just the stuff in it needed by other header files.

We'll make use of this when cleaning up includes to only include the
minimal parts of conf-parser.h that are required by other headers without
pulling in the kitchen sink.

5 months agofuzz: Clean up includes
Daan De Meyer [Wed, 21 May 2025 07:45:18 +0000 (09:45 +0200)] 
fuzz: Clean up includes

Split out of #37344.

5 months agotest: Clean up includes
Daan De Meyer [Wed, 21 May 2025 07:45:06 +0000 (09:45 +0200)] 
test: Clean up includes

To make sure everything still compiles, we add a preliminary include
of forward.h to tests.h to make sure it is included in every test source
file. We'll clean up the tests.h includes in a later commit.

We also add a <errno.h> include to errno-list.h to keep test-errno-list.c
compiling. It'll be removed again when we clean up includes in src/basic.

Split out of #37344.

5 months agotree-wide: Clean up includes
Daan De Meyer [Wed, 21 May 2025 07:37:24 +0000 (09:37 +0200)] 
tree-wide: Clean up includes

This removes more unused includes from the components already cleaned
up in #37467 and #37457.

Split out of #37344.

5 months agobasic: Include time-util.h in constants.h
Daan De Meyer [Wed, 21 May 2025 07:23:13 +0000 (09:23 +0200)] 
basic: Include time-util.h in constants.h

constants.h defines a bunch of constants that use macros from
time-util.h, so add the needed include. To avoid cyclic dependencies,
we move the HAS_FEATURE_MEMORY_SANITIZER and HAS_FEATURE_ADDRESS_SANITIZER
logic to macro.h and get rid of the constants.h include there.

The rest of this commit is adding missing constants.h includes where
needed due to it being removed from macro.h.

5 months agomacro-fundamental: Introduce typeof_field()
Daan De Meyer [Wed, 21 May 2025 08:47:56 +0000 (10:47 +0200)] 
macro-fundamental: Introduce typeof_field()

5 months agoicmp6-packet: Fix typo
Daan De Meyer [Wed, 21 May 2025 08:32:15 +0000 (10:32 +0200)] 
icmp6-packet: Fix typo

5 months agopcre2-util: Make sure PatternCompileCase enum is named
Daan De Meyer [Wed, 21 May 2025 08:31:21 +0000 (10:31 +0200)] 
pcre2-util: Make sure PatternCompileCase enum is named

5 months agoforward.h: Add forward declaration of BusObjectImplementation
Daan De Meyer [Wed, 21 May 2025 08:11:48 +0000 (10:11 +0200)] 
forward.h: Add forward declaration of BusObjectImplementation

5 months agokernel-install/90-loaderentry.install: print message if quiting (#37522)
Zbigniew Jędrzejewski-Szmek [Wed, 21 May 2025 07:55:27 +0000 (09:55 +0200)] 
kernel-install/90-loaderentry.install: print message if quiting (#37522)

60-ukify.install prints a message like this, and it is quite useful when
trying to figure out what is going on.

5 months agoupdate TODO
Lennart Poettering [Mon, 19 May 2025 08:08:39 +0000 (10:08 +0200)] 
update TODO

5 months agoPrettify bootctl status (#37524)
Lennart Poettering [Wed, 21 May 2025 05:10:07 +0000 (07:10 +0200)] 
Prettify bootctl status (#37524)

5 months agoresolved: add new "DNS Delegate" concepts (#34368)
Lennart Poettering [Tue, 20 May 2025 22:32:07 +0000 (00:32 +0200)] 
resolved: add new "DNS Delegate" concepts (#34368)

Various long standing issues (at least: #5573 #14159 #20485 #21260
#24532 #32022 #18056) have been asking for a way to delegate DNS
resolution of specific domains to very specific DNS servers.

This PR goes a major step towards that goal by adding a new concept "DNS
Delegate" which allows to configure just that. Basically, this adds a
third kind of DNS scope to resolved's logic: besides the per-link and
global DNS scopes there are now also "delegate" scopes, which can be
created by dropping in a new file /etc/systemd/dns-delegate/*.conf. They
carry DNS= and Domains= lines just like the global setting or what the
per-link configuration can carry.

And they are consulted the same way as link DNS scopes are considered,
following the same routing rules.

This allows to configure these DNS delegates statically via drop-in
files as mentioned, and only adds the most basic functionality. Later on
we might want to extend this:

1. Allow dynamic creation of DNS delegates via IPC with lifecycle bound
to IPC client (usecase: installing a DNS delegate that routes traffic to
some DNS-over-TLS server once basic setup is complete).
2. Allow configuration of protocol details per delegate the same way
this is currently allowed per-link.
3. Instead of strictly using DNS as delegation protocol, support an
alternative varlink based protocol (without retransmission problems and
so on) that systemd-machined and similar can implement.

This PR is not complete yet. Lacks docs and tests. Seems to work fine in
my local tests however.

Fixes: #5573
Fixes: #18056
Fixes: #20485
5 months agotest: add simple integration test for delegation feature 34368/head
Lennart Poettering [Fri, 9 May 2025 08:28:53 +0000 (10:28 +0200)] 
test: add simple integration test for delegation feature

5 months agoman: document dns-delegate files
Lennart Poettering [Wed, 2 Apr 2025 13:39:54 +0000 (15:39 +0200)] 
man: document dns-delegate files

5 months agoresolvectl: show delegate information, too
Lennart Poettering [Wed, 11 Sep 2024 14:12:04 +0000 (16:12 +0200)] 
resolvectl: show delegate information, too

5 months agoresolvectl: rework parsing of dns server + search domain bus properties
Lennart Poettering [Wed, 11 Sep 2024 14:10:45 +0000 (16:10 +0200)] 
resolvectl: rework parsing of dns server + search domain bus properties

Let's handle the per-link and the global dns server/search domain
property parsing the same. Let's use a flags field for three separate
booleans, and unify more code.

5 months agoresolved: add concept of delegating lookups below certain domains to specific DNS...
Lennart Poettering [Tue, 3 Sep 2024 08:56:31 +0000 (10:56 +0200)] 
resolved: add concept of delegating lookups below certain domains to specific DNS servers

This permits configuration of additional "delegates" which ensure that
lookups for certain DNS zones are routed to specific sets of DNS
servers, in addition to the routes we create for each network interface.

For now, this allows only static configuration, but eventually we should
open this up to IPC.

Fixes: #5573 #14159 #20485 #21260 #24532 #32022
(Fixes #32022, because now redundant)

5 months agoresolved: add a new DnsScopeOrigin enum, to delcare the "origin" of a DnsScope explicitly
Lennart Poettering [Mon, 2 Sep 2024 15:49:19 +0000 (17:49 +0200)] 
resolved: add a new DnsScopeOrigin enum, to delcare the "origin" of a DnsScope explicitly

This new enum field is supposed to indicate why a DnsScope came to be.
For now it distinguishes two origins: the "global" one (which is what is
configured in resolved.conf) and "link" ones (which are synthesized for
each link).

The field as is is pretty redundant, the same information can be
determined from whether the .link field is set or not.

This is pretty much just preparation for later commits that add
statically configured additional DnsScopes whose origin shall be encoded
with this.

5 months agoupdate TODO
Lennart Poettering [Tue, 20 May 2025 20:58:17 +0000 (22:58 +0200)] 
update TODO

5 months agobootctl: prefix all paths with the mountpoint prefix 37524/head
Zbigniew Jędrzejewski-Szmek [Tue, 20 May 2025 14:28:51 +0000 (16:28 +0200)] 
bootctl: prefix all paths with the mountpoint prefix

Continuation of 7851732262ec94f50598c4a289589a6ddb97ebfd and
5a65d2e53531f99ee03b576bee3464775d000f48. Absolute paths are always
nicer for the user because it's much easier to figure out where the
file is located. And printing some paths with the prefix and some
without was quite confusing.

5 months agobootctl: rework Boot Loader Entries section in status
Zbigniew Jędrzejewski-Szmek [Tue, 20 May 2025 13:03:35 +0000 (15:03 +0200)] 
bootctl: rework Boot Loader Entries section in status

Kernels are loaded from two partitions (XBOOTLDR and ESP). In the past this
wasn't always so, but a while ago the docs and the code were updated to load
from both locations. The $BOOT location specifies where to install only. So
rework the status output to print both locations and indicate which one is
$BOOT by appending ", $BOOT".

Also change the section title to "… Locations". We don't show *entries* here,
so the old title could be a bit confusing.

Example:
Boot Loader Entry Locations:
          ESP: /efi (/dev/disk/by-partuuid/31659406-5a17-46ec-8195-0dea1667db58)
     XBOOTLDR: /boot (/dev/disk/by-partuuid/4f8a8fe9-4b45-4070-9e9b-a681be51c902, $BOOT)
        token: fedora

5 months agomeson: fix executable name in comment
Yu Watanabe [Tue, 20 May 2025 14:11:08 +0000 (23:11 +0900)] 
meson: fix executable name in comment

Follow-up for e4b4a9b6773cf4fa228d87dc473f563f1b7ff6b6.

5 months ago{pidfd,cgroup}-util: avoid alignment warning when accessing f_handle (#37520)
Luca Boccassi [Tue, 20 May 2025 13:50:22 +0000 (14:50 +0100)] 
{pidfd,cgroup}-util: avoid alignment warning when accessing f_handle (#37520)

NetworkManager imports some systemd code, which we then build with
`-Wcast-align=strict`. This results in this warning:

```
../src/libnm-systemd-shared/src/basic/pidfd-util.c: In function 'pidfd_get_inode_id':
../src/libnm-systemd-shared/src/basic/pidfd-util.c:255:41: warning: cast increases required alignment of target type [-Wcast-align]
  255 |                                 *ret = *(uint64_t*) fh.file_handle.f_handle;
      |                                         ^
```

Since the address of `f_handle` should always be aligned at the word
boundary (it is preceded by 2 int`s` in `file_handle`), this patch uses
`CAST_ALIGN_PTR()` to avoid this warning.

5 months agorepart: add --append-fstab parameter (#37238)
Luca Boccassi [Tue, 20 May 2025 13:49:43 +0000 (14:49 +0100)] 
repart: add --append-fstab parameter (#37238)

If --generate-fstab=PATH is used, there is the possibility that the
fstab file already exists, making systemd-repart fail.

This commit will add a new --append-fstab= parameter, that will read
the file and merge it with the new generated content.  Using the
comments, the command can separate the automatic-generated section from
the user-provided section, allowing for the next append the replacement
only of the automatic-generated section, keeping the user one.

5 months agokernel-install: print entry-token path that was not found 37522/head
Zbigniew Jędrzejewski-Szmek [Tue, 20 May 2025 12:41:15 +0000 (14:41 +0200)] 
kernel-install: print entry-token path that was not found

5 months agokernel-install/90-loaderentry.install: print message if quiting because of KERNEL_INS...
Zbigniew Jędrzejewski-Szmek [Tue, 20 May 2025 12:31:53 +0000 (14:31 +0200)] 
kernel-install/90-loaderentry.install: print message if quiting because of KERNEL_INSTALL_LAYOUT

60-ukify.install prints a message like this, and it is quite useful when
trying to figure out what is going on.

5 months agonetworkd: add test to ensure that untracked addresses are kept
Matteo Croce [Mon, 19 May 2025 03:46:50 +0000 (05:46 +0200)] 
networkd: add test to ensure that untracked addresses are kept

Users can alter the network configuration manually, but networkd should
not interfere with manually set addresses and routes.

5 months agoVarious meson improvements (#37510)
Daan De Meyer [Tue, 20 May 2025 11:44:33 +0000 (13:44 +0200)] 
Various meson improvements (#37510)

5 months agocore: Also refresh confext extensions when reloading notify-reload service (#33995)
Luca Boccassi [Tue, 20 May 2025 10:27:34 +0000 (11:27 +0100)] 
core: Also refresh confext extensions when reloading notify-reload service (#33995)

`ExtensionImages=` and `ExtensionDirectories=` now let you specify
vpick-named extensions; however, since they just get set up once when
the service is started, you can't see newer versions without restarting
the service entirely. Here, also reload confext extensions when you
reload a service. This allows you to deploy a new version of some
configuration and have it picked up at reload time without interruption
to your workload.

Right now, we would only reload confext extensions and leave the sysext
ones behind, since it didn't seem prudent to swap out what is likely
program code at reload. This is made possible by only going for the
`SYSTEMD_CONFEXT_HIERARCHIES` overlays (which only contains `/etc`).

This PR:
- Adjusts `service.c` to also refresh extensions when needed.
- Adds integration tests to check that a confext reload actually
occurred.
- Adds to the `systemd.exec` man pages to document this behavior.

This is a follow up to #24864 and #31364. Thank you to @bluca and
@goenkam for help in getting this up.

5 months agomkosi: update debian commit reference to b0bbe045f41789845ecf591fd29f50c564034104
Luca Boccassi [Mon, 19 May 2025 15:08:29 +0000 (16:08 +0100)] 
mkosi: update debian commit reference to b0bbe045f41789845ecf591fd29f50c564034104

b0bbe045f4 systemd-boot: fix manpages installation
db46ebd2ec Install new files for upstream build
648bfbad0b systemd-homed: add dependency on polkitd
5a5f1bd5a3 document requirement to sync *.link files with initrd
1f2b663871 d/README.Debian: update some outdated paragraphs
03e6ab9c93 Add version to systemd-boot-efi-signed virtual package
5d7a08916c d/control: bump Standards-Version to 4.7.2, no changes
ace9e4beaf d/signing-template/copyright: use GPL URL instead of old FSF postal address

5 months agocgroup-util: avoid alignment warning when accessing f_handle 37520/head
Jan Vaclav [Tue, 20 May 2025 10:16:31 +0000 (12:16 +0200)] 
cgroup-util: avoid alignment warning when accessing f_handle

5 months agopidfd-util: avoid alignment warning when accessing f_handle
Jan Vaclav [Tue, 20 May 2025 10:07:43 +0000 (12:07 +0200)] 
pidfd-util: avoid alignment warning when accessing f_handle

5 months agocore/cgroup: also assume cgroup.events frozen attr is available (#37518)
Mike Yuan [Tue, 20 May 2025 08:58:53 +0000 (10:58 +0200)] 
core/cgroup: also assume cgroup.events frozen attr is available (#37518)

5 months agomeson: Use hyphens everywhere in gperf.c filenames 37510/head
Daan De Meyer [Tue, 20 May 2025 08:46:28 +0000 (10:46 +0200)] 
meson: Use hyphens everywhere in gperf.c filenames

5 months agorepart: add --append-fstab parameter 37238/head
Alberto Planas [Thu, 24 Apr 2025 13:02:27 +0000 (15:02 +0200)] 
repart: add --append-fstab parameter

If --generate-fstab=PATH is used, there is the possibility that the
fstab file already exists, making systemd-repart fail.

This commit will add a new --append-fstab= parameter, that will read
the file and merge it with the new generated content.  Using the
comments, the command can separate the automatic-generated section from
the user-provided section, allowing for the next append the replacement
only of the automatic-generated section, keeping the user one.

Signed-off-by: Alberto Planas <aplanas@suse.com>
5 months agomeson: Rework clang-tidy integration to be done via unit tests
Daan De Meyer [Thu, 15 May 2025 13:09:27 +0000 (15:09 +0200)] 
meson: Rework clang-tidy integration to be done via unit tests

Instead of using run-clang-tidy.py with its own scheduling, let's
just gather a list of source files ourselves and then use that to
add a unit test for each source file that runs clang-tidy on the
source file.

We also add a bit of logic to run clang-tidy on most header files
as well for extra coverage. This uncovered various header files that
were not standalone so this commit also includes fixes to make sure
the clang-tidy tests are all green.

We can also use this in a later commit to run clang-include-cleaner
on each source file in the same way.

5 months agotree-wide: Ensure source file names are unique
Daan De Meyer [Thu, 15 May 2025 12:07:59 +0000 (14:07 +0200)] 
tree-wide: Ensure source file names are unique

Let's ensure all of our source file names are unique without having
to take the directory into account.

This allows us to create meson targets or unit tests identified by the
the name of the source file they operate on without having to include
the full path of the source file in the target or test name to avoid
conflicts.

5 months agomeson: Build fuzz executables by default if fuzz-tests option is enabled
Daan De Meyer [Thu, 15 May 2025 12:52:48 +0000 (14:52 +0200)] 
meson: Build fuzz executables by default if fuzz-tests option is enabled

fuzz-tests is enabled by default now but we still don't build the fuzz
executables by default. Let's change that so that we always make sure these
still compile when we make changes.

5 months agooss-fuzz: Add comment on why we build with --auto-features=disabled
Daan De Meyer [Mon, 19 May 2025 15:43:48 +0000 (17:43 +0200)] 
oss-fuzz: Add comment on why we build with --auto-features=disabled

5 months agomeson: Make sure fuzz-journal-remote is built in oss-fuzz
Daan De Meyer [Mon, 19 May 2025 15:41:18 +0000 (17:41 +0200)] 
meson: Make sure fuzz-journal-remote is built in oss-fuzz

oss-fuzz builds with --auto-features=disabled, yet we have to make
sure all fuzzers are still built when --auto-features=disabled, so
let's always build systemd-journal-remote even if it is disabled so
that we can use its objects to build fuzz-journal-remote. Instead,
when remote=disabled, we make sure we don't installed
systemd-journal-remote.

5 months agomeson: Extract more objects instead of compiling multiple times
Daan De Meyer [Thu, 15 May 2025 12:16:57 +0000 (14:16 +0200)] 
meson: Extract more objects instead of compiling multiple times

Also, let's deflatten the lists of sources in preparation for the
next commit at the same time.

In systemctl, we split out systemctl-main.c to make sure the definition
of main() is in a separate object which allows us to extract the systemctl.c
object and link it in the fuzzer target without getting a multiple definition
error when linking.

5 months agojournal-remote: Allow building without microhttpd support
Daan De Meyer [Thu, 15 May 2025 11:23:54 +0000 (13:23 +0200)] 
journal-remote: Allow building without microhttpd support

systemd-journal-remote is useful even if the microhttpd related features
are not enabled so let's not skip it entirely if microhttpd is not available.

5 months agostring-util: add find_line[_after] functions
Alberto Planas [Wed, 7 May 2025 09:00:10 +0000 (11:00 +0200)] 
string-util: add find_line[_after] functions

As a wrapper for `find_line_startswith`, `find_line_after` search for
the exact line and return the pointer for the next line, or NULL if
missing.

`find_line` with search for the exact line and return the pointer to the
beginning of the line.

Signed-off-by: Alberto Planas <aplanas@suse.com>
5 months agocgroup-util: modernize cg_get_keyed_attribute() 37518/head
Mike Yuan [Mon, 19 May 2025 19:06:17 +0000 (21:06 +0200)] 
cgroup-util: modernize cg_get_keyed_attribute()

- assert on supplied keys being unique
- Reject duplicate attributes with -EBADMSG
- Rename 'ret_values' to just 'values', given we don't
  allocate the array
- Remove now unused cg_get_keyed_attribute_graceful()

5 months agocore/cgroup: also assume cgroup.events frozen attr is available
Mike Yuan [Mon, 19 May 2025 16:41:29 +0000 (18:41 +0200)] 
core/cgroup: also assume cgroup.events frozen attr is available

Follow-up for 3c86a935ad2f88a83f1f465544cb0c8bdc288f4c

5 months agoboot: fix ia32 build with clang
Zbigniew Jędrzejewski-Szmek [Mon, 19 May 2025 11:37:43 +0000 (13:37 +0200)] 
boot: fix ia32 build with clang

After 668d915a4bea202e739a9bd3f895c7269f320659, the build fails:
[7/14] Linking target src/boot/systemd-bootia32.elf
FAILED: src/boot/systemd-bootia32.elf
clang  -o src/boot/systemd-bootia32.elf src/boot/systemd-bootia32.elf.p/boot.c.o src/boot/systemd-bootia32.elf.p/line-edit.c.o src/boot/systemd-bootia32.elf.p/bcd.c.o -Wl,--as-needed -Wl,--no-undefined -pie -fstack-protector src/boot/libefiia32.a -nostdlib -static-pie -Wl,--entry=efi_main -Wl,--fatal-warnings -Wl,-static,-pie,--no-dynamic-linker,-z,text -z common-page-size=4096 -z max-page-size=4096 -z noexecstack -z relro -z separate-code -Wl,-z,nopack-relative-relocs -fcf-protection=none -fno-asynchronous-unwind-tables -fno-exceptions -fno-unwind-tables -fno-sanitize=all -Wno-unused-command-line-argument -m32
/usr/sbin/ld: src/boot/libefiia32.a.p/console.c.o: in function `console_set_mode':
/home/zbyszek/src/systemd-work/build-clang/../src/boot/console.c:267:(.text+0xb8f): undefined reference to `__moddi3'
/usr/sbin/ld: src/boot/libefiia32.a.p/console.c.o: in function `get_auto_mode':
/home/zbyszek/src/systemd-work/build-clang/../src/boot/console.c:228:(.text+0xf18): undefined reference to `__udivdi3'
/usr/sbin/ld: src/boot/libefiia32.a.p/efi-string.c.o: in function `push_num':
/home/zbyszek/src/systemd-work/build-clang/../src/boot/efi-string.c:695:(.text+0x3c1a): undefined reference to `__moddi3'
/usr/sbin/ld: /home/zbyszek/src/systemd-work/build-clang/../src/boot/efi-string.c:696:(.text+0x3c54): undefined reference to `__divdi3'
/usr/sbin/ld: /home/zbyszek/src/systemd-work/build-clang/../src/boot/efi-string.c:702:(.text+0x3cda): undefined reference to `__umoddi3'
/usr/sbin/ld: /home/zbyszek/src/systemd-work/build-clang/../src/boot/efi-string.c:703:(.text+0x3d0a): undefined reference to `__udivdi3'
/usr/sbin/ld: src/boot/libefiia32.a.p/ticks.c.o: in function `time_usec':
/home/zbyszek/src/systemd-work/build-clang/../src/boot/ticks.c:110:(.text+0x9d): undefined reference to `__udivdi3'
/usr/sbin/ld: src/boot/libefiia32.a.p/ticks.c.o: in function `ticks_freq_arch':
/home/zbyszek/src/systemd-work/build-clang/../src/boot/ticks.c:46:(.text+0x394): undefined reference to `__udivdi3'
/usr/sbin/ld: /home/zbyszek/src/systemd-work/build-clang/../src/boot/ticks.c:49:(.text+0x3ce): undefined reference to `__udivdi3'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Restore the use of -lgcc for 32-bit builds.

(FWIW, neither --rtlib=compiler-rt nor --rtlib=libgcc help.)

5 months agosd-varlink: Expose sd_varlink_idl_parse() (#37513)
Daan De Meyer [Mon, 19 May 2025 14:13:44 +0000 (16:13 +0200)] 
sd-varlink: Expose sd_varlink_idl_parse() (#37513)

5 months agosd-varlink: Expose sd_varlink_idl_parse() 37513/head
Daan De Meyer [Mon, 19 May 2025 12:49:43 +0000 (14:49 +0200)] 
sd-varlink: Expose sd_varlink_idl_parse()

We're planning to do code generation based on the systemd varlink
APIs. To simplify this, let's expose the IDL parser, so we can use
it to do code generation instead of having to write our own IDL
parser.

5 months agosd-varlink: Fix argument names of sd_varlink_idl_parse()
Daan De Meyer [Mon, 19 May 2025 13:07:34 +0000 (15:07 +0200)] 
sd-varlink: Fix argument names of sd_varlink_idl_parse()

5 months agoman: document confext reload behavior for ExtensionDirectories/Images 33995/head
maia x. [Thu, 22 Aug 2024 20:34:34 +0000 (13:34 -0700)] 
man: document confext reload behavior for ExtensionDirectories/Images

5 months agotest: check reloading notify-reload service refreshes vpick extensions
maia x. [Mon, 6 Jan 2025 18:41:19 +0000 (10:41 -0800)] 
test: check reloading notify-reload service refreshes vpick extensions

In TEST-50-DISSECT.dissect, this adds the following cases:
- testservice-50g: vpick extension in ExtensionDirectories
- testservice-50h: vpick extension in ExtensionImages
- testservice-50i: ExtensionDirectories + RootImage
- testservice-50j: ExtensionDirectories + RootDirectory

5 months agocore: reload confexts when reloading notify-reload services
maia x. [Mon, 6 Jan 2025 18:31:44 +0000 (10:31 -0800)] 
core: reload confexts when reloading notify-reload services

`ExtensionImages=` and `ExtensionDirectories=` now let you specify
vpick-named extensions; however, since they just get set up once when
the service is started, you can't see newer versions without restarting
the service entirely.  Here, also reload confext extensions when you
reload a service. This allows you to deploy a new version of some
configuration and have it picked up at reload time without interruption
to your workload.

Right now, we would only reload confext extensions and leave the sysext
ones behind, since it didn't seem prudent to swap out what is likely
program code at reload. This is made possible by only going for the
`SYSTEMD_CONFEXT_HIERARCHIES` overlays (which only contains `/etc`).

Implementation wise, this uses the new kernel API and two collaborating
child processes under the host & child namespaces in order to gather the
right FDs needed:

  - (1) In child, set up the extension images and directories in a slave
mountns, and obtain their FDs.
  - (2) Fork into a grandchild under target process namespace, and do a
        "fake" unmount to obtain the FD of the underlying target folder
say /etc).
  - (3) In the child again, set up new overlay under host NS rights.

We do not want to do I/O heavy jobs inline in PID1 blocking the state
machine, so add separate async states to handle this case.

Co-authored-by: Luca Boccassi <luca.boccassi@gmail.com>
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.

5 months agounits: kill only udev services and keep udev sockets on switching root
Yu Watanabe [Tue, 13 May 2025 17:56:21 +0000 (02:56 +0900)] 
units: kill only udev services and keep udev sockets on switching root

This also makes initrd-cleanup.service explicitly start
initrd-switch-root.service with replace-irreversibly mode, to avoid
systemd-udevd.service being triggered by kernel events and the start
job of initrd-switch-root.service being cancelled.

Follow-ups for 676fb42aaec60281651368f083abb3cbaf3c7dc2.
Addresses https://github.com/systemd/systemd/pull/37374#issuecomment-2875990471.

5 months agoterminal-util: restore terminal settings if fd_reopen() fails
Mike Yuan [Fri, 16 May 2025 19:50:29 +0000 (21:50 +0200)] 
terminal-util: restore terminal settings if fd_reopen() fails

Follow-up for a0c314d6b04c0a20d566b15c759d18cdb2916c14

5 months agosd-bus: drop a bunch of 'else'
Lennart Poettering [Fri, 16 May 2025 07:55:17 +0000 (09:55 +0200)] 
sd-bus: drop a bunch of 'else'

With the new US taxes on bits and bytes let's reduce our footprint a
bit.

5 months agoRemove overzealous checks (#37493)
Yu Watanabe [Fri, 16 May 2025 16:37:18 +0000 (01:37 +0900)] 
Remove overzealous checks (#37493)

5 months agobasic/terminal-util: simplify output param handling 37493/head
Zbigniew Jędrzejewski-Szmek [Fri, 16 May 2025 13:24:12 +0000 (15:24 +0200)] 
basic/terminal-util: simplify output param handling

Those static functions were written to support optional output params, but they
are only ever called with the output param set, and it doesn't make sense to
ever call them without the output param. Since those are internal functions,
drop this unused complexity.

5 months agobasic/terminal-util: drop 'U' suffix
Zbigniew Jędrzejewski-Szmek [Thu, 15 May 2025 11:55:11 +0000 (13:55 +0200)] 
basic/terminal-util: drop 'U' suffix

C automatically casts a signed int to unsigned in binary operation with an
unsigned int. Thus that suffix is not useful. Also surrounding code doesn't use
it.

5 months agosrc/boot: assume that intmax_t is the biggest integer
Zbigniew Jędrzejewski-Szmek [Wed, 14 May 2025 20:03:29 +0000 (22:03 +0200)] 
src/boot: assume that intmax_t is the biggest integer

Same as in 81d7934882ae13c64d9b08d365a0baa011cb2fbb, intmax_t by definition is
the widest int. Strictly speaking, the check whether
  sizeof(intmax_t) == sizeof(long long)
in the code below is redundant, but I think it's nicer to keep it for symmetry
with the other cases.

Requested in
https://github.com/systemd/systemd/pull/37442#pullrequestreview-2840906908.

5 months agoTEST-07-PID1: drop journal message flood test
Yu Watanabe [Wed, 14 May 2025 19:02:26 +0000 (04:02 +0900)] 
TEST-07-PID1: drop journal message flood test

This partially reverts f9b186c21aa500eb7da3de0dcbd4cc1f07589a5a.

The test case is unstable, and fills debugging logs after journald
is restarted.

5 months agoman: reword recommendations around Accept=
Lennart Poettering [Thu, 15 May 2025 16:46:03 +0000 (18:46 +0200)] 
man: reword recommendations around Accept=

Accept=yes has very valid usecases (i.e. for sporadically invoked
services) and strong benefits (i.e. better security because connections
can be sandboxed nicely, isolating them). Let's hence reword things and
stop claiming that Accept=yes was a legacy thing, because it really
isn't.

Some other man fixes, too

5 months agocatalog: add more entries
Lennart Poettering [Thu, 15 May 2025 13:24:31 +0000 (15:24 +0200)] 
catalog: add more entries

While message IDs are about more than catalog entries (they make
messages recognizable), I think it makes sense to document at least all
those messages that indicate problems with catalog entries, in an
attempt to be helpful to users.

Fixes: #36201