]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
11 months agoMerge pull request #29470 from yuwata/network-test-mode
Luca Boccassi [Fri, 6 Oct 2023 12:41:34 +0000 (13:41 +0100)] 
Merge pull request #29470 from yuwata/network-test-mode

network: introduce test mode

11 months agotest-network: move get_dbus_dhcp_client_state() and friends to global
Yu Watanabe [Fri, 6 Oct 2023 05:10:18 +0000 (14:10 +0900)] 
test-network: move get_dbus_dhcp_client_state() and friends to global

11 months agoMerge pull request #29456 from yuwata/journal-replace-truncating-with-punching-holes
Daan De Meyer [Fri, 6 Oct 2023 07:18:06 +0000 (09:18 +0200)] 
Merge pull request #29456 from yuwata/journal-replace-truncating-with-punching-holes

journal: replace truncating with punching holes

11 months agoUpdate HACKING instructions
Daan De Meyer [Thu, 5 Oct 2023 15:04:53 +0000 (17:04 +0200)] 
Update HACKING instructions

Let's mention that we just need the latest stable release of mkosi,
not the latest git commit. We also split the instructions for building
on the host and the instructions for building with mkosi into two blocks,
as it's not required to build on the host anymore to build with mkosi.

11 months agoFix a typo in `systemctl-enable.c`
G2-Games [Fri, 6 Oct 2023 06:03:18 +0000 (01:03 -0500)] 
Fix a typo in `systemctl-enable.c`

11 months agofuzz: suppress log messages 29470/head
Yu Watanabe [Fri, 6 Oct 2023 04:26:16 +0000 (13:26 +0900)] 
fuzz: suppress log messages

11 months agolibsystemd-network: introduce $SYSTEMD_NETWORK_TEST_MODE environment variable
Yu Watanabe [Fri, 6 Oct 2023 04:22:04 +0000 (13:22 +0900)] 
libsystemd-network: introduce $SYSTEMD_NETWORK_TEST_MODE environment variable

Then, drop dhcp_client_set_test_mode() and friends.

11 months agojournalctl: verify that old entries are not sealed with too recent key (#28885)
felixdoerre [Fri, 6 Oct 2023 03:18:21 +0000 (05:18 +0200)] 
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>
11 months agobacklight: support to specify percentage of minimum brightness
Yu Watanabe [Wed, 4 Oct 2023 12:46:26 +0000 (21:46 +0900)] 
backlight: support to specify percentage of minimum brightness

Closes #29328.

11 months agoman: fix typo
Yu Watanabe [Fri, 6 Oct 2023 02:18:07 +0000 (11:18 +0900)] 
man: fix typo

Follow-up for a121b331e37682341152b51269cf8ce00e68d755.

11 months agocore: fix typo
Yu Watanabe [Fri, 6 Oct 2023 02:15:30 +0000 (11:15 +0900)] 
core: fix typo

11 months agoMerge pull request #29417 from yuwata/sd-journal-cleanups-for-generic-array-bisect...
Yu Watanabe [Fri, 6 Oct 2023 02:04:07 +0000 (11:04 +0900)] 
Merge pull request #29417 from yuwata/sd-journal-cleanups-for-generic-array-bisect-plus-one

sd-journal: cleanups for generic_array_bisect_plus_one()

11 months agosd-journal: make journal_file_next_entry() always return the nearest entry object 29417/head
Yu Watanabe [Wed, 27 Sep 2023 19:55:21 +0000 (04:55 +0900)] 
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.

11 months agosd-journal: reduce number of calls generic_array_bisect_plus_one()
Yu Watanabe [Wed, 27 Sep 2023 19:15:04 +0000 (04:15 +0900)] 
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.

11 months agosd-journal: drop unnecessary re-read of data object
Yu Watanabe [Wed, 27 Sep 2023 17:42:00 +0000 (02:42 +0900)] 
sd-journal: drop unnecessary re-read of data object

Follow-up for ec50313d4e329de276240883d86d05168a4cf09f.

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.

11 months agosd-journal: rewrite conditions for test result and direction
Yu Watanabe [Wed, 27 Sep 2023 03:47:35 +0000 (12:47 +0900)] 
sd-journal: rewrite conditions for test result and direction

No functional change, just refactoring. Hopefully the condition is more
descriptive now.

11 months agotest: add reproducer for SIGBUS issue caused by journal truncation 29456/head
Yu Watanabe [Thu, 5 Oct 2023 09:02:24 +0000 (18:02 +0900)] 
test: add reproducer for SIGBUS issue caused by journal truncation

The added code fails without the previous commit.

For issue #24320.

11 months agoMerge pull request #29438 from evelikov/document-rm-extra-uefi-vars
Luca Boccassi [Thu, 5 Oct 2023 23:12:49 +0000 (00:12 +0100)] 
Merge pull request #29438 from evelikov/document-rm-extra-uefi-vars

Document and purge LoaderConfigConsoleMode and LoaderEntryLastBooted

11 months agomachinectl: align UID shift status field properly
Lennart Poettering [Thu, 5 Oct 2023 20:44:23 +0000 (22:44 +0200)] 
machinectl: align UID shift status field properly

11 months agoimage-discover: skip properly over files that cannot be recognized as image files
Lennart Poettering [Thu, 5 Oct 2023 20:44:50 +0000 (22:44 +0200)] 
image-discover: skip properly over files that cannot be recognized as image files

Follow-up for: #29364

11 months agoMerge pull request #29364 from poettering/make-ddi-easy
Lennart Poettering [Thu, 5 Oct 2023 19:13:13 +0000 (21:13 +0200)] 
Merge pull request #29364 from poettering/make-ddi-easy

repart: make building DDIs easier (and other fixes)

11 months agosystemctl-show: align "Cntrl PID" correctly
Mike Yuan [Thu, 5 Oct 2023 16:49:45 +0000 (00:49 +0800)] 
systemctl-show: align "Cntrl PID" correctly

11 months agorepart: make arg_empty a proper enum with a string table 29364/head
Lennart Poettering [Wed, 4 Oct 2023 15:10:31 +0000 (17:10 +0200)] 
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.

11 months agotest: test the new --make-ddi= logic
Lennart Poettering [Fri, 29 Sep 2023 16:02:18 +0000 (18:02 +0200)] 
test: test the new --make-ddi= logic

11 months agorepart: add simple mechanism to override fstype choices
Lennart Poettering [Thu, 5 Oct 2023 16:54:43 +0000 (18:54 +0200)] 
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.

11 months agorepart: relax rules on CopyFiles= a bit
Lennart Poettering [Fri, 29 Sep 2023 14:44:45 +0000 (16:44 +0200)] 
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.

11 months agorepart: say image file instead of loopback file
Lennart Poettering [Thu, 28 Sep 2023 16:57:39 +0000 (18:57 +0200)] 
repart: say image file instead of loopback file

After all we can now operate without loopback device, so it might be a
big misleading.

11 months agosysext: fix some sysextisms in confext mode
Lennart Poettering [Thu, 28 Sep 2023 16:24:11 +0000 (18:24 +0200)] 
sysext: fix some sysextisms in confext mode

Nothing earth-shattering. Just make sure we never expose the string
"sysext" in "confext" mode.

11 months agodiscover-image: nicely support .sysext.raw + .confext.raw suffix for DDIs
Lennart Poettering [Thu, 28 Sep 2023 16:22:24 +0000 (18:22 +0200)] 
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".

11 months agorepart: make it easy to generate DDIs
Lennart Poettering [Thu, 28 Sep 2023 16:16:59 +0000 (18:16 +0200)] 
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

11 months agorepart: add new --copy-source= switch
Lennart Poettering [Fri, 29 Sep 2023 14:24:48 +0000 (16:24 +0200)] 
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.

11 months agorepart: drop redundant ()
Lennart Poettering [Fri, 29 Sep 2023 14:18:22 +0000 (16:18 +0200)] 
repart: drop redundant ()

11 months agorepart: get rid of redundant variable 'dry_run'
Lennart Poettering [Fri, 29 Sep 2023 14:16:03 +0000 (16:16 +0200)] 
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.

11 months agorepart: rework --empty= handling a bit
Lennart Poettering [Fri, 29 Sep 2023 14:09:50 +0000 (16:09 +0200)] 
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.

11 months agorepart: disable pager in --dry-run=no mode
Lennart Poettering [Thu, 28 Sep 2023 16:20:41 +0000 (18:20 +0200)] 
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.

11 months agorepart: don't wipe the disk image if we just created it fresh
Lennart Poettering [Thu, 28 Sep 2023 16:08:48 +0000 (18:08 +0200)] 
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.

11 months agofileio: revamp search_and_fopen()
Lennart Poettering [Fri, 29 Sep 2023 13:37:58 +0000 (15:37 +0200)] 
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()

11 months agoMerge pull request #29455 from poettering/scope-pidref
Lennart Poettering [Thu, 5 Oct 2023 16:40:32 +0000 (18:40 +0200)] 
Merge pull request #29455 from poettering/scope-pidref

pid1: allow creating scope units based on pidfds (as opposed to numeric pids)

11 months agodocs/HACKING: Arch has dropped asp in favor of pkgctl
Mike Yuan [Thu, 5 Oct 2023 15:21:01 +0000 (23:21 +0800)] 
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

11 months agoupdate TODO 29455/head
Lennart Poettering [Thu, 5 Oct 2023 07:56:29 +0000 (09:56 +0200)] 
update TODO

11 months agotree-wide: prefer sending pifds over pids when creating scope units
Lennart Poettering [Thu, 5 Oct 2023 07:55:28 +0000 (09:55 +0200)] 
tree-wide: prefer sending pifds over pids when creating scope units

11 months agopidref: add trivial helper pidref_set_self() to set pidref to our handle to our own...
Lennart Poettering [Thu, 5 Oct 2023 07:47:42 +0000 (09:47 +0200)] 
pidref: add trivial helper pidref_set_self() to set pidref to our handle to our own process

11 months agopid1: allow creating scope units based in pidfds instead of plain pids
Lennart Poettering [Thu, 5 Oct 2023 07:46:40 +0000 (09:46 +0200)] 
pid1: allow creating scope units based in pidfds instead of plain pids

11 months agomkosi: Update to latest
Daan De Meyer [Thu, 5 Oct 2023 13:17:01 +0000 (15:17 +0200)] 
mkosi: Update to latest

We have to set the image runtime size explicitly now so that's it's
grown a bit when we boot in nspawn or qemu.

11 months agomountpoint-util: Check hardcoded list before asking kernel if option is supported
Daan De Meyer [Thu, 5 Oct 2023 10:49:07 +0000 (12:49 +0200)] 
mountpoint-util: Check hardcoded list before asking kernel if option is supported

mount_option_supported() will call fsopen() which will probe the
kernel filesystem module. This means that we'll suddenly start
probing filesystem modules when running generators as those determine
which mount options to use. To prevent generators from loading kernel
filesystem modules as much as possible, let's always first check the
hardcoded list of filesystem which we know support a feature before
falling back to asking the kernel.

11 months agoMerge pull request #29454 from poettering/cg-pidref-get-path
Lennart Poettering [Thu, 5 Oct 2023 13:44:25 +0000 (15:44 +0200)] 
Merge pull request #29454 from poettering/cg-pidref-get-path

cgroup-util: add cg_pidref_get_path() helper and use it

11 months agoMerge pull request #29458 from poettering/serialize-pidref
Lennart Poettering [Thu, 5 Oct 2023 13:43:02 +0000 (15:43 +0200)] 
Merge pull request #29458 from poettering/serialize-pidref

pid1: serialize pidref as pidfd if possible

11 months agoMerge pull request #29439 from yuwata/mmap-cache-cleanups-part2
Daan De Meyer [Thu, 5 Oct 2023 12:49:48 +0000 (14:49 +0200)] 
Merge pull request #29439 from yuwata/mmap-cache-cleanups-part2

mmap-cache: several cleanups (part2)

11 months agoman: document LoaderEntryLastBooted 29438/head
Emil Velikov [Mon, 2 Oct 2023 16:56:42 +0000 (17:56 +0100)] 
man: document LoaderEntryLastBooted

The option was introduced with systemd v250 although it went
undocumented. It effectively sits between Default and OneShot, in term
of priority.

It is repeatedly updated as long as loader.conf default is "@saved" and
the OneShot is not set.

v2:
 - squash some typos

v3:
 - special mention to default @saved + loader.conf reference
 - reword update side, to avoid misleading that it's needlessly
   overwritten

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
11 months agoMerge pull request #29453 from poettering/cgroup-no-controller
Lennart Poettering [Thu, 5 Oct 2023 11:31:02 +0000 (13:31 +0200)] 
Merge pull request #29453 from poettering/cgroup-no-controller

cgroup-util: drop "controller" argument from various cgroup helper calls

11 months agoupdate TODO 29454/head
Lennart Poettering [Thu, 5 Oct 2023 09:49:14 +0000 (11:49 +0200)] 
update TODO

11 months agocgroup-util: add cg_pidref_get_path() helper and use it
Lennart Poettering [Thu, 5 Oct 2023 09:49:07 +0000 (11:49 +0200)] 
cgroup-util: add cg_pidref_get_path() helper and use it

11 months agoMerge pull request #29442 from yuwata/network-dhcp4-preferred-address
Luca Boccassi [Thu, 5 Oct 2023 11:25:42 +0000 (12:25 +0100)] 
Merge pull request #29442 from yuwata/network-dhcp4-preferred-address

network: introduce [DHCPv4] PreferredAddress= setting

11 months agoupdate TODO 29458/head
Lennart Poettering [Thu, 5 Oct 2023 10:46:13 +0000 (12:46 +0200)] 
update TODO

11 months agopid1: serialize pidrefs as pidfds if possible
Lennart Poettering [Thu, 5 Oct 2023 10:45:38 +0000 (12:45 +0200)] 
pid1: serialize pidrefs as pidfds if possible

One major step towards total pidfdification of systemd.

11 months agorepart: Mention that xattrs are not copied when populating XFS with protofile
Daan De Meyer [Thu, 5 Oct 2023 08:42:26 +0000 (10:42 +0200)] 
repart: Mention that xattrs are not copied when populating XFS with protofile

11 months agoman: document LoaderConfigConsoleMode
Emil Velikov [Mon, 2 Oct 2023 16:31:36 +0000 (17:31 +0100)] 
man: document LoaderConfigConsoleMode

The variable was introduced with systemd v250 although it went
completely undocumented, even though sd-boot will honour and print it
separately (from the loader.conf one) in the boot help screen.

Document it in the systemd-boot and hint about it in loader.conf manual
pages.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
11 months agobootctl: remove all our non-volatile variables on uninstall
Emil Velikov [Mon, 2 Oct 2023 16:09:29 +0000 (17:09 +0100)] 
bootctl: remove all our non-volatile variables on uninstall

Grepping around showed a few extra entries that are not listed in the
remove_loader_variables() function. Namely:
 - BootNext
 - OsIndications
 - LoaderConfigConsoleMode
 - LoaderEntryLastBooted

Of which the latter two are systemd specific, even though they are
undocumented. Ensure they're removed - follow-up commits will add
documentation references.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
11 months agojournal-file-util: Prefer punching holes instead of truncating
Daan De Meyer [Wed, 4 Oct 2023 07:27:18 +0000 (09:27 +0200)] 
journal-file-util: Prefer punching holes instead of truncating

It seems truncating might cause SIGBUS (#24320). Let's play it safe
and always prefer punching holes over truncating.

11 months agojournal-file-util: do not fail when journal_file_set_offline() called more than once
Yu Watanabe [Thu, 5 Oct 2023 09:20:40 +0000 (18:20 +0900)] 
journal-file-util: do not fail when journal_file_set_offline() called more than once

Previously, if journal_file_set_offline() is called twice with 'wait = false',
the second call triggered segfaults, as the offline_state is OFFLINE_DONE,
and journal_file_set_offline_thread_join() tries to call pthread_join()
with NULL.

11 months agotest: modernize test-journal-flush
Yu Watanabe [Thu, 5 Oct 2023 08:15:54 +0000 (17:15 +0900)] 
test: modernize test-journal-flush

11 months agocgroup-util: make sure cg_get_owner() only works for cgroups, not cgroup attribute... 29453/head
Lennart Poettering [Thu, 5 Oct 2023 08:39:06 +0000 (10:39 +0200)] 
cgroup-util: make sure cg_get_owner() only works for cgroups, not cgroup attribute files

11 months agocgroup-util: drop "controller" argument from various cgroup helper calls
Lennart Poettering [Thu, 5 Oct 2023 08:28:22 +0000 (10:28 +0200)] 
cgroup-util: drop "controller" argument from various cgroup helper calls

systemd's own cgroup hierarchy is special to us, we use it to actually
manage processes. Because of that many calls tha apply to cgroups are
only ever called with the SYSTEMD_CGROUP_CONTROLLER as controller
argument. Let's hence remove the argument altogether.

This in particular touches the kill and xattr routines.

This changes no behaviour, we just drop an argument that is always set
to the same value anyway.

This is preparation to eventually getting rid of the cgroupvs1, because
on cgroupvs2 the cgroup paths do not change for different controllers,
there's only a single hierarchy there.

11 months agosd-boot: introduce and use efivar_unset()
Emil Velikov [Wed, 4 Oct 2023 10:51:47 +0000 (11:51 +0100)] 
sd-boot: introduce and use efivar_unset()

Currently some of the code base check for the variable presence before
removing it, and some do not.

More so, in all cases (being updated) we're dealing with non-volatile
variables where changing those attribute to NVRAM wear out.

From what information I could find, there is no definitive answer if the
UEFI implementation will write to the NVRAM even when the variable is
missing.

So add a simple helper that checks for the variable presence before
removing it. While also having a bit cleaner API than the current
efivar_set(..., NULL, ...);

efivar_unset() follows the design from efivar_set*() where it returns an
EFI_STATUS even though its (presently) unused.

v2:
 - add inline comment, use early return

v3:
 - typos? typos!

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
11 months agotest-network: add tests for [DHCPv4] RequestAddress= setting 29442/head
Yu Watanabe [Wed, 4 Oct 2023 12:29:31 +0000 (21:29 +0900)] 
test-network: add tests for [DHCPv4] RequestAddress= setting

11 months agoMerge pull request #29450 from YHNdnzj/run-mandatory
Luca Boccassi [Wed, 4 Oct 2023 22:30:46 +0000 (23:30 +0100)] 
Merge pull request #29450 from YHNdnzj/run-mandatory

man/systemd.exec: document that API fs are required to setup namespacing

11 months agonetwork: introduce [DHCPv4] RequestAddress= setting
Yu Watanabe [Wed, 4 Oct 2023 11:46:55 +0000 (20:46 +0900)] 
network: introduce [DHCPv4] RequestAddress= setting

This may be useful when requesting a specific address.

Closes #29437.

11 months agonetwork: skip to set request address when anonymized
Yu Watanabe [Wed, 4 Oct 2023 21:53:01 +0000 (06:53 +0900)] 
network: skip to set request address when anonymized

In sd-dhcp-client.c, we do not set the option in the DHCPDISCOVER
message when anonymized, and the specified address is ignored
anyway. So, this does not change the behavior, but suppress
misleading debugging log in dhcp4_set_request_address().

11 months agoman/systemd.exec: document that API fs are required to setup namespacing 29450/head
Mike Yuan [Wed, 4 Oct 2023 21:04:12 +0000 (05:04 +0800)] 
man/systemd.exec: document that API fs are required to setup namespacing

Closes #27997

11 months agoman/systemd.exec: suffix one more directory with /
Mike Yuan [Wed, 4 Oct 2023 21:30:46 +0000 (05:30 +0800)] 
man/systemd.exec: suffix one more directory with /

11 months agoMerge pull request #29391 from lf-/jade/analyze-plot-tooltips
Luca Boccassi [Wed, 4 Oct 2023 20:15:52 +0000 (21:15 +0100)] 
Merge pull request #29391 from lf-/jade/analyze-plot-tooltips

analyze: add tooltips with dependency information to "plot"

11 months agoFix Positivo N14EP6 key toggle touchpad and programmable keys (#29448)
Lucas Adriano Salles [Wed, 4 Oct 2023 20:06:34 +0000 (17:06 -0300)] 
Fix Positivo N14EP6 key toggle touchpad and programmable keys (#29448)

11 months agostub: drop empty line
Lennart Poettering [Mon, 2 Oct 2023 18:49:51 +0000 (20:49 +0200)] 
stub: drop empty line

11 months agomarkdown: add document listing TPM2 PCR measurements we make comprehensively
Lennart Poettering [Mon, 2 Oct 2023 18:49:04 +0000 (20:49 +0200)] 
markdown: add document listing TPM2 PCR measurements we make comprehensively

This is useful to write TPM event log decoders.

11 months agommap-cache: each Window is owned by MMapFileDescriptor 29439/head
Yu Watanabe [Fri, 29 Sep 2023 22:10:27 +0000 (07:10 +0900)] 
mmap-cache: each Window is owned by MMapFileDescriptor

And MMapFileDescriptor always references MMapCache, hence it is not
necessary Window to have a reference to MMapCache.

This also renames the list fields 'by_fd' -> 'windows', to make them
consistent with the name of the head.

No functional change, just refactoring.

11 months agommap-cache: merge mmap_cache_fd_get() with try_context() and find_mmap()
Yu Watanabe [Fri, 29 Sep 2023 21:51:48 +0000 (06:51 +0900)] 
mmap-cache: merge mmap_cache_fd_get() with try_context() and find_mmap()

The post operations (attach the found or new window to a context, update
the keep_always flag, and calculate the address) in three steps are
equivalent, and the two searching logics are quite simple.
Let's merge them to decrease the total lines.

No functional change, just refactoring.

11 months agommap-cache: merge window_matches() and window_matches_fd()
Yu Watanabe [Sat, 30 Sep 2023 02:32:38 +0000 (11:32 +0900)] 
mmap-cache: merge window_matches() and window_matches_fd()

Let's drop meaningless optimization, and always check if the window is
owned by the expected fd.

11 months agommap-cache: merge mmap_try_harder() with make_room()
Yu Watanabe [Thu, 28 Sep 2023 01:27:45 +0000 (10:27 +0900)] 
mmap-cache: merge mmap_try_harder() with make_room()

The function make_room() is short and only used by mmap_try_harder().
Let's merge them with short comments.

No functional change, just refactoring.

11 months agodocs: fix typo in UEFI_SECURITY.md
Luca Boccassi [Wed, 4 Oct 2023 10:08:25 +0000 (11:08 +0100)] 
docs: fix typo in UEFI_SECURITY.md

11 months agosd-journal: drop unused argument for generic_array_bisect_plus_one()
Yu Watanabe [Wed, 27 Sep 2023 03:02:25 +0000 (12:02 +0900)] 
sd-journal: drop unused argument for generic_array_bisect_plus_one()

11 months agoMerge pull request #29386 from yuwata/mmap-cache-cleanups-part1
Daan De Meyer [Wed, 4 Oct 2023 06:49:24 +0000 (08:49 +0200)] 
Merge pull request #29386 from yuwata/mmap-cache-cleanups-part1

mmap-cache: several cleanups (part1)

11 months agotest-network: test SIP servers obtained by DHCP
Yu Watanabe [Wed, 4 Oct 2023 02:18:47 +0000 (11:18 +0900)] 
test-network: test SIP servers obtained by DHCP

For issue #29145.

11 months agoMerge pull request #29403 from yuwata/journal-decouple-journald-and-journal-remote
Daan De Meyer [Wed, 4 Oct 2023 05:55:52 +0000 (07:55 +0200)] 
Merge pull request #29403 from yuwata/journal-decouple-journald-and-journal-remote

journal: drop ManagedJournalFile and decouple journald and journal-remote

11 months agoNEWS: systemd-analyze plot tooltips 29391/head
Jade Lovelace [Sun, 1 Oct 2023 21:27:38 +0000 (14:27 -0700)] 
NEWS: systemd-analyze plot tooltips

11 months agoanalyze: add tooltips with dependency information to "plot"
Jade Lovelace [Sun, 1 Oct 2023 05:21:33 +0000 (22:21 -0700)] 
analyze: add tooltips with dependency information to "plot"

This helps a lot with figuring out why units were started when they
were, rather than guessing there is a dependency relation. We could
perhaps also do fun JavaScript things in the future to highlight
dependencies on mouse-over.

11 months agosd-netlink: use secure_getenv()
Yu Watanabe [Wed, 4 Oct 2023 00:19:27 +0000 (09:19 +0900)] 
sd-netlink: use secure_getenv()

Follow-up for 52afaee74b40a765b8118393bff92717f78d0a51.

Fixes CID#1522326.

11 months agopo: fix invalid printf format specifier
Yu Watanabe [Wed, 4 Oct 2023 00:02:48 +0000 (09:02 +0900)] 
po: fix invalid printf format specifier

11 months agotree-wide: fix typo
Yu Watanabe [Tue, 3 Oct 2023 23:58:10 +0000 (08:58 +0900)] 
tree-wide: fix typo

11 months agosd-journal: drop unnecessary re-read of object
Yu Watanabe [Thu, 28 Sep 2023 00:05:53 +0000 (09:05 +0900)] 
sd-journal: drop unnecessary re-read of object

This reverts the following commits.
a1640191b4ca583ca62a4bd3b91edec3532bd41f
231741d355fbbe544f6bf62d714f56a6c857fb6f

These were done by my misunderstanding of the mmap cache behavior.

Also, this updates the comments added by
df04b9ed86a8b45c25cfff0fd800adb66407309a.

11 months agoMerge pull request #29426 from ddstreet/tpm2_minor_changes
Luca Boccassi [Tue, 3 Oct 2023 21:16:57 +0000 (22:16 +0100)] 
Merge pull request #29426 from ddstreet/tpm2_minor_changes

Minor commits for tpm2

11 months agoMerge pull request #29428 from mrc0mmand/soft-reboot
Luca Boccassi [Tue, 3 Oct 2023 21:13:32 +0000 (22:13 +0100)] 
Merge pull request #29428 from mrc0mmand/soft-reboot

test: spawn the to-be-killed-on-soft-reboot units with --collect

11 months agomacro: use __builtin_unreachable on NDEBUG
NRK [Mon, 2 Oct 2023 13:25:00 +0000 (19:25 +0600)] 
macro: use __builtin_unreachable on NDEBUG

note that this slightly changes the semantic of assert when NDEBUG is
defined. if there's an extern function call (without attribute pure or
similar) then the compiler has to assume it has side effects and still
emit the function call.

whereas the old assert guaranteed that nothing will be evaluated on
NDEBUG.

Closes: https://github.com/systemd/systemd/issues/29408
11 months agotpm2: cache TPM's supported ECC curves 29426/head
Dan Streetman [Fri, 8 Sep 2023 17:14:38 +0000 (13:14 -0400)] 
tpm2: cache TPM's supported ECC curves

This brings the tpm2_supports_ecc_curve() api in line with the other
tpm2_supports_*() functions, of returning a boolean.

11 months agotpm2: change tpm2_unseal() to accept Tpm2Context instead of device string
Dan Streetman [Thu, 31 Aug 2023 13:10:40 +0000 (09:10 -0400)] 
tpm2: change tpm2_unseal() to accept Tpm2Context instead of device string

This matches the change to tpm2_seal(), which now accepts a Tpm2Context instead
of a device string.

This also allows using the same TPM context for sealing and unsealing, which
will be required by (future) test code when sealing/unsealing using a transient
key.

11 months agotpm2: use GREEDY_REALLOC_APPEND() in tpm2_get_capability_handles(), cap max value
Dan Streetman [Fri, 8 Sep 2023 18:22:11 +0000 (14:22 -0400)] 
tpm2: use GREEDY_REALLOC_APPEND() in tpm2_get_capability_handles(), cap max value

Simplify the function with GREEDY_REALLOC_APPEND(). Also limit the size_t-sized
max value to UINT32_MAX since that's the maximum of the range this searches,
and the max parameter for tpm2_get_capability() is uint32_t.

11 months agotpm2: update tpm2 test for supported commands
Dan Streetman [Wed, 2 Aug 2023 17:35:46 +0000 (13:35 -0400)] 
tpm2: update tpm2 test for supported commands

The test expects TPM2_CC_FIRST - 1 and TPM2_CC_LAST + 1 to be unsupported, but
those are not necessarily invalid commands. Instead test known-invalid
commands. Also add some more valid commands.

11 months agotpm2: allow tpm2_make_encryption_session() without bind key
Dan Streetman [Fri, 30 Jun 2023 16:57:23 +0000 (12:57 -0400)] 
tpm2: allow tpm2_make_encryption_session() without bind key

Allow providing no bind key, and use ESYS_TR_NONE instead.

11 months agotest-loopback: suppress warning about ignored unused result
Zbigniew Jędrzejewski-Szmek [Tue, 3 Oct 2023 12:06:58 +0000 (14:06 +0200)] 
test-loopback: suppress warning about ignored unused result

11 months agotpm2: downgrade most log functions from error to debug
Dan Streetman [Fri, 8 Sep 2023 16:39:49 +0000 (12:39 -0400)] 
tpm2: downgrade most log functions from error to debug

Because most TPM2 functions here are 'library-like' functions, they should be
at debug level, not error level.

The only functions not reduced to logging at debug are tpm2_list_devices(),
since it is expected to print output, and the tpm2_parse_pcr_argument_*()
functions, since the system-wide parse_*_argument() functions generally log at
error level.

11 months agotest: spawn the to-be-killed-on-soft-reboot units with --collect 29428/head
Frantisek Sumsal [Tue, 3 Oct 2023 14:40:49 +0000 (16:40 +0200)] 
test: spawn the to-be-killed-on-soft-reboot units with --collect

Otherwise they might leave stuff behind if they don't respond fast
enough to the first SIGTERM and get SIGKILLEd, which then breaks reusing
the unit name further in the test:

[ 2993.620849] H testsuite-82.sh[43]: + systemd-run -p Type=exec -p DefaultDependencies=no -p IgnoreOnIsolate=yes --unit=testsuite-82-nosurvive.service sleep infinity
[ 2993.628686] H systemd[1]: testsuite-82-nosurvive.service: About to execute: /usr/bin/sleep infinity
[ 2993.628886] H systemd[1]: testsuite-82-nosurvive.service: Forked /usr/bin/sleep as 65
[ 2993.629328] H systemd[1]: testsuite-82-nosurvive.service: Changed dead -> start
...
[ 2993.699892] H testsuite-82.sh[43]: + systemctl --no-block --check-inhibitors=yes soft-reboot
[ 2993.704326] H systemd-logind[41]: The system will soft-reboot now!
...
[ 3001.249302] H systemd[1]: Sending SIGKILL to PID 65 (sleep).
...
[ 3001.303158] H testsuite-82.sh[136]: + systemd-notify '--status=Second Boot'
...
[ 3001.409504] H testsuite-82.sh[136]: + systemd-run -p Type=exec --unit=testsuite-82-nosurvive.service sleep infinity
[ 3001.414061] H testsuite-82.sh[165]: Failed to start transient service unit: Unit testsuite-82-nosurvive.service was already loaded or has a fragment file.

Spotted in Ubuntu CI.