Commit Graph
82290 Commits
Author SHA1 Message Date
Yu Watanabe fe3ada076e cpu-set-util: introduce config_parse_cpu_set()
Then, make parse_cpu_set() as a tiny wrapper of it.

Note, previously when an invalid CPU range, e.g. "3-0", is specified,
we ignore the range but allocate an empty set. But, with this commit,
now the conf parser simply ignore it without no side effect.
This potentially changes behavior of a system with such invalid setting,
but the change should be favorable for consistency with other parsers.
2025-06-24 00:20:20 +09:00
Yu Watanabe 0b9ae2d303 core/load-fragment: rename config_parse_allowed_cpuset() -> config_parse_unit_cpu_set()
Then, use it in other conf parsers.
With this change, now NUMAMask= setting accepts unit specifiers.
2025-06-24 00:20:20 +09:00
Yu Watanabe 01eb1ce19b cpu-set-util: drop unused cpu_set_free() 2025-06-24 00:20:20 +09:00
Yu Watanabe 16069d753e udev/net: several cleanups for config_parse_rps_cpu_mask()
- Previously, `LinkConfig.rps_cpu_mask == NULL` indicates setting RPS
  will be skipped, but now make the condition is changed to
  `LinkConfig.rps_cpu_mask.set == NULL`. Then, we can avoid allocating
  CPUSet when something configured.
- When "disable" or "all", now allocate a temporal object, and then
  replace with it.

No functional change, just refactoring.
2025-06-24 00:20:20 +09:00
Yu Watanabe 296fe3d511 cpu-set-util: rename cpu_set_reset() -> cpu_set_done()
This also introduces cpu_set_done_and_replace().

No functional change, just refactoring.
2025-06-24 00:20:20 +09:00
Yu Watanabe f4093f43fb cpu-set-util: rename cpu_set_add_all() and cpu_mask_add_all()
This renames
- cpu_set_add_all() -> cpu_set_add_set(),
- cpu_mask_add_all() -> cpu_set_add_all().

No functional change, just refactoring.
2025-06-24 00:20:20 +09:00
Yu Watanabe 168351eee7 core,test: use parse_cpu_set()
As it is defined as
```
static inline int parse_cpu_set(const char *rvalue, CPUSet *cpu_set){
        return parse_cpu_set_full(rvalue, cpu_set, false, NULL, NULL, 0, NULL);
}
```
2025-06-24 00:20:20 +09:00
Yu Watanabe c4afb3c3e3 cpu-set-util: several cleanups for cpu_set_{from,to}_dbus()
- rename arguments,
- use SET_BIT() and BIT_SET() macros,
- explicitly (re)alloc before setting bits.

No functional change, just refactoring.
2025-06-24 00:20:20 +09:00
Yu Watanabe 8de95eafa1 cpu-set-util: several cleanups for cpu_set_realloc(), cpu_set_add() and friends
- introduce CPU_SET_MAX_NCPU and check overflow several more places,
- use GREEDY_REALLOC0(),
- introduce cpu_set_add_range() helper function,
- explicitly (re)alloc first before setting multiple bits.

No functional change, just refactoring.
2025-06-24 00:20:20 +09:00
Yu Watanabe df77ec5d3a exec-invoke: modernize exec_context_cpu_affinity_from_numa()
- always assign 'ret' on success,
- do not modify previous assignment of 'ret', and simply overwrite it.

No functional change, just refactoring.
2025-06-24 00:20:20 +09:00
Yu Watanabe 2d4613427e cpu-set-util: several cleanups for cpu_set_to_string() and cpu_set_to_range_string()
- Add missing assertions.
- Replace GREEDY_REALLOC() + sprintf() with strextendf_with_separator().
2025-06-24 00:20:20 +09:00
Yu Watanabe df04987af2 cpu-set-util: make cpu_set_to_mask_string() work with an empty cpu set
This also make it use strextendf_with_separator() and SET_BIT().

Fixes CID#1611618.
2025-06-24 00:20:20 +09:00
Valentin David 0dc39dffbd 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.
2025-06-23 15:32:11 +02:00
Lennart Poettering fa34fda2eb update TODO 2025-06-23 14:48:09 +02:00
Luca Boccassi e248790263 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": {}
}
2025-06-23 12:42:27 +01:00
Bastien Nocera 3dcb56f5e0 hwdb: Add hwbd definitions for maker tools
As originally added back in 2016 in 68ea57b21d ("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
2025-06-23 10:44:58 +01:00
Oliver Schramm 16fe095178 hwdb: Add support for Lenovo IdeaPad Slim 5 series
Signed-off-by: Oliver Schramm <oliver.schramm97@gmail.com>
2025-06-22 16:48:50 +01:00
Jim Spentzos 50ba3c7ef0 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
2025-06-22 21:57:26 +09:00
Yu Watanabe 4d05a19c95 bootctl: honour architecture when updating boot loaders (#37913)
Fixes: #33413
Follow-up for: #30418
2025-06-21 02:25:17 +09:00
Lennart Poettering be7c58353c update TODO 2025-06-21 02:22:28 +09:00
Lennart Poettering 222b0b05ce core: escape UTF-8 in mount unit Where field before sending to clients
Followup for: 4804da5853 #27541

Fixes: #36206
2025-06-21 02:22:28 +09:00
Lennart Poettering e04d782416 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
2025-06-21 02:19:27 +09:00
Yu Watanabe 73e95bcca0 logind inhibitor code fixes (#37907)
Fixes: #35565
2025-06-21 02:09:52 +09:00
Jan Čermák a2015ad126 journal-gatewayd: make num_entries in Range header optional again
Since 435c372ce5 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
2025-06-21 02:08:03 +09:00
Lennart Poettering 6b8770b96b bootctl: when updating everything check PE machine type
Let's never accidentally over-write foreign-arch PE binaries with native
ones.

Fixes: #33413
2025-06-20 14:06:53 +02:00
Lennart Poettering 95df8288c7 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
2025-06-20 14:06:53 +02:00
Lennart Poettering 897c4ff111 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
2025-06-20 10:18:46 +02:00
Lennart Poettering c4ad8365d5 logind: fix minor coding style issues
Fixes: #35565
2025-06-20 10:18:43 +02:00
Luca Boccassi da993edcf7 tpm2: print clear log message in case of dictionary lockout mode (#37894)
Fixes: #32260
2025-06-19 22:55:36 +01:00
Yu Watanabe 6e272b5f20 resolved: enforce RefuseRecordTypes= also in proxy mode (#37902)
Fixes: #36491
2025-06-20 05:59:24 +09:00
Lennart Poettering 83d4b2fd75 nspawn: --network-veth also works with unpriv nspawn
(because we ask nsresourced for help)

Fixes: #36179
2025-06-20 01:37:55 +09:00
Lennart Poettering 884fb39f33 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.
2025-06-19 18:30:06 +02:00
Lennart Poettering 576a2bc79b resolved: honour RefuseRecordTypes= also in proxy mode
Fixes: #36491
2025-06-19 18:02:54 +02:00
Lennart Poettering 95625f3cb6 resolved: use dns_question_isempty() where appropriate 2025-06-19 18:02:53 +02:00
Lennart Poettering 2aacaf81e1 resolved: split out helper that determines on RefuseRecordTypes= match 2025-06-19 18:02:24 +02:00
Yu Watanabe 1b675afdbd Several assorted cleanups (#37888) 2025-06-20 00:58:48 +09:00
Lennart Poettering df21ceca25 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
2025-06-19 12:33:52 +02:00
Lennart Poettering 48cb1ad9c3 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.
2025-06-19 12:32:15 +02:00
Yu Watanabe 68650ed391 test-bpf-firewall: use ASSERT_XYZ() and bpf_program_pin() 2025-06-19 19:08:45 +09:00
Yu Watanabe cef4ec347f ioprio-util: move from basic/ to shared/
It is not used by libsystemd.
2025-06-19 19:08:45 +09:00
Yu Watanabe d26faa3186 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.
2025-06-19 19:08:45 +09:00
Yu Watanabe 92b64168f6 sd-lldp: replace ETHERTYPE_LLDP with ETH_P_LLDP
ETH_P_LLDP is defined in linux/if_ether.h.
2025-06-19 19:08:45 +09:00
Yu Watanabe dbfe2faa48 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.
2025-06-19 18:03:12 +09:00
Yu Watanabe 079a135eee test-cpu-set-util: use ASSERT_XYZ() macros 2025-06-18 16:36:14 +01:00
Lukas Nykryn 64fcb07199 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.
2025-06-18 16:58:18 +02:00
Lennart Poettering ea71d34738 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.
2025-06-18 19:06:11 +09:00
Matteo Croce 030b227cec test: add test for systemd upgrade
Add a basic test to check that systemd works after an upgrade
2025-06-18 09:51:21 +01:00
Yu Watanabe 43aacae83a dirent-util: use getdents64() as is
This partially reverts e86a492ff0.

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.
2025-06-18 10:45:49 +02:00
Yu Watanabe abb99d3168 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.
2025-06-18 10:45:27 +02:00
Lennart Poettering 17f2b40f22 sd-bus: several coding style cleanups (#37867)
- replace `type *func()` -> `type* func()`,
- rename arguments for storing results,
- add several missing assertions.
2025-06-18 10:39:48 +02:00