Commit Graph
93924 Commits
Author SHA1 Message Date
Yu Watanabe 979c66e240 hexdump: add missing short comments
Follow-up for b26ac01e42.
Follow-up for 45d43b8912.
2026-11-05 14:44:58 +09:00
Yu Watanabe d58c666ac8 test-hexdump: add missing short comments
Follow-up for b26ac01e42.
Follow-up for 7ff3f83104.
2026-11-05 14:23:07 +09:00
Yu Watanabe 190060c25d core: Install D-Bus name match if API bus is ready (#44381) 2026-11-05 12:13:33 +09:00
Jake Freeland a9e4ac6fa1 network/netdev: add bond LACPActive= setting
This allows configuring a bond in 802.3ad mode to use active or passive
LACP. During LACP discovery, active LACP routinely transmits LACPDUs, while
passive LACP only sends LACPDUs in response to a partner's LACPDU.
2026-11-05 12:12:50 +09:00
Yu Watanabe efca02fa36 test: add ASSERT_MEMEQ() and friends, and convert assert_se() in tests/fuzzers (#44641)
This adds a few typed assertion helpers to src/shared/tests.h that print
where things differ on failure, instead of just aborting:

- ASSERT_MEMEQ() / ASSERT_MEMEQ_NN() for memory regions
- ASSERT_MEMEQ_BYTE() / ASSERT_MEMEQ_ZERO()
- ASSERT_IOVEC_EQ() / ASSERT_IOVW_EQ()

On mismatch they show a hexdump-style, side-by-side diff of the
operands. To back this, hexdump() is moved from basic/hexdecoct to a new
shared/hexdump (the EFI hexdump() in src/boot is renamed to hexdump16()
to avoid the name clash), and the dump helpers live next to it.

The rest is mechanical: existing ASSERT_TRUE(memcmp(...) == 0) and
similar patterns are switched to the new macros, and assert_se() in the
fuzzers (plus a couple of test files) is converted to the typed ASSERT_*
family.

No functional change to non-test code.
2026-11-05 12:11:05 +09:00
Yu Watanabe e762d33144 Automatically detect and fix missing parameter comments (#44621)
I'm tired of reviews that constantly point out to add `/*
parameter_name= */` comments to functions calls where `NULL`, `0`, or
`true`, or `false` are passed. Let's add automated checking for this so
people have a reliable way to test this and the CI warns about it.

This is #43725 again. GitHub closed it when its base branch was deleted
after the tree-wide comments in #44532 were merged.

Since #44532 went in 23 pull requests added 232 new bare literals. The
checker also got stricter in the meantime. It now checks calls through
the shims in `src/include/override`, literals that have a comment after
them and `/* name */` comments that lost their `=`. That's 342 arguments
on current main and they're all fixed up here, one commit per top-level
source directory like in #44532, before the CI step is switched on. The
fixups are comments only. The `fsmount()` shim now uses the parameter
names from fsmount(2), so its last argument is commented as `attr_flags`
instead of glibc's misleading `ms_flags`.

The checker needs libclang 19 or newer. On four CPUs the whole suite
takes about a minute and a half.
2026-11-05 12:10:21 +09:00
Christian Brauner 60c900fd52 ci: run the argument comment checker in the linter workflow
The tree is clean now, keep it that way. Run the whole argument-comments
suite like the clang-tidy one. Checking only the lines a pull request
changed misses comments that go stale when a parameter is renamed,
since no caller's line changes then. On four CPUs the suite takes about
a minute and a half.

meson test reports a test that exits with 77 as skipped, so make sure
the libclang bindings are there first. Otherwise a tools tree without
them would pass the step without checking anything.

While at it, add the script to the mypy and tab checks.
2026-11-04 23:20:19 +01:00
Christian Brauner c52445cf7f test: comment bare literal arguments
docs/CODING_STYLE.md asks for a /* name= */ comment whenever NULL or
another value meaning "unset" is passed to a function. Add it wherever
a bare NULL, 0, false or true is passed for a parameter with a telling
name. Mechanical, generated by tools/check-argument-comments.py --fix.
2026-11-04 23:20:18 +01:00
Christian Brauner e221e19369 sysext: add the missing = to argument name comments
tools/check-argument-comments.py only takes the /* name= */ form that
docs/CODING_STYLE.md shows as naming a parameter, as clang-tidy's
bugprone-argument-comment does. Add the '=' these comments are missing.
Mechanical, generated by tools/check-argument-comments.py --fix.
2026-11-04 23:20:17 +01:00
Christian Brauner fae98e8341 shared: comment bare literal arguments
docs/CODING_STYLE.md asks for a /* name= */ comment whenever NULL or
another value meaning "unset" is passed to a function. Add it wherever
a bare NULL, 0, false or true is passed for a parameter with a telling
name. Mechanical, generated by tools/check-argument-comments.py --fix.

While at it, add the '=' that some of the existing comments are missing.

By hand, drop the /* uncompressed */ in dns_packet_read_rr() which only
repeats the new comment, and wrap the get_mempolicy() call in
numa-util.c that grew to 141 columns.
2026-11-04 23:20:15 +01:00
Christian Brauner 60cc1cc33c run: comment bare literal arguments
docs/CODING_STYLE.md asks for a /* name= */ comment whenever NULL or
another value meaning "unset" is passed to a function. Add it wherever
a bare NULL, 0, false or true is passed for a parameter with a telling
name. Mechanical, generated by tools/check-argument-comments.py --fix.
2026-11-04 23:20:14 +01:00
Christian Brauner 15616443ad resolve: comment bare literal arguments
docs/CODING_STYLE.md asks for a /* name= */ comment whenever NULL or
another value meaning "unset" is passed to a function. Add it wherever
a bare NULL, 0, false or true is passed for a parameter with a telling
name. Mechanical, generated by tools/check-argument-comments.py --fix.
2026-11-04 23:20:13 +01:00
Christian Brauner 7d6dbc7e6a repart: comment bare literal arguments
docs/CODING_STYLE.md asks for a /* name= */ comment whenever NULL or
another value meaning "unset" is passed to a function. Add it wherever
a bare NULL, 0, false or true is passed for a parameter with a telling
name. Mechanical, generated by tools/check-argument-comments.py --fix.
2026-11-04 23:20:12 +01:00
Christian Brauner 2379690ab2 oom: add the missing = to argument name comments
tools/check-argument-comments.py only takes the /* name= */ form that
docs/CODING_STYLE.md shows as naming a parameter, as clang-tidy's
bugprone-argument-comment does. Add the '=' these comments are missing.
Mechanical, generated by tools/check-argument-comments.py --fix.
2026-11-04 23:20:11 +01:00
Christian Brauner 5ecc1bc6d8 nsresourced: comment bare literal arguments
docs/CODING_STYLE.md asks for a /* name= */ comment whenever NULL or
another value meaning "unset" is passed to a function. Add it wherever
a bare NULL, 0, false or true is passed for a parameter with a telling
name. Mechanical, generated by tools/check-argument-comments.py --fix.
2026-11-04 23:20:09 +01:00
Christian Brauner a9d831553c network: comment bare literal arguments
docs/CODING_STYLE.md asks for a /* name= */ comment whenever NULL or
another value meaning "unset" is passed to a function. Add it wherever
a bare NULL, 0, false or true is passed for a parameter with a telling
name. Mechanical, generated by tools/check-argument-comments.py --fix.

While at it, add the '=' that some of the existing comments are missing.
2026-11-04 23:20:08 +01:00
Christian Brauner 04b9e53f24 login: comment bare literal arguments
docs/CODING_STYLE.md asks for a /* name= */ comment whenever NULL or
another value meaning "unset" is passed to a function. Add it wherever
a bare NULL, 0, false or true is passed for a parameter with a telling
name. Mechanical, generated by tools/check-argument-comments.py --fix.
2026-11-04 23:20:07 +01:00
Christian Brauner d229e8b083 libsystemd-network: comment bare literal arguments
docs/CODING_STYLE.md asks for a /* name= */ comment whenever NULL or
another value meaning "unset" is passed to a function. Add it wherever
a bare NULL, 0, false or true is passed for a parameter with a telling
name. Mechanical, generated by tools/check-argument-comments.py --fix.
2026-11-04 23:20:06 +01:00
Christian Brauner 8351be43fe libsystemd: comment bare literal arguments
docs/CODING_STYLE.md asks for a /* name= */ comment whenever NULL or
another value meaning "unset" is passed to a function. Add it wherever
a bare NULL, 0, false or true is passed for a parameter with a telling
name. Mechanical, generated by tools/check-argument-comments.py --fix.
2026-11-04 23:20:04 +01:00
Christian Brauner 7b11ddeb6d hostname: comment bare literal arguments
docs/CODING_STYLE.md asks for a /* name= */ comment whenever NULL or
another value meaning "unset" is passed to a function. Add it wherever
a bare NULL, 0, false or true is passed for a parameter with a telling
name. Mechanical, generated by tools/check-argument-comments.py --fix.
2026-11-04 23:20:03 +01:00
Christian Brauner 08a1dd7701 home: comment bare literal arguments
docs/CODING_STYLE.md asks for a /* name= */ comment whenever NULL or
another value meaning "unset" is passed to a function. Add it wherever
a bare NULL, 0, false or true is passed for a parameter with a telling
name. Mechanical, generated by tools/check-argument-comments.py --fix.
2026-11-04 23:20:02 +01:00
Christian Brauner 5ce21657cd core: comment bare literal arguments
docs/CODING_STYLE.md asks for a /* name= */ comment whenever NULL or
another value meaning "unset" is passed to a function. Add it wherever
a bare NULL, 0, false or true is passed for a parameter with a telling
name. Mechanical, generated by tools/check-argument-comments.py --fix.
2026-11-04 23:20:00 +01:00
Christian Brauner de5ee2f9bb boot: comment bare literal arguments
docs/CODING_STYLE.md asks for a /* name= */ comment whenever NULL or
another value meaning "unset" is passed to a function. Add it wherever
a bare NULL, 0, false or true is passed for a parameter with a telling
name. Mechanical, generated by tools/check-argument-comments.py --fix.
2026-11-04 23:19:59 +01:00
Christian Brauner 7e539a1e38 basic: comment bare literal arguments
docs/CODING_STYLE.md asks for a /* name= */ comment whenever NULL or
another value meaning "unset" is passed to a function. Add it wherever
a bare NULL, 0, false or true is passed for a parameter with a telling
name. Mechanical, generated by tools/check-argument-comments.py --fix.
2026-11-04 23:19:58 +01:00
Christian Brauner 1d5ffd4689 analyze: comment bare literal arguments
docs/CODING_STYLE.md asks for a /* name= */ comment whenever NULL or
another value meaning "unset" is passed to a function. Add it wherever
a bare NULL, 0, false or true is passed for a parameter with a telling
name. Mechanical, generated by tools/check-argument-comments.py --fix.
2026-11-04 23:19:57 +01:00
Christian Brauner 46095348ab include: name the fsmount() parameters like the man page
The fsmount() shim took its parameter names from glibc which calls the
last one ms_flags. That's misleading as it takes MOUNT_ATTR_* flags and
not MS_* flags. The kernel and fsmount(2) call it attr_flags. Use the
names from fsmount(2) and fix up the two comments in namespace.c that
called it mount_attrs and flags.
2026-11-04 23:19:55 +01:00
Christian Brauner 5e4fa24313 mkosi: install python3-clang in the tools image
tools/check-argument-comments.py needs the libclang python bindings.
2026-11-04 23:19:54 +01:00
Christian Brauner a24b65bc71 meson: add an argument-comments test suite
Run tools/check-argument-comments.py over the sources that are compiled,
one test per top-level source directory, in a suite that a plain "meson
test" leaves out like the other linters. The NSS, PAM and cryptsetup
token modules don't end up in sources, so collect theirs as well. The
source directory is passed explicitly, so the suite works without git,
from a tarball say. The script exits with meson's skip code where the
libclang python bindings are missing.
2026-11-04 23:19:53 +01:00
Christian Brauner dee2b81067 tools: add a checker for missing argument name comments
CODING_STYLE asks for a /* name= */ comment whenever NULL or another
value meaning "unset" is passed to a function. Nothing enforces it.
clang-tidy's bugprone-argument-comment only validates comments that
exist, and its option to demand them for literals never sees NULL
behind its cast in C and flags every size and mode along the way.

Add tools/check-argument-comments.py. It parses each file with
libclang and the flags from compile_commands.json, with every set of
them for a file that is built more than once, takes the parameter
names from the first declaration the caller sees, the one clang-tidy
compares comments against, and reports arguments spelled as a bare
NULL, 0, false or true, in the file and in the in-tree headers it
includes.

The arguments are read from the text of the call. So a literal with a
comment after it is still bare, and a comment at the end of the
previous line belongs to the previous argument. Like clang-tidy, only
a /* name= */ comment names a parameter, and case and leading or
trailing underscores don't matter. A /* name */ that lost its '=' is
reported too.

Calls into libc are skipped, and so are calls produced by macro bodies
since the caller never spelled their arguments. A call written inside
a macro argument is checked, as is a call through a macro that only
renames the function, the shims in src/include/override for example,
and a call through the sym_* pointers of the dlopen() wrappers.
--diff REV limits the report to lines that differ from a revision, and
--fix inserts the comments.

    tools/check-argument-comments.py --diff "$(git merge-base main HEAD)" src

The builtin headers, stddef.h and friends, are located by asking the
clang binary of the same major version. libclang derives their
location from its own, and in the Fedora rawhide tools tree that
comes out as the relative ../lib/clang/22, so every file fails to
parse with 'stddef.h' file not found.

Needs python3-clang and libclang 19 or newer. Older versions return
the file location from clang_getSpellingLocation(), so calls produced
by macro bodies would be checked as if the caller had spelled them.
2026-11-04 23:19:52 +01:00
Luca Boccassi 4343b7c7d5 nsresourced: add an inode-based BPF policy (#44390)
Let's use idmap-aware inode LSM hooks on Linux 7.4 and newer to check
the
ownership recorded on the actual backing filesystem. This permits safe
OverlayFS uppers while rejecting persistent transient IDs, including
when a
mount idmap translates stable caller IDs into transient IDs. Older
kernels
continue to use the path policy.

Let's preserve the policy maps and replace pinned program links
atomically
on restart, so failed replacement keeps existing namespaces protected.
Tests
cover OverlayFS, mount idmaps, links, ownership changes, POSIX queue
creation
and namespace lifetimes, and failed pin replacement.
2026-11-04 19:14:11 +00:00
Yu Watanabe 3f0c5c5687 test-tpm2: convert remaining assert_se() to ASSERT_* macros
Replace the assert_se() in policy_or_tree_reference() with the typed
ASSERT_* macros, so that a failing assertion logs the values involved.
2026-11-05 03:21:37 +09:00
Yu Watanabe 1041a88717 test-fs-util: drop assert_se() duplicating the ASSERT_OK() checks
The two xopenat_full() reopen checks were already expressed with
ASSERT_OK() right below; remove the leftover assert_se() duplicates.

Follow-up for 3295505085
2026-11-05 03:21:37 +09:00
Yu Watanabe 1bea7ef777 fuzz-xdg-desktop: use ASSERT_OK() and friends
Replace assert_se() with the typed ASSERT_* macros, so that a failing
assertion logs the values involved.
2026-11-05 03:21:37 +09:00
Yu Watanabe c36fdc94a2 fuzz-link-parser: use ASSERT_OK() and friends
Replace assert_se() with the typed ASSERT_* macros, so that a failing
assertion logs the values involved.
2026-11-05 03:21:37 +09:00
Yu Watanabe 5fcce5b5fa fuzz-udev-rules: use ASSERT_OK() and friends
Replace assert_se() with the typed ASSERT_* macros, so that a failing
assertion logs the values involved.
2026-11-05 03:21:37 +09:00
Yu Watanabe 30b6cb6da5 fuzz-udev-rule-parse-value: use ASSERT_OK() and friends
Replace assert_se() with the typed ASSERT_* macros, so that a failing
assertion logs the values involved.
2026-11-05 03:21:37 +09:00
Yu Watanabe 650b77282b fuzz-systemctl-parse-argv: use ASSERT_OK() and friends
Replace assert_se() with the typed ASSERT_* macros, so that a failing
assertion logs the values involved.
2026-11-05 03:21:37 +09:00
Yu Watanabe d25bcf2113 fuzz-resource-record: use ASSERT_OK() and friends
Replace assert_se() with the typed ASSERT_* macros, so that a failing
assertion logs the values involved.
2026-11-05 03:21:37 +09:00
Yu Watanabe cec076f77b fuzz-etc-hosts: use ASSERT_OK() and friends
Replace assert_se() with the typed ASSERT_* macros, so that a failing
assertion logs the values involved.
2026-11-05 03:21:37 +09:00
Yu Watanabe 6b4198d7d1 fuzz-dns-packet: use ASSERT_OK() and friends
Replace assert_se() with the typed ASSERT_* macros, so that a failing
assertion logs the values involved.
2026-11-05 03:21:37 +09:00
Yu Watanabe e8fd109387 fuzz-nspawn-settings: use ASSERT_OK() and friends
Replace assert_se() with the typed ASSERT_* macros, so that a failing
assertion logs the values involved.
2026-11-05 03:21:37 +09:00
Yu Watanabe 607729ad6a fuzz-nspawn-oci: use ASSERT_OK() and friends
Replace assert_se() with the typed ASSERT_* macros, so that a failing
assertion logs the values involved.
2026-11-05 03:21:37 +09:00
Yu Watanabe 1a0058fb91 fuzz-network-parser: use ASSERT_OK() and friends
Replace assert_se() with the typed ASSERT_* macros, so that a failing
assertion logs the values involved.
2026-11-05 03:21:37 +09:00
Yu Watanabe f241539464 fuzz-netdev-parser: use ASSERT_OK() and friends
Replace assert_se() with the typed ASSERT_* macros, so that a failing
assertion logs the values involved.
2026-11-05 03:21:37 +09:00
Yu Watanabe ac548ece67 fuzz-journal-file: use ASSERT_OK() and friends
Replace assert_se() with the typed ASSERT_* macros, so that a failing
assertion logs the values involved.
2026-11-05 03:21:37 +09:00
Yu Watanabe 4ec8fffed9 fuzz-bus-message: use ASSERT_OK() and friends
Replace assert_se() with the typed ASSERT_* macros, so that a failing
assertion logs the values involved.
2026-11-05 03:21:37 +09:00
Yu Watanabe f86fd03386 fuzz-bus-match: use ASSERT_OK() and friends
Replace assert_se() with the typed ASSERT_* macros, so that a failing
assertion logs the values involved.
2026-11-05 03:21:37 +09:00
Yu Watanabe 01cc22e103 fuzz-ndisc-rs: use ASSERT_OK() and friends
Replace assert_se() with the typed ASSERT_* macros, so that a failing
assertion logs the values involved.
2026-11-05 03:21:37 +09:00
Yu Watanabe 9c9c6ce545 fuzz-lldp-rx: use ASSERT_OK() and friends
Replace assert_se() with the typed ASSERT_* macros, so that a failing
assertion logs the values involved.
2026-11-05 03:21:37 +09:00
Yu Watanabe b446fab4bc fuzz-dhcp6-client: use ASSERT_OK() and friends
Replace assert_se() with the typed ASSERT_* macros, so that a failing
assertion logs the values involved.
2026-11-05 03:21:37 +09:00