Commit graph

67753 commits

Author SHA1 Message Date
Lennart Poettering 8525de1365 test: extend some existing tests with varlinkctl lines, to test varlinkctl + new PCRExtend service 2023-10-06 11:49:38 +02:00
Lennart Poettering 4e16d5c69e pcrextend: make pcrextend tool acccessible via varlink
This is primarily supposed to be a 1st step with varlinkifying our
various command line tools, and excercise in how this might look like
across our codebase one day. However, at AllSystemsGo! 2023 it was
requested that we provide an API to do a PCR measurement along with a
matching event log record, and this provides that.
2023-10-06 11:49:38 +02:00
Lennart Poettering d408a53f78 varlinkctl: add new varlinkctl tool 2023-10-06 11:49:38 +02:00
Lennart Poettering 02b0d24d1e varlink: add varlink_invocation() call
This call checks if we are invoked in a socket-activation Varlink server
context. It's useful for commands that can be run from the command line
or as Varlink service and then either serve commands from the cmdline or
those from Varlink.
2023-10-06 11:49:38 +02:00
Lennart Poettering 2e5edb93b7 varlink: add new call varlink_server_loop_auto()
This is a helper call that runs the specified VarlinkServer object in an
event loop, and exits once no more connections exist.

This is useful for pure varlink servers (i.e. those which only server
varlink requests and do nothing else), to run as long as there's
something to do and exit right after.
2023-10-06 11:49:38 +02:00
Lennart Poettering 206504a594 varlink: add varlink_server_listen_auto() helper
This new helper will automatically take listening fds passed in from the
service manager and processes varlink on them. It's useful for Varlink
services that shall be socket activatable.
2023-10-06 11:49:38 +02:00
Lennart Poettering 4772334013 varlink: add exit-on-idle logic for Varlink server
This adds a logic that if enabled ensures sd_event_exit() is called
whenever the varlink connection count hits zero.

This is useful for implementing pure Varlink services (i.e. services
whose only job is to serve Varlink requests), that shall run only as
long as needed, i.e. as long as at least one request is being served.
2023-10-06 11:49:38 +02:00
Lennart Poettering faec54ad34 test: add test for varlink introspection logic 2023-10-06 11:49:38 +02:00
Lennart Poettering 7dce9ead5d oomd: move SubscriptionTaken Varlink error out of generic Varlink code
This error is a private error returned by PID 1 to oomd. It's internal,
and very specific to the use-case. Hence it should not be part of the
org.varlink.service interface (which isn't really our namespace anyway).

Hence, let's clean this up and move it over to the ManagedOOM varlink
interface of PID, where it belongs.

Since this is a private protocol of our two daemons, and the client
(i.e. oomd) doesn't explicitly test for this error anyway we can just
move it over without ill effects.
2023-10-06 11:49:38 +02:00
Lennart Poettering abef4a7b3c tree-wide: make all our Varlink APIs introspectable 2023-10-06 11:49:38 +02:00
Lennart Poettering 0f274a8790 varlink: add varlink_connect_url() and varlink_connect_exec() calls 2023-10-06 11:49:38 +02:00
Lennart Poettering 7e006b49ad varlink: implement the org.varlink.service introspection interface by default + hook up validator
Fixes: #23874
2023-10-06 11:49:38 +02:00
Lennart Poettering f946d4c9ec varlink: add introspection data for the org.varlink.service and io.systemd interfaces
The official org.varlink.service interface definition, as per:

https://varlink.org/Service

And the io.systemd service where we carry some super generic errors our
Varlink implementation generates.
2023-10-06 11:49:38 +02:00
Lennart Poettering 9fc843ed0e varlink: allow associating Varlink IDL information with a VarlinkServer
The data is not used for anything yet, but this will be added in later
commits.
2023-10-06 11:49:38 +02:00
Lennart Poettering e50b2a93d6 varlink: add IDL/introspection logic 2023-10-06 11:49:38 +02:00
Lennart Poettering 8240fa920d varlink: add new helper that reports whether connection is idle
This is useful to allow event loops to run exactly as long as there's
something to do but not longer.
2023-10-06 07:44:47 +02:00
Lennart Poettering 5e71f86dff alloc-util: add realloc0() helper than is like realloc() but zero-initializes appended space 2023-10-06 07:44:47 +02:00
felixdoerre 3846d3aa29
journalctl: verify that old entries are not sealed with too recent key (#28885)
When verifying seals produced with forward secure sealing, the verification
currently does not check that old entries are only sealed with the key for
their epoch and not a more recent one. This missing check allows an attacker
to remove seals, and create new ones with the currently available key, and
verify will claim everything is in order, although all entries could have
been modified.

This resolves CVE-2023-31439.

Co-authored-by: Felix Dörre <felix.doerre@kit.edu>
2023-10-06 12:18:21 +09:00
Yu Watanabe 09ff0aadf9 backlight: support to specify percentage of minimum brightness
Closes #29328.
2023-10-06 11:21:20 +09:00
Yu Watanabe 4f4d7911cd man: fix typo
Follow-up for a121b331e3.
2023-10-06 11:18:47 +09:00
Yu Watanabe 8c35a97758 core: fix typo 2023-10-06 11:15:30 +09:00
Yu Watanabe 8af8f9e891
Merge pull request #29417 from yuwata/sd-journal-cleanups-for-generic-array-bisect-plus-one
sd-journal: cleanups for generic_array_bisect_plus_one()
2023-10-06 11:04:07 +09:00
Yu Watanabe 77db35bf10 sd-journal: make journal_file_next_entry() always return the nearest entry object
Previously, if the input offset 'p' does not point to an entry object,
the function returns the next of the nearest entry object on
DIRECTION_DOWN, as generic_array_bisect() already returns the nearest
entry object.
2023-10-06 09:57:27 +09:00
Yu Watanabe 80f96c0ce1 sd-journal: reduce number of calls generic_array_bisect_plus_one()
If the first call of generic_array_bisect_plus_one() provides the same
offset, then it is not necessary to call the next one, as we already
know the entry object is also liked to the input data object.

Also, this make the function reuse the object returned by
generic_array_bisect_plus_one().

No functional change, just optimization.
2023-10-06 09:55:04 +09:00
Yu Watanabe 20c45e5784 sd-journal: drop unnecessary re-read of data object
Follow-up for ec50313d4e.

The function generic_array_bisect_plus_one() does not read any new data
objects, so the data object is still valid, and not necessary to re-read it.
2023-10-06 09:55:04 +09:00
Yu Watanabe d67078b4a3 sd-journal: rewrite conditions for test result and direction
No functional change, just refactoring. Hopefully the condition is more
descriptive now.
2023-10-06 09:55:00 +09:00
Luca Boccassi 85d0fd29af
Merge pull request #29438 from evelikov/document-rm-extra-uefi-vars
Document and purge LoaderConfigConsoleMode and LoaderEntryLastBooted
2023-10-06 00:12:49 +01:00
Lennart Poettering 3fe418a571 machinectl: align UID shift status field properly 2023-10-05 23:23:52 +01:00
Lennart Poettering e7df707b8a image-discover: skip properly over files that cannot be recognized as image files
Follow-up for: #29364
2023-10-05 23:23:31 +01:00
Lennart Poettering c79e760f36
Merge pull request #29364 from poettering/make-ddi-easy
repart: make building DDIs easier (and other fixes)
2023-10-05 21:13:13 +02:00
Mike Yuan 4146960ee9 systemctl-show: align "Cntrl PID" correctly 2023-10-05 19:37:44 +01:00
Lennart Poettering 634b847149 repart: make arg_empty a proper enum with a string table
Now that we translate in both directions (from enum to string, and
string to enum) let's just make the thing a proper enum with a proper
string table, like we generally do.
2023-10-05 19:18:36 +02:00
Lennart Poettering 99d9edf0bd test: test the new --make-ddi= logic 2023-10-05 19:18:36 +02:00
Lennart Poettering e59049d7a9 repart: add simple mechanism to override fstype choices
This is very useful for quickly testing things when building DDIs, in
particular in the CI, and trivial to add.
2023-10-05 19:18:36 +02:00
Lennart Poettering 489b0f515b repart: relax rules on CopyFiles= a bit
If a source dir doesn't exist, mention this, but continue.

This is useful to permit generic definitions that apply to all kinds of
trees, where some parts might remain unpopulated.
2023-10-05 19:11:49 +02:00
Lennart Poettering 37a3878801 repart: say image file instead of loopback file
After all we can now operate without loopback device, so it might be a
big misleading.
2023-10-05 19:10:57 +02:00
Lennart Poettering 95515896f6 sysext: fix some sysextisms in confext mode
Nothing earth-shattering. Just make sure we never expose the string
"sysext" in "confext" mode.
2023-10-05 19:10:06 +02:00
Lennart Poettering a747994b45 discover-image: nicely support .sysext.raw + .confext.raw suffix for DDIs
Back at Plumbers 2022 we discussed that we should push people towards
using the .sysext.raw and .confext.raw for their DDIs if they are
extension images. Let's actually support that, by chopping off these
suffixes when turning file names into "pretty image names".
2023-10-05 19:09:12 +02:00
Lennart Poettering a121b331e3 repart: make it easy to generate DDIs
This adds --make-ddi=confext, --make-ddi=sysext, --make-ddi=portable, to
make it really easiy to generate DDIs of the specified class. It
it's ultimately just a fancy wrapper around some defaults and in
particular --definitions=.

This makes it very easy to generate a confext:

 $ systemd-repart -C --private-key=privkey.pem --certificate=cert.crt -s mytree/ mytree.confext.raw
2023-10-05 19:08:11 +02:00
Lennart Poettering 607343a1ac repart: add new --copy-source= switch
This specifies a directory to which CopyFiles= is considered relative.
If unset defaults to the --root=/--image= setting, or host / otherwise.

This is very similar to --root= but is much more focussed: it is really
and exclusively about CopyFiles= (and related settings such as
ExcludeFiles=) and does not affect any of the settings, i.e. it doesn't
affect CopyBlocks=, the machine ID/seed handling, or where definitions
are read from.

In fact, --root= and --copy-source= may be combined for example to
use the machine ID and similar from one tree, but the copy the files
from another.
2023-10-05 19:07:19 +02:00
Lennart Poettering 248f0186c1 repart: drop redundant () 2023-10-05 19:06:26 +02:00
Lennart Poettering ba6bd342fa repart: get rid of redundant variable 'dry_run'
There's only one case where we set 'dry_run', which is when
--empty=create is set. Hence simplify things and directly check for
that.
2023-10-05 19:05:33 +02:00
Lennart Poettering 243dd1e9fa repart: rework --empty= handling a bit
Introduce a new enum value EMPTY_UNSET to which arg_empty now is set
initially. Only after we finished parsing the command line we'll now set
this to EMPTY_REFUSE as before.

This prepares ground for later changes, where we then can make different
decisions after havig all input from the command line.

As of now this doesn't change behaviour of systemd-repart, it just
rearranges things a bit.
2023-10-05 19:04:40 +02:00
Lennart Poettering 6c05395e82 repart: disable pager in --dry-run=no mode
When --dry-run=yes is used it makes sense to spawn a pager to look at
the report it provides you with about what it is about to do. Hoewver,
when we are actually doing it, then the output is more in the category
of "logs" than "review material", and logs we generally don't page when
we generate them.
2023-10-05 19:03:46 +02:00
Lennart Poettering 19c58989f7 repart: don't wipe the disk image if we just created it fresh
Let's avoid some unnecessary work if we the image is freshly created
anyway.
2023-10-05 19:02:53 +02:00
Lennart Poettering 2c07d314b2 fileio: revamp search_and_fopen()
Let's modernize and clean up search_and_fopen a bit: let's add support
for regular open() (instead of fopen()), as well as access() (if caller
just wants to check if a file exists without opening it.

This unifies much of the code involved, which previously was duplicated
in search_and_fopen() and search_and_fopen_nulstr()
2023-10-05 19:01:28 +02:00
Lennart Poettering 27a1719bba
Merge pull request #29455 from poettering/scope-pidref
pid1: allow creating scope units based on pidfds (as opposed to numeric pids)
2023-10-05 18:40:32 +02:00
Mike Yuan ba96ba0420 docs/HACKING: Arch has dropped asp in favor of pkgctl
Prompted by #29461

See also: https://wiki.archlinux.org/title/Arch_build_system#Using_the_pkgctl_tool
2023-10-05 17:54:37 +02:00
Lennart Poettering ed287b87d2 update TODO 2023-10-05 17:11:03 +02:00
Lennart Poettering 7eda208ffe tree-wide: prefer sending pifds over pids when creating scope units 2023-10-05 17:10:00 +02:00