]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
7 months agoMerge pull request #29407 from CM4all/test-kernel-acl-dummy
Luca Boccassi [Mon, 2 Oct 2023 15:30:39 +0000 (16:30 +0100)] 
Merge pull request #29407 from CM4all/test-kernel-acl-dummy

src/test: fixups for kernels without ACL and net-dummy

7 months agoMerge pull request #29339 from bluca/mount_namespace_new_api
Luca Boccassi [Mon, 2 Oct 2023 15:04:26 +0000 (16:04 +0100)] 
Merge pull request #29339 from bluca/mount_namespace_new_api

Use new mount API for bind/image mount tunnel

7 months agoresolve: tolerate merging a zero-ttl RR and a nonzero-ttl RR if not mDNS
Benjamin Peterson [Mon, 25 Sep 2023 14:23:27 +0000 (07:23 -0700)] 
resolve: tolerate merging a zero-ttl RR and a nonzero-ttl RR if not mDNS

resolved rejected RRsets containing a RR with a zero TTL and a RR with a nonzero TTL. In practice—see the linked issues—, this case triggered when an AF_UNSPEC query to a CNAMEd domain returned a zero TTL for the CNAME on one address family and a nonzero TTL for the CNAME on the other address family.

The zero-nonzero TTL check cites RFC 2181 § 5.2 in a comment. That section says DNS clients should reject any RRset containing differing TTLs, which the check only implements a very special case of. That the old behavior caused real-world false NXDOMAIN results is reason enough to completely ignore the RFC's recommendation. However, mDNS treats zero TTLs specially, so the error case needs to be kept for mDNS.

Fixes https://github.com/systemd/systemd/issues/22177
Fixes https://github.com/systemd/systemd/issues/20617
Fixes https://github.com/systemd/systemd/issues/19118

7 months agoMerge pull request #29405 from poettering/boot-xmalloc0
Lennart Poettering [Mon, 2 Oct 2023 14:45:40 +0000 (16:45 +0200)] 
Merge pull request #29405 from poettering/boot-xmalloc0

boot: add xmalloc0() + memzero() helpers

7 months agotest/test-execute: skip PrivateNetwork tests if kernel has no dummy netdevice support 29407/head
Max Kellermann [Mon, 2 Oct 2023 12:24:56 +0000 (14:24 +0200)] 
test/test-execute: skip PrivateNetwork tests if kernel has no dummy netdevice support

7 months agotest/test-chown-rec: skip ACL tests if kernel has no ACL support
Max Kellermann [Mon, 2 Oct 2023 12:05:25 +0000 (14:05 +0200)] 
test/test-chown-rec: skip ACL tests if kernel has no ACL support

The second half of `chown_recursive` works only if the kernel has ACL support.

7 months agomount-util: use new mount API for image mount tunnel 29339/head
Luca Boccassi [Wed, 27 Sep 2023 00:37:25 +0000 (01:37 +0100)] 
mount-util: use new mount API for image mount tunnel

7 months agodocs: add document about UEFI security posture in src/boot/efi/
Luca Boccassi [Sun, 1 Oct 2023 17:55:12 +0000 (18:55 +0100)] 
docs: add document about UEFI security posture in src/boot/efi/

This is not intended as a user guide, but to describe the generic security
posture of the UEFI components. Hence we do not publish it on systemd.io
but only in the repository.

7 months agoMerge pull request #29400 from yuwata/network-limit-read-size
Luca Boccassi [Mon, 2 Oct 2023 13:23:51 +0000 (14:23 +0100)] 
Merge pull request #29400 from yuwata/network-limit-read-size

network: limit read size

7 months agofuzz: limit size for fuzz-manager-serialize
Yu Watanabe [Mon, 2 Oct 2023 01:42:58 +0000 (10:42 +0900)] 
fuzz: limit size for fuzz-manager-serialize

Fixes #29357 and oss-fuzz#62756
(https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=62756).

7 months agodissect-image: support verity_dissect_and_mount() in two steps too
Luca Boccassi [Wed, 27 Sep 2023 00:04:44 +0000 (01:04 +0100)] 
dissect-image: support verity_dissect_and_mount() in two steps too

With the new mount API first the image is opened, and later mounted

7 months agodissect-image: optionally allow mounting via new kernel mount API in two steps
Lennart Poettering [Tue, 14 Mar 2023 10:09:46 +0000 (11:09 +0100)] 
dissect-image: optionally allow mounting via new kernel mount API in two steps

This adds support for the new fsmount() logic of the kernel: we'll first
create an unattached fsmount fd, and then in a second step attach this
to some real file system inode – as opposed to attaching file system
directly. The benefit of this is that we can pass the open fsmount fds
over some sockets if need be, to isolate the mounting code from the
attaching code.

7 months agomount-util: add make_fsmount()
Lennart Poettering [Tue, 14 Mar 2023 10:09:57 +0000 (11:09 +0100)] 
mount-util: add make_fsmount()

7 months agomount-util: use new mount API for bind mount tunnel
Luca Boccassi [Tue, 26 Sep 2023 23:01:45 +0000 (00:01 +0100)] 
mount-util: use new mount API for bind mount tunnel

If we have the new mount API we can simplify bind mounting into a namespace
a lot

7 months agomountpoint-util: add bool mount_new_api_supported() helper
Luca Boccassi [Thu, 28 Sep 2023 12:19:45 +0000 (13:19 +0100)] 
mountpoint-util: add bool mount_new_api_supported() helper

7 months agotest: fix check in test unit in TEST-50-DISSECT
Luca Boccassi [Wed, 27 Sep 2023 00:37:59 +0000 (01:37 +0100)] 
test: fix check in test unit in TEST-50-DISSECT

'[[ not found'

7 months agoutil: add xmalloc0() helper 29405/head
Lennart Poettering [Mon, 2 Oct 2023 11:12:11 +0000 (13:12 +0200)] 
util: add xmalloc0() helper

7 months agomemory-util: move memzero() to src/fundamental/ to share with UEFI
Lennart Poettering [Mon, 2 Oct 2023 11:06:27 +0000 (13:06 +0200)] 
memory-util: move memzero() to src/fundamental/ to share with UEFI

(and while we are at it, make sure it returns the input pointer as
output)

7 months agoMerge pull request #29343 from DaanDeMeyer/tmp
Daan De Meyer [Mon, 2 Oct 2023 12:29:32 +0000 (14:29 +0200)] 
Merge pull request #29343 from DaanDeMeyer/tmp

Use a subdirectory of /run/systemd for PrivateDevices=

7 months agocore: Use a subdirectory of /run/ for PrivateDevices= 29343/head
Daan De Meyer [Wed, 27 Sep 2023 08:52:50 +0000 (10:52 +0200)] 
core: Use a subdirectory of /run/ for PrivateDevices=

When we're starting early boot services such as systemd-userdbd.service,
/tmp might not yet be mounted, so let's use a directory in /run instead
which is guaranteed to be available.

7 months agoMerge pull request #29335 from abderrahim/version-info-check
Luca Boccassi [Mon, 2 Oct 2023 09:56:15 +0000 (10:56 +0100)] 
Merge pull request #29335 from abderrahim/version-info-check

man: add checks for missing version information

7 months agomount: Log when we can't create the mount point
Daan De Meyer [Sun, 1 Oct 2023 18:40:45 +0000 (20:40 +0200)] 
mount: Log when we can't create the mount point

Debugging mount unit failures caused by systemd not being able to
create the mount point is currently rather hard. Let's log about
failures to create mount points to simplify debugging.

7 months agojournalctl: find boot ID more gracefully in corrupted journal
Yu Watanabe [Wed, 27 Sep 2023 21:04:53 +0000 (06:04 +0900)] 
journalctl: find boot ID more gracefully in corrupted journal

In discover_next_boot(), first we find a new boot ID based on the value
stored in the entry object. Then, find the tail (or head when we are going
upwards) entry of the boot based on the _BOOT_ID= field data.

If boot IDs of an entry in the entry object and _BOOT_ID field data
are inconsistent, which may happen on corrupted journal, then previously
discover_next_boot() failed with -ENODATA.

This makes the function check if the two boot IDs in each entry are
consistent, and skip the entry if not.

Fixes the failure of `journalctl -b -1` for 'truncated' journal:
https://github.com/systemd/systemd/pull/29334#issuecomment-1736567951

7 months agonetwork: set maximum length to be read by read_full_file_full() 29400/head
Yu Watanabe [Mon, 2 Oct 2023 01:28:55 +0000 (10:28 +0900)] 
network: set maximum length to be read by read_full_file_full()

Fixes #29264 and oss-fuzz#62556
(https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=62556).

7 months agofileio: make read_full_file_full() usable with size and READ_FULL_FILE_UNBASE64
Yu Watanabe [Sun, 1 Oct 2023 07:48:36 +0000 (16:48 +0900)] 
fileio: make read_full_file_full() usable with size and READ_FULL_FILE_UNBASE64

When READ_FULL_FILE_UNBASE64 (or READ_FULL_FILE_UNHEX) is specified,
setting size argument by caller is difficult, as it is hard to estimate
the encoded length.

This makes when size is specified with decoding option, let's read file
more, and check decoded size later with the specified size.

7 months agobuild(deps): bump meson from 1.2.1 to 1.2.2 in /.github/workflows
dependabot[bot] [Sun, 1 Oct 2023 10:00:38 +0000 (10:00 +0000)] 
build(deps): bump meson from 1.2.1 to 1.2.2 in /.github/workflows

Bumps [meson](https://github.com/mesonbuild/meson) from 1.2.1 to 1.2.2.
- [Release notes](https://github.com/mesonbuild/meson/releases)
- [Commits](https://github.com/mesonbuild/meson/compare/1.2.1...1.2.2)

---
updated-dependencies:
- dependency-name: meson
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
7 months agobuild(deps): bump actions/checkout from 3.6.0 to 4.1.0
dependabot[bot] [Sun, 1 Oct 2023 09:14:31 +0000 (09:14 +0000)] 
build(deps): bump actions/checkout from 3.6.0 to 4.1.0

Bumps [actions/checkout](https://github.com/actions/checkout) from 3.6.0 to 4.1.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/f43a0e5ff2bd294095638e18286ca9a3d1956744...8ade135a41bc03ea155e62e844d188df1ea18608)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
7 months agobuild(deps): bump github/codeql-action from 2.21.5 to 2.21.9
dependabot[bot] [Sun, 1 Oct 2023 09:14:38 +0000 (09:14 +0000)] 
build(deps): bump github/codeql-action from 2.21.5 to 2.21.9

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.21.5 to 2.21.9.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/00e563ead9f72a8461b24876bee2d0c2e8bd2ee8...ddccb873888234080b77e9bc2d4764d5ccaaccf9)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
7 months agoman: add version info for newly added systemd-tpm2-setup.service 29335/head
Abderrahim Kitouni [Sun, 1 Oct 2023 10:49:44 +0000 (11:49 +0100)] 
man: add version info for newly added systemd-tpm2-setup.service

7 months agoman: re-add some version info for sd_pid_get_owner_uid.xml
Abderrahim Kitouni [Sun, 1 Oct 2023 09:34:51 +0000 (10:34 +0100)] 
man: re-add some version info for sd_pid_get_owner_uid.xml

These were mistakenly removed in 00f95506e2523a9c120d9c38cc78d15bb56b8ec7

7 months agoman: add a couple missing version annotations
Abderrahim Kitouni [Sun, 1 Oct 2023 09:27:59 +0000 (10:27 +0100)] 
man: add a couple missing version annotations

These were discovered by the newly added checks

7 months agoman: add checks for missing version information
Abderrahim Kitouni [Tue, 26 Sep 2023 17:25:06 +0000 (18:25 +0100)] 
man: add checks for missing version information

This adds a new script tools/check-version-history.py and a corresponding
test when building in developer mode. It checks manpages (except dbus
documentation which is handled by update-dbus-docs) for missing version
history information.

It also adds ignore lists based on version 183 (the version that our version
annotations go back to). These can be augmented if we want to ignore other
elements if it doesn't make sense for them to have version annotations.

7 months agomeson: Pass all -static-pie args to linker
Jan Janssen [Sun, 1 Oct 2023 07:55:48 +0000 (09:55 +0200)] 
meson: Pass all -static-pie args to linker

Fixes: #29381
7 months agoMerge pull request #29384 from yuwata/sd-journal-cleanups-for-generic-array-get
Luca Boccassi [Sun, 1 Oct 2023 10:28:32 +0000 (11:28 +0100)] 
Merge pull request #29384 from yuwata/sd-journal-cleanups-for-generic-array-get

sd-journal: cleanups for generic_array_get()

7 months agomeson: drop unused home_includes
Yu Watanabe [Sat, 30 Sep 2023 11:09:53 +0000 (20:09 +0900)] 
meson: drop unused home_includes

7 months agosd-journal: merge journal_file_next_entry_for_data() with generic_array_get_plus_one() 29384/head
Yu Watanabe [Wed, 27 Sep 2023 05:52:21 +0000 (14:52 +0900)] 
sd-journal: merge journal_file_next_entry_for_data() with generic_array_get_plus_one()

Because journal_file_next_entry_for_data() provides the first entry, while
journal_file_next_entry() actually provides the next entry of the input,
this also renames it to journal_file_move_to_entry_for_data().

Also, previously, on DIRECTION_UP the function did not fall back to the
'extra' entry when all entries linked in the chained array are broken.
This also fixes the issue, and now it fall back to the extra entry.

7 months agosd-journal: add/update comments
Yu Watanabe [Wed, 27 Sep 2023 17:12:00 +0000 (02:12 +0900)] 
sd-journal: add/update comments

7 months agosd-journal: add missing 'error' handling
Yu Watanabe [Tue, 26 Sep 2023 16:35:31 +0000 (01:35 +0900)] 
sd-journal: add missing 'error' handling

When we reach an empty array, there are at least two possibilities:
- journal file is corrupted,
- invalid index is requested.

We cannot distinguish them here, let's simply return earlier.

7 months agosd-journal: fix calculation of number of 'total' entries in the chained arrays
Yu Watanabe [Mon, 25 Sep 2023 02:10:01 +0000 (11:10 +0900)] 
sd-journal: fix calculation of number of 'total' entries in the chained arrays

If there's corruption and we are going upwards, then the 'total'
must be decreased when we go to the previous array. However,
previously, we wrongly kept or increased the number. This fixes
the behavior.

7 months agosd-journal: merge two bump_entry_array() calls
Yu Watanabe [Tue, 26 Sep 2023 16:29:11 +0000 (01:29 +0900)] 
sd-journal: merge two bump_entry_array() calls

No functional changes, just refactoring.

7 months agosd-journal: make bump_entry_array() return positive when a valid offset found
Yu Watanabe [Tue, 26 Sep 2023 16:14:58 +0000 (01:14 +0900)] 
sd-journal: make bump_entry_array() return positive when a valid offset found

When it returns 0 offset, then the subsequent
journal_file_move_to_object() will fail. Let's return
generic_array_get() earlier in such situation.

7 months agosd-journal: drop redundant re-read of entry array object
Yu Watanabe [Mon, 25 Sep 2023 01:44:50 +0000 (10:44 +0900)] 
sd-journal: drop redundant re-read of entry array object

This effectively reverts d9b61db922404a216de018cc5ddff9b69bcaf1db.

In the do-while loop, we do not read any other entry array object, hence
the current object is always in the mmap cache and not necessary to re-read it.

7 months agologind: add HANDLE_ACTION_IS_SLEEP() and HANDLE_ACTION_IS_SHUTDOWN() helpers
Lennart Poettering [Fri, 29 Sep 2023 20:17:12 +0000 (22:17 +0200)] 
logind: add HANDLE_ACTION_IS_SLEEP() and HANDLE_ACTION_IS_SHUTDOWN() helpers

Let's group this HandleAction types in nice little helpers.

Prompted by #28579

7 months agoMerge pull request #29380 from medhefgo/ms-certs
Luca Boccassi [Sat, 30 Sep 2023 08:51:58 +0000 (09:51 +0100)] 
Merge pull request #29380 from medhefgo/ms-certs

man: man: Adjust Microsoft UEFI certificate links

7 months agoMerge pull request #29378 from mrc0mmand/more-test-tweaks
Frantisek Sumsal [Sat, 30 Sep 2023 07:35:35 +0000 (07:35 +0000)] 
Merge pull request #29378 from mrc0mmand/more-test-tweaks

test: a couple of TEST-82-SOFTREBOOT tweaks

7 months agoman: Verify Microsoft keys 29380/head
Jan Janssen [Sat, 30 Sep 2023 07:30:24 +0000 (09:30 +0200)] 
man: Verify Microsoft keys

7 months agoman: Adjust Microsoft UEFI certificate links
Jan Janssen [Sat, 30 Sep 2023 07:19:57 +0000 (09:19 +0200)] 
man: Adjust Microsoft UEFI certificate links

The files were fixed to all be properly der encoded.

7 months agoMerge pull request #29363 from medhefgo/elf2efi
Luca Boccassi [Fri, 29 Sep 2023 22:01:53 +0000 (23:01 +0100)] 
Merge pull request #29363 from medhefgo/elf2efi

elf2efi: Rework to allow using any linker

7 months agotest: don't pipe the whole journal through jq 29378/head
Frantisek Sumsal [Fri, 29 Sep 2023 21:26:15 +0000 (23:26 +0200)] 
test: don't pipe the whole journal through jq

Doing that in VMs without acceleration is prohibitively expensive (i.e.
20+ seconds in the C8S job). Thankfully, the recent [0] --lines=+n syntax
makes this all quite easy to fix.

[0] 8d6791d2aa9

7 months agotest: use Type=exec for the auxiliary services
Frantisek Sumsal [Fri, 29 Sep 2023 20:10:42 +0000 (22:10 +0200)] 
test: use Type=exec for the auxiliary services

To make sure the respective binaries are exec()ed before moving further
with the test.

7 months agotest: shutdown the machine on fail after soft-reboot
Frantisek Sumsal [Fri, 29 Sep 2023 20:07:12 +0000 (22:07 +0200)] 
test: shutdown the machine on fail after soft-reboot

Since the soft-reboot drops the enqueued end.service, we won't shutdown
the test VM if the test fails and have to wait for the watchdog to kill
us (which may take quite a long time). Let's just forcibly kill the
machine instead to save CI resources.

7 months agoMerge pull request #29344 from poettering/tpm2-setup
Lennart Poettering [Fri, 29 Sep 2023 19:56:28 +0000 (21:56 +0200)] 
Merge pull request #29344 from poettering/tpm2-setup

tpm2-setup: set up TPM2 Storage Root Key (SRK) in a separate service

7 months agosysext: validate against the right API level
Lennart Poettering [Fri, 29 Sep 2023 16:28:42 +0000 (18:28 +0200)] 
sysext: validate against the right API level

Let's ake sure we check confexts against the confext api level, and
sysext against the sysext api level.

Previously the test would simply be skipped for confexts...

7 months agope-binary: actually check if PE binary is UEFI binary when determining if UKI
Lennart Poettering [Fri, 29 Sep 2023 16:55:31 +0000 (18:55 +0200)] 
pe-binary: actually check if PE binary is UEFI binary when determining if UKI

If it's not a UEFI binary, then it's not a UKI.

7 months agoMerge pull request #29374 from mrc0mmand/test-tweaks
Luca Boccassi [Fri, 29 Sep 2023 18:07:59 +0000 (19:07 +0100)] 
Merge pull request #29374 from mrc0mmand/test-tweaks

test: use "test-" prefix for units

7 months agoupdate TODO 29344/head
Lennart Poettering [Wed, 27 Sep 2023 07:33:48 +0000 (09:33 +0200)] 
update TODO

7 months agotpm2-setup: add new early boot tool for initializing the SRK
Lennart Poettering [Tue, 26 Sep 2023 19:25:53 +0000 (21:25 +0200)] 
tpm2-setup: add new early boot tool for initializing the SRK

This adds an explicit service for initializing the TPM2 SRK. This is
implicitly also done by systemd-cryptsetup, hence strictly speaking
redundant, but doing this early has the benefit that we can parallelize
this in a nicer way. This also write a copy of the SRK public key in PEM
format to /run/ + /var/lib/, thus pinning the disk image to the TPM.
Making the SRK public key is also useful for allowing easy offline
encryption for a specific TPM.

Sooner or later we should probably grow what this service does, the
above is just the first step. For example, the service should probably
offer the ability to reset the TPM (clear the owner hierarchy?) on a
factory reset, if such a policy is needed. And we might want to install
some default AK (?).

Fixes: #27986
Also see: #22637

7 months agoMerge pull request #29234 from ddstreet/tpm2_marshal_serialize_handle_index
Lennart Poettering [Fri, 29 Sep 2023 17:15:15 +0000 (19:15 +0200)] 
Merge pull request #29234 from ddstreet/tpm2_marshal_serialize_handle_index

add tpm2 functions for marshalling blobs, serializing handles, and handle/index conversion

7 months agoelf2efi: Add GNU_RELRO support 29363/head
Jan Janssen [Thu, 28 Sep 2023 15:54:35 +0000 (17:54 +0200)] 
elf2efi: Add GNU_RELRO support

7 months agoci: Update compiler build matrix
Jan Janssen [Mon, 25 Sep 2023 15:24:26 +0000 (17:24 +0200)] 
ci: Update compiler build matrix

Given that gold is pretty much unmaintained and does not support
`-static-pie` for bootloader components it should be safe to drop.

Also switch to clang-17 while we're at it.

7 months agoboot: Lift linker requirements
Jan Janssen [Fri, 22 Sep 2023 12:41:47 +0000 (14:41 +0200)] 
boot: Lift linker requirements

The biggest reason for forcing bfd was the use of linker scrips. Since
we don't rely on those anymore we can lift the requirement.

The biggest issue is gold as it does not understand -static-pie. Given
that it's pretty much on life support it's safe to just declare it not
supported anymore.

Don't link addons with libefi as clang/lld is sometimes very eager to
include memset etc., causing needless binary bloat and link errors with
LTO.

Fixes: #29165
7 months agoelf2efi: Add --copy-sections option
Jan Janssen [Fri, 22 Sep 2023 10:15:55 +0000 (12:15 +0200)] 
elf2efi: Add --copy-sections option

This makes the special PE sections available again in our output EFI
images.

Since the compiler provides no way to mark a section as not allocated,
we use GNU assembler syntax to emit the sections instead. This ensures
the section data isn't emitted twice as load segments will only contain
allocating input sections.

7 months agoelf2efi: Add next_section_address helper
Jan Janssen [Fri, 22 Sep 2023 10:13:09 +0000 (12:13 +0200)] 
elf2efi: Add next_section_address helper

7 months agoelf2efi: Check ELF image base if possible
Jan Janssen [Thu, 28 Sep 2023 14:22:13 +0000 (16:22 +0200)] 
elf2efi: Check ELF image base if possible

7 months agoelf2efi: Rework ELF section conversion
Jan Janssen [Thu, 28 Sep 2023 14:09:42 +0000 (16:09 +0200)] 
elf2efi: Rework ELF section conversion

The main reason we need to apply a whole lot of logic to the section
conversion logic is because PE sections have to be aligned to the page
size (although, currently not even EDK2 enforces this). The process of
achieving this with a linker script is fraught with errors, they are a
pain to set up correctly and suck in general. They are also not
supported by mold, which requires us to forcibly use bfd, which also
means that linker feature detection is easily at odds as meson has a
differnt idea of what linker is in use.

Instead of forcing a manual ELF segment layout with a linker script we
just let the linker do its thing. We then simply copy/concatenate the
sections while observing proper page boundaries.
Note that we could just copy the ELF load *segments* directly and
achieve the same result. Doing this manually allows us to strip sections
we don't need at runtime like the dynamic linking information (the
elf2efi conversion is effectively the dynamic loader).

Important sections like .sbat that we emit directly from code will
currently *not* be exposed as individual PE sections as they are
contained within the ELF segments. A future commit will fix this.

7 months agotpm2: add tpm2_index_to_handle() and tpm2_index_from_handle() 29234/head
Dan Streetman [Fri, 30 Jun 2023 16:52:10 +0000 (12:52 -0400)] 
tpm2: add tpm2_index_to_handle() and tpm2_index_from_handle()

Adjust the tpm2_esys_handle_from_tpm_handle() function into better-named
tpm2_index_to_handle(), which operates like tpm2_get_srk() but allows using any
handle index. Also add matching tpm2_index_from_handle().

Also change the references to 'location' in tpm2_persist_handle() to more
appropriate 'handle index'.

7 months agotpm2: add tpm2_serialize() and tpm2_deserialize()
Dan Streetman [Fri, 30 Jun 2023 17:42:25 +0000 (13:42 -0400)] 
tpm2: add tpm2_serialize() and tpm2_deserialize()

Add functions to perform serialization and deserialization of ESYS_TR objects.

7 months agotpm2: add tpm2_marshal_blob() and tpm2_unmarshal_blob()
Dan Streetman [Wed, 28 Jun 2023 15:46:31 +0000 (11:46 -0400)] 
tpm2: add tpm2_marshal_blob() and tpm2_unmarshal_blob()

Add functions to marshal and unmarshal our 'blob' object.

7 months agotest: use /run/ for test configuration 29374/head
Frantisek Sumsal [Fri, 29 Sep 2023 14:07:05 +0000 (16:07 +0200)] 
test: use /run/ for test configuration

7 months agotest: use "test-" prefix for units
Frantisek Sumsal [Fri, 29 Sep 2023 13:55:53 +0000 (15:55 +0200)] 
test: use "test-" prefix for units

So the coverage-related drop-in [0] can kick in to avoid errors with
DynamicUser=true. Also, to not make the test confusing with this change,
replace "nft-test" with "test-nft" everywhere.

[0] See test/README.testsuite, section "Code coverage"

7 months agotpm2: move measurement log to /run/log/ (from /var/log/)
Lennart Poettering [Fri, 29 Sep 2023 09:59:40 +0000 (11:59 +0200)] 
tpm2: move measurement log to /run/log/ (from /var/log/)

I have no idea what went on in my mind when I used a path in /var/ for
the tpm2 event log we now keep for userspace measurements. The
measurements are only valid for the current boot, hence should not be
persisted (in particular as they cannot be rotated, hence should not
grow without bounds).

Fix that, simply move from /var/log/ to /run/log/.

7 months agoMerge pull request #29193 from keszybz/path-util-adjustment
Daan De Meyer [Fri, 29 Sep 2023 09:33:12 +0000 (11:33 +0200)] 
Merge pull request #29193 from keszybz/path-util-adjustment

Make unit mangling follow paths

7 months agoMerge pull request #29241 from poettering/pidref-watch
Daan De Meyer [Fri, 29 Sep 2023 09:32:19 +0000 (11:32 +0200)] 
Merge pull request #29241 from poettering/pidref-watch

pid1: move unit_watch_pid()/unit_unwatch_pid() logic over to PidRef

7 months agoukify: explicitly import attribute
Valentin Lefebvre [Wed, 27 Sep 2023 14:41:58 +0000 (16:41 +0200)] 
ukify: explicitly import attribute

* Explicitly import attributes rsa and serialization from cryptography.hazmat

Signed-off-by: Valentin Lefebvre <valentin.lefebvre@suse.com>
7 months agocore: Make private /dev read-only after populating it
Daan De Meyer [Wed, 27 Sep 2023 09:55:59 +0000 (11:55 +0200)] 
core: Make private /dev read-only after populating it

7 months agoMerge pull request #29183 from ddstreet/tpm2_openssl_functions
Daan De Meyer [Fri, 29 Sep 2023 08:25:39 +0000 (10:25 +0200)] 
Merge pull request #29183 from ddstreet/tpm2_openssl_functions

Add openssl functions for use by TPM2 sealing calculations

7 months agoautomount: fix unused value coverity warnings
Luca Boccassi [Fri, 29 Sep 2023 01:00:34 +0000 (02:00 +0100)] 
automount: fix unused value coverity warnings

'r' is no longer used, so no point in setting it before returning

CID#1522310
CID#1522312

Follow-up for bfeb10911e58bf8890eb7687cf12eddb09ab0c5d

7 months agofix: do not check/verify slice units if recursive errors are to be ignored
Maanya Goenka [Wed, 27 Sep 2023 15:44:04 +0000 (15:44 +0000)] 
fix: do not check/verify slice units if recursive errors are to be ignored

Before this fix, when recursive-errors was set to 'no' during a systemd-analyze
verification, the parent slice was checked regardless. The 'no' setting means that,
only the specified unit should be looked at and verified and errors in the slices should be
ignored. This commit fixes that issue.

Example:

Say we have a sample.service file:

[Unit]
Description=Sample Service

[Service]
ExecStart=/bin/echo "a"
Slice=support.slice

Before Change:

systemd-analyze verify --recursive-errors=no maanya/sample.service
Assertion 'u' failed at src/core/unit.c:153, function unit_has_name(). Aborting.
Aborted (core dumped)

After Change:
systemd-analyze verify --recursive-errors=no maanya/sample.service
{No errors}

7 months agoupdate TODO 29241/head
Lennart Poettering [Tue, 19 Sep 2023 14:22:05 +0000 (16:22 +0200)] 
update TODO

7 months agocore: move pid watch/unwatch logic of the service manager to pidfd
Lennart Poettering [Tue, 19 Sep 2023 19:58:55 +0000 (21:58 +0200)] 
core: move pid watch/unwatch logic of the service manager to pidfd

This makes sure unit_watch_pid() and unit_unwatch_pid() will track
processes by pidfd if supported. Also ports over some related code.
Should not really change behaviour.

Note that this does *not* add support waiting for POLLIN on the pidfds
as additional exit notification. This is left for a later commit (this
commit is already large enough), in particular as that would add new
logic and not just convert existing logic.

7 months agotest-watch-pid: use a real PID, not a made up one
Lennart Poettering [Wed, 20 Sep 2023 09:34:57 +0000 (11:34 +0200)] 
test-watch-pid: use a real PID, not a made up one

This matters once we track processes with pidfds rather than just pid_t,
because made up PIDs likely won't exist.

The essence of the test remains unmodified, we just use a real, existing
PID instead of 4711.

7 months agopidref: add pidref_verify() helper
Lennart Poettering [Tue, 19 Sep 2023 14:22:29 +0000 (16:22 +0200)] 
pidref: add pidref_verify() helper

This new helper can be used after reading process info from procfs, to
verify that the data that was just read actually matches the pidfd, and
does not belong to some new process that just reused the numeric PID of
the process we originally pinned.

7 months agopidref: add pidref_hash_ops
Lennart Poettering [Tue, 19 Sep 2023 14:11:34 +0000 (16:11 +0200)] 
pidref: add pidref_hash_ops

This adds a "hash_ops" structure, which allows using PidRef structures
as keys in Hashmap and Set objects.

7 months agopidref: add helpers for managing PidRef on the heap
Lennart Poettering [Tue, 19 Sep 2023 14:15:00 +0000 (16:15 +0200)] 
pidref: add helpers for managing PidRef on the heap

Usually we want to embed PidRef in other structures, but sometimes it
makes sense to allocate it on the heap in case it should be used
standalone. Add helpers for that.

Primary usecase: use as key in Hashmap objects, that for example map
process to unit objects in PID 1.

This adds pidref_free()/pidref_freep() for freeing such an allocated
struct, as well as pidref_dup() (for duplicating an existing PidRef
on the heap 1:1), and pidref_new_pid() (for allocating a new PidRef from a
PID).

7 months agopidref: add PIDREF_MAKE_FROM_PID()
Lennart Poettering [Tue, 19 Sep 2023 14:05:42 +0000 (16:05 +0200)] 
pidref: add PIDREF_MAKE_FROM_PID()

This helper truns a pid_t into a PidRef. It's different from
pidref_set_pid() in being "passive", i.e. it does not attempt to acquire
a pidfd for the pid.

This is useful when using the PidRef as a lookup key that shall also
work after a process is already dead, and hence no conversion to a pidfd
is possible anymore.

7 months agocgroup-util: add cg_read_pidref() helper
Lennart Poettering [Tue, 19 Sep 2023 14:05:01 +0000 (16:05 +0200)] 
cgroup-util: add cg_read_pidref() helper

Just like cg_read_pid() but returns a PidRef

7 months agoMerge pull request #29249 from poettering/pid1-error-message
Luca Boccassi [Thu, 28 Sep 2023 21:18:15 +0000 (22:18 +0100)] 
Merge pull request #29249 from poettering/pid1-error-message

pid1: refactoring of unit state machine logging and unit timer refactoring

7 months agoresolved: register ipv4only.arpa are private domain
Bertrand Jacquin [Wed, 27 Sep 2023 18:39:52 +0000 (19:39 +0100)] 
resolved: register ipv4only.arpa are private domain

From RFC 8880:

Because the 'ipv4only.arpa' zone has to be an insecure delegation,
DNSSEC cannot be used to protect these answers from tampering by
malicious devices on the path.

Consequently, the 'ipv4only.arpa' zone MUST be an insecure delegation to
give DNS64/NAT64 gateways the freedom to synthesize answers to those
queries at will, without the answers being rejected by DNSSEC-capable
resolvers. DNSSEC-capable resolvers that follow this specification MUST
NOT attempt to validate answers received in response to queries for the
IPv6 AAAA address records for 'ipv4only.arpa'. Note that the name
'ipv4only.arpa' has no use outside of being used for this special DNS
pseudo-query used to learn the DNS64/NAT64 address synthesis prefix, so
the lack of DNSSEC security for that name is not a problem.

See: https://datatracker.ietf.org/doc/html/rfc8880#name-security-considerations

7 months agoopenssl: add kdf_ss_derive() 29183/head
Dan Streetman [Fri, 7 Jul 2023 14:13:27 +0000 (10:13 -0400)] 
openssl: add kdf_ss_derive()

Add function to perform KDF-SS ("concat" KDF).

While Openssl allows a digest, HMAC, or KMAC for the auxiliary function H, this
currently only allows using a digest for H.

7 months agoopenssl: add ecc_edch()
Dan Streetman [Fri, 7 Jul 2023 14:11:07 +0000 (10:11 -0400)] 
openssl: add ecc_edch()

Add function to perform ECC EDCH.

7 months agoopenssl: add openssl_cipher_many()
Dan Streetman [Tue, 27 Jun 2023 19:04:59 +0000 (15:04 -0400)] 
openssl: add openssl_cipher_many()

Add function to perform openssl cipher operations.

7 months agoopenssl: add kdf_kb_hmac_derive()
Dan Streetman [Tue, 27 Jun 2023 19:04:59 +0000 (15:04 -0400)] 
openssl: add kdf_kb_hmac_derive()

Add function to perform key-based (KB) key derivation function (KDF) using
hash-based message authentication code (HMAC).

Also alphabetize openssl-util.c header list, and include string-util.h.

7 months agoopenssl: add rsa_oaep_encrypt_bytes()
Dan Streetman [Thu, 15 Jun 2023 12:19:51 +0000 (08:19 -0400)] 
openssl: add rsa_oaep_encrypt_bytes()

Add function to encrypt bytes, similar to rsa_encrypt_bytes() but using OAEP
(Optimal Asymmetric Encryption Padding).

7 months agoopenssl: add openssl_hmac_many()
Dan Streetman [Mon, 26 Jun 2023 21:40:18 +0000 (17:40 -0400)] 
openssl: add openssl_hmac_many()

Add function to perform HMAC on multiple buffers.

Also update test-openssl with associated testing, and replace some memcmp()
with memcmp_nn().

7 months agoopenssl: replace openssl_hash() with openssl_digest()
Dan Streetman [Wed, 5 Jul 2023 20:53:01 +0000 (16:53 -0400)] 
openssl: replace openssl_hash() with openssl_digest()

The openssl_hash() function was used only by string_hashnum(); change it to use
openssl_digest() instead.

7 months agoopenssl: add openssl_digest_many()
Dan Streetman [Wed, 5 Jul 2023 16:28:39 +0000 (12:28 -0400)] 
openssl: add openssl_digest_many()

Add function to perform openssl digest calculation on multiple buffers.

7 months agoopenssl: add openssl_digest_size()
Dan Streetman [Wed, 5 Jul 2023 16:59:47 +0000 (12:59 -0400)] 
openssl: add openssl_digest_size()

Add function to get digest hash size for provided digest name.

7 months agoMerge pull request #29361 from keszybz/kernel-install-work
Luca Boccassi [Thu, 28 Sep 2023 16:16:15 +0000 (17:16 +0100)] 
Merge pull request #29361 from keszybz/kernel-install-work

Advertise installkernel ↔ kernel-install duality

7 months agoRemove json_variant_merge_pair() in favor of json_variant_set_field_non_null()
Daan De Meyer [Thu, 28 Sep 2023 09:51:25 +0000 (11:51 +0200)] 
Remove json_variant_merge_pair() in favor of json_variant_set_field_non_null()

7 months agoMerge pull request #28545 from bluca/softreboot_survive
Luca Boccassi [Thu, 28 Sep 2023 16:12:03 +0000 (17:12 +0100)] 
Merge pull request #28545 from bluca/softreboot_survive

pid1: add SurviveFinalKillSignal= to skip units on final sigterm/sigkill spree