Commit Graph
89014 Commits
Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek f0405bfdff nsresourced: fix typo
Reported by qarmin (Rafał Mikrut).
2026-05-18 12:44:45 +02:00
Zbigniew Jędrzejewski-Szmek 4f688e61c9 coredump: use a fixed string instead a scope-delimited compound literal
The compound literal (const char[]){'.','.','.'} has block scope
(C99 6.5.2.5p6). Once we leave the if and loop back, copy[1].iov_base
formally points into a destroyed object. Works on GCC/Clang in practice,
but is UB.

Let's do the easy thing and use a string.

Reported by qarmin (Rafał Mikrut).
2026-05-18 12:44:45 +02:00
Zbigniew Jędrzejewski-Szmek fd12cc9a52 core/manager: fix (theoretical) fd leak on invalid messages
We'd leak fds on early return. We are sending a message to ourself,
so it's unlikely to fail. But let's keep the logic correct.

Reported by qarmin (Rafał Mikrut).
2026-05-18 12:33:37 +02:00
Zbigniew Jędrzejewski-Szmek e305f552ec core/dbus-execute: propagate oom in property_get_cpu_affinity
The function already returns errors, so I'm not sure why we ignored
the error in the second call, potentially leaving variables unitialized.
It seems easiest to propagate the error.

Reported by qarmin (Rafał Mikrut).
2026-05-18 12:29:12 +02:00
Zbigniew Jędrzejewski-Szmek 92e0c920c7 basic/path-util: fix executable_is_good
Reported by qarmin (Rafał Mikrut).
2026-05-18 12:28:08 +02:00
Lennart Poettering c91ddaf1ee update TODO 2026-05-18 08:45:21 +02:00
Luca Boccassi 0096c83c5d boot: fix off-by-one truncation when reading efivars
'val' is allocated as 'size + 1', so the NUL terminator must be written
to 'size', rather than 'size - 1'.

Follow-up for fab8275646
2026-05-18 08:26:44 +02:00
Yu Watanabe e61ac7cd27 network/address: drop duplicated address earlier
network_adjust_dhcp_server() searches network->addresses_by_section,
hence without this change, an address entry picked by
network_adjust_dhcp_server() may be detached and freed by the cleanup
function.
2026-05-18 06:40:29 +02:00
Yu Watanabe a0177d96dc dhcp-message: introduce dhcp_message_{payload,packet}_size() 2026-05-18 09:34:32 +09:00
Yu Watanabe 3e6c08b967 Introduce several more helper functions to read sysfs attributes and use them where applicable (#41065)
Let's not use sd_device_get_sysattr_value() unless the result is
sanitized, escaped, or filtered.
2026-05-18 07:26:44 +09:00
Yu Watanabe 9b768b5bf5 Apply "ruff format" and "ruff check --fix" for all python scripts (#40758) 2026-05-18 07:26:11 +09:00
RiskoZS 4b2a88fe07 hwdb: Add keymap for Lenovo 15IRX9 (#42141)
This adds a mapping for the Fn+F9 key (used to launch Lenovo Vantage
on Windows) on the Lenovo LOQ 15IRX9 gaming laptop.
2026-05-18 05:28:52 +09:00
Luca Boccassi 1d73c5f04f dhcp-client: clear overloaded sname/file fields after parsing
When SD_DHCP_OPTION_OVERLOAD indicates that the sname and/or file header
fields are overloaded with extra DHCP options, dhcp_message_parse() merges
those options into message->options but leaves the raw bytes untouched in
the header. As a result, dhcp_message_build() emits the header (including
the overloaded bytes) verbatim, and the next parse re-parses those bytes,
appending duplicate entries to the options map (each tag's iov list grows).
Subsequent builds then differ from the first, breaking the parse/build
roundtrip.

This was caught by fuzz-dhcp-client, which asserts that two consecutive
build calls produce identical output.

Zero out the overloaded fields after parsing them, since their content has
already been merged into the options map. This makes the roundtrip
idempotent and avoids re-emitting stale overloaded data in the rebuilt
header. The JSON build/parse path was already correct (it omits sname/file
from the JSON when the overload bit is set), so only the binary path needed
fixing.

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

Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 04:52:25 +09:00
Yu Watanabe 2a1a026d72 udev-builtin-input-id: drop unused value 2026-05-18 02:55:56 +09:00
Yu Watanabe 6f72bb7bc9 tree-wide: use device_get_sysattr_unsigned() and friends 2026-05-18 02:55:56 +09:00
Yu Watanabe 6ad682d70f udev-builtin-usb_id: make set_usb_iftype() and friends return const char* 2026-05-18 02:55:56 +09:00
Yu Watanabe 23c93e2cd6 udev-builtin-usb_id: use device_get_sysattr_unsigned() and friends
This also fix the parser of bInterfaceClass from safe_atoi() to
safe_atou_full() as it is unsigned hex.
2026-05-18 02:55:56 +09:00
Yu Watanabe 247e4caa3c sd-device: also add device_get_sysattr_streq() 2026-05-18 02:55:56 +09:00
Yu Watanabe 1e39d3eb08 sd-device: also add device_get_sysattr_u8() and _u16() 2026-05-18 02:55:56 +09:00
Yu Watanabe 3c230737f5 sd-device: use macro to define device_get_sysattr_int() and friends 2026-05-18 02:55:56 +09:00
Yu Watanabe dbfe8b162b test: add test cases for device_get_sysattr_int() and friends 2026-05-18 02:55:56 +09:00
Yu Watanabe 532276524f sd-device: rename argument names for storing result
When a function takes only one argument for storing result, the argument
is not necessary to be named as ret_xyz, but ret should be enough.
2026-05-18 02:55:56 +09:00
Yu Watanabe 06d687ffac tree-wide: use device_get_sysattr_safe_string()
The obtained strings are passed to another function, e,g, handled as a
path and opened, printed to the terminal, written to a file, saved to
udev database as udev property, exposed through DBus, passed to logger,
and so on. Hence, these should not contain any malicious characters.
2026-05-18 02:55:56 +09:00
Yu Watanabe fdce4d4687 udev-builtin-net_id: quote strings in log messages 2026-05-18 02:55:56 +09:00
Yu Watanabe 35edd031b9 udev-builtin-net_id: use EINVAL when we get unexpected sysattr value
The results are completely ignored or only checked if it is negative or
not. Hence, this does not change anything.
2026-05-18 02:55:56 +09:00
Yu Watanabe c5a04f59d9 udev: drop redundant checks
This partially reverts 16325b35fa,
as bad characters are already filtered.
2026-05-18 02:55:56 +09:00
Yu Watanabe c6ea72e39a Revert "udev-builtin-net-id: print cescaped bad attributes"
This reverts commit 7c4047957e.

This is not necessary, as bad characters are already filtered.
2026-05-18 02:55:56 +09:00
Yu Watanabe d0e48e2601 udev: use device_get_sysattr_safe_string() in device_get_sysattr_value_filtered()
Then, renamed to device_get_sysattr_safe_string_filtered().
2026-05-18 02:55:56 +09:00
Yu Watanabe 13ce62caba sd-device: use device_get_sysattr_safe_string()
The read value are exposed by sd_device_get_subsystem() and friends.
Hence, it is better to filter invalid characters.
Of course, these should be always safe unless the kernel is buggy.
But, just for safety.

Note, even if uevent file contains invalid characters, then
device_read_uevent_file() should succeed without parsing the contents.
The caller should fail later with a proper error code if a necessary
field is unset. E.g. sd_device_get_ifindex() should still return -ENOENT
even when uevent file contains an invalid characters.
2026-05-18 02:55:56 +09:00
Yu Watanabe 0341058ee6 sd-device: introduce device_get_sysattr_safe_string()
This introduce a helper function that verifies read sysattr value.
Some sysattr value may come from firmware, and kernel may expose unsafe
string. The introduced function should be used when we use the result as
a string.
2026-05-18 02:55:56 +09:00
Yu Watanabe b74f016e59 string-util: introduce STRING_ALLOW_NEWLINES switch for string_is_safe()
This also make StringSafeFlags defined in basic-forward.h so other
headers can use the enum.
2026-05-18 02:55:34 +09:00
Jörg Behrmann 2cdf552762 emacs: add settings for Python modes
Both python-mode and python-ts-mode are shipped by Emacs nowadays, with the
latter being the more modern tree-sitter-based one. Even though they are
similar, the newer one doesn't automatically take the older ones settings.
2026-05-18 02:51:41 +09:00
Jörg Behrmann 24b79ff1d0 ci/linter: show diffs for ruff check when possible 2026-05-18 02:51:41 +09:00
Yu Watanabe e184315aee ci/linter: run ruff for all python scripts 2026-05-18 02:51:41 +09:00
Yu Watanabe 4c333638ad proxy-echo: apply "ruff check --fix" 2026-05-18 02:51:35 +09:00
Yu Watanabe 06961b7c5f fake-report-server: apply "ruff format" and "ruff check --fix" 2026-05-18 02:49:29 +09:00
Yu Watanabe 2a0eaff3a7 fake-imds: apply "ruff format" and "ruff check --fix" 2026-05-18 02:48:35 +09:00
Yu Watanabe 94f807be03 merge-bpf-compdb: apply "ruff format" 2026-05-18 02:47:09 +09:00
Yu Watanabe 9e15fad481 xml_helper: apply "ruff format" 2026-05-18 02:44:47 +09:00
Yu Watanabe 8fc2bde0db update-man-rules: apply "ruff format" 2026-05-18 02:44:47 +09:00
Yu Watanabe c1e31e12b4 update-dbus-docs: apply "ruff format" and "ruff check --fix" 2026-05-18 02:44:47 +09:00
Yu Watanabe 09e34716fc sync-docs: apply "ruff format" and "ruff check --fix" 2026-05-18 02:44:47 +09:00
Yu Watanabe 3b690e2c7e meson-render-jinja2: apply "ruff format" 2026-05-18 02:44:47 +09:00
Yu Watanabe 1fbb5e0ff1 meson-extract-unit-files: apply "ruff format" 2026-05-18 02:44:47 +09:00
Yu Watanabe 3675924f5b make-man-index: apply "ruff format" 2026-05-18 02:44:47 +09:00
Yu Watanabe 8b24db05d4 make-directive-index: apply "ruff format" 2026-05-18 02:44:47 +09:00
Yu Watanabe e0ac581a8b list-discoverable-partitions: apply "ruff format" 2026-05-18 02:44:47 +09:00
Yu Watanabe cc1373700b generate-gperfs: apply "ruff format" 2026-05-18 02:44:47 +09:00
Yu Watanabe 86d3b07fba gdb-sd_dump_hashmaps: apply "ruff format" and "ruff check --fix" 2026-05-18 02:44:47 +09:00
Yu Watanabe 30c87278d4 find-unused-library-symbols: apply "ruff format" and "ruff check --fix" 2026-05-18 02:44:47 +09:00