Commit Graph
91123 Commits
Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek d768cdcceb cgls: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. --help now goes through the pager, like other
commands with --no-pager.

Synopses are adjusted. --user-unit/--unit without any unit names is
technically allowed, but not very meaningful, since it's the same as
the default mode. So [] is dropped. And the prog help string is then
adjusted to match the man page.
2026-08-15 15:28:58 +02:00
Zbigniew Jędrzejewski-Szmek 73d0a3a2ea cat: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. "COMMAND…" is marked as optional, since
'cat' is the default verb.
2026-08-15 15:25:23 +02:00
Zbigniew Jędrzejewski-Szmek 38293644a2 bsod: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added.
2026-08-15 15:25:23 +02:00
Zbigniew Jędrzejewski-Szmek 50ffe81202 binfmt: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. The abstract is changed to use the imperative
form ("Register …" instead of "Registers …"), consistent with the other
commands. --help now goes through the pager, like other commands with
--no-pager.
2026-08-15 15:25:23 +02:00
Zbigniew Jędrzejewski-Szmek c0a3967acb battery-check: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added.
2026-08-15 15:25:23 +02:00
Zbigniew Jędrzejewski-Szmek 7027ca6ee4 systemd-hwdb: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added.
2026-08-15 15:25:23 +02:00
Zbigniew Jędrzejewski-Szmek ba76d38f37 firstboot: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. The abstract is changed to use the imperative
form ("Configure …" instead of "Configures …"), consistent with the
other commands.
2026-08-15 15:24:58 +02:00
Zbigniew Jędrzejewski-Szmek f25a3d3240 TEST-74-AUX-UTILS.introspect-cli: simplify how --introspect-cli is tested
After c9cd66ee3a and
c81b5d36b9, the comment about systemd-backlight
and systemd-veritysetup was outdated. We can test them as any other program.

Also, use an array to make list easier to extend in the future and
adjust $PATH so we don't need to care about the split between public
and non-public programs.
2026-08-15 13:36:54 +02:00
Yu Watanabe 6a5809b2a8 pidfd: introduce pidfd_info_mask_is_supported() (#43298)
The helper is currently unused. But should be useful for checking the
kernel features. It will be used in systemd-coredump.
2026-08-15 03:32:20 +09:00
Yu Watanabe e3a224a46d sd-varlink: several fixlets (#43369) 2026-08-15 01:38:18 +09:00
Yu Watanabe f807a32125 coredump: do not leak TID in the host to container (#43349)
PID, UID, and GID are converted by sending struct ucred, however, TID
was not converted. Let's convert TID if corresponding pidfd exists, and
discards TID otherwise.

Fixes 4c7af7d9d1.
2026-08-15 01:38:04 +09:00
Yu Watanabe 7ae2bc9199 pidfd-util: introduce pidfd_info_mask_is_supported() helper function
Since kernel v6.19, ioctl(PIDFD_GET_INFO) can return the set of
supported flags when PIDFD_INFO_SUPPORTED_MASK is specified.

This allows checking whether, e.g., PIDFD_INFO_COREDUMP_SIGNAL is
supported by the running kernel.
2026-08-15 01:35:23 +09:00
Yu Watanabe 73e67f5fb1 test: split out test-pidfd-util from test-process-util
The tested function pidfd_get_inode_id_self_cached() is provided by
pidfd-util.c. Let's introduce a new unit test for the file.
2026-08-15 01:35:23 +09:00
dongshengyuan 507ba1e51c core: fix bind paths whitespace parsing
Stop warning on extra spaces in BindPaths= and BindReadOnlyPaths=.
Keep bind path parsing and serialization consistent.

Fixes: #43214
2026-08-15 00:26:40 +09:00
Yu Watanabe 534a73fd3f coredump: do not leak TID in the host to container
PID, UID, and GID are converted by sending struct ucred, however,
TID was not converted. Let's convert TID if corresponding pidfd exists,
and discards TID otherwise.

Fixes 4c7af7d9d1.
2026-08-15 00:11:59 +09:00
Yu Watanabe 63da977f64 sd-varlink: do not call disconnect callback for incomplete connection
The connect callback is called after sd_varlink_server_add_connection()
succeeds. Do not call the disconnect callback for connections that have
not been established yet.
2026-08-14 23:56:19 +09:00
ShiroKSH db08fdbc33 sd-varlink: decrement connection counters on failure
Previously, sd_varlink_server_add_connection_pair() did not decrement
the connection counters when json_stream_attach_fds() failed.

Set the ucred before calling json_stream_attach_fds() so that
sd_varlink_close() also decrements the counters when it fails.
2026-08-14 23:56:19 +09:00
Yu Watanabe 0bd40fdc07 json-stream: do not take ownership of passed fds on failure
This makes json_stream_attach_fds() and json_stream_connect_fd_pair()
leave the passed file descriptors with the caller on failure. Callers
should call TAKE_FD() only after a successful call.

Also make qmp_client_connect_fd() always take ownership of the passed
file descriptor, including on failure. Previously, ownership of the
passed file descriptor on failure was unclear and depended on where
the function failed.
2026-08-14 23:55:51 +09:00
dongshengyuan 77b9a626ce getty-generator: strip whitespace from getty.auto credential
The getty.auto credential is a textual configuration value, but credentials
are read as raw file contents. A value written by common text-file workflows
can therefore end in a newline, causing false\n to be rejected and ignored.

Reproducer:
  printf 'false\n' > "$CREDENTIALS_DIRECTORY/getty.auto"

Before: getty units could still be generated because the credential was
ignored as invalid.
Expected: false\n is parsed the same as false and disables getty
generation.

Strip the value in getty-generator before parsing it. This keeps the
credential framework byte-preserving while applying text semantics where
getty.auto is consumed.

Follow-up for: 3a883e89bc
2026-08-14 11:59:58 +02:00
Zbigniew Jędrzejewski-Szmek cbc8cb18e1 shared: add new securebits (#43376)
The securebits parsing code now recognizes 'no-cap-ambient-raise' (added
in Linux 4.3), 'exec-restrict-file', and 'exec-deny-interactive' (both
added in Linux 6.14). The '-locked' variants were added too.

The `exec-restrict-file` and `exec-deny-interactive` securebits are
particularly useful in combination with `RestrictFileSystemAccess=` to
allow developers to extend the "only execute immutable files" concept to
script interpreters. Those securebits are not documented in the
[`capabilities(7)`](https://man7.org/linux/man-pages/man7/capabilities.7.html)
manpage, only in the [Executability
check](https://docs.kernel.org/userspace-api/check_exec.html) kernel
docs.
2026-08-14 11:57:17 +02:00
Zbigniew Jędrzejewski-Szmek 8975c5c1cf Add a "declarative program header" and introspection of options and verbs (#43152) 2026-08-14 11:52:42 +02:00
Daan De Meyer 7c1609b4c2 ci: harden Claude code review orchestration
Replace opaque built-in review behavior with explicit parallel review lenses for
correctness, concurrency, security, architecture, coding style, and regression
coverage, plus bounded domain-specific reviewers and independent validation.
Prefetch pull request discussion in the setup job while letting the read-only
review job fetch and inspect the full commit history without per-commit
worktrees.

Keep GitHub writes isolated to the setup and posting jobs, pin the Claude models
and CLI, and bound execution below the AWS credential lifetime. Materialize
review instructions from the trusted base revision and scope agent writes to the
structured result directory so untrusted pull request content cannot widen the
review authority.

Treat the posting job as the authoritative trust boundary: validate all
model-selected commits, paths, lines, and thread IDs, normalize degenerate line
ranges, bound sanitized output, and surface GitHub API failures in the tracking
comment before performing writes. Retain daandemeyer/systemd in the repository
allowlist so the workflow can be exercised end to end on the personal fork.

Manual runs against fork PR #15 covered OIDC authentication, sandboxing, result
artifact handoff, tracking-comment updates, and validation of posted output.

Signed-off-by: Daan De Meyer <daan@amutable.com>
2026-08-14 09:45:47 +02:00
Skye Soss bfc302dad2 shared: add new securebits
The securebits parsing code now recognizes 'no-cap-ambient-raise'
(added in Linux 4.3), 'exec-restrict-file', and 'exec-deny-interactive'
(both added in Linux 6.14). The '-locked' variants were added too.
2026-08-13 13:21:28 -05:00
Skye Soss 89fb28f1d3 include/uapi: add linux/securebits.h 2026-08-13 13:21:28 -05:00
Yu Watanabe dc5de3fc03 json-stream: refuse to attach already attached fds
json_stream_attach_fds() closes already attached fds.
Hence, the new fds must be different from the already attached ones.
2026-08-14 00:54:52 +09:00
Yu Watanabe 3e96a99bab sd-varlink: fix memleak on failure path 2026-08-14 00:54:52 +09:00
Yu Watanabe 8f4cd7de43 resolvectl: fix query option handling and resolvconf input errors (#43370) 2026-08-14 00:35:58 +09:00
Yu Watanabe df9265b5a3 resolved: fix domain replacement and delegate DNS parsing (#43365) 2026-08-14 00:29:26 +09:00
dongshengyuan f4284e9ceb path-lookup: reject empty env path components
Only trailing empty components have special meaning:
they request appending the built-in defaults.

Share the validation between normal path lookup and
systemd-analyze verify, so verify does not compose
values that path lookup later rejects.

Propagate generator path parse errors instead of
turning them into empty generator paths.

Follow-up for: cf7d80a5fe
2026-08-14 00:27:09 +09:00
Yu Watanabe cad2c455ec fstab-filter: fix preserve fstab option escaping (#43274)
Fixes #42787.
2026-08-14 00:23:47 +09:00
guolin 9269952ab2 shell-completion: add completion for machinectl restart
The `restart` verb was added to machinectl as a convenience alias for
`reboot`, but its shell completions were never updated. Add it to both
the bash and zsh completions.
2026-08-13 15:55:03 +01:00
Luca Boccassi 4f80cc06a1 test: add TEST-94-COCO integration test for confidential VMs (#43296) 2026-08-13 13:19:15 +01:00
Zbigniew Jędrzejewski-Szmek 94af9a8b40 verbs: wrap abstract too
So far there's only one multi-line abstract. But as pointed out in the
review, it's silly to handle footer but not the abstract.

help_abstract() is not reused because it only works with one-line
abstracts. (It always prints an empty line to separate paragraphs.)
So the formatting is done anew in print_wrapped(). I think this is OK,
since it's all very simple. After everything has been converted to
COMMAND() and its helpers, help_abstract() and the sister functions will
become unused and can be dropped then.
2026-08-13 13:52:35 +02:00
Zbigniew Jędrzejewski-Szmek 7ea090f41b verbs: wrap the help footer at print time
The footer is now wrapped to min($COLUMNS, 80) when it is printed, so
CommandDescription footers do not need to be hard-wrapped in the source,
and make use of the available terminal width. Newlines embedded in the
text are preserved and each line is wrapped independently, so explicit
line breaks can still be used where needed, e.g. before the example
command line in varlinkctl.

The text is wrapped at max of 80 columns to avoid very wrong lines on
wide terminals. Such lines are hard to read.

A new helper is added for this. We already have format_strv_width in
format-table, but it requires a strv, so we'd need to conver the data,
and returns a formatted string, which we'd need to print ourselves. So
overall, it seems better to add a dedicated helper.
2026-08-13 13:48:24 +02:00
Zbigniew Jędrzejewski-Szmek 7670c20c6e verbs: add PagerFlags pointer to all CommandDescription's
Before this series, many help() functions opened the pager. This got lost
in the translation. Starting the pager requires access to arg_pager_flags.
While we could pipe this through in case when command_print_help() is
called directly, but this hard in the case when verb_help_auto() or
VERB_COMMON_HELP_AUTO/VERB_COMMON_HELP_AUTO_HIDDEN are used. Let's instead
extend the (const static) CommandDescription structure with a pointer to
the arg_pager_flags variable. This restores the pager functionality in a
uniform fashion with a one-line change in the individual binaries.
2026-08-13 13:46:08 +02:00
Zbigniew Jędrzejewski-Szmek 8a14181f55 resolvectl: separate systemd-resolve in introspection data
Previously, the systemd-resolve compat alias was described in the same
CommandDescription structure and resolvectl. But they have different
option sets, so this doesn't really work. The alias is deprecated, so
describe it as such in the abstract, but give it a separate entry.

$ build/resolvectl --introspect-cli
{
  "mediaType": "application/vnd.io.systemd.cli-introspection-0",
  "commands": [
    {
      "names": [ "resolvconf" ],
      "abstract": [
        "Register DNS server and domain configuration with systemd-resolved."
      ],
      ...
    },
    {
      "names": [ "resolvectl" ],
      "abstract": [
        "Send control commands to the network name resolution manager, or\nresolve domain names, IPv4 and IPv6 addresses, DNS records, and services."
      ],
      ...
    },
    {
      "names": [ "systemd-resolve" ],
      "abstract": [
        "Send control commands to the network name resolution manager, or\nresolve domain names, IPv4 and IPv6 addresses, DNS records, and services.\n\nThis command is deprecated. Use resolvectl.1 instead."
      ],
      ...
    }
  ]
}
2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek 1a54ce154c various: add --introspect-cli 2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek 6c83ea9eda Add infrastracture to introspect commandline binaries
This adds the helpers to add a hidden --introspect-cli option which
prints a machine-readable description of the program's interface and
exits. Applicable to any programs that have been converted to
VERB_COMMAND().

The output format follows the draft CLI-Introspection Specification
(https://github.com/behrmann/uapi-specifications/blob/cli-introspection/specs/cli_introspection.md):
a single JSON document with a fixed "mediaType" string and an array of
command objects, one per VERB_COMMAND() defined in the binary, so multicall
binaries are described in full. Options are taken from the command's option
namespace, so e.g. systemd-dissect does not list the mount.ddi mount-helper
options.

$ build/systemd-id128 --json=pretty --introspect-cli
{
        "mediaType" : "application/vnd.io.systemd.cli-introspection-0",
        "commands" : [
                {
                        "names" : [
                                "systemd-id128"
                        ],
                        "version" : "262~devel",
                        "features" : [
                                "-PAM",
                                ...
                        ],
                        "abstract" : [
                                "Generate and print 128-bit identifiers."
                        ],
                        "options" : [
                                {
                                        "names" : [
                                                "-h",
                                                "--help"
                                        ],
                                        "argument" : "no_argument",
                                        "help" : "Show this help"
                                },
                                ...
                        ],
                        "verbs" : [
                                {
                                        "names" : [
                                                "new"
                                        ],
                                        "abstract" : [
                                                "Generate a new ID"
                                        ],
                                        "maxArguments" : 1
                                },
                                ...
                        ]
                }
        ]
}

$ build/systemd-id128 --introspect-cli | jq '.commands[0].options[].names[-1]'
"--help"
"--version"
"--no-pager"
"--no-legend"
"--json"
"-j"
"--pretty"
"--value"
"--app-specific"
"--uuid"
"--introspect-cli"
2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek adbec875af systemd-notify: convert to VERB_COMMAND 2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek 816ce4eeee notify: do not print full help output on error
Printing a wall of text is obnoxious. Just tell the user what the
problem was.
2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek 66246c98b5 systemd-dissect: convert to VERB_COMMAND 2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek df03655bc5 resolvectl: convert to VERB_COMMAND 2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek 580489eeec resolvectl: drop --help for systemd-resolve
The rename was done in v239. We generally don't document obsolete
interfaces, so let's just drop the (very nice) --help that we have here.
2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek a60c999d5b systemd-backlight: convert to VERB_COMMAND 2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek c9cd66ee3a backlight: add parse_argv() 2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek 92462517a1 systemd-ask-password: convert to VERB_COMMAND 2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek 24acd23d8d systemd-analyze: convert to VERB_COMMAND 2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek 37e3568236 systemd-ac-power: convert to VERB_COMMAND 2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek edb15285d0 systemd-veritysetup: convert to VERB_COMMAND
The --help output now shows -h/--help.

"verity protected" is changed to the more correct spelling of
"verity-protected".
2026-08-13 13:23:05 +02:00
Zbigniew Jędrzejewski-Szmek c81b5d36b9 veritysetup: add the usual parse_argv() function
More options will be added later, so let's use the usual
setup.
2026-08-13 13:23:05 +02:00