Commit Graph
89484 Commits
Author SHA1 Message Date
Lennart Poettering b3bad27735 test: cover hostnamectl tag editing and the new hostnamed Varlink methods
Add two testcases to TEST-71-HOSTNAME:

 - testcase_tags exercises the new "hostnamectl tags" +/- prefix syntax
   (add/remove, idempotency, the no-mixing rule, invalid input), the
   AddAndRemoveTags() D-Bus method and the SetTags() Varlink method
   (set/add/remove, explicit empty set, current-list basis).

 - testcase_varlink_setters exercises the new SetHostname(),
   SetStaticHostname(), SetPrettyHostname(), SetIconName(), SetChassis(),
   SetDeployment() and SetLocation() Varlink methods, including resetting
   values via null and rejection of invalid input.
2026-06-01 10:56:16 +02:00
Lennart Poettering 4a05010532 rules: auto-tag host from the SYSTEMD_MACHINE_TAG udev property
When a device carries a SYSTEMD_MACHINE_TAG udev property, tag it for
systemd and pull in systemd-machine-tag@<tag>.service, which adds the
given tag to the host's machine tags. In other words, attaching the
property to a device makes the host auto-tag itself with the specified
machine tag.
2026-06-01 10:56:16 +02:00
Lennart Poettering 432f54118d units: add systemd-machine-tag@.service template
Add a service template that adds the machine tag given as its instance
name to the host's machine tags. Whenever an instance is pulled in, the
tag is added; the operation is idempotent.

It talks to hostnamed over Varlink (which is socket-activated), so it
works very early at boot, before the system bus is up. It is ordered
after local-fs.target so that /etc/machine-info can be written, requires
hostnamed's socket and the local filesystems to be available, and does
not run in the initrd.
2026-06-01 10:56:16 +02:00
Lennart Poettering 775c721328 hostnamectl: allow incrementally adding/removing tags
Teach the "tags" verb to accept arguments prefixed with '+' or '-': a
'+'-prefixed argument adds all of its (colon-separated) tags to the
configured list, a '-'-prefixed one removes them, mapping onto the new
AddAndRemoveTags() D-Bus method. The prefix applies to the whole
argument, so e.g.

    hostnamectl tags +foo:bar -quux:ooo

adds foo and bar and removes quux and ooo. Plain (replace) and prefixed
(add/remove) arguments may not be mixed in one invocation.
2026-06-01 10:56:16 +02:00
Lennart Poettering 8b5d45278b hostnamed: clean up and tighten rules on valid machine info settings
Let's refactor things so that there's a separate xyz_is_valid() call for
each field, and make it mostly wrap string_is_safe().

This tightens the rules on some fields, mostly to refuse newlines and
some other things.
2026-06-01 10:56:16 +02:00
Lennart Poettering a6ccfb780a hostnamed: handle SIGRTMIN+18 and memory pressure
Wire up the usual SIGRTMIN+18 control signal handler and a memory
pressure event source in hostnamed's event loop, like our other
long-running daemons, so it reacts to memory pressure (e.g. by trimming
its heap) and supports the common debug/control commands. Watchdog
support via sd_event_set_watchdog() was already in place.
2026-06-01 10:56:16 +02:00
Lennart Poettering 0d791bc259 hostnamed: add full introspection comments to io.systemd.Hostname
Add a SD_VARLINK_FIELD_COMMENT for every field of the Describe() method
that still lacked one, plus an interface comment and a symbol comment for
the Describe() method itself, so that introspecting io.systemd.Hostname
produces fully documented output.
2026-06-01 10:56:16 +02:00
Lennart Poettering e3f453b3e9 hostnamed: add Varlink equivalents for the hostname/machine-info setters
Add SetHostname(), SetStaticHostname(), SetPrettyHostname(), SetIconName(),
SetChassis(), SetDeployment() and SetLocation() to the io.systemd.Hostname
Varlink interface, mirroring the existing D-Bus methods of the same names.

Each takes a single nullable string "newValue" (null clears/resets the
value; the method name itself makes clear what the value is) plus the usual
allowInteractiveAuthentication polkit input, and applies the same
validation, polkit actions and /etc/hostname resp. /etc/machine-info
persistence as its D-Bus counterpart. The five machine-info setters share
a common helper. The hostname validator is reused from the D-Bus path,
translating its INVALID_ARGS error into a Varlink invalid-parameter error.

Being reachable over the socket-activated Varlink socket, these work in
early boot before the system bus is up.
2026-06-01 10:56:16 +02:00
Lennart Poettering 0f790ea87f hostnamed: add SetTags() Varlink method
Add a SetTags() method to the io.systemd.Hostname Varlink interface that
combines what the D-Bus SetTags() and AddAndRemoveTags() methods do into
a single call: it takes three tag lists, 'set', 'add' and 'remove'. If
'set' is supplied the tag list is first reset to it (an explicit empty
array clears it), otherwise the current tags are used as basis; then the
'add' tags are added and the 'remove' tags are dropped.

The set arithmetic is shared with the D-Bus AddAndRemoveTags() handler
via machine_tags_add_remove().

Being reachable over Varlink (and hence socket-activatable without the
system bus) this is usable very early at boot, before dbus-daemon is up.
2026-06-01 10:56:16 +02:00
Lennart Poettering 3eb956700f hostnamed: add AddAndRemoveTags() D-Bus method
Add a new D-Bus method on org.freedesktop.hostname1 that incrementally
updates the machine tags instead of replacing the whole list: it takes
two string arrays, one of tags to add and one of tags to remove, and
stores (current ∪ add) \ remove.

This avoids the read-modify-write race that clients would otherwise hit
when several of them each manage a subset of the host's tags.

Factor the tag persistence and the write-error-to-D-Bus-error mapping out
of method_set_tags() into helpers, and add a machine_tags_add_remove()
helper for the set arithmetic, all to be shared with further callers.
2026-06-01 10:56:16 +02:00
Lennart Poettering f45e7b6f8a hostnamed: move error logging into context_write_data_{static_hostname|machine_info}()
This is preparation for adding Varlink calls for these operations, as it
makes sense to unify log msg generation in one place (i.e. the callee)
rather than in two (the two callers, i.e. the D-Bus and the Varlink
interfaces).
2026-06-01 10:56:16 +02:00
Lennart Poettering 8b9d503471 strv: add strv_remove_strv()
This is to strv_remove() what strv_extend_strv() is to strv_extend()
2026-06-01 10:56:15 +02:00
Luca Boccassi 8ff7a5cd09 journalctl: don't assert on MESSAGE field without "MESSAGE=" prefix
sd_journal_get_data() can return a MESSAGE data object whose payload does
not start with "MESSAGE=", e.g. when the journal file is corrupted. Instead
of aborting the whole process, log and skip over such an entry like we do for
other bad/missing fields.

[   87.287390] post.sh[1619]: + journalctl -q -o short-monotonic --grep 'didn'\''t pass validation'
[   87.287844] post.sh[1620]: + grep -v test-varlink-idl
[   87.325676] post.sh[1619]: Assertion 'message = startswith(message, "MESSAGE=")' failed at src/journal/journalctl-show.c:261, function show(). Aborting.

 #0  0x00007fb47b49a29c n/a (libc.so.6 + 0x9a29c)
 #1  0x00007fb47b43e7d0 raise (libc.so.6 + 0x3e7d0)
 #2  0x00007fb47b425681 abort (libc.so.6 + 0x25681)
 #3  0x00007fb47b8a1ace log_assert_failed (libsystemd-shared-261~rc2.so + 0xa1ace)
 #4  0x000055f8e1ef9ddb show (journalctl + 0xcddb)
 #5  0x000055f8e1efa6ee action_show (journalctl + 0xd6ee)
 #6  0x000055f8e1ef3c20 run (journalctl + 0x6c20)
 #7  0x00007fb47b427741 n/a (libc.so.6 + 0x27741)
 #8  0x00007fb47b427879 __libc_start_main (libc.so.6 + 0x27879)
 #9  0x000055f8e1ef4915 _start (journalctl + 0x7915)

Co-developed-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 23:02:25 +01:00
Luca Boccassi 7bd3a80122 Translations update from Fedora Weblate (#42403)
Translations update from [Fedora
Weblate](https://translate.fedoraproject.org) for
[systemd/main](https://translate.fedoraproject.org/projects/systemd/main/).



Current translation status:

![Weblate translation
status](https://translate.fedoraproject.org/widget/systemd/main/horizontal-auto.svg)
2026-05-31 11:55:15 +01:00
Fco. Javier F. Serrador 341bf1cceb po: Translated using Weblate (Spanish)
Currently translated at 100.0% (285 of 285 strings)

Co-authored-by: Fco. Javier F. Serrador <fserrador@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/es/
Translation: systemd/main
2026-05-31 10:02:00 +00:00
joo es d4b27821fa po: Translated using Weblate (Arabic)
Currently translated at 100.0% (285 of 285 strings)

Co-authored-by: joo es <jonnyse@users.noreply.translate.fedoraproject.org>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/ar/
Translation: systemd/main
2026-05-31 10:01:59 +00:00
Rafael Fontenelle 11f9189982 po: Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (285 of 285 strings)

Co-authored-by: Rafael Fontenelle <rafaelff@gnome.org>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/pt_BR/
Translation: systemd/main
2026-05-31 10:01:58 +00:00
Anders Jonsson d5fb757a8b po: Translated using Weblate (Swedish)
Currently translated at 100.0% (285 of 285 strings)

Co-authored-by: Anders Jonsson <anders.jonsson@norsjovallen.se>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/sv/
Translation: systemd/main
2026-05-31 10:01:57 +00:00
Luna Jernberg 73a22deca1 po: Translated using Weblate (Swedish)
Currently translated at 100.0% (285 of 285 strings)

Co-authored-by: Luna Jernberg <droidbittin@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/sv/
Translation: systemd/main
2026-05-31 10:01:56 +00:00
Ettore Atalan b112b72cab po: Translated using Weblate (German)
Currently translated at 99.2% (283 of 285 strings)

Co-authored-by: Ettore Atalan <atalanttore@googlemail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/de/
Translation: systemd/main
2026-05-31 10:01:55 +00:00
Marek Adamski f08a4d354c po: Translated using Weblate (Polish)
Currently translated at 100.0% (285 of 285 strings)

Co-authored-by: Marek Adamski <maradam@users.noreply.translate.fedoraproject.org>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/pl/
Translation: systemd/main
2026-05-31 10:01:55 +00:00
김인수 8196a11fd4 po: Translated using Weblate (Korean)
Currently translated at 100.0% (285 of 285 strings)

Co-authored-by: 김인수 <simmon@nplob.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/ko/
Translation: systemd/main
2026-05-31 10:01:54 +00:00
Yuri Chornoivan 07ad7c58a6 po: Translated using Weblate (Ukrainian)
Currently translated at 97.1% (277 of 285 strings)

Co-authored-by: Yuri Chornoivan <yurchor@ukr.net>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/uk/
Translation: systemd/main
2026-05-31 10:01:53 +00:00
Américo Monteiro c4d5d1f89a po: Translated using Weblate (Portuguese)
Currently translated at 100.0% (285 of 285 strings)

Co-authored-by: Américo Monteiro <a_monteiro@gmx.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/pt/
Translation: systemd/main
2026-05-31 10:01:52 +00:00
sykikxo 4dfae2dc0f hwdb: add Infinix Y3 Max YL-613 keys
Map the Power Boost key (top-right corner, scancode 0x64) to KEY_PROG1.
Map the Touchpad Toggle key (Fn+F8, scancode 0x76) to KEY_F21.

Verified working via evtest:

Event: type 4 (EV_MSC), code 4 (MSC_SCAN), value 64
Event: type 1 (EV_KEY), code 148 (KEY_PROG1), value 1

Event: type 4 (EV_MSC), code 4 (MSC_SCAN), value 76
Event: type 1 (EV_KEY), code 206 (KEY_F21), value 1

DMI: svnInfinix:*pnY3Max:*
AT keyboard scancodes: 0x64, 0x76 (set 2)
2026-05-31 10:16:53 +01:00
sykikxo 3bc3b418c8 hwdb: add Infinix Y3 Max YL-613 touchpad properties 2026-05-31 10:15:26 +01:00
Hosted Weblate e1a22b4f15 po: Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/
Translation: systemd/main
2026-05-30 12:34:04 +01:00
Luca Boccassi 6b0492096e libfido2: enable translations for Plymouth strings (#42389)
- This synchronize the state for existing stuff.
- Enable translations for Plymouth interaction strings.
- Translate them in French as an example.

Fixes #42384.
2026-05-30 10:38:46 +01:00
Raito Bezarius 62badf869b po/fr: translate FIDO2-related strings for Plymouth
Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
2026-05-30 00:20:00 +02:00
Raito Bezarius 41a7be06ca po: regenerate PO files
Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
2026-05-30 00:20:00 +02:00
Raito Bezarius 8c46cefa02 po: regenerate POT files
Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
2026-05-30 00:20:00 +02:00
Raito Bezarius 45164c57f8 shared/libfido2: translate Plymouth interaction strings
Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
2026-05-30 00:20:00 +02:00
Raito Bezarius d5876c1e35 po: regenerate translations
This changes some lines and add translations related to resolved
policies and sysupdate policies.

Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
2026-05-29 23:54:20 +02:00
Luca Boccassi 3db89cbf0e hwdb: reject overlong fnmatch key instead of passing NULL to fnmatch()
When the accumulated trie key exceeds the fixed-size line buffer,
linebuf_get() returns NULL. trie_fnmatch_f() passed that NULL straight
into fnmatch() as the pattern, causing a SIGSEGV on a crafted hwdb.bin
(reachable now that recursion is capped rather than overflowing the
stack first). Treat the NULL like the other corruption checks and
return -EBADMSG.

Follow-up for 73fea38cf1

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

Co-developed-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-29 17:21:31 +01:00
Daan De Meyer 6ec161c5b9 ssh-proxy: Default to root user
When ssh-ing into a VM, you generally do not want to log
in as your user from the host. Let's default to the root
user unless a user is explicitly specified.
2026-05-29 16:13:29 +02:00
Daan De Meyer 0a63318420 ssh-generator: Make sure sshd can always read the authorized keys file
sshd reads AuthorizedKeysFile after dropping to the authenticating user's UID, so the
0400 credential file under %d/ is unreadable for non-root users. Materialize a 0444
copy in a RuntimeDirectory so the ephemeral key works for any user. */
2026-05-29 16:12:45 +02:00
Yu Watanabe 20572a8938 units: drop Before=sockets.target from networkd resolve hook
Otherwise, it introduces cyclic dependencies:
```
systemd[1]: sockets.target: Found ordering cycle:
    systemd-networkd-resolve-hook.socket/start after network-pre.target/start after
    iptables.service/start after basic.target/start after sockets.target/start -
    after systemd-networkd-resolve-hook.socket
systemd[1]: sockets.target: Job systemd-networkd-resolve-hook.socket/start deleted
    to break ordering cycle starting with sockets.target/start
```

Follow-up for 37adb410a2.
Fixes #42353.
2026-05-29 04:34:30 +09:00
Yu Watanabe f8fbee74ba network: mention interface name in polkit details
Closes #42274.
2026-05-29 04:34:18 +09:00
jeffhuang 0c5cba6420 pe-binary: bound section data against file size, cap UKI zero-padding hash, validate optional header size
A hostile but structurally valid 382-byte PE32+ "EFI application" with a
single section whose VirtualSize is ~4 GiB and SizeOfRawData is 0 drives
uki_hash() into ~4.17 M iterations of SHA-256 over 1024 bytes of zeros
— wedging the parser for >10 s. Nine more slow-units share the same
shape. A separate MSAN finding from the new fuzzer (CIFuzz, memory
sanitizer) shows pe_load_headers() reading uninitialised heap memory
when SizeOfOptionalHeader is too small to actually contain
NumberOfRvaAndSizes.

Three tightenings in src/shared/pe-binary.c:

  1. In pe_load_sections, reject sections whose PointerToRawData +
     SizeOfRawData exceeds the actual file size. Raw section data must
     fit inside the file; this is the parser-wide invariant
     pe_hash / uki_hash / pe_read_section_data rely on.

  2. In uki_hash, cap the (VirtualSize - SizeOfRawData) zero-padding
     hash loop at 64 MiB. Real UKIs do not pad sections with tens of
     MiB of zero-equivalent data; anything above this cap is a
     malformed PE.

  3. In pe_load_headers, reject a PE whose SizeOfOptionalHeader is too
     small to cover up to NumberOfRvaAndSizes. Without this guard the
     subsequent size-mismatch check reads uninitialised optional-header
     bytes, caught by MSAN under CIFuzz.

Add the 382 B canonical reproducer (plus two structural siblings) and
the MSAN reproducer to test/fuzz/fuzz-pe-binary/. Also add a libFuzzer
harness in src/fuzz/fuzz-pe-binary.c and unit tests in
src/test/test-pe-binary.c that exercise each fix branch in isolation.
The 64 MiB hash boundary test is gated behind SYSTEMD_SLOW_TESTS so it
doesn't slow down emulated-arch CI.

This is a robustness fix, not a security fix: PE binaries consumed by
bootctl / systemd-stub / pcrlock / kernel-install / systemd-measure are
already trusted and signed at the consumer side, so the worst pre-fix
behaviour is wasted CPU on a UKI install / measure / inspect call.

Closes #42344.

Reported-by: AI-assisted libFuzzer campaign
Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-29 04:30:48 +09:00
Zbigniew Jędrzejewski-Szmek 97a0ec135b Downgrade warning about missing libseccomp
We currently log at warning level:
/usr/lib/systemd/system/systemd-udevd.service:56: System call bpf cannot be
  resolved as libseccomp is not available, ignoring: Operation not supported

In the initrd, or in minimal installations, not installing libseccomp is
reasonable, depending on various other choices. We shouldn't make fuss
about this.

C.f. https://bugzilla.redhat.com/show_bug.cgi?id=2463540.
2026-05-29 01:09:19 +09:00
Zbigniew Jędrzejewski-Szmek 5991f0b861 profile.d: add instructions how to deactivate 80-systemd-osc-context.sh
This was requested in https://github.com/systemd/systemd/issues/42333.
Indeed, this integration is using three levels of systemd magick, so
doing this correctly is not obvious. Let's include specific instructions
to help people for whom this integration is causing problems.
2026-05-29 01:08:07 +09:00
Lennart Poettering eb3799a373 fd-util: add wildcard_fd_is_valid() helper and use it tree-wide
Many *at()-style helpers accept a directory fd that may be either a
regular, valid fd (>= 0) or one of the special AT_FDCWD/XAT_FDROOT
wildcard values, and open-code that check in their assertions. Add a
wildcard_fd_is_valid() helper for it and use it tree-wide.
2026-05-28 13:33:08 +01:00
Malformed C d35fa257eb nspawn: join network namespace before cloning user namespace
When both --private-users and --network-namespace-path are
specified, systemd-nspawn fails to start with "Operation not
permitted" during the setns() call.

This occurs because of the following execution sequence:
1. The outer child calls raw_clone() with CLONE_NEWUSER to create
   the new user namespace.
2. The inner child is spawned inside this new user namespace.
3. The inner child then attempts to call setns() to join the
   external network namespace.

Because the inner child is already running inside
the restricted user namespace, the kernel rejects
the setns() call to join a network namespace owned by
a different (host/more privileged) user namespace.

Fix this by moving the setns() call to the outer child, executing it
just before the raw_clone() call. This ensures the network namespace
is joined while the process still has the necessary privileges, which
also aligns with the inner child's expectation that the network
namespace is already set up upon entry.
2026-05-28 16:53:23 +09:00
Yu Watanabe 68af89e619 meson: move simple test entries 2026-05-28 16:44:29 +09:00
Yu Watanabe 96c2f88ce5 fuzz-hwdb: shorten name of reproducers
The file name of the reproducer is used for test name, and the test name
is messed when the file name is too long.
Also, the mentioned issues are not regressions, but long standing bugs.

Follow-up for 73fea38cf1.
2026-05-28 16:44:16 +09:00
Daan De Meyer d4aa9dcda5 test: stop using PATH_TEST()/QMP_TEST() macro to make not confuse gcc/gcov/lcov (#42338) 2026-05-28 09:33:22 +02:00
jeffhuang 73fea38cf1 hwdb: bounds-check trie offsets against the mmap before dereferencing
Fixes a family of OOB reads in the trie walker where attacker-controlled
offsets are loaded from a (possibly hostile) hwdb.bin and added to
hwdb->map without first checking that the resulting pointer stays inside
the mapping. Crash sites:

  - trie_fnmatch_f               sd-hwdb.c:187   (#42340)
  - trie_search_f                sd-hwdb.c:233   (#42341)
  - trie_children_cmp_f /bsearch sd-hwdb.c:94    (#42342)
  - hwdb_add_property            sd-hwdb.c:121   (#42343)
  - trie_node_from_off (UBSAN)   sd-hwdb.c:83
  - trie_fnmatch_f stack overflow on cyclic children (CIFuzz finding)

Commit b45a897edc ("hwdb: reject out-of-bounds fnmatch prefixes")
plugged the first site only at the prefix_off-content level, but the
crash on the read of node->prefix_off itself still happens when node is
already OOB. This is the structural fix: a single hwdb_at() helper
validates that [off, off + size) lies inside the mapping, and
trie_node_from_off() / trie_string() return NULL on OOB; every caller
treats the result as nullable and surfaces -EBADMSG.

trie_fnmatch_f() additionally caps its recursion depth at 2048; without
the cap a corrupt trie whose child offsets form a cycle (or just a deep
linear chain) drives the parser into stack-overflow rather than
returning -EBADMSG (caught by CIFuzz address sanitizer on this branch).

Additions:

  - A fuzz-hwdb libFuzzer harness that drives sd_hwdb_new_from_path,
    sd_hwdb_get, sd_hwdb_seek, and sd_hwdb_enumerate on attacker bytes.
  - Five hand-crafted unit tests in test-sd-hwdb.c (one per crash
    bucket, plus the cyclic-trie recursion case) that build a malformed
    in-memory hwdb.bin and assert -EBADMSG rather than SIGSEGV /
    stack-overflow.
  - Regression corpus files under test/fuzz/fuzz-hwdb/ pinning each
    fixed bucket, including the CIFuzz stack-overflow reproducer.

Closes #42340.
Closes #42341.
Closes #42342.
Closes #42343.

Reported-by: AI-assisted libFuzzer campaign
Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 15:05:24 +09:00
Luca Boccassi 6f31db9b07 test-oomd: drop racy last_had_mem_reclaim assertion
test_oomd_cgroup_context_acquire_and_insert sets c1->pgscan = UINT64_MAX
and c1->last_had_mem_reclaim = 888 before re-inserting via
oomd_insert_cgroup_context(h1, h2, cgroup), then asserts that c2 carries
over last_had_mem_reclaim == 888.

The assumption was that, because c1->pgscan (which becomes c2->last_pgscan)
is UINT64_MAX and is therefore strictly greater than the freshly-acquired
c2->pgscan, oomd_pgscan_rate() in oomd_insert_cgroup_context() would
return 0 and leave last_had_mem_reclaim untouched. But the function
treats last_pgscan > pgscan as "cgroup was recreated", resets last_pgscan
to 0, and returns pgscan - 0 == pgscan. So when the kernel records any
non-zero pgscan on the live cgroup of the test unit, the rate is > 0 and
last_had_mem_reclaim is overwritten with now(CLOCK_MONOTONIC).

From src/oom/oomd-util.c:

    uint64_t oomd_pgscan_rate(const OomdCGroupContext *c) {
            [...]
            last_pgscan = c->last_pgscan;
            if (c->last_pgscan > c->pgscan) {
                    log_debug("Last pgscan %"PRIu64" greater than current pgscan %"PRIu64" for %s. Using last pgscan of zero.",
                                    c->last_pgscan, c->pgscan, c->path);
                    last_pgscan = 0;
            }
            return c->pgscan - last_pgscan;
    }

    int oomd_insert_cgroup_context(Hashmap *old_h, Hashmap *new_h, const char *path) {
            [...]
            if (oomd_pgscan_rate(curr_ctx) > 0)
                    curr_ctx->last_had_mem_reclaim = now(CLOCK_MONOTONIC);

Under sanitizers the test can be slow enough that the kernel scans the
test service cgroup at least once between the two acquisitions, which
triggers the failure:

    [ 1898.159455] test-oomd-util[2606]: /* test_oomd_cgroup_context_acquire_and_insert */
    [ 1898.161247] test-oomd-util[2606]: Last pgscan 18446744073709551615 greater than current pgscan 2 for /system.slice/test-oomd-util.service. Using last pgscan of zero.
    [ 1898.161330] test-oomd-util[2606]: src/oom/test-oomd-util.c:322: Assertion failed: Expected "c2->last_had_mem_reclaim == 888u", but 1898161250 != 888

(1898161250 matches the monotonic timestamp of the log line, confirming
that last_had_mem_reclaim was overwritten with now(CLOCK_MONOTONIC).)

The propagation of last_had_mem_reclaim is already covered
deterministically by TEST(oomd_update_cgroup_contexts_between_hashmaps),
which builds OomdCGroupContext structs directly with matching pgscan
values so that oomd_pgscan_rate() returns exactly 0. So just drop the
racy setup and assertion here.

Follow-up for df637ede7b

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

Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 15:01:43 +09:00
Luca Boccassi 004401fd06 resolve: validate short RSA DNSKEY blobs
Reject malformed RSA DNSKEY data before reading the extended exponent
header, and add a regression test.

Co-developed-by: GitHub Copilot (GPT 5.5) <copilot@github.com>
2026-05-28 15:00:51 +09:00
Yu Watanabe 071493c725 test-pressure: set timeout to make not wait forever
If this runs on a slow or busy machine, then we may not get enough
pressure to trigger the event sources. In such case, the test does not
finish. It is problematic when the test is _not_ run with 'meson test',
e.g. debian/ubuntu CIs.

Let's introduce a timeout for each event loop, and skip test cases
gracefully.
2026-05-27 21:34:04 +01:00