]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
8 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>
8 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

8 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

8 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 /

8 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"

8 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)

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

8 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.

8 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

8 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)

8 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.

8 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

8 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

8 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.

8 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.

8 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

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

8 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.

8 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

8 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

8 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
8 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.

8 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.

8 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.

8 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.

8 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.

8 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

8 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.

8 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.

8 months agotest: use --service-type= instead of -p Type=
Frantisek Sumsal [Tue, 3 Oct 2023 14:38:35 +0000 (16:38 +0200)] 
test: use --service-type= instead of -p Type=

8 months agodocs: fix spelling in UEFI_SECURITY.md
Luca Boccassi [Tue, 3 Oct 2023 10:39:15 +0000 (11:39 +0100)] 
docs: fix spelling in UEFI_SECURITY.md

that that -> that

8 months agoMerge pull request #29420 from bluca/uefi_doc
Zbigniew Jędrzejewski-Szmek [Tue, 3 Oct 2023 09:57:59 +0000 (11:57 +0200)] 
Merge pull request #29420 from bluca/uefi_doc

Fixups for UEFI_SECURITY.md

8 months agodocs: rephrase sentence about UKIs in UEFI_SECURITY.md 29420/head
Luca Boccassi [Tue, 3 Oct 2023 09:12:36 +0000 (10:12 +0100)] 
docs: rephrase sentence about UKIs in UEFI_SECURITY.md

8 months agodocs: rephrase sentence about addons measuring in UEFI_SECURITY.md
Luca Boccassi [Tue, 3 Oct 2023 09:08:33 +0000 (10:08 +0100)] 
docs: rephrase sentence about addons measuring in UEFI_SECURITY.md

8 months agoman: update the list of ignored options by Anonymize=yes
Yu Watanabe [Tue, 3 Oct 2023 04:19:50 +0000 (13:19 +0900)] 
man: update the list of ignored options by Anonymize=yes

Closes #29362.

8 months agoMerge pull request #29390 from yuwata/sd-netlink-make-default-timeout-configurable
Luca Boccassi [Mon, 2 Oct 2023 21:59:07 +0000 (22:59 +0100)] 
Merge pull request #29390 from yuwata/sd-netlink-make-default-timeout-configurable

sd-netlink: make the default timeout configurable

8 months agoudevadm: avoid side-effect in assert()
NRK [Mon, 2 Oct 2023 19:26:48 +0000 (01:26 +0600)] 
udevadm: avoid side-effect in assert()

this was found when trying to use __builtin_assume() with clang:
https://github.com/systemd/systemd/pull/29409#issuecomment-1743575402

8 months agotpm2: edit tpm2_get_or_create_srk() comment
Dan Streetman [Mon, 2 Oct 2023 20:25:10 +0000 (16:25 -0400)] 
tpm2: edit tpm2_get_or_create_srk() comment

Adjust the comment to correct the return value, i.e. 1 for SRK created, 0 for
SRK already exists, <0 on error.

8 months agodocs: rename src/boot/efi/SECURITY.md as UEFI_SECURITY.md
Luca Boccassi [Mon, 2 Oct 2023 17:51:39 +0000 (18:51 +0100)] 
docs: rename src/boot/efi/SECURITY.md as UEFI_SECURITY.md

8 months agodoc: add compiler hardening details to UEFI SECURITY.md
Luca Boccassi [Mon, 2 Oct 2023 16:44:50 +0000 (17:44 +0100)] 
doc: add compiler hardening details to UEFI SECURITY.md

8 months agobuild(deps): bump systemd/mkosi
dependabot[bot] [Sun, 1 Oct 2023 18:16:06 +0000 (18:16 +0000)] 
build(deps): bump systemd/mkosi

Bumps [systemd/mkosi](https://github.com/systemd/mkosi) from adaa41512aa30c952daae5ba0abcf2622d66b93b to a8ecff0defa132d729dcdab38380dcae31138e7e.
- [Release notes](https://github.com/systemd/mkosi/releases)
- [Changelog](https://github.com/systemd/mkosi/blob/main/NEWS.md)
- [Commits](https://github.com/systemd/mkosi/compare/adaa41512aa30c952daae5ba0abcf2622d66b93b...a8ecff0defa132d729dcdab38380dcae31138e7e)

---
updated-dependencies:
- dependency-name: systemd/mkosi
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
8 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

8 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

8 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

8 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

8 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

8 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.

8 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

8 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.

8 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

8 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).

8 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

8 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.

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

8 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

8 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

8 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'

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

8 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)

8 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=

8 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.

8 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

8 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.

8 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

8 months agotest: split test-tables into three 29403/head
Yu Watanabe [Sat, 30 Sep 2023 10:45:27 +0000 (19:45 +0900)] 
test: split test-tables into three

Let's drop dependency to libjournal_core and libudevd_core from
test-tables.

8 months agojournal: move several tests to libsystemd/sd-journal
Yu Watanabe [Sat, 30 Sep 2023 10:18:34 +0000 (19:18 +0900)] 
journal: move several tests to libsystemd/sd-journal

This also renames test-journal-xyz for journald (rather than sd-journal)
to test-journald-xyz.

8 months agojournal-remote: drop dependencies to journald
Yu Watanabe [Sat, 30 Sep 2023 10:08:23 +0000 (19:08 +0900)] 
journal-remote: drop dependencies to journald

Now journal-remote can be built without libjournal_core.

8 months agojournald: move and rename journal/managed-journal-file.[ch] -> shared/journal-file...
Yu Watanabe [Sat, 30 Sep 2023 07:09:16 +0000 (16:09 +0900)] 
journald: move and rename journal/managed-journal-file.[ch] -> shared/journal-file-util.[ch]

The files are used by both journald and journal-remote.
Let's move them to src/shared.

8 months agojournald: drop ManagedJournalFile
Yu Watanabe [Sat, 30 Sep 2023 06:46:16 +0000 (15:46 +0900)] 
journald: drop ManagedJournalFile

The ManagedJournalFile object is a trivial wrapper of JournalFile.
Let's drop it, and also drop 'managed_' prefix from the functions.

8 months agojournald: split-out closing journal files from managed_journal_file_open()
Yu Watanabe [Sat, 30 Sep 2023 06:15:28 +0000 (15:15 +0900)] 
journald: split-out closing journal files from managed_journal_file_open()

No functional change, just refactoring and preparation for later
commits.

8 months agojournald: do not close all files stored in Server.deferred_closes
Yu Watanabe [Sat, 30 Sep 2023 06:05:23 +0000 (15:05 +0900)] 
journald: do not close all files stored in Server.deferred_closes

Just before the call of managed_journal_file_open(), we already called
server_vacuum_deferred_closes(), so there is a room to store the file.

8 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).

8 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.

8 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>
8 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>
8 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>
8 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

8 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

8 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

8 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.

8 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
8 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()

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

8 months agosd-netlink: make the default timeout configurable by environment variable 29390/head
Yu Watanabe [Sun, 1 Oct 2023 03:04:59 +0000 (12:04 +0900)] 
sd-netlink: make the default timeout configurable by environment variable

On normal systems, triggering a timeout should be a bug in code or
configuration error, so I do not think we should extend the default
timeout. Also, we should not introduce a 'first class' configuration
option about that. But, making it configurable may be useful for cases
such that "an extremely highly utilized system (lots of OOM kills,
very high CPU utilization, etc)".

Closes #25441.

8 months agosd-netlink: make calc_elapse() return USEC_INFINITY when no timeout is requested
Yu Watanabe [Sun, 1 Oct 2023 03:04:52 +0000 (12:04 +0900)] 
sd-netlink: make calc_elapse() return USEC_INFINITY when no timeout is requested

Then, timout_compare() becomes simplar, the timeout value becomes
consistent with what sd_netlink_get_timeout() provides.

This also drop unnecessary assignment of reply_callback.timeout after
the slot is dropped from the prioq.

8 months agommap-cache: rebreak lines 29386/head
Yu Watanabe [Thu, 28 Sep 2023 01:25:32 +0000 (10:25 +0900)] 
mmap-cache: rebreak lines

8 months agommap-cache: modernize free functions
Yu Watanabe [Thu, 28 Sep 2023 00:45:47 +0000 (09:45 +0900)] 
mmap-cache: modernize free functions

No functional change, just refactoring.

8 months agommap-cache: check if mmap protection mode is consistent when fd is already managed
Yu Watanabe [Thu, 28 Sep 2023 01:46:23 +0000 (10:46 +0900)] 
mmap-cache: check if mmap protection mode is consistent when fd is already managed

Otherwise, MMapFileDescriptor with an unexpected protection mode may be
returned.

8 months agommap-cache: modernize mmap_cache_add_fd()
Yu Watanabe [Thu, 28 Sep 2023 00:38:59 +0000 (09:38 +0900)] 
mmap-cache: modernize mmap_cache_add_fd()

- use hashmap_ensure_put(),
- use _cleanup_free_ attribute,
- use structured initializer.

8 months agommap-cache: use structured initializer
Yu Watanabe [Thu, 28 Sep 2023 00:30:07 +0000 (09:30 +0900)] 
mmap-cache: use structured initializer

8 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.

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

8 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.

8 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.

8 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.

8 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.

8 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.

8 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

8 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

8 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