Commit Graph
87527 Commits
Author SHA1 Message Date
Michael Vogt 3e9eaf45f0 network: make check-pointer-deref clean
Add the needed assert changes to make the code clean
for the new check-pointer-deref script.
2026-03-30 13:36:00 +02:00
Michael Vogt 1626130254 journal: make check-pointer-deref clean
Add the needed assert changes to make the code clean
for the new check-pointer-deref script.
2026-03-30 13:36:00 +02:00
Michael Vogt f3c49a597f nspawn: make check-pointer-deref clean
Add the needed assert changes to make the code clean
for the new check-pointer-deref script.
2026-03-30 13:36:00 +02:00
Michael Vogt 69d54d5213 cleanup: address review feedback from claude
Trivial ordering/modernizing change that got highlighted by
claude and refined by keszybz to move to the modern systemd
style.

Thanks to keszybz for suggesting this.
2026-03-30 13:34:58 +02:00
Michael Vogt ad7813844a mkosi: add coccinelle to the debian tools tree too
It is already part of the fedora/opensues tools tree. It must
have slipped through for Debian so lets add it.
2026-03-30 13:31:07 +02:00
Adam Dinwoodie 566a4f3437 man: fix caps in example path 2026-03-30 09:14:32 +01:00
Daan De Meyer be2ac4beb5 repart: allow --el-torito= with any --empty= value
The restriction requiring --empty= to be require, force, or create
when using --el-torito= is unnecessary.
context_verify_eltorito_overlap() already validates that the ISO 9660
blocks don't collide with GPT partition entries or the first usable
LBA, which is sufficient to guarantee safety regardless of the empty
mode.

This is needed for two-stage image builds where the first stage creates
the usr and verity partitions, and the second stage adds --el-torito=
to produce a bootable ISO with a UKI containing usrhash= derived from
the verity hash of the first stage. In the second stage, repart runs
with --empty=allow since the image already exists.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-29 23:58:07 +02:00
Valentin David 365361f490 repart: Optionally write minimal an El Torito boot catalog for EFI
This only points the firmware to the ESP. The ISO9660 is empty.
The initramfs should create a loop device to change block size
and enable GPT partitions.

This was tested using OVMF on qemu, with:
`-drive if=pflash,file=OVMF_CODE.fd,readonly=on,format=raw -drive if=pflash,file=OVMF_VARS.fd,format=raw -drive if=none,id=live-disk,file=dick.iso,media=cdrom,format=raw,readonly=on -device virtio-scsi-pci,id=scsi -device scsi-cd,drive=live-disk`

And a simple definition:
```
[Partition]
Type=esp
Format=vfat
CopyFiles=/usr/lib/systemd/boot/efi/systemd-bootx64.efi:/EFI/BOOT/BOOTX64.EFI
```
2026-03-29 22:46:54 +02:00
Daan De Meyer ea79ac6f36 Assorted coverity fixes (#41406) 2026-03-29 21:02:55 +02:00
Zbigniew Jędrzejewski-Szmek ab3a2f375f sd-varlink: export sd_varlink_set_sentinel
I tried to implement a varlink service using sd-varlink, and
not being able to use the approach with sentinel is exteremely
painful. This is useful internally and likewise externally.
2026-03-29 20:32:15 +02:00
Luca Boccassi 34c82cbe2f systemd-repart man page fixes (#41410)
Found two small issues in the man page.
2026-03-29 13:58:04 +01:00
Morten Linderud 3242308ce3 man/systemd-repart: quote jq expression
Some shells will try to parse this, or expand it, causing an error. Lets
quote it so it's simpler for people.

Signed-off-by: Morten Linderud <morten@linderud.pw>
2026-03-29 14:20:28 +02:00
Morten Linderud a0ba770edc man/systemd-repart: remove extra pipe character in manpage
Signed-off-by: Morten Linderud <morten@linderud.pw>
2026-03-29 14:15:05 +02:00
Valentin David 421bdc489f repart: Make it possible to set persistent allow-discards activation flag
AllowDiscards= will set allow-discards in the persistent flags which will make
activating the device automatically activate with that option. This is
useful for devices discovered through gpt-auto-generator without
needing to use some kernel command line to set the option.
2026-03-28 23:46:37 +01:00
Adrian Wannenmacher f377be7081 fix list of inhibitor lock types
Markdown and HTML don't support mixing ordered and unordered items
within a single list. This means the previous syntax actually produced
three separate lists.

Also, markdown converters don't necesarrily respect the first number in
an ordered list, and may just overwrite it to one. This is the case for
the one that generates the systemd.io page. And even if that wasn't the
case, the numbering of the second ordered list would be off by one.
2026-03-28 20:57:52 +00:00
Luca Boccassi 4b25c74c20 recurse-dir: add assert_cc for DIRENT_SIZE_MAX allocation
Coverity flags offsetof(DirectoryEntries, buffer) + DIRENT_SIZE_MAX * 8
as a potential overflow. All operands are compile-time constants, so add
an assert_cc() to prove this at build time.

CID#1548020

Follow-up for 6393b847f4
2026-03-28 20:24:22 +00:00
Luca Boccassi 3e38052f1d exec-util: use unsigned shift for ExecCommandFlags
Using signed int literal '1' in left shift operations can
theoretically lead to undefined behavior. Use 1U to be explicit
about unsigned arithmetic.

CID#1548018

Follow-up for b3d593673c
2026-03-28 20:13:40 +00:00
Luca Boccassi cda2962daf compress: add assert for space doubling overflow safety
Coverity flags 2 * space as a potential overflow. The space value
is bounded by prior allocation success, but add an explicit assert
to document this for static analyzers.

CID#1548056

Follow-up for 5e592c66bd
2026-03-28 20:13:03 +00:00
Luca Boccassi 2bd6930efe importd: add assert for log_message_size accumulation bounds
Coverity flags log_message_size += l as a potential overflow, but l
is bounded by the read() count parameter which is
sizeof(log_message) - log_message_size. Add an assert to make this
invariant explicit.

CID#1548062

Follow-up for 3d7415f43f
2026-03-28 20:10:14 +00:00
Luca Boccassi c34169e9d3 sd-bus: add asserts for rbuffer_size accumulation bounds
Coverity flags rbuffer_size += k as a potential overflow, but k is
always bounded by the iov size (which is the difference between the
allocated buffer and current rbuffer_size). Add asserts to make this
invariant explicit.

CID#1548044
CID#1548071

Follow-up for a7e3212d89
2026-03-28 20:09:40 +00:00
Luca Boccassi 1b7d2fa978 uid-range: add asserts to document overflow safety in coalesce
Coverity flags the x->start + x->nr and y->start + y->nr additions
as potential overflows. These are safe because uid_range_add_internal()
validates start + nr <= UINT32_MAX before inserting entries. Add asserts
to document this invariant for static analyzers.

CID#1548015

Follow-up for 8530dc4467
2026-03-28 19:56:31 +00:00
Luca Boccassi c8b53fcfd3 sd-event: add assert to help static analysis trace signal bounds
Coverity flags the signal_sources array access as a potential
out-of-bounds read because it cannot trace through the SIGNAL_VALID()
macro to know that ssi_signo < _NSIG. Add an explicit assert after
the runtime check to make the constraint visible to static analyzers.

CID#1548033

Follow-up for 7a64c5f23e
2026-03-28 19:56:31 +00:00
Luca Boccassi be85048e28 cpu-set-util: add asserts to guide static analysis after realloc
Coverity flags CPU_SET_S() calls as potential out-of-bounds writes
because it cannot trace that cpu_set_realloc() guarantees the
allocated buffer is large enough for the given index. Add asserts
to make the size invariant explicit.

CID#1611787
CID#1611788

Follow-up for 0985c7c4e2
2026-03-28 19:56:31 +00:00
Luca Boccassi 1929226e7e debug-generator: use unsigned bit shift for breakpoint flags
Using signed int literal '1' in left shift can lead to undefined
behavior if the shift amount causes overflow of a signed int. Use
UINT32_C(1) since the result is stored in a uint32_t variable.

CID#1568482

Follow-up for e9f781a5a4
2026-03-28 19:56:31 +00:00
Luca Boccassi 86fd0337c6 scsi_id: use strscpy instead of strncpy for wwn fields
strncpy does not null-terminate the destination buffer if the source
string is longer than the count parameter. Since wwn and
wwn_vendor_extension are char[17] and we copy up to 16 bytes, there's
a risk of missing null termination. Use strscpy which always
null-terminates.

CID#1469706

Follow-up for 4e9fdfccbd
2026-03-28 19:56:31 +00:00
Luca Boccassi 3e889473c9 resolved: fix TOCTOU in hook discovery
Coverity complains that the directory is not pinned by FD
so it might changed between the stat and the open

CID#1643236

Follow-up for 8209f4adcd
2026-03-28 19:56:31 +00:00
Luca Boccassi bf37ed0a65 stat-util: add assert to silence coverity
Coverity thinks _mntidb can be used uninitialized, but this
is not the case when r == 0. Add a bool variable to make it
clearer instead of reusing 'r' later, and an assert to guide
static analyzers.

CID#1644850

Follow-up for 5817c73391
2026-03-28 19:56:31 +00:00
Luca Boccassi 8fe512a02e stat-util: fix return type of mode_verify_socket()
It returns an error code, not a mode

Follow-up for 97fe03e12f
2026-03-28 19:56:31 +00:00
Luca Boccassi 74a9ed911d pe-binary: add explicit cast to silence coverity
Otherwise it gets confused about underflows (which are already checked)

CID#1645068

Follow-up for a434270139
2026-03-28 19:56:31 +00:00
Luca Boccassi 1a0fe20bc2 pe-binary: fix error reporting
This is a local calculation, errno is not set

Follow-up for a434270139
2026-03-28 19:56:31 +00:00
Luca Boccassi 85b20f5fa7 boot: add overflow check in GPT parser
ALIGN_TO() can overflow and return SIZE_MAX

CID#1644887

Follow-up for ccbd324a3a
2026-03-28 19:56:31 +00:00
Luca Boccassi 9bdc8c8138 imdsd: voidify unchecked call
CID#1646046

Follow-up for eb6e5b07f1
2026-03-28 19:56:30 +00:00
Luca Boccassi 7ff1bfdb68 dissect: add asserts to appease coverity
CID#1645844
CID#1645845

Follow-up for 91578e5293
2026-03-28 15:37:58 +00:00
RiskoZS 7471dc2994 hwdb: Add keymaps for Acer Nitro 5 AN517-54
Add mappings for the Fn+F7 (microphone mute), NitroSense and power keys for the Acer Nitro 5 AN517-54
2026-03-28 12:07:56 +00:00
Luca Boccassi b3c3a40b35 sysupdate: add more input validation
Ensure bogus inputs are cleanly rejected. These are privileged
interfaces so in practice it's not a problem.

Reported on yeswehack.com as YWH-PGM9780-168

Follow-up for bf2c741fd7
2026-03-28 09:15:33 +01:00
Luca Boccassi 9094caf66e mkosi: add CI for Ubuntu 26.04 (#41383)
It is in final beta now, so we can start building and testing it
2026-03-28 01:19:35 +00:00
Luca Boccassi b4335ea9fc mkosi: add test job for Ubuntu 26.04
It is now in beta freeze, so we can start adding test coverage
2026-03-27 23:08:35 +00:00
Luca Boccassi 1d6585f218 mkosi: pull in gnu coreutils for Ubuntu 26.04 and newer
The default coreutils in Ubuntu 26.04 moved to uutils, which is broken
in many subtle and annoying ways, breaking various tests. It's also
a giant monolithic megabinary which makes the minimal image size
go up and break other tests.

Force the gnu coreutils to be pulled in all images.
2026-03-27 23:08:35 +00:00
Luca Boccassi f737b38977 test: exclude gnusleep from coredumps parsing
In Ubuntu 26.04 the actual binary is called gnusleep, and sleep is a symlink,
so fix the regex exclusion for the coredump checks
2026-03-27 22:40:09 +00:00
Luca Boccassi 9f56d62f92 test: check for bin/bash in dissect --mtree instead of cat
Ubuntu is doing shenanigans with their coreutils so they are now
symlinks instead of binaries, so the grep fails. Check bash instead
to fix test failure on 26.04.
2026-03-27 22:40:09 +00:00
Luca Boccassi a1dada941d mkosi: depend on bpftool for Ubuntu 26.04 build image
bpftool was disentangled, so we can depend on it, and build with bpf
2026-03-27 22:40:09 +00:00
Duncan Overbruck 7208a74a2b boot-entry: add 'auto' keyword to parse_boot_entry_token_type
Add the auto keyword as documented in the help message and man pages of
`kernel-install`, `bootctl` and `systemd-pcrlock`.
2026-03-27 23:16:54 +01:00
Luca Boccassi 1224e5d195 shutdown: remove kexec-tools dependency
'kexec -e' is just a small wrapper that does the xen hypercall
on xen, or otherwise just calls reboot(). Drop the dependency,
and reuse the existing xen hypercall helper.
2026-03-27 23:03:01 +01:00
Zbigniew Jędrzejewski-Szmek 5f2258affc many: more checks for pointer access without NULL check (#41370)
This is a followup for https://github.com/systemd/systemd/pull/41096
that makes more subsystems pass the new `check-pointer-deref` coccinelle
checks. See the individual commits.

My plan is to do a few more of these PRs until we have it all covered. I
could also do it in a single very big PR but I'm worried about a)
conflicts b) that its just too big/annoying to review. Only 7 dirs left
but some (like src/basic) are quite big (~50k loc) so those PRs will be
a bit bigger.
2026-03-27 14:58:27 +01:00
Daan De Meyer bb5c7328cf vmspawn: improve firmware selection to match mkosi's implementation
Align find_ovmf_config() with mkosi's find_ovmf_firmware() by adding
checks that were previously missing:

- Filter on interface-types, only selecting UEFI firmware definitions.
  Previously non-UEFI (e.g. BIOS-only) firmware could be selected.

- Check machine type compatibility using substring matching against the
  target machine patterns in firmware descriptions (e.g. "q35" matches
  "pc-q35-*"), following the same approach as mkosi.

- Make nvram-template optional in the firmware JSON mapping. Firmware
  definitions without an nvram-template are now parsed successfully
  (with vars remaining NULL) rather than failing entirely.

Also rework the firmware target parsing to store both architecture and
machine arrays per target (instead of just a flat architecture list),
and extract the machine matching into firmware_data_matches_machine().

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-27 14:22:29 +01:00
Daan De Meyer d6e5fbca73 vmspawn: Add --firmware=describe
It's useful to be able to check what firmware description vmspawn
will select. In particular, this will allow me to figure out the
nvram template file that will be picked up so I can pick it up in
mkosi and operate on it to pass a modified version of it to vmspawn
with --efi-nvram-template=.
2026-03-27 14:22:29 +01:00
Daan De Meyer 5a7d70e807 vmspawn: add --efi-nvram-template= and --firmware-features= options
Add --efi-nvram-template=PATH to specify a custom firmware variables
file to copy and use as the initial EFI NVRAM state instead of the
default template from the firmware definition.

Add --firmware-features=FEATURE[,FEATURE...] to require or exclude
specific firmware features during automatic firmware discovery.
Features prefixed with "!" are excluded. If a feature appears in both
the included and excluded lists, inclusion takes priority. Firmware
with the "enrolled-keys" feature is excluded by default.

Refactor --secure-boot= to operate on the firmware features sets
instead of maintaining a separate tristate. --secure-boot=yes adds
"secure-boot" to the include set, --secure-boot=no adds it to the
exclude set, and --secure-boot=auto removes it from both.

Generalize find_ovmf_config() to accept include/exclude feature sets
instead of a secure boot tristate, removing the special-cased
enrolled-keys and secure-boot filtering logic.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-27 14:22:29 +01:00
Pavel Borecki 36338926af po: Translated using Weblate (Czech)
Currently translated at 100.0% (266 of 266 strings)

Co-authored-by: Pavel Borecki <pavel.borecki@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/cs/
Translation: systemd/main
2026-03-27 13:10:16 +00:00
Lennart Poettering b34ff170d1 tmpfile-util: don't log about lack of O_TMPFILE support
It's a very common case (vfat...), and it's just too much noise. After
all the whole function exists primarily to deal with O_TMPFILE not being
availeble everywhere...
2026-03-27 11:55:32 +00:00
Luca Boccassi 79f8447f5f sd-boot: 4 smaller fixes (#41367) 2026-03-27 11:47:33 +00:00