]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
2 years agobasic/strv: check printf arguments to strv_extendf() 25470/head
Zbigniew Jędrzejewski-Szmek [Mon, 21 Nov 2022 19:06:55 +0000 (20:06 +0100)] 
basic/strv: check printf arguments to strv_extendf()

The second argument to _printf_() specifies where the arguments start. We need to
use 0 in two cases: when the args in a va_list and can't be checked, and with journald
logging functions which accept multiple format strings with multiple argument sets,
which the _printf_ checker does not understand. But strv_extendf() can be checked.

2 years agomanager: fix format strings for trigger metadata
Zbigniew Jędrzejewski-Szmek [Mon, 21 Nov 2022 19:03:08 +0000 (20:03 +0100)] 
manager: fix format strings for trigger metadata

Fixup for c8bc7519c888a99134f88f8c82353246d3c0cc5d.

2 years agopo: Translated using Weblate (Dutch)
Richard E. van der Luit [Sun, 20 Nov 2022 15:19:54 +0000 (16:19 +0100)] 
po: Translated using Weblate (Dutch)

Currently translated at 100.0% (193 of 193 strings)

Co-authored-by: Richard E. van der Luit <fedoraproject@veneax.nl>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/nl/
Translation: systemd/main

2 years agoremove obsolete translate in zh_CN.po
lichao [Sat, 19 Nov 2022 12:45:30 +0000 (20:45 +0800)] 
remove obsolete translate in zh_CN.po

2 years agoMerge pull request #25438 from poettering/localhost-ifindex-tweak
Yu Watanabe [Sat, 19 Nov 2022 06:36:12 +0000 (15:36 +0900)] 
Merge pull request #25438 from poettering/localhost-ifindex-tweak

resolved: fix ifindex for contacting per-interface DNS server if it is 127.0.0.1

2 years agoMerge pull request #25423 from yuwata/network-tc-cake-rtt-and-ack-filter
Yu Watanabe [Sat, 19 Nov 2022 06:35:49 +0000 (15:35 +0900)] 
Merge pull request #25423 from yuwata/network-tc-cake-rtt-and-ack-filter

network: tc-cake: support controlling RTT and ACK filter

2 years agodbus-manager: add comments about booleans in function calls
Mike Yuan [Fri, 18 Nov 2022 23:49:27 +0000 (07:49 +0800)] 
dbus-manager: add comments about booleans in function calls

Update to match the new coding style
See also: https://github.com/systemd/systemd/pull/25437#discussion_r1026934242

2 years agotest-network: add tests for RTT and ACK filter for CAKE 25423/head
Yu Watanabe [Thu, 17 Nov 2022 11:44:56 +0000 (20:44 +0900)] 
test-network: add tests for RTT and ACK filter for CAKE

2 years agonetwork: tc-cake: add support to specify ACK filter
Yu Watanabe [Thu, 17 Nov 2022 09:27:57 +0000 (18:27 +0900)] 
network: tc-cake: add support to specify ACK filter

2 years agoMerge pull request #25389 from fbuihuu/update-test-for-opensuse
Yu Watanabe [Fri, 18 Nov 2022 20:58:51 +0000 (05:58 +0900)] 
Merge pull request #25389 from fbuihuu/update-test-for-opensuse

Update test/ for openSUSE

2 years agobootctl: rework how we handle referenced but absent EFI boot entries
Lennart Poettering [Fri, 18 Nov 2022 17:05:53 +0000 (18:05 +0100)] 
bootctl: rework how we handle referenced but absent EFI boot entries

Follow-up for #25368.

Let's consider ENOENT an expected error, and just debug log about it
(though, let's suffix it with `, ignoring.`). All other errors will log
loudly, as they are unexpected errors.

2 years agoresolved: when configuring 127.0.0.1 as per-interface DNS server, contact it via... 25438/head
Lennart Poettering [Fri, 18 Nov 2022 15:52:06 +0000 (16:52 +0100)] 
resolved: when configuring 127.0.0.1 as per-interface DNS server, contact it via "lo" always

ussually if you specify a DNS server on some interface then we'll use
that interface to talk to it. Let's override this for localhost
addresses, as they only really make sense on "lo".

Fixes: #25397
2 years agoresolved: use right conditionalization when setting unicast ifindex on UDP sockets
Lennart Poettering [Fri, 18 Nov 2022 15:52:01 +0000 (16:52 +0100)] 
resolved: use right conditionalization when setting unicast ifindex on UDP sockets

2 years agonspawn: allow sched_rr_get_interval_time64 through seccomp filter
Sam James [Fri, 18 Nov 2022 07:18:18 +0000 (07:18 +0000)] 
nspawn: allow sched_rr_get_interval_time64 through seccomp filter

We only allow a selected subset of syscalls from nspawn containers
and don't list any time64 variants (needed for 32-bit arches when
built using TIME_BITS=64, which is relatively new).

We allow sched_rr_get_interval which cpython's test suite makes
use of, but we don't allow sched_rr_get_interval_time64.

The test failures when run in an arm32 nspawn container on an arm64 host
were as follows:
```
======================================================================
ERROR: test_sched_rr_get_interval (test.test_posix.PosixTester.test_sched_rr_get_interval)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-lang/python-3.11.0_p1/work/Python-3.11.0/Lib/test/test_posix.py", line 1180, in test_sched_rr_get_interval
    interval = posix.sched_rr_get_interval(0)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 1] Operation not permitted
```

Then strace showed:
```
sched_rr_get_interval_time64(0, 0xffbbd4a0) = -1 EPERM (Operation not permitted)
```

This appears to be the only time64 syscall that isn't already included one of
the sets listed in nspawn-seccomp.c that has a non-time64 variant. Checked
over each of the time64 syscalls known to systemd and verified that none
of the others had a non-time64-variant whitelisted in nspawn other than
sched_rr_get_interval.

Bug: https://bugs.gentoo.org/880131

2 years agosysupdate: Support volatile-root for finding the root partition
reuben olinsky [Tue, 1 Nov 2022 05:58:52 +0000 (22:58 -0700)] 
sysupdate: Support volatile-root for finding the root partition

The existing logic can't find the root device in scenarios where
the root has been replaced with an overlay. We support looking
at "/run/systemd/volatile-root" to find the original root, similar
to what systemd-repart and gpt-auto-generator do.

2 years agoupdate TODO
Lennart Poettering [Fri, 18 Nov 2022 13:58:30 +0000 (14:58 +0100)] 
update TODO

2 years agoMerge pull request #25410 from DaanDeMeyer/mkfs-xfs-fixes
Lennart Poettering [Fri, 18 Nov 2022 13:45:48 +0000 (14:45 +0100)] 
Merge pull request #25410 from DaanDeMeyer/mkfs-xfs-fixes

Followups for #25400

2 years agoboot/measure: fix oom check
Li kunyu [Fri, 18 Nov 2022 07:10:24 +0000 (16:10 +0900)] 
boot/measure: fix oom check

2 years agotest: fix the default timeout values described in README.testsuite 25389/head
Franck Bui [Tue, 15 Nov 2022 10:00:22 +0000 (11:00 +0100)] 
test: fix the default timeout values described in README.testsuite

Unlike it was described, the default is 30 min.

2 years agomeson: install test-kernel-install only when -Dkernel-install=true
Franck Bui [Tue, 15 Nov 2022 08:04:42 +0000 (09:04 +0100)] 
meson: install test-kernel-install only when -Dkernel-install=true

This patch fixes the following build failure:

  meson.build:3853:8: ERROR: Unknown variable "test_kernel_install_sh".

Fixes #25432.

2 years agotests: update install_suse_systemd()
Franck Bui [Fri, 18 Nov 2022 09:18:19 +0000 (10:18 +0100)] 
tests: update install_suse_systemd()

- Use inst_recursive() and image_install() helpers where appropriate

- Update comments to explain why we need to install the test data manually in
  $initdir

- Install manual/ in $initdir as TEST-35-LOGIN relies on
  manual/test-session-properties

2 years agofuzz: fuzz-compress: fix copy-and-paste error: buf -> buf2 (#25431)
Li kunyu [Fri, 18 Nov 2022 06:03:41 +0000 (06:03 +0000)] 
fuzz: fuzz-compress: fix copy-and-paste error: buf -> buf2 (#25431)

2 years agoMerge pull request #25414 from zx2c4-forks/krngseed
Luca Boccassi [Thu, 17 Nov 2022 18:49:40 +0000 (19:49 +0100)] 
Merge pull request #25414 from zx2c4-forks/krngseed

EFI random seed post #25319 review fixups

2 years agokmod-setup: Make sure the tpm module is available early
Daan De Meyer [Thu, 17 Nov 2022 11:35:46 +0000 (12:35 +0100)] 
kmod-setup: Make sure the tpm module is available early

Required for early boot services such as systemd-pcrphase-sysinit
which need early access to the tpm.

2 years agoUpdate NEWS and TODO with sd-boot random seed developments
Jason A. Donenfeld [Thu, 17 Nov 2022 15:35:12 +0000 (16:35 +0100)] 
Update NEWS and TODO with sd-boot random seed developments

2 years agoMerge pull request #25333 from yuwata/find-esp-part-entry-scheme
Lennart Poettering [Thu, 17 Nov 2022 14:28:54 +0000 (15:28 +0100)] 
Merge pull request #25333 from yuwata/find-esp-part-entry-scheme

find-esp: downgrade and ignore error on retrieving PART_ENTRY_SCHEME

2 years agosignal-util: add common implementation for propagating a signal
Lennart Poettering [Wed, 16 Nov 2022 17:54:29 +0000 (18:54 +0100)] 
signal-util: add common implementation for propagating a signal

i.e. let's add a common logic to be called from a signal handler to
raise the passed signal again.

Follow-up for: #25399

2 years agohwdb: fix Compaq N14KP6 key toggle touchpad (#25404)
Edson Juliano Drosdeck [Thu, 17 Nov 2022 13:37:08 +0000 (10:37 -0300)] 
hwdb: fix Compaq N14KP6 key toggle touchpad (#25404)

2 years agolog: Remove log_ratelimit_debug() macros
Daan De Meyer [Thu, 17 Nov 2022 09:25:06 +0000 (10:25 +0100)] 
log: Remove log_ratelimit_debug() macros

These don't make sense anymore since we disable log ratelimiting
when logging at debug level.

2 years agorepart: Write temporary LUKS header to /var/tmp instead of /tmp 25410/head
Daan De Meyer [Thu, 17 Nov 2022 13:15:28 +0000 (14:15 +0100)] 
repart: Write temporary LUKS header to /var/tmp instead of /tmp

This is a relatively large file so let's not create it in memory.

2 years agoFollowups for aa6aa81c1e2fa0d35f91545d440ce5a31e1a43df
Daan De Meyer [Wed, 16 Nov 2022 16:33:31 +0000 (17:33 +0100)] 
Followups for aa6aa81c1e2fa0d35f91545d440ce5a31e1a43df

2 years agotmpfile-util: Introduce fopen_temporary_child()
Daan De Meyer [Thu, 17 Nov 2022 13:12:48 +0000 (14:12 +0100)] 
tmpfile-util: Introduce fopen_temporary_child()

Instead of having fopen_temporary() create the file either next
to an existing file or in tmp/, let's split this up clearly into
two different functions, one for creating temporary files next to
existing files, and one for creating a temporary file in a directory.

2 years agonetwork: tc-cake: add support to specify RTT
Yu Watanabe [Thu, 17 Nov 2022 09:11:38 +0000 (18:11 +0900)] 
network: tc-cake: add support to specify RTT

2 years agoboot: only use __builtin_object_size with -O>0 25414/head
Jason A. Donenfeld [Wed, 16 Nov 2022 18:46:41 +0000 (19:46 +0100)] 
boot: only use __builtin_object_size with -O>0

__builtin_object_size() returns -1 with -O0, so disable this and warn
about it instead.

2 years agoboot: do not truncate random seed file
Jason A. Donenfeld [Wed, 16 Nov 2022 18:34:53 +0000 (19:34 +0100)] 
boot: do not truncate random seed file

There are concerns about the FAT file system driver exploding if we try
to do this, so just leave the bytes zeroed out instead.

2 years agorandom-seed: handle post-merge review nits
Jason A. Donenfeld [Wed, 16 Nov 2022 18:27:50 +0000 (19:27 +0100)] 
random-seed: handle post-merge review nits

These are various misc things that came up after merging.

2 years agoHandle MACHINE_ID=uninitialized
Marcus Schäfer [Wed, 16 Nov 2022 15:25:08 +0000 (16:25 +0100)] 
Handle MACHINE_ID=uninitialized

systemd supports /etc/machine-id to be set to: uninitialized
In this case the expectation is that systemd creates a new
machine ID and replaces the value 'uninitialized' with the
effective machine id. In the scope of kernel-install we
should also enforce the creation of a new machine id in this
condition

2 years agopcrphase: add $SYSTEMD_PCRPHASE_STUB_VERIFY env var for overriding stub check
Lennart Poettering [Mon, 14 Nov 2022 16:26:45 +0000 (17:26 +0100)] 
pcrphase: add $SYSTEMD_PCRPHASE_STUB_VERIFY env var for overriding stub check

2 years agoshared/tpm2-util: Fix "Error: Esys invalid ESAPI handle (40000001)" warning
Vitaly Kuznetsov [Tue, 15 Nov 2022 13:57:23 +0000 (14:57 +0100)] 
shared/tpm2-util: Fix "Error: Esys invalid ESAPI handle (40000001)" warning

systemd-cryptenroll complains (but succeeds!) upon binding to a signed PCR
policy:

$ systemd-cryptenroll --unlock-key-file=/tmp/passphrase --tpm2-device=auto
  --tpm2-public-key=... --tpm2-signature=..." /tmp/tmp.img

ERROR:esys:src/tss2-esys/esys_iutil.c:394:iesys_handle_to_tpm_handle() Error: Esys invalid ESAPI handle (40000001).
WARNING:esys:src/tss2-esys/esys_iutil.c:415:iesys_is_platform_handle() Convert handle from TPM2_RH to ESYS_TR, got: 0x40000001
ERROR:esys:src/tss2-esys/esys_iutil.c:394:iesys_handle_to_tpm_handle() Error: Esys invalid ESAPI handle (40000001).
WARNING:esys:src/tss2-esys/esys_iutil.c:415:iesys_is_platform_handle() Convert handle from TPM2_RH to ESYS_TR, got: 0x4000000
New TPM2 token enrolled as key slot 1.

The problem seems to be that Esys_LoadExternal() function from tpm2-tss
expects a 'ESYS_TR_RH*' constant specifying the requested hierarchy and not
a 'TPM2_RH_*' one (see Esys_LoadExternal() -> Esys_LoadExternal_Async() ->
iesys_handle_to_tpm_handle() call chain).

It all works because Esys_LoadExternal_Async() falls back to using the
supplied values when iesys_handle_to_tpm_handle() fails:

    r = iesys_handle_to_tpm_handle(hierarchy, &tpm_hierarchy);
    if (r != TSS2_RC_SUCCESS) {
        ...
        tpm_hierarchy = hierarchy;
    }

Note, TPM2_RH_OWNER was used on purpose to support older tpm2-tss versions
(pre https://github.com/tpm2-software/tpm2-tss/pull/1531), use meson magic
to preserve compatibility.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
2 years agoMerge pull request #25399 from DaanDeMeyer/siginfo-crash
Lennart Poettering [Wed, 16 Nov 2022 17:42:07 +0000 (18:42 +0100)] 
Merge pull request #25399 from DaanDeMeyer/siginfo-crash

crash-handler: Make sure we propagate the original siginfo

2 years agoMerge pull request #25096 from DaanDeMeyer/journald-log-fixes
Daan De Meyer [Wed, 16 Nov 2022 15:40:00 +0000 (16:40 +0100)] 
Merge pull request #25096 from DaanDeMeyer/journald-log-fixes

journal: Ratelimit more journald log messages

2 years agocrash-handler: Make sure we propagate the original siginfo 25399/head
Daan De Meyer [Sun, 5 Jun 2022 12:25:22 +0000 (14:25 +0200)] 
crash-handler: Make sure we propagate the original siginfo

If we call raise(), we lose the information from the original signal.
If we use rt_sigqueueinfo(), the original siginfo gets reused which
is helpful when debugging crashes.

2 years agosigbus: Add fallback in case rt_tgsiqqueueinfo() fails
Daan De Meyer [Wed, 16 Nov 2022 14:06:55 +0000 (15:06 +0100)] 
sigbus: Add fallback in case rt_tgsiqqueueinfo() fails

2 years agomkfs-util: Add support for rootless xfs population
Daan De Meyer [Wed, 16 Nov 2022 10:17:52 +0000 (11:17 +0100)] 
mkfs-util: Add support for rootless xfs population

We use mkfs.xfs's protofile (-p) support to achieve this. The
protofile is a description of the files that should be copied into
the filesystem. The format is described in the manpage of mkfs.xfs.

2 years agoMerge pull request #25319 from zx2c4-forks/krngseed
Luca Boccassi [Wed, 16 Nov 2022 14:07:54 +0000 (15:07 +0100)] 
Merge pull request #25319 from zx2c4-forks/krngseed

boot: implement kernel EFI RNG seed protocol with proper hashing

2 years agosigbus: Make sure the signal is delivered to the same thread
Daan De Meyer [Wed, 16 Nov 2022 14:05:24 +0000 (15:05 +0100)] 
sigbus: Make sure the signal is delivered to the same thread

2 years agomissing_syscall: Add rt_tgsigqueueinfo()
Daan De Meyer [Wed, 16 Nov 2022 14:03:11 +0000 (15:03 +0100)] 
missing_syscall: Add rt_tgsigqueueinfo()

2 years agoMerge pull request #25310 from jlinton/fpdt_dev_mem_alt
Lennart Poettering [Wed, 16 Nov 2022 13:55:17 +0000 (14:55 +0100)] 
Merge pull request #25310 from jlinton/fpdt_dev_mem_alt

acpi-fpdt: Use kernel fpdt parsing

2 years agoMerge pull request #24855 from kraxel/qemu
Lennart Poettering [Wed, 16 Nov 2022 13:53:42 +0000 (14:53 +0100)] 
Merge pull request #24855 from kraxel/qemu

better qemu support (handle direct kernel boot etc).

2 years agoMerge pull request #25393 from poettering/tpm2-override
Lennart Poettering [Wed, 16 Nov 2022 13:30:26 +0000 (14:30 +0100)] 
Merge pull request #25393 from poettering/tpm2-override

tpm2-util: force default TCTI to be "device" with parameter "/dev/tpm…

2 years agosystemd-boot man page: add section for virtual machines 24855/head
Gerd Hoffmann [Tue, 4 Oct 2022 13:01:39 +0000 (15:01 +0200)] 
systemd-boot man page: add section for virtual machines

2 years agoboot: improve support for qemu
Gerd Hoffmann [Fri, 9 Sep 2022 11:12:04 +0000 (13:12 +0200)] 
boot: improve support for qemu

systemd-boot expects being loaded from ESP and is quite unhappy in case
the loaded image device path is something else.  When running on qemu
this can easily happen though.  Case one is direct kernel boot, i.e.
loading via 'qemu -kernel systemd-bootx64.efi'.  Case two is sd-boot
being added to the ovmf firmware image and being loaded from there.

This patch detects both cases and goes inspect all file systems known to
the firmware, trying to find the ESP.  When present the
VMMBootOrderNNNN variables are used to inspect the file systems in the
given order.

2 years agoMerge pull request #24555 from medhefgo/bootctl
Zbigniew Jędrzejewski-Szmek [Wed, 16 Nov 2022 11:27:30 +0000 (12:27 +0100)] 
Merge pull request #24555 from medhefgo/bootctl

bootctl: Small improvements

2 years agolocalectl,analyze: some minor vertical table rework fixes
Lennart Poettering [Fri, 11 Nov 2022 13:32:51 +0000 (14:32 +0100)] 
localectl,analyze: some minor vertical table rework fixes

Follow-up for #25339

2 years agolog: Disable log rate limiting if debug logging is enabled 25096/head
Daan De Meyer [Wed, 16 Nov 2022 10:37:14 +0000 (11:37 +0100)] 
log: Disable log rate limiting if debug logging is enabled

When debugging, it makes sense to not do any rate limiting at all.

2 years agoMerge pull request #24944 from DaanDeMeyer/repart-rootless
Daan De Meyer [Wed, 16 Nov 2022 08:09:06 +0000 (09:09 +0100)] 
Merge pull request #24944 from DaanDeMeyer/repart-rootless

repart: Add support for running without root privileges

2 years agoRevert "journal: Make sd_journal_previous/next() return 0 at HEAD/TAIL"
Daan De Meyer [Mon, 14 Nov 2022 11:45:47 +0000 (12:45 +0100)] 
Revert "journal: Make sd_journal_previous/next() return 0 at HEAD/TAIL"

This commit broke backwards compatibility so let's revert it until
we find a better solution.

This reverts commit 977ad21b5b8f6323515297bd8995dcaaca0905df.

2 years agoFix reading /etc/machine-id in kernel-install (#25388)
Marcus Schäfer [Tue, 15 Nov 2022 23:17:19 +0000 (00:17 +0100)] 
Fix reading /etc/machine-id in kernel-install (#25388)

* Fix reading /etc/machine-id in kernel-install

The kernel-install script has code to read the contents of
/etc/machine-id into the MACHINE_ID variable. Depending
on the variable content kernel-install either logs the
value or creates a new machine id via 'systemd-id128 new'.
In that logic there is one issue. If the file /etc/machine-id
exists but is empty, the script tries to call read on an
empty file which return with an exit code != 0. As the
script code also uses 'set -e', kernel-install will exit at
this point which is unexpected.

The condition of an empty /etc/machine-id file exists for
example when building OS images, which should initialize the
system id on first boot but not staticly inside of the image.
afaik an empty /etc/machine-id is also a common approach
to make systemd indicate that it should create a new system
id. Because of this, the commit makes sure the reading of
/etc/machine-id does not fail in any case such that the
handling of the MACHINE_ID variable takes place.

2 years agoUpdate hostnamectl.xml
angus-p [Tue, 15 Nov 2022 16:11:36 +0000 (16:11 +0000)] 
Update hostnamectl.xml

set-hostname is obsolete

2 years agotpm2: add some extra validation of device string before using it 25393/head
Lennart Poettering [Tue, 15 Nov 2022 22:01:04 +0000 (23:01 +0100)] 
tpm2: add some extra validation of device string before using it

Let's add some extra validation before constructing and using the .so
name to load. This isn't really security sensitive, given that we
used secure_getenv() to get the device string (and it thus should have
been come from a trusted source) but let's better be safe than sorry.

2 years agotpm2-util: force default TCTI to be "device" with parameter "/dev/tpmrm0"
Lennart Poettering [Mon, 14 Nov 2022 16:26:49 +0000 (17:26 +0100)] 
tpm2-util: force default TCTI to be "device" with parameter "/dev/tpmrm0"

Apparently some distros default to tss-abmrd. Let's bypass that and
always go to the kernel resource manager.

abmrd cannot really work for us, since we want to access the TPM already
in earliest boot i.e. in environments the abmrd service is not available
in.

Fixes: #25352
2 years agoMemoryZSwapMax directive to configure new memory.zswap.max cgroup file
Pasha Vorobyev [Fri, 4 Feb 2022 19:49:46 +0000 (11:49 -0800)] 
MemoryZSwapMax directive to configure new memory.zswap.max cgroup file

2 years agorepart: Run most repart integration tests without root privileges 24944/head
Daan De Meyer [Thu, 10 Nov 2022 14:40:00 +0000 (15:40 +0100)] 
repart: Run most repart integration tests without root privileges

To make sure rootless mode keeps working, let's run all repart
integration tests that we can without root privileges. The only ones
we need to keep running with root privileges are the tests that operate
on a block/loop device and those that use --image=.

2 years agorepart: Don't use loop devices when we're not operating on a block device
Daan De Meyer [Sun, 9 Oct 2022 22:14:17 +0000 (00:14 +0200)] 
repart: Don't use loop devices when we're not operating on a block device

When repart is not operating on a block device, if we avoid using
any loop devices at all, it becomes possible to run repart without
needing root privileges.

Note that this also depends on the filesystems in use to support
population without needing root privileges (specifically, squashfs,
ext4 or btrfs).

2 years agorepart: Change mode of temporary root to 755
Daan De Meyer [Thu, 10 Nov 2022 13:32:15 +0000 (14:32 +0100)] 
repart: Change mode of temporary root to 755

Let's make sure regular users can access read/execute files when
we're populating from a temporary root.

2 years agorepart: Fail early if no sources are provided for a read-only filesystem
Daan De Meyer [Wed, 12 Oct 2022 12:53:48 +0000 (14:53 +0200)] 
repart: Fail early if no sources are provided for a read-only filesystem

2 years agorepart: Skip partition_populate_directory() if no sources are provided
Daan De Meyer [Wed, 12 Oct 2022 12:40:29 +0000 (14:40 +0200)] 
repart: Skip partition_populate_directory() if no sources are provided

2 years agorepart: Fail early if we're missing privileges to populate a filesystem
Daan De Meyer [Tue, 11 Oct 2022 08:56:16 +0000 (10:56 +0200)] 
repart: Fail early if we're missing privileges to populate a filesystem

2 years agorepart: Ensure files end up owned by root in generated filesystems
Daan De Meyer [Mon, 10 Oct 2022 21:34:04 +0000 (23:34 +0200)] 
repart: Ensure files end up owned by root in generated filesystems

By forking off a user namespace before running mkfs and ID mapping
the user running repart to root in the user namespace, we can make
sure that files in the generated filesystems are all owned by root
instead of the user running repart.

To make this work we have to make sure that all the files in the
root directory that's passed to the mkfs binary are owned by the
user running repart, so we have to drop the shortcut for only a
single root directory in partition_populate_directory().

2 years agorepart: Fix copy failure error message
Daan De Meyer [Mon, 10 Oct 2022 16:12:15 +0000 (18:12 +0200)] 
repart: Fix copy failure error message

2 years agorepart: Move verity sig formatting into data partition functions
Daan De Meyer [Sun, 9 Oct 2022 20:30:05 +0000 (22:30 +0200)] 
repart: Move verity sig formatting into data partition functions

Refactoring to make implementing rootless repart easier.

2 years agorepart: Move verity hash formatting into data partition functions
Daan De Meyer [Sun, 9 Oct 2022 20:26:10 +0000 (22:26 +0200)] 
repart: Move verity hash formatting into data partition functions

Refactoring to make implementing rootless repart easier.

2 years agorepart: Do offline encryption instead of online
Daan De Meyer [Sun, 9 Oct 2022 18:46:59 +0000 (20:46 +0200)] 
repart: Do offline encryption instead of online

Offline encryption can be done without mounting the luks device. For
now we still use loop devices to split out the partition we want to
write to but in a later commit we'll replace this with a regular file.

For offline encryption, we need to keep 2x the luks header size space
free at the end of the partition, so this means our encrypted partitions
will be 16M larger than before.

2 years agorepart: Let libcryptsetup calculate the volume key
Daan De Meyer [Thu, 13 Oct 2022 12:36:06 +0000 (14:36 +0200)] 
repart: Let libcryptsetup calculate the volume key

We also bump the volume key size to 512 bits.

2 years agomkfs-util: Add support to populate vfat without mounting using mcopy
Daan De Meyer [Tue, 11 Oct 2022 08:50:58 +0000 (10:50 +0200)] 
mkfs-util: Add support to populate vfat without mounting using mcopy

mkfs.vfat doesn't support specifying a root directory to bootstrap
the filesystem from (see https://github.com/dosfstools/dosfstools/issues/183).
Instead, we can use the mcopy tool from the mtools package to copy
files into the vfat filesystem after creating it without needing to
mount the vfat filesystem.

2 years agomkosi: Add mkfs tools to mkosi image
Daan De Meyer [Sun, 9 Oct 2022 17:52:08 +0000 (19:52 +0200)] 
mkosi: Add mkfs tools to mkosi image

Useful for testing systemd-repart

2 years agomkfs-util: Add root support for ext and btrfs
Daan De Meyer [Fri, 7 Oct 2022 19:21:46 +0000 (21:21 +0200)] 
mkfs-util: Add root support for ext and btrfs

For these filesysrems, it's useful to provide the filesystem upfront
so that we don't have to mount it later which requires root privileges.

2 years agomkfs-util: Make argument handling for mkfs binaries more flexible
Daan De Meyer [Mon, 10 Oct 2022 22:10:39 +0000 (00:10 +0200)] 
mkfs-util: Make argument handling for mkfs binaries more flexible

Preparation for the next commit.

2 years agobtrfs-util: Remove bogus assert()
Daan De Meyer [Mon, 10 Oct 2022 13:45:24 +0000 (15:45 +0200)] 
btrfs-util: Remove bogus assert()

If size is zero, BTRFS_IOC_CLONE_RANGE will copy until the end of
the source file.

2 years agoMerge pull request #25001 from DaanDeMeyer/repart-filter
Daan De Meyer [Tue, 15 Nov 2022 19:07:24 +0000 (20:07 +0100)] 
Merge pull request #25001 from DaanDeMeyer/repart-filter

repart: Add --include/--exclude-partitions

2 years agorepart: Add integration test for --include/--exclude-partitions 25001/head
Daan De Meyer [Fri, 11 Nov 2022 13:26:45 +0000 (14:26 +0100)] 
repart: Add integration test for --include/--exclude-partitions

2 years agorepart: Add --include/--exclude-partitions
Daan De Meyer [Fri, 14 Oct 2022 10:06:55 +0000 (12:06 +0200)] 
repart: Add --include/--exclude-partitions

Let's allow filtering the partitions to operate on by partition
type UUID. This is necessary when building bootable images with a
verity protected root/usr partition as we can only build the UKI
image when we have the verity roothash which means we cannot populate
the EFI partition yet when we run repart initially to determine the
verity roothash.

2 years agorepart: Use first unused partition number for new partitions
Daan De Meyer [Fri, 14 Oct 2022 10:40:28 +0000 (12:40 +0200)] 
repart: Use first unused partition number for new partitions

If we skip some partition types in a first run of systemd-repart,
we don't want their partition numbers to be different than usual,
so let's change the allocation of partition numbers to account for
that.

2 years agogpt: Expose GptPartitionType and get rid of SECONDARY/OTHER
Daan De Meyer [Thu, 13 Oct 2022 19:26:16 +0000 (21:26 +0200)] 
gpt: Expose GptPartitionType and get rid of SECONDARY/OTHER

Instead of exposing just the partition type UUID, let's expose the
GptPartitionType struct, which has a lot more information available
in a much more accessible way.

Also, let's get rid of SECONDARY/OTHER in PartitionDesignator. These
were only there to support preferred architectures in dissect-image.c,
but we can easily handle that by comparing architectures when we decide
whether to override a partition. This is done in a new function
compare_arch().

2 years agotests: install dmi-sysfs module on openSUSE
Franck Bui [Fri, 11 Nov 2022 17:34:06 +0000 (18:34 +0100)] 
tests: install dmi-sysfs module on openSUSE

Required by TEST-54-CREDS.

2 years agotests: install systemd-resolved on openSUSE
Franck Bui [Tue, 8 Nov 2022 15:01:59 +0000 (16:01 +0100)] 
tests: install systemd-resolved on openSUSE

It's needed since systemd-resolved has its own test suite (commit
fb6f25d7b979134adf57).

2 years agorepart: Remove the repeated ';' from code (#25386)
Li kunyu [Tue, 15 Nov 2022 08:02:51 +0000 (08:02 +0000)] 
repart: Remove the repeated ';' from code (#25386)

2 years agoMerge pull request #24908 from DaanDeMeyer/repart-minimize
Daan De Meyer [Tue, 15 Nov 2022 07:19:28 +0000 (08:19 +0100)] 
Merge pull request #24908 from DaanDeMeyer/repart-minimize

repart: Add Minimize setting

2 years agoacpi-fpdt: Use kernel fpdt parsing 25310/head
Jeremy Linton [Tue, 8 Nov 2022 05:31:30 +0000 (23:31 -0600)] 
acpi-fpdt: Use kernel fpdt parsing

On some kernels/distros (RHEL/aarch64) /dev/mem is
turned off. This means that the ACPI FPDT data is
missing from systemd-analyze output when /dev/mem
fails to provide the boot times.

Instead recent kernels can export that data from
/sys/firmware/acpi/fpdt/boot/ entries. Use that
information if available first.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
2 years agorandom-seed: refresh EFI boot seed when writing a new seed 25319/head
Jason A. Donenfeld [Fri, 11 Nov 2022 14:22:35 +0000 (15:22 +0100)] 
random-seed: refresh EFI boot seed when writing a new seed

Since this runs at shutdown to write a new seed, we should also keep the
bootloader's seed maximally fresh by doing the same. So we follow the
same pattern - hash some new random bytes with the old seed to make a
new seed. We let this fail without warning, because it's just an
opportunistic thing. If the user happens to have set up the random seed
with bootctl, and the RNG is initialized, then things should be fine. If
not, we create a new seed if systemd-boot is in use. And if not, then we
just don't do anything.

2 years agoboot: implement kernel EFI RNG seed protocol with proper hashing
Jason A. Donenfeld [Wed, 9 Nov 2022 11:44:37 +0000 (12:44 +0100)] 
boot: implement kernel EFI RNG seed protocol with proper hashing

Rather than passing seeds up to userspace via EFI variables, pass seeds
directly to the kernel's EFI stub loader, via LINUX_EFI_RANDOM_SEED_TABLE_GUID.
EFI variables can potentially leak and suffer from forward secrecy
issues, and processing these with userspace means that they are
initialized much too late in boot to be useful. In contrast,
LINUX_EFI_RANDOM_SEED_TABLE_GUID uses EFI configuration tables, and so
is hidden from userspace entirely, and is parsed extremely early on by
the kernel, so that every single call to get_random_bytes() by the
kernel is seeded.

In order to do this properly, we use a bit more robust hashing scheme,
and make sure that each input is properly memzeroed out after use. The
scheme is:

    key = HASH(LABEL || sizeof(input1) || input1 || ... || sizeof(inputN) || inputN)
    new_disk_seed = HASH(key || 0)
    seed_for_linux = HASH(key || 1)

The various inputs are:
- LINUX_EFI_RANDOM_SEED_TABLE_GUID from prior bootloaders
- 256 bits of seed from EFI's RNG
- The (immutable) system token, from its EFI variable
- The prior on-disk seed
- The UEFI monotonic counter
- A timestamp

This also adjusts the secure boot semantics, so that the operation is
only aborted if it's not possible to get random bytes from EFI's RNG or
a prior boot stage. With the proper hashing scheme, this should make
boot seeds safe even on secure boot.

There is currently a bug in Linux's EFI stub in which if the EFI stub
manages to generate random bytes on its own using EFI's RNG, it will
ignore what the bootloader passes. That's annoying, but it means that
either way, via systemd-boot or via EFI stub's mechanism, the RNG *does*
get initialized in a good safe way. And this bug is now fixed in the
efi.git tree, and will hopefully be backported to older kernels.

As the kernel recommends, the resultant seeds are 256 bits and are
allocated using pool memory of type EfiACPIReclaimMemory, so that it
gets freed at the right moment in boot.

2 years agorepart: Add Minimize= integration test 24908/head
Daan De Meyer [Thu, 10 Nov 2022 11:33:02 +0000 (12:33 +0100)] 
repart: Add Minimize= integration test

2 years agoMerge pull request #25327 from keszybz/mkosi-less-work
Frantisek Sumsal [Mon, 14 Nov 2022 11:44:16 +0000 (11:44 +0000)] 
Merge pull request #25327 from keszybz/mkosi-less-work

Skip mkosi runs on docs-only changes and some small cleanups

2 years agoMerge pull request #25361 from bluca/readme
Luca Boccassi [Mon, 14 Nov 2022 11:32:39 +0000 (12:32 +0100)] 
Merge pull request #25361 from bluca/readme

README: note a couple more kconfigs

2 years agomeasure: fix section names in 'objcopy' example in systemd-measure man
Vitaly Kuznetsov [Fri, 11 Nov 2022 16:15:55 +0000 (17:15 +0100)] 
measure: fix section names in 'objcopy' example in systemd-measure man

A copy paste error has crippled in the objcopy example in 'systemd-measure'
manual,  "--change-section-vma" should reference the section being added,
not ".splash". When used as-is, the resulting UKI is unbootable.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
2 years agoREADME: note Kconfig for verifying DDIs via MoK keys 25361/head
Luca Boccassi [Sat, 12 Nov 2022 01:07:13 +0000 (01:07 +0000)] 
README: note Kconfig for verifying DDIs via MoK keys

Also note them in the mkosi.build kernel config list

2 years agomkosi: drop spaces after shell redirection operator 25327/head
Zbigniew Jędrzejewski-Szmek [Thu, 10 Nov 2022 14:12:33 +0000 (15:12 +0100)] 
mkosi: drop spaces after shell redirection operator

2 years agoci: use mkosi executable directly
Zbigniew Jędrzejewski-Szmek [Thu, 10 Nov 2022 14:10:08 +0000 (15:10 +0100)] 
ci: use mkosi executable directly

2 years agosystemctl: do not show unit properties with --all
Yu Watanabe [Sun, 13 Nov 2022 12:10:56 +0000 (21:10 +0900)] 
systemctl: do not show unit properties with --all

Fixes a bug introduced by a6e334649d4bdff0c6f664e98666b2223aa21a8b.

Fixes #25343.

2 years agotmpfiles: log at info level when some allowed failures occur
Luca Boccassi [Thu, 10 Nov 2022 15:47:19 +0000 (15:47 +0000)] 
tmpfiles: log at info level when some allowed failures occur

In provision.conf we ship:

d- /root :0700 root :root -
d- /root/.ssh :0700 root :root -

These are allowed to fail, for example on a read-only filesystem. But they still
log at error level, which is annoying and gets flagged. Tune those specific errors
down to info.

There are likely more that could be tuned down, but the important thing is to cover
the tmpfiles.d that we ship right now.

Before:

$ echo -e "d- /root :0700 root :root - \nd- /root/.ssh :0700 root :root -" | SYSTEMD_LOG_LEVEL=err build/systemd-tmpfiles --root=/tmp/img --create -
Failed to create directory or subvolume "/tmp/img/root": Read-only file system
Failed to open path '/tmp/img/root': No such file or directory
$

After:

$ echo -e "d- /root :0700 root :root - \nd- /root/.ssh :0700 root :root -" | SYSTEMD_LOG_LEVEL=err build/systemd-tmpfiles --root=/tmp/img --create -
$