]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
4 months agoinclude: update syscall list 37958/head
Yu Watanabe [Thu, 19 Jun 2025 00:09:17 +0000 (09:09 +0900)] 
include: update syscall list

open_tree_attr is since kernel 6.15-rc1:
https://github.com/torvalds/linux/commit/c4a16820d90199409c9bf01c4f794e1e9e8d8fd8

4 months agofs-util: use int for argument that takes F_OK and friends
Yu Watanabe [Sat, 21 Jun 2025 16:40:25 +0000 (01:40 +0900)] 
fs-util: use int for argument that takes F_OK and friends

access_nofollow() is a simple wrapper of faccessat(), and it is defined as
```
int faccessat(int dirfd, const char *pathname, int mode, int flags);
```

4 months agofs-util: include fcntl.h in fs-util.h
Yu Watanabe [Sat, 21 Jun 2025 16:34:36 +0000 (01:34 +0900)] 
fs-util: include fcntl.h in fs-util.h

fs-util.h provides access_nofollow() but it did not include neither
fcntl.h nor unistd.h, which define F_OK and friends. Hence we cannot use
the function without including one of the headers. Let's include fcntl.h
in fs-util.h, then we can use the function by simply including fs-util.h.

4 months agoinclude: import kernel headers for several struct and enum definitions
Yu Watanabe [Thu, 19 Jun 2025 20:40:29 +0000 (05:40 +0900)] 
include: import kernel headers for several struct and enum definitions

- mempolicy.h for MPOL_DEFAULT and friends,
- sched/types.h for struct sched_attr,
- xattr.h for struct xattr_args.

4 months agonamespace-util: include sched.h
Yu Watanabe [Thu, 19 Jun 2025 20:44:06 +0000 (05:44 +0900)] 
namespace-util: include sched.h

To make CLONE_NEWNS and friends defined, which is used by clone_flag_to_namespace_type().

4 months agomeson: sort file list
Yu Watanabe [Thu, 19 Jun 2025 20:37:44 +0000 (05:37 +0900)] 
meson: sort file list

4 months agotree-wide: include missing_fs.h only where necessary
Yu Watanabe [Thu, 19 Jun 2025 15:59:32 +0000 (00:59 +0900)] 
tree-wide: include missing_fs.h only where necessary

The additional definitions provided by the header are
- EXT4_IOC_RESIZE_FS, used in resize-fs.c,
- FILEID_KERNFS, used in cgroup-util.c and pidfd-util.c.

Let's drop the inclusion at other places.

4 months agotree-wide: use sd_bus_message_send() instead of sd_bus_send() wherever possible
Lennart Poettering [Tue, 24 Jun 2025 11:07:54 +0000 (13:07 +0200)] 
tree-wide: use sd_bus_message_send() instead of sd_bus_send() wherever possible

Also, add a coccinelle script that patches this automatically.

4 months agoudev: reset loopback block device ownership and mode on detach
Lennart Poettering [Thu, 19 Jun 2025 15:18:11 +0000 (17:18 +0200)] 
udev: reset loopback block device ownership and mode on detach

Loopback block devices are agressively reused, without being removed in
between. This means various inode attributes on their device nodes will
– so far – remain in effect between uses of the devices. Since there are
applications which change access mode/ownership of such devices after
attaching files to them, let's undo this again when we detect them to be
unused again.

Fixes: #37745
4 months agoimport: rename keyring extension from .gpg to .pgp and add OBS key for system:systemd...
Lennart Poettering [Tue, 24 Jun 2025 05:31:07 +0000 (07:31 +0200)] 
import: rename keyring extension from .gpg to .pgp and add OBS key for system:systemd (#37927)

The format is not specific to gpg, it's defined by the pgp
protocols. Lintian even warns about it:

systemd-container: openpgp-file-has-implementation-specific-extension
[usr/lib/systemd/import-pubring.gpg]

Rename it accordingly, as new pgp implementations are slowly becoming
more popular.

Keep using /etc/systemd/import-pubring.gpg for backward compatibility.

4 months agoNEWS: add not about vendor import-pubring renaming 37927/head
Luca Boccassi [Mon, 23 Jun 2025 22:24:33 +0000 (23:24 +0100)] 
NEWS: add not about vendor import-pubring renaming

4 months agomkosi: drop suse spec workarounds that were merged upstream
Luca Boccassi [Mon, 23 Jun 2025 22:14:16 +0000 (23:14 +0100)] 
mkosi: drop suse spec workarounds that were merged upstream

4 months agomkosi: workaround for opensuse spec file to pick up new import-pubring filename
Luca Boccassi [Sun, 22 Jun 2025 17:18:53 +0000 (18:18 +0100)] 
mkosi: workaround for opensuse spec file to pick up new import-pubring filename

4 months agomkosi: update debian commit reference to 84966b99cdfc7ea3ee35163ad224775d9be90055
Luca Boccassi [Sun, 22 Jun 2025 17:12:32 +0000 (18:12 +0100)] 
mkosi: update debian commit reference to 84966b99cdfc7ea3ee35163ad224775d9be90055

84966b99cd systemd-container: pick up renamed keyring file
7aab0da57c udev: add 'clock' system group for PTP rules

4 months agoimport-pubring: add OBS key for system:systemd
Luca Boccassi [Sun, 22 Jun 2025 16:52:02 +0000 (17:52 +0100)] 
import-pubring: add OBS key for system:systemd

We are publishing ParticleOS images at
https://build.opensuse.org/project/show/system:systemd

so add the signing key to the default keyring, so that they
can be imported out of the box.

4 months agoimport: rename keyring extension from .gpg to .pgp
Luca Boccassi [Sun, 22 Jun 2025 16:43:35 +0000 (17:43 +0100)] 
import: rename keyring extension from .gpg to .pgp

The format is not specific to gpg, it's defined by the pgp
protocols. Lintian even warns about it:

systemd-container: openpgp-file-has-implementation-specific-extension [usr/lib/systemd/import-pubring.gpg]

Rename it accordingly, as new pgp implementations are slowly becoming
more popular.

Keep using /etc/systemd/import-pubring.gpg for backward compatibility.

4 months agotest-cpu-set-util: fix check for CPUSet.allocated
Yu Watanabe [Sat, 21 Jun 2025 14:06:16 +0000 (23:06 +0900)] 
test-cpu-set-util: fix check for CPUSet.allocated

The check was simply wrong and meaningless, as it always checked
CPUSet.allocated is greater than or equals to 1, as sizeof(__cpu_mask) is 8.

Let's make the test more strict.

4 months agouser-record: also support "aliases" in the "status" section of user records
Lennart Poettering [Fri, 13 Jun 2025 08:08:25 +0000 (10:08 +0200)] 
user-record: also support "aliases" in the "status" section of user records

Some user record providers might want to implement case-insensitive user
record matching, or other forms of non-normalized matching. So far
uderdb didn't allow that, because client's typically revalidate the
returned user records against the search keys (at least our clients do)
– they check if the search user name is actually part of the user record
and its aliases.

In order to support such lookups we thus need to allow the looup keys to
be part of the user record, but also not be persisted in it, because
the number of casings/spellings of a username might be ridiculously
high.

A nice way out is to allow "aliases" not only in the main part of the
record, but also in the "status" part, that contains information
dynamically determined at query time. We can insert a second "aliases"
field there, which the parser will then merge with the primary "aliases"
field, but the existing rules around "status" ensure tha the data is
never persisted.

Follow-up: e2e1f38f5a9d442d0a027986024f4ea75ce97d2f

4 months agonetwork/dhcp6: handle conflict addresses gracefully (#37916)
Luca Boccassi [Mon, 23 Jun 2025 21:23:35 +0000 (22:23 +0100)] 
network/dhcp6: handle conflict addresses gracefully (#37916)

4 months agocore: turn ordering cycle log message into a recognizable one + catalog entry (#37893)
Yu Watanabe [Mon, 23 Jun 2025 17:56:07 +0000 (02:56 +0900)] 
core: turn ordering cycle log message into a recognizable one + catalog entry (#37893)

Fixes: #35642
4 months agoglob-util: several cleanups for safe_glob() (#37933)
Yu Watanabe [Mon, 23 Jun 2025 17:53:37 +0000 (02:53 +0900)] 
glob-util: several cleanups for safe_glob() (#37933)

4 months agohome: Make sure we resolve /etc/skel symlink
Daan De Meyer [Sun, 22 Jun 2025 12:17:08 +0000 (14:17 +0200)] 
home: Make sure we resolve /etc/skel symlink

Otherwise copy_tree_at() will try to copy the symlink which we obviously
don't want.

4 months agohomed,userdbd: mark "secrets" section of user records always to "sensitive" (#37935)
Yu Watanabe [Mon, 23 Jun 2025 15:50:44 +0000 (00:50 +0900)] 
homed,userdbd: mark "secrets" section of user records always to "sensitive" (#37935)

4 months agobootspec: ensure memory free in one error path
Lennart Poettering [Mon, 23 Jun 2025 12:40:21 +0000 (14:40 +0200)] 
bootspec: ensure memory free in one error path

4 months agosysupdate: use path_is_safe()
Yu Watanabe [Sun, 22 Jun 2025 05:44:04 +0000 (14:44 +0900)] 
sysupdate: use path_is_safe()

path_is_safe(...) is an alias of path_is_valid_full(..., false).

4 months agoconsole: when switching console modes and one doesn't work, always go for the next
Lennart Poettering [Fri, 20 Jun 2025 09:05:00 +0000 (11:05 +0200)] 
console: when switching console modes and one doesn't work, always go for the next

So far we already had a logic in place to go for the next mode if some
mode doesn't work – but it was only applied if we'd actively cycle
through resolutions.

Let's extend the logic and always apply it: whenever we try to switch to
a mode, and it doesn't work, go to the next one until we find one that
works.

Fixes: #37324
4 months agocatalog: add entries for the order cycle log messages 37893/head
Lennart Poettering [Thu, 19 Jun 2025 08:15:49 +0000 (10:15 +0200)] 
catalog: add entries for the order cycle log messages

Fixes: #35642
4 months agocore: when removing a job from a transaction, include in structured log message which
Lennart Poettering [Thu, 19 Jun 2025 08:15:35 +0000 (10:15 +0200)] 
core: when removing a job from a transaction, include in structured log message which

4 months agocore: cast log_oom() got void
Lennart Poettering [Wed, 18 Jun 2025 09:51:45 +0000 (11:51 +0200)] 
core: cast log_oom() got void

4 months agocore: change ordering cycle log message log levels
Lennart Poettering [Wed, 18 Jun 2025 09:48:39 +0000 (11:48 +0200)] 
core: change ordering cycle log message log levels

Let's downgrade the log message about our attempts to deal with an
ordering cycle to warning, because this is a "positive" thing, we try to
improve an earlier error.

OTOH increase the log level when we first log about the cycle to error,
since that highlights the actual problem.

4 months agocore: make log cycle messages recognizable via message IDs
Lennart Poettering [Wed, 18 Jun 2025 09:47:25 +0000 (11:47 +0200)] 
core: make log cycle messages recognizable via message IDs

4 months agocore: output log cycle path in one log message, not many
Lennart Poettering [Wed, 18 Jun 2025 09:47:06 +0000 (11:47 +0200)] 
core: output log cycle path in one log message, not many

Fixes: #35642
4 months agoglob-util: drop unused _cleanup_globfree_ 37933/head
Yu Watanabe [Mon, 23 Jun 2025 00:20:55 +0000 (09:20 +0900)] 
glob-util: drop unused _cleanup_globfree_

4 months agotest: use safe_glob() at one more place
Yu Watanabe [Mon, 23 Jun 2025 00:00:20 +0000 (09:00 +0900)] 
test: use safe_glob() at one more place

This also makes the test use ASSERT_OK() and STRV_FOREACH() macros.

No functional change, just refactoring.

4 months agoglob-util: rework safe_glob()
Yu Watanabe [Sun, 22 Jun 2025 23:55:54 +0000 (08:55 +0900)] 
glob-util: rework safe_glob()

Currently, callers of safe_glob() set an empty glob_t or glob_t with
opendir func, and all other components are always zero.
So, let's introduce safe_glob_full() which optionally takes opendir
function, rather than glob_t, and returns result strv, rather than
storing results in glob_t.
Also, introduce safe_glob() which is a trivial wrapper of
safe_glob_full() without opendir func.

No functional change, just refactoring.

4 months agotest-glob-util: drop redundant test cases
Yu Watanabe [Sun, 22 Jun 2025 02:09:11 +0000 (11:09 +0900)] 
test-glob-util: drop redundant test cases

The removed glob() with GLOB_ALTDIRFUNC is exactly the same as what
safe_glob() does, which is tested in TEST(safe_glob) below.
Let's drop the test cases.

4 months agoUse paths specified from environment variables for /etc configuration files
Valentin David [Mon, 10 Mar 2025 09:53:41 +0000 (10:53 +0100)] 
Use paths specified from environment variables for /etc configuration files

Some configuration files that need updates are directly under in /etc. To
update them atomically, we need write access to /etc. For Ubuntu Core this is
an issue as /etc is not writable. Only a selection of subdirectories can be
writable. The general solution is symlinks or bind mounts to writable places.
But for atomic writes in /etc, that does not work. So Ubuntu has had a patch
for that that did not age well.

Instead we would like to introduce some environment variables for alternate
paths.

 * SYSTEMD_ETC_HOSTNAME: /etc/hostname
 * SYSTEMD_ETC_MACHINE_INFO: /etc/machine-info
 * SYSTEMD_ETC_LOCALTIME: /etc/localtime
 * SYSTEMD_ETC_LOCALE_CONF: /etc/locale.conf
 * SYSTEMD_ETC_VCONSOLE_CONF: /etc/vconsole.conf
 * SYSTEMD_ETC_ADJTIME: /etc/adjtime

While it is for now expected that there is a symlink from the standard, we
still try to read them from that alternate path. This is important for
`/etc/localtime`, which is a symlink, so we cannot have an indirect symlink or
bind mount for it.

Since machine-id is typically written only once and not updated. This commit
does not cover it. An initrd can properly create it and bind mount it.

4 months agouserdb: when loading a user record from JSON, mark 'secret' section in JSON variant... 37935/head
Lennart Poettering [Mon, 23 Jun 2025 12:40:25 +0000 (14:40 +0200)] 
userdb: when loading a user record from JSON, mark 'secret' section in JSON variant as sensitive as side effect

When we load a user record we retain a reference to the original JSON.
Thus the loaded objects might live at least as long as our user record
object, hence we better make sure we set the 'sensitive' flag for the
'secret' section if it's not marked like that yet.

This is paranoia only: we already should be setting this flag properly
earlier, when acquiring the json variant in the first place. But it's
better to be safe than sorry.

4 months agohomed: set "secrets" section to 'sensitive' in more places
Lennart Poettering [Mon, 23 Jun 2025 12:37:58 +0000 (14:37 +0200)] 
homed: set "secrets" section to 'sensitive' in more places

We already do this in all placed where we it *really* matters, i.e. for
passwords PINs. But let's do this also at any place where we add the
section at all, regardless whether it is for storing a pw or something
else.

With this we establish the rule that if it's in "secrets", then it
shall be marked "sensitive".

4 months agoupdate TODO
Lennart Poettering [Mon, 23 Jun 2025 12:37:37 +0000 (14:37 +0200)] 
update TODO

4 months agohomed: do not log new password when debug logs are enabled
Luca Boccassi [Sun, 22 Jun 2025 15:44:02 +0000 (16:44 +0100)] 
homed: do not log new password when debug logs are enabled

systemd-homed[3443]: Sending to worker:
{
  "enforcePasswordPolicy": false,
  "userName": "foobarbaz",
  "perMachine": [
    {
      "storage": "directory",
      "matchMachineId": "c1082742b92c4f7e8d30d6b17f9d3351"
    }
  ],
  "disposition": "regular",
  "lastChangeUSec": 1750606709833174,
  "lastPasswordChangeUSec": 1750606709833174,
  "privileged": {
    "hashedPassword": [
      "$y$j9T$ai2Fshq0ev9W05WL4SoRJ1$EFfe41ACrJKXMCQ83A05n6UW.HrRr9/O4b1x0CXgAXD"
    ]
  },
  "binding": {
    "c1082742b92c4f7e8d30d6b17f9d3351": {
      "blobDirectory": "/var/cache/systemd/home/foobarbaz",
      "uid": 60056,
      "gid": 60056
    }
  },
  "secret": {
    "password": [
      "test"
    ]
  },
  "__systemd_homework_internal_blob_fdmap": {}
}

4 months agonetwork/dhcp6: consider the DHCPv6 protocol as finished when conflict addresses exist 37916/head
Yu Watanabe [Fri, 20 Jun 2025 18:51:30 +0000 (03:51 +0900)] 
network/dhcp6: consider the DHCPv6 protocol as finished when conflict addresses exist

Replaces #37891.

4 months agonetwork/dhcp6: refactoring for verify_dhcp6_address()
Yu Watanabe [Fri, 20 Jun 2025 18:48:51 +0000 (03:48 +0900)] 
network/dhcp6: refactoring for verify_dhcp6_address()

No functional change. Preparation for later changes.

4 months agohwdb: Add hwbd definitions for maker tools
Bastien Nocera [Sat, 21 Jun 2025 18:01:18 +0000 (20:01 +0200)] 
hwdb: Add hwbd definitions for maker tools

As originally added back in 2016 in 68ea57b21d4d ("Added support
for 3D printers to uaccess (ID_MAKER_TOOL)").

The first devices added would be 3D printers compatible with Flashprint
from Flashforge, as listed in this connector plugin:
https://github.com/Mrnt/OctoPrint-FlashForge/blob/master/octoprint_flashforge/__init__.py#L28

See https://github.com/flathub/com.flashforge.FlashPrint/issues/59

4 months agohwdb: Add support for Lenovo IdeaPad Slim 5 series
Oliver Schramm [Sun, 22 Jun 2025 11:51:51 +0000 (13:51 +0200)] 
hwdb: Add support for Lenovo IdeaPad Slim 5 series

Signed-off-by: Oliver Schramm <oliver.schramm97@gmail.com>
4 months agopo: Translated using Weblate (Greek)
Jim Spentzos [Sun, 22 Jun 2025 12:13:39 +0000 (12:13 +0000)] 
po: Translated using Weblate (Greek)

Currently translated at 35.0% (90 of 257 strings)

Co-authored-by: Jim Spentzos <jimspentzos2000@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/el/
Translation: systemd/main

4 months agobootctl: honour architecture when updating boot loaders (#37913)
Yu Watanabe [Fri, 20 Jun 2025 17:25:17 +0000 (02:25 +0900)] 
bootctl: honour architecture when updating boot loaders (#37913)

Fixes: #33413
Follow-up for: #30418

4 months agoupdate TODO
Lennart Poettering [Fri, 20 Jun 2025 10:58:46 +0000 (12:58 +0200)] 
update TODO

4 months agocore: escape UTF-8 in mount unit Where field before sending to clients
Lennart Poettering [Fri, 20 Jun 2025 11:16:10 +0000 (13:16 +0200)] 
core: escape UTF-8 in mount unit Where field before sending to clients

Followup for: 4804da58536ab7ad46178a03f4d2da49fd8e4ba2 #27541

Fixes: #36206
4 months agocopy: when looking for file holes, consider empty data segments
Lennart Poettering [Fri, 20 Jun 2025 10:07:27 +0000 (12:07 +0200)] 
copy: when looking for file holes, consider empty data segments

This could mean that we hit EOF, or it could mean that somebody punched
a hole concurrently where we are currently looking. Let's figure this
out by simply trying to copy a single byte, which will give us a
definitive answer.

Fixes: #35569
4 months agologind inhibitor code fixes (#37907)
Yu Watanabe [Fri, 20 Jun 2025 17:09:52 +0000 (02:09 +0900)] 
logind inhibitor code fixes (#37907)

Fixes: #35565
4 months agojournal-gatewayd: make num_entries in Range header optional again
Jan Čermák [Wed, 18 Jun 2025 15:32:49 +0000 (17:32 +0200)] 
journal-gatewayd: make num_entries in Range header optional again

Since 435c372ce5059082212d37ac7039844f14f34a80 added in v256,
num_entries part of the Range header is mandatory and error is returned
when it's not filled in. This makes using the "follow" argument clumsy,
because for an indefinite following of the logs, arbitrary high number
must be specified. This change makes it possible to omit it again and
documents this behavior in the man page.

Moreover, as the cursor part of the header was never mandatory, enclose
it in square brackets in the documentation as well and elaborate how
indexing works.

Following are some concrete examples of the Range header which are now
accepted:

 entries= (or entries=:)
  - everything starting from the first event

 entries=cursor
  - everything starting from `cursor`

 entries=:-9:10
  - last 10 events and close the connection

If the follow flag is set:

 entries=:-4:10
  - last 5 events, wait for 5 new and close connection

 entries=:-9:
  - last 10 events and keep streaming

Note that only the very last one is changing current behavior, but
reintroduces pre-v256 compatibility.

Fixes #37172

4 months agobootctl: when updating everything check PE machine type 37913/head
Lennart Poettering [Fri, 20 Jun 2025 12:03:57 +0000 (14:03 +0200)] 
bootctl: when updating everything check PE machine type

Let's never accidentally over-write foreign-arch PE binaries with native
ones.

Fixes: #33413
4 months agobootctl: be more careful when opening arbitrary files from ESP
Lennart Poettering [Fri, 20 Jun 2025 11:59:04 +0000 (13:59 +0200)] 
bootctl: be more careful when opening arbitrary files from ESP

Let's refuse all kind of weird stuff early.

As suggested here: https://github.com/systemd/systemd/pull/30418#pullrequestreview-2128220792

4 months agologind: fix boolean comparison 37907/head
Lennart Poettering [Thu, 19 Jun 2025 16:27:06 +0000 (18:27 +0200)] 
logind: fix boolean comparison

We cannot compare a boolean with a bit mask. This worked only by
accident, since MANAGER_IS_INHIBITED_CHECK_DELAY happened to be 1. But
we need to do this properly.

Fixes: #35565
4 months agologind: fix minor coding style issues
Lennart Poettering [Thu, 19 Jun 2025 16:26:54 +0000 (18:26 +0200)] 
logind: fix minor coding style issues

Fixes: #35565
4 months agotpm2: print clear log message in case of dictionary lockout mode (#37894)
Luca Boccassi [Thu, 19 Jun 2025 21:55:36 +0000 (22:55 +0100)] 
tpm2: print clear log message in case of dictionary lockout mode (#37894)

Fixes: #32260
4 months agoresolved: enforce RefuseRecordTypes= also in proxy mode (#37902)
Yu Watanabe [Thu, 19 Jun 2025 20:59:24 +0000 (05:59 +0900)] 
resolved: enforce RefuseRecordTypes= also in proxy mode (#37902)

Fixes: #36491
4 months agonspawn: --network-veth also works with unpriv nspawn
Lennart Poettering [Thu, 19 Jun 2025 16:13:20 +0000 (18:13 +0200)] 
nspawn: --network-veth also works with unpriv nspawn

(because we ask nsresourced for help)

Fixes: #36179
4 months agoresolved: make bypass tests work 37902/head
Lennart Poettering [Thu, 19 Jun 2025 16:28:16 +0000 (18:28 +0200)] 
resolved: make bypass tests work

It's not sufficient to append a DNS key to a packet, we must also update
the qdcount too. We got this right in most tests but didn#t here.
Moreover, we must extract the packet then to actually have a DnsQuestion
properly filled in.

Fix that. Without this the tests didn't test anything reasonable.

4 months agoresolved: honour RefuseRecordTypes= also in proxy mode
Lennart Poettering [Thu, 19 Jun 2025 15:50:40 +0000 (17:50 +0200)] 
resolved: honour RefuseRecordTypes= also in proxy mode

Fixes: #36491
4 months agoresolved: use dns_question_isempty() where appropriate
Lennart Poettering [Thu, 19 Jun 2025 15:50:02 +0000 (17:50 +0200)] 
resolved: use dns_question_isempty() where appropriate

4 months agoresolved: split out helper that determines on RefuseRecordTypes= match
Lennart Poettering [Thu, 19 Jun 2025 15:44:14 +0000 (17:44 +0200)] 
resolved: split out helper that determines on RefuseRecordTypes= match

4 months agoSeveral assorted cleanups (#37888)
Yu Watanabe [Thu, 19 Jun 2025 15:58:48 +0000 (00:58 +0900)] 
Several assorted cleanups (#37888)

4 months agocryptsetup: handle DA lockout/bad PIN properly 37894/head
Lennart Poettering [Thu, 19 Jun 2025 10:28:32 +0000 (12:28 +0200)] 
cryptsetup: handle DA lockout/bad PIN properly

Now that we have recognizable errors, let's print clear error messages
when we try to unlock a TPM slot. And in case of the token plugin
propagate this as ENOANO so that libcryptsetup recognizes this as bad
PIN. (ENOANO is documented as the error to return in that case)

Fixes: #32260
4 months agotpm2-util: recognize DA lockout mode and PIN failures properly
Lennart Poettering [Thu, 19 Jun 2025 10:26:45 +0000 (12:26 +0200)] 
tpm2-util: recognize DA lockout mode and PIN failures properly

When we create the policy session the previously passed PIN will be
checked. This means we'll see PIN errors here, in case the PIN is wrong
or if DA lockout mode has been triggered.

Recognize these two errors, and bubble up recognizable errors.

4 months agotest-bpf-firewall: use ASSERT_XYZ() and bpf_program_pin() 37888/head
Yu Watanabe [Wed, 18 Jun 2025 18:32:15 +0000 (03:32 +0900)] 
test-bpf-firewall: use ASSERT_XYZ() and bpf_program_pin()

4 months agoioprio-util: move from basic/ to shared/
Yu Watanabe [Wed, 18 Jun 2025 03:05:14 +0000 (12:05 +0900)] 
ioprio-util: move from basic/ to shared/

It is not used by libsystemd.

4 months agomissing_network: IPPROTO_MPTCP is already defined in linux/in.h
Yu Watanabe [Wed, 18 Jun 2025 01:34:06 +0000 (10:34 +0900)] 
missing_network: IPPROTO_MPTCP is already defined in linux/in.h

And the header is already included through (our implementation of)
netinet/in.h, hence we can safely drop the definition here.

4 months agosd-lldp: replace ETHERTYPE_LLDP with ETH_P_LLDP
Yu Watanabe [Wed, 18 Jun 2025 01:24:23 +0000 (10:24 +0900)] 
sd-lldp: replace ETHERTYPE_LLDP with ETH_P_LLDP

ETH_P_LLDP is defined in linux/if_ether.h.

4 months agoport write_env_file() to label_os_pre() + teach firstboot a bit of relabelling (...
Yu Watanabe [Thu, 19 Jun 2025 09:03:12 +0000 (18:03 +0900)] 
port write_env_file() to label_os_pre() + teach firstboot a bit of relabelling (#37869)

This is a clean-up, and also addresses some of the points of #37857.

4 months agotest-cpu-set-util: use ASSERT_XYZ() macros
Yu Watanabe [Tue, 17 Jun 2025 18:54:43 +0000 (03:54 +0900)] 
test-cpu-set-util: use ASSERT_XYZ() macros

4 months agoman: encourage the creation of empty machine-id instead of deleting it
Lukas Nykryn [Wed, 18 Jun 2025 11:33:25 +0000 (13:33 +0200)] 
man: encourage the creation of empty machine-id instead of deleting it

Current text hints that machine-id in template image should be empty
if the system is read-only. But most of the bare metal systems and
regular VMs have /etc read-only at this phase of boot.

4 months agofd-util: move cmsg_close_all() to socket-util.[ch]
Lennart Poettering [Wed, 18 Jun 2025 07:29:48 +0000 (09:29 +0200)] 
fd-util: move cmsg_close_all() to socket-util.[ch]

This call only makes sense on sockets, it's not a generic fd concept,
hence let's move this over.

4 months agotest: add test for systemd upgrade
Matteo Croce [Mon, 14 Apr 2025 14:32:47 +0000 (16:32 +0200)] 
test: add test for systemd upgrade

Add a basic test to check that systemd works after an upgrade

4 months agodirent-util: use getdents64() as is
Yu Watanabe [Mon, 9 Jun 2025 15:17:36 +0000 (00:17 +0900)] 
dirent-util: use getdents64() as is

This partially reverts e86a492ff08526e5adf85fa881c76f80adc3c84a.

The function getdents64() was introduced in glibc-2.30, and our baseline
on glibc is 2.31. Hence, we can assume the function always exists.
The posix_getdents() wrapper was introduced for compatibility with musl.
However, even the latest release of musl does not provide posix_getdents()
yet. Also, even with musl, by defining _LARGEFILE64_SOURCE, we can get
getdents64() and struct dirent64. Hence, the wrapper is anyway not
necessary.

4 months agomallinfo-util: assume mallinfo() exists
Yu Watanabe [Mon, 9 Jun 2025 15:39:38 +0000 (00:39 +0900)] 
mallinfo-util: assume mallinfo() exists

The check existed for musl. Let's remove it, as we explicitly request glibc.

While removing the check, this also drops generic_mallinfo, introduces
a tiny converter from struct mallinfo to struct mallinfo2 if mallinfo2()
does not exist, and renames mallinfo-util.h to malloc.h.

With this change, we can drop many ifdefs and casts in .c files.

4 months agosd-bus: several coding style cleanups (#37867)
Lennart Poettering [Wed, 18 Jun 2025 08:39:48 +0000 (10:39 +0200)] 
sd-bus: several coding style cleanups (#37867)

- replace `type *func()` -> `type* func()`,
- rename arguments for storing results,
- add several missing assertions.

4 months agoupdate TODO 37869/head
Lennart Poettering [Wed, 18 Jun 2025 08:29:20 +0000 (10:29 +0200)] 
update TODO

4 months agofirstboot: make sure labelling is enabled
Lennart Poettering [Wed, 18 Jun 2025 08:29:15 +0000 (10:29 +0200)] 
firstboot: make sure labelling is enabled

Preparation to address #37857.

4 months agotmpfiles: fix symlink creation when replacing
Lennart Poettering [Wed, 18 Jun 2025 08:23:42 +0000 (10:23 +0200)] 
tmpfiles: fix symlink creation when replacing

When we remove an existing inode in order to create a symlink we need to
create the symlink via a pinned directory again, instead of using an
absolute path, otherwise this will not work in the --root= case.

Let's fix this, and switch this over to symlinkat_atomic_full().

4 months agofirstboot: use WRITE_STRING_FILE_LABEL more
Lennart Poettering [Tue, 17 Jun 2025 13:09:34 +0000 (15:09 +0200)] 
firstboot: use WRITE_STRING_FILE_LABEL more

Let's explicitly label 3 key files we generate in systemd-firstboot.

Addresses some more of #37857.

4 months agoenv-file: port write_env_file() to label_ops_pre()
Lennart Poettering [Tue, 17 Jun 2025 12:58:36 +0000 (14:58 +0200)] 
env-file: port write_env_file() to label_ops_pre()

Let's make more use of label_ops_pre()/label_ops_post(), and replace
write_env_file_label() by a flag to write_env_file().

This simplifies and normalizes the code.

This also makes one relevant change: it sets the new
WRITE_ENV_FILE_LABEL flag in firstboot.c when we write locale.conf,
where we previously did not (but should have). This should address one
detail of #37857.

4 months agofs-util: replace symlink_atomic_full_label() by a flag to symlinkat_atomic_full()
Lennart Poettering [Wed, 18 Jun 2025 08:14:09 +0000 (10:14 +0200)] 
fs-util: replace symlink_atomic_full_label() by a flag to symlinkat_atomic_full()

More porting work to label_ops_pre()/label_ops_post()

This also enables labelling of the /etc/localtime symlink in
systemd-firstboot, which should address one small facet of #37857

4 months agosd-lldp: several improvements (#37845)
Yu Watanabe [Tue, 17 Jun 2025 19:58:04 +0000 (04:58 +0900)] 
sd-lldp: several improvements (#37845)

This makes
- sd-lldp-tx not send machine ID as chassis ID, but use application
specific machine ID,
- sd-lldp-tx emit vlan ID if it is running on a vlan interface,
- Describe() DBus method also reply LLDP configurations,
- io.systemd.Network.GetLLDPNeighbors varlink method provides vlan ID,
if received.

Closes #37613.

4 months agoresolved: Tweak link-local addresses relevancy
George Tsiamasiotis [Tue, 17 Jun 2025 12:30:41 +0000 (15:30 +0300)] 
resolved: Tweak link-local addresses relevancy

We now consider link-local addresses routable when we have configured
unicast link-local dns servers. This allows creating the DNS scope, even
when the interface doesn't get a routable address.

4 months agobus-util: coding style cleanups 37867/head
Yu Watanabe [Tue, 17 Jun 2025 14:52:11 +0000 (23:52 +0900)] 
bus-util: coding style cleanups

- replace `type *func()` -> `type* func()`,
- rename arguments for storing results.

4 months ago sd-bus: coding style cleanups
Yu Watanabe [Tue, 17 Jun 2025 13:39:09 +0000 (22:39 +0900)] 
 sd-bus: coding style cleanups

- replace `type *func()` -> `type* func()`,
- rename arguments for storing results,
- add several missing assertions.

4 months agosd-bus: BusMessageContainer.begin is always zero in sd_bus_message_open_container()
Yu Watanabe [Tue, 17 Jun 2025 15:21:11 +0000 (00:21 +0900)] 
sd-bus: BusMessageContainer.begin is always zero in sd_bus_message_open_container()

4 months agotest-network: compare LLDP sender and receiver information 37845/head
Yu Watanabe [Sun, 15 Jun 2025 02:36:01 +0000 (11:36 +0900)] 
test-network: compare LLDP sender and receiver information

4 months agonetwork: also include information about LLDP sender in reply for Describe() method
Yu Watanabe [Sun, 15 Jun 2025 01:13:25 +0000 (10:13 +0900)] 
network: also include information about LLDP sender in reply for Describe() method

Addresses https://github.com/systemd/systemd/pull/37845#issuecomment-2973257825.

4 months agosd-lldp-tx: introduce sd_lldp_tx_describe() to dump current settings
Yu Watanabe [Sun, 15 Jun 2025 01:04:37 +0000 (10:04 +0900)] 
sd-lldp-tx: introduce sd_lldp_tx_describe() to dump current settings

4 months agoboot: fix typo
Yu Watanabe [Tue, 17 Jun 2025 16:47:45 +0000 (01:47 +0900)] 
boot: fix typo

Follow-up for cab9c7b5a42effa8a45611fc6b8556138c869b5f.

4 months agosd-lldp-rx: also dump received MUD URL
Yu Watanabe [Sun, 15 Jun 2025 01:52:16 +0000 (10:52 +0900)] 
sd-lldp-rx: also dump received MUD URL

4 months agonetwork/lldp-tx: also emit VLAN ID
Yu Watanabe [Sun, 15 Jun 2025 01:38:38 +0000 (10:38 +0900)] 
network/lldp-tx: also emit VLAN ID

4 months agosd-lldp-tx: allow to emit VLAN ID
Yu Watanabe [Sun, 15 Jun 2025 01:35:18 +0000 (10:35 +0900)] 
sd-lldp-tx: allow to emit VLAN ID

4 months agosd-lldp-tx: append capabilities before MUD URL
Yu Watanabe [Sun, 15 Jun 2025 01:20:12 +0000 (10:20 +0900)] 
sd-lldp-tx: append capabilities before MUD URL

No functional change, but let's append vendor specific informations
after others to sort the TLVs with their type.

4 months agosd-lldp-tx: do not expose machine ID by default
Yu Watanabe [Sat, 14 Jun 2025 19:03:26 +0000 (04:03 +0900)] 
sd-lldp-tx: do not expose machine ID by default

Previously, systemd-networkd sent machine ID as chassis ID.
Let's use application specific machine ID.

This is a kind of backward compat breaking. Hence, this also introduces
the support of $SD_LLDP_SEND_MACHINE_ID environment variable.

Closes #37613.

4 months agocgroup-util: Always open cgroupv2 attribute files in O_NONBLOCK mode
Daan De Meyer [Tue, 22 Apr 2025 08:36:21 +0000 (10:36 +0200)] 
cgroup-util: Always open cgroupv2 attribute files in O_NONBLOCK mode

As explained in https://lore.kernel.org/all/20250419183545.1982187-1-shakeel.butt@linux.dev/,
writing to memory.max or memory.high triggers synchronous memory reclaim
if the limit is lowered. This can end up taking nonnegligible amounts
of time, completely blocking pid1 from doing any other work while the
reclaim is ongoing.

To address this problem, the kernel going to add O_NONBLOCK semantics
to memory.max and memory.high. If the file is opened with O_NONBLOCK,
the synchronous memory reclaim is skipped and only triggered later
without blocking the process writing the file. Let's make sure we make
use of this by opening cgroupv2 attribute files with O_NONBLOCK.

We opt to do this for all cgroupv2 attribute files, to make sure that
if the same problem happens elsewhere in the future and is fixed in the
same way, we immediately take advantage of that fix without having to
make changes in systemd as well. We probably never want to block when
writing cgroupv2 attributes and any cases where we do want to block should
indicate so explicitly instead of blocking by default.

4 months agocore/timer: Introduce RandomOffsetSec= knob (#36437)
Lennart Poettering [Tue, 17 Jun 2025 14:05:12 +0000 (16:05 +0200)] 
core/timer: Introduce RandomOffsetSec= knob (#36437)

This is like RandomDelaySec, but it doesn't reset whenever the manager
restarts.

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