]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
2 years agomkosi: Check for failures by mounting again 27806/head
Daan De Meyer [Wed, 31 May 2023 11:03:18 +0000 (13:03 +0200)] 
mkosi: Check for failures by mounting again

We rely on vsock to communicate the exit status back to us from the
VM but vsock in Github Actions is broken so let's switch back to
mounting for now.

2 years agomkosi: Don't fail on systemd-vconsole-setup.service failure for now
Daan De Meyer [Wed, 31 May 2023 12:21:49 +0000 (14:21 +0200)] 
mkosi: Don't fail on systemd-vconsole-setup.service failure for now

Let's make CI green again and dig into this failure later

2 years agomkosi: Disable cmdline addon test for now
Daan De Meyer [Wed, 31 May 2023 11:24:10 +0000 (13:24 +0200)] 
mkosi: Disable cmdline addon test for now

This fails but we didn't notice until now because error reporting
from the mkosi VM was broken. Let's disable it for now to get CI
green again.

2 years agomkosi: Use proper check to detect whether we're in a VM
Daan De Meyer [Fri, 26 May 2023 15:38:23 +0000 (17:38 +0200)] 
mkosi: Use proper check to detect whether we're in a VM

2 years agomkosi: Blacklist vmw_vmci to avoid issues with vsock in Github Actions
Daan De Meyer [Tue, 30 May 2023 12:48:43 +0000 (14:48 +0200)] 
mkosi: Blacklist vmw_vmci to avoid issues with vsock in Github Actions

If this module is loaded, sending readiness notifications from the
VM will fail with "no route to host" so let's blacklist the module
to prevent that from happening.

2 years agomkosi: Enforce usage of vsock with qemu in CI
Daan De Meyer [Sat, 27 May 2023 09:12:22 +0000 (11:12 +0200)] 
mkosi: Enforce usage of vsock with qemu in CI

2 years agomkosi: Update to latest
Daan De Meyer [Sat, 27 May 2023 09:12:11 +0000 (11:12 +0200)] 
mkosi: Update to latest

2 years agosd-daemon: Add debug logging
Daan De Meyer [Wed, 31 May 2023 08:22:57 +0000 (10:22 +0200)] 
sd-daemon: Add debug logging

2 years agosd-daemon: Introduce pid_notify_with_fds_internal()
Daan De Meyer [Wed, 31 May 2023 08:08:47 +0000 (10:08 +0200)] 
sd-daemon: Introduce pid_notify_with_fds_internal()

No change in behavior, just refactoring

2 years agosysv-generator-test: Bump log level to info
Daan De Meyer [Wed, 31 May 2023 12:18:35 +0000 (14:18 +0200)] 
sysv-generator-test: Bump log level to info

Otherwise, non-fatal debug error logs might interfere with the test.

2 years agotest-udev: Skip running in container
Daan De Meyer [Sat, 27 May 2023 10:21:19 +0000 (12:21 +0200)] 
test-udev: Skip running in container

Containers generally don't have permission to mknod() which is
required by test-udev so let's skip the test as well if we detect
we're running in a container.

2 years agooom: Make sure temporary test file is in /tmp
Daan De Meyer [Sat, 27 May 2023 09:43:10 +0000 (11:43 +0200)] 
oom: Make sure temporary test file is in /tmp

2 years agokmod-setup: Load virtio-vsock kernel module early
Daan De Meyer [Sat, 27 May 2023 09:32:39 +0000 (11:32 +0200)] 
kmod-setup: Load virtio-vsock kernel module early

We might want to send sd-notify over vsock very early on so let's
make sure we load the relevant kernel module as early as possible.

2 years agorepart: Allow target directory excludes
Daan De Meyer [Mon, 22 May 2023 21:17:49 +0000 (23:17 +0200)] 
repart: Allow target directory excludes

Currently, ExcludeFiles= supports excluding directories on the host
from being copied. Let's extend this to also support preventing files
from being copied into specific directories in the partition by adding
a new option ExcludeFilesTarget=. An example where this is useful is
when setting up btrfs subvolumes in the top level that are intended to
be mounted into specific locations, so /usr would be stored in @usr,
/home in @home, .... To accomplish this, we need to copy /usr to @usr
and prevent any files from being copied into /usr in the partition,
which with this commit, we'd be able to do as follows:

```
[Partition]
CopyFiles=/usr:@usr
ExcludeFilesTarget=/usr
```

2 years agoshared/loop-util: use longer delay when waiting for loop device
Zbigniew Jędrzejewski-Szmek [Mon, 29 May 2023 22:20:30 +0000 (00:20 +0200)] 
shared/loop-util: use longer delay when waiting for loop device

The kernel may be syncing a file system or doing something else that requires
more time. So make the delay a bit longer, but provide some feedback and also
grow the delay exponentially (though with a long exponent). If the kernel is
doing something else, no need to repeat so often. With 38 attempts, we get a
total of slightly above 5000 ms.

I wrote this when I thought that the the delay is not long enough. It turned
out that we were blocking the file system on the loop device, so waiting longer
wasn't helpful. But I think it's nicer to do it this way anyway.

2 years agoMerge pull request #27842 from keszybz/man-page-links
Zbigniew Jędrzejewski-Szmek [Tue, 30 May 2023 11:40:45 +0000 (13:40 +0200)] 
Merge pull request #27842 from keszybz/man-page-links

Man page formatting and links and such

2 years agoman: mention that udevadm verify also checks for udev rules style issues
Dmitry V. Levin [Mon, 29 May 2023 08:00:00 +0000 (08:00 +0000)] 
man: mention that udevadm verify also checks for udev rules style issues

Starting with commit acc1954a0394, udevadm verify also checks token
delimiters, which are not necessarily a matter of udev rules syntax,
but rather a question of style and readability.  Mention that in the
documentation to avoid confusion.

Suggested-by: Martin Wilck <mwilck@suse.com>
Complements: acc1954a0394 ("udev-rules: check token delimiters")

2 years agoman/analyze: drop paths from output examples 27842/head
Zbigniew Jędrzejewski-Szmek [Tue, 30 May 2023 08:06:05 +0000 (10:06 +0200)] 
man/analyze: drop paths from output examples

They are not useful for the user but make the examples
wider than necessary.

2 years agoman/analyze: reword description of malloc and fix link
Zbigniew Jędrzejewski-Szmek [Tue, 30 May 2023 08:04:02 +0000 (10:04 +0200)] 
man/analyze: reword description of malloc and fix link

2 years agoSupport no-journal for dm-integrity devices.
Russell Harmon [Mon, 29 May 2023 01:51:36 +0000 (18:51 -0700)] 
Support no-journal for dm-integrity devices.

As documented in integritysetup.8, dm-integrity devices support running
without a journal whatsoever. This change allows the
CRYPT_ACTIVATE_NO_JOURNAL flag (the same as is used with `integritysetup
--integrity-no-journal`) to be passed in during dmsetup by specifying
the `no-journal` option in integritytab.5.

2 years agoMerge pull request #27687 from keszybz/boot-efi-choices
Mike Yuan [Tue, 30 May 2023 07:21:42 +0000 (15:21 +0800)] 
Merge pull request #27687 from keszybz/boot-efi-choices

gpt-auto-generator: rework/simplify logic for picking /efi or /boot

2 years agobpf: test with GCC BPF compiler on opensuse
James Hilliard [Mon, 29 May 2023 21:45:13 +0000 (15:45 -0600)] 
bpf: test with GCC BPF compiler on opensuse

2 years agohome: move the assert back to the intended place
Frantisek Sumsal [Mon, 29 May 2023 18:28:34 +0000 (20:28 +0200)] 
home: move the assert back to the intended place

98d81cf974 moved the assertion at the beginning of home_dispatch_acquire(),
which is however before we even check for any ongoing operation, hence we
might hit it even in legitimate cases.

Let's move it back to after we check for any possibly ongoing operation, to
make it once again a safety check.

Follow-up to 98d81cf974.
Resolves: #22443 and #24036

2 years agobpf: stabilize GCC BPF support
James Hilliard [Mon, 29 May 2023 21:01:34 +0000 (15:01 -0600)] 
bpf: stabilize GCC BPF support

Now that we have a GCC release which should support our bpf programs
lets set the minimum version and stabilize it.

2 years agodissect: implement the same logic as gpt-auto-generator 27687/head
Zbigniew Jędrzejewski-Szmek [Wed, 24 May 2023 14:55:16 +0000 (16:55 +0200)] 
dissect: implement the same logic as gpt-auto-generator

gpt-auto-generator does three checks: 1. whether the directory doesn't have
files, 2. whether it's not in fstab, and 3. whether it is not a mount point.
For dissect logic, 3. is not relevant, and it ignores 2.
But the check whether files exists was done only partially: it was done
for /efi, but not for /boot.

Two changes are made:
- the check whether /boot is empty is now done.
- for ESP, /boot is used in preference to /efi, if not used for XBOOTLDR.

With those changes, the logic in dissect matches what gpt-auto-generator does.
There are the two intentional differences described in the first paragraph,

2 years agogpt-auto-generator: rework/simplify logic for picking /efi or /boot
Zbigniew Jędrzejewski-Szmek [Wed, 5 Apr 2023 15:10:16 +0000 (17:10 +0200)] 
gpt-auto-generator: rework/simplify logic for picking /efi or /boot

I started looking into https://github.com/uapi-group/specifications/issues/35.

BLS says:
> Otherwise [no existing XBOOTLDR partition], if on GPT and an ESP is found and
> it is large enough (let’s say at least 1G) it should be used as $BOOT and
> used as primary location to place boot loader menu resources in.

> It is recommended to mount $BOOT to /boot/, and the ESP to /efi/.

DPS says:
> The ESP used for the current boot is automatically mounted to /efi/ (or
> /boot/ as fallback), unless a different partition is mounted there (possibly
> via /etc/fstab, or because the Extended Boot Loader Partition — see below —
> exists) or the directory is non-empty on the root disk.

I don't think we want to mount the same partition in two places.
If the same partition is not mounted in two places, then the two specs are
contradictory.

The code in gpt-auto-generator implemented the logic from the DPS. It is
modified to implement the logic from BLS.

Effectively:
- if both /boot and /efi are available:
  - if both XBOOTLDR and ESP exist:
    ESP on /efi, XBOOTLDR on /boot
  - if only ESP exists:
    ESP on /boot
  - if only XBOOTLDR exists:
    XBOOTLDR on /boot
- if only /boot is available:
  - if XBOOTLDR exists:
    XBOOTLDR on /boot
  - if only ESP exists:
    ESP on /boot
- if only /efi is available:
  - if ESP exists:
    ESP on /efi

"Available" means that it the mount point is not mounted over and does not
contain files. If the directory doesn't exist, it is also "available" and will
be created later when the mount or automount unit is started.

Thus, the generator attempts to match the partitions and mount points to the
extent possible. In all cases, /boot is the primary place to install kernels.
ESP can be found on /boot or /efi, depending on the situation.

If this patch is merged, I'll submit fixes for BLS and DPS to describe the
same logic.

2 years agoman/tmpfiles: add more man page citerefs
Zbigniew Jędrzejewski-Szmek [Wed, 17 May 2023 16:31:25 +0000 (18:31 +0200)] 
man/tmpfiles: add more man page citerefs

This was supposed to be part of 8fb350049bb7a7305589f201df9d37482e544f24, but
I forgot to save the file.

2 years agoresolvectl: drop extra colon
David Tardon [Sun, 28 May 2023 20:30:48 +0000 (22:30 +0200)] 
resolvectl: drop extra colon

2 years agobasic/syscall: update syscall list
Yu Watanabe [Sun, 28 May 2023 15:05:38 +0000 (00:05 +0900)] 
basic/syscall: update syscall list

Only notable change is that memfd_secret is now defined on s390(x).

2 years agogpt/DPS: add more aliases for python's machine
Luca Boccassi [Fri, 26 May 2023 19:45:29 +0000 (20:45 +0100)] 
gpt/DPS: add more aliases for python's machine

In mkosi we set the default architecture to platform.machine() which
is again slightly incompatible for a few architectures, so add more
aliases, so that repart works by default with these names.

2 years agopo: add a false positive to POTFILES.skip
Piotr Drąg [Sat, 27 May 2023 16:11:35 +0000 (18:11 +0200)] 
po: add a false positive to POTFILES.skip

Scripts used to detect files that should be in POTFILES.in, like
intltool-update -m used on https://l10n.gnome.org/module/systemd/,
falsely detect this file as containing translations. Avoid this
behavior by putting the file in POTFILES.skip.

2 years agotree-wide: Downgrade a few more noisy log messages to trace
Daan De Meyer [Sat, 27 May 2023 08:36:30 +0000 (10:36 +0200)] 
tree-wide: Downgrade a few more noisy log messages to trace

2 years agoboot/measure: replace TPM PolicyPCR session with calculation
Dan Streetman [Fri, 5 May 2023 23:48:14 +0000 (19:48 -0400)] 
boot/measure: replace TPM PolicyPCR session with calculation

Instead of using a trial policy with a TPM to calculate the measurement hash,
this uses a function to calculate the hash with no TPM needed.

2 years agoMerge pull request #27721 from yuwata/journalctl-cleanup
Yu Watanabe [Fri, 26 May 2023 22:59:22 +0000 (07:59 +0900)] 
Merge pull request #27721 from yuwata/journalctl-cleanup

journalctl: split get_boots() into three

2 years agoAdd DHCPServer information to JSON output.
Rene Hollander [Sun, 30 Apr 2023 11:31:28 +0000 (13:31 +0200)] 
Add DHCPServer information to JSON output.

Adds a new JSON object called DHCPServer for each interface that has a
DHCPServer configured. It has the following attributes:
- PoolSize and PoolOffset from the configuration
- List of offered leases
- List of static leases from the configuration

2 years agoRevert "test: add test case for systemd-update-utmp vs daemon-reexec"
Frantisek Sumsal [Fri, 26 May 2023 19:41:43 +0000 (21:41 +0200)] 
Revert "test: add test case for systemd-update-utmp vs daemon-reexec"

Temporarily revert the test case for #27167, as the additional
daemon-reexecs exacerbate #27287, making CIs fail quite often.
As the #27167 is also covered by TEST-01-BASIC itself, since we do
daemon-reexec there anyway, we shouldn't lose any coverage, but it
should make CIs more stable until #27287 is figured out.

Resolves (or more like works around): #27807

This reverts commit d689f70a2c18666bbf6500df7a53962a8f3e91a4.

2 years agoMerge pull request #27517 from ddstreet/tpm2_calculate_policy
Daan De Meyer [Fri, 26 May 2023 21:08:15 +0000 (23:08 +0200)] 
Merge pull request #27517 from ddstreet/tpm2_calculate_policy

Tpm2 calculate policy

2 years agojournalctl: split get_boots() into three 27721/head
Yu Watanabe [Fri, 26 May 2023 18:57:39 +0000 (03:57 +0900)] 
journalctl: split get_boots() into three

Previously, get_boots() used for three ways; finding boot entry by
boot ID, finding boot entry by offset, listing up all boot IDs.

Let's split it into three for each usecase.

No functional change, just refactoring.

2 years agologs-show: introduce add_match_boot_id() helper function
Yu Watanabe [Sun, 21 May 2023 14:06:28 +0000 (23:06 +0900)] 
logs-show: introduce add_match_boot_id() helper function

2 years agoMerge pull request #27787 from keszybz/firstboot-synchronous-restart
Mike Yuan [Fri, 26 May 2023 18:30:45 +0000 (02:30 +0800)] 
Merge pull request #27787 from keszybz/firstboot-synchronous-restart

firstboot: make restart of vconsole-setup synchronuous

2 years agoMerge pull request #27786 from YHNdnzj/format-timestamp-monotonic
Yu Watanabe [Fri, 26 May 2023 18:05:34 +0000 (03:05 +0900)] 
Merge pull request #27786 from YHNdnzj/format-timestamp-monotonic

time-util,format-table: add relative_monotonic variant for timestamp

2 years agoMerge pull request #27803 from mrc0mmand/even-more-nalloc-shenanigans
Yu Watanabe [Fri, 26 May 2023 17:58:32 +0000 (02:58 +0900)] 
Merge pull request #27803 from mrc0mmand/even-more-nalloc-shenanigans

A couple more fixes for potential OOM-related issues

2 years agogpt/DPS: alias amd64 to x86-64 and aarch64 to arm64
Luca Boccassi [Fri, 26 May 2023 14:44:42 +0000 (15:44 +0100)] 
gpt/DPS: alias amd64 to x86-64 and aarch64 to arm64

The DSP and our implementation mixes Debian terminology with CPU
terminology. It uses arm64 which is a Debian thing instead of
aarch64, but x86-64 which is a CPU thing instead of amd64.
Add some convenience and transparent aliasing, so that we don't
need to maintain architecture-specific and tool-specific translation
layers in mkosi among other places, while at the same time the DDIs
still look the same (ie: the partlabel does not change depending on
which alias is used, the canonical label is used on disk).

2 years agotest-gpt: verify that alias entries are identical to the primary ones
Lennart Poettering [Fri, 26 May 2023 14:55:29 +0000 (16:55 +0200)] 
test-gpt: verify that alias entries are identical to the primary ones

Given we allow aliases we better check for consistency of alias entries
and the primary one.

2 years agotpm2: add tpm2_calculate_sealing_policy() 27517/head
Dan Streetman [Thu, 15 Dec 2022 17:56:35 +0000 (12:56 -0500)] 
tpm2: add tpm2_calculate_sealing_policy()

This adds a function to fully calculate the authPolicy needed to seal a secret,
and updates tpm2_seal() to use the new function instead of a trial policy.

2 years agotpm2: use tpm2_policy_authorize()
Dan Streetman [Thu, 9 Feb 2023 15:04:58 +0000 (10:04 -0500)] 
tpm2: use tpm2_policy_authorize()

This updates the function to build the sealing policy to use the dedicated
function to perform PolicyAuthorize.

This is separate from the previous commit to make each commit easier to read.

2 years agotpm2: add tpm2_policy_authorize()
Dan Streetman [Fri, 9 Dec 2022 19:49:52 +0000 (14:49 -0500)] 
tpm2: add tpm2_policy_authorize()

This adds functions to get the digest for a PolicyAuthorize operation. For
building a policy hash, this provides a function to calculate the hash; and for
building a policy hash to satisfy the authPolicy for an existing object, this
provides a function to perform PolicyAuthorize with an existing session.

2 years agotpm2: add tpm2_policy_auth_value()
Dan Streetman [Fri, 9 Dec 2022 19:59:05 +0000 (14:59 -0500)] 
tpm2: add tpm2_policy_auth_value()

This adds functions to get the digest for a PolicyAuthValue operation. For
building a policy hash, this provides a function to calculate the hash; and for
building a policy hash to satisfy the authPolicy for an existing object, this
provides a function to perform PolicyAuthValue with an existing session.

2 years agotpm2: add tpm2_policy_pcr()
Dan Streetman [Thu, 8 Dec 2022 22:56:11 +0000 (17:56 -0500)] 
tpm2: add tpm2_policy_pcr()

This adds functions to get the digest for a PolicyPCR operation. For building
a policy hash, this provides a function to calculate the hash; and for building
a policy hash to satisfy the authPolicy for an existing object, this provides a
function to perform PolicyPCR with an existing session.

2 years agotpm2: rename pcr_values_size vars to n_pcr_values
Dan Streetman [Thu, 11 May 2023 19:33:31 +0000 (15:33 -0400)] 
tpm2: rename pcr_values_size vars to n_pcr_values

Using the n_ prefix is more appropriate/conventional than the _size suffix.

No functional change, this is cosmetic only.

2 years agotpm2: add tpm2_get_name()
Dan Streetman [Wed, 14 Dec 2022 15:46:13 +0000 (10:46 -0500)] 
tpm2: add tpm2_get_name()

This adds functions to get the "name" of a key. The key "name", as defined
by the TPM2 spec, includes its entire public area (with attribute fields),
not only its key fingerprint.

A function is added to calculate the name of a provided key public area,
as well as a function to get the name of a key which is present in the TPM.

2 years agotpm2: add tpm2_set_auth()
Dan Streetman [Tue, 6 Dec 2022 18:16:43 +0000 (13:16 -0500)] 
tpm2: add tpm2_set_auth()

This provides a function to perform the SetAuth TPM function, which provides
the authValue for a key.

2 years agotpm2: replace hash_pin() with tpm2_digest_*() functions
Dan Streetman [Wed, 14 Dec 2022 15:46:13 +0000 (10:46 -0500)] 
tpm2: replace hash_pin() with tpm2_digest_*() functions

The hash_pin() function is just a specific use case of the digest functions.

2 years agotpm2: add tpm2_digest_*() functions
Dan Streetman [Wed, 14 Dec 2022 15:46:13 +0000 (10:46 -0500)] 
tpm2: add tpm2_digest_*() functions

These functions allow extending (or initializing) a TPM2B_DIGEST with additional
data, using a specified hash operation. This is needed to perform hash
calculations instead of relying on the TPM to perform the calculations in
trial sessions.

2 years agoman: fix UKI filename suffix in 'tries' description
Vitaly Kuznetsov [Fri, 26 May 2023 14:57:37 +0000 (16:57 +0200)] 
man: fix UKI filename suffix in 'tries' description

Boot Loader Type #2 entries (UKIs in $BOOT/EFI/Linux/) have '.efi' suffix,
not '.conf'.

2 years agomount-util: Downgrade another noisy debug log to trace level
Daan De Meyer [Fri, 26 May 2023 14:14:46 +0000 (16:14 +0200)] 
mount-util: Downgrade another noisy debug log to trace level

2 years agonspawn: restore cross-architecture booting
Luca Boccassi [Fri, 26 May 2023 11:42:42 +0000 (12:42 +0100)] 
nspawn: restore cross-architecture booting

The check added by 4c27749b8c6b24ef7481ba183ae1fca3749afbf7 breaks
booting an arm64 image on x86 using qemu-bin-fmt, so remove it.
Without it, the image built with mkosi --architecture=aarch64
boots fine in nspawn.

2 years agoudev: introduce .PART_SUFFIX internal property
Yu Watanabe [Wed, 24 May 2023 04:05:56 +0000 (13:05 +0900)] 
udev: introduce .PART_SUFFIX internal property

To make unify rules for disk and partition.

2 years agoMerge pull request #27746 from yuwata/unit-bidirectional-dep
Zbigniew Jędrzejewski-Szmek [Fri, 26 May 2023 14:20:48 +0000 (16:20 +0200)] 
Merge pull request #27746 from yuwata/unit-bidirectional-dep

core/unit: make unit dependency always bidirectional

2 years agosd-network: avoid leaking DHCPLease 27803/head
Frantisek Sumsal [Fri, 26 May 2023 09:38:58 +0000 (11:38 +0200)] 
sd-network: avoid leaking DHCPLease

If we fail any allocation prior adding the lease to the server lease
hashmap.

==2103==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 128 byte(s) in 2 object(s) allocated from:
    #0 0x4a203e in __interceptor_calloc /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:77:3
    #1 0x4f6341 in calloc (/build/fuzz-dhcp-server+0x4f6341)
    #2 0x4ec818 in add_lease /work/build/../../src/systemd/src/libsystemd-network/fuzz-dhcp-server.c:26:9
    #3 0x4ec2bf in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/libsystemd-network/fuzz-dhcp-server.c:75:9
    #4 0x4f68a8 in NaloFuzzerTestOneInput (/build/fuzz-dhcp-server+0x4f68a8)
    #5 0x5158b3 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
    #6 0x51509a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
    #7 0x516769 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:757:19
    #8 0x517435 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:895:5
    #9 0x50679f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
    #10 0x507068 in LLVMFuzzerRunDriver /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:925:10
    #11 0x4f6b25 in main (/build/fuzz-dhcp-server+0x4f6b25)
    #12 0x7f16084e3082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)

DEDUP_TOKEN: __interceptor_calloc--calloc--add_lease
SUMMARY: AddressSanitizer: 128 byte(s) leaked in 2 allocation(s).

Found by Nallocufzz.

2 years agosd-journal: log about errors from ordered_hashmap_*()
Frantisek Sumsal [Thu, 25 May 2023 09:58:32 +0000 (11:58 +0200)] 
sd-journal: log about errors from ordered_hashmap_*()

Follow-up to 08a8fd6e8d.

2 years agojournal-remote: bump the refcount right after creating the writer object
Frantisek Sumsal [Thu, 25 May 2023 20:47:13 +0000 (22:47 +0200)] 
journal-remote: bump the refcount right after creating the writer object

Otherwise we might hit an assertion during cleanup if the
following mmap_cache_new() call fails:

Assertion 'p->n_ref > 0' failed at src/journal-remote/journal-remote-write.c:80, function writer_unref(). Aborting.

==2069==ERROR: AddressSanitizer: ABRT on unknown address 0x000000000815 (pc 0x7f39dcd0200b bp 0x7ffe2fe24db0 sp 0x7ffe2fe24b60 T0)
SCARINESS: 10 (signal)
    #0 0x7f39dcd0200b in raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
    #1 0x7f39dcce1858 in abort (/lib/x86_64-linux-gnu/libc.so.6+0x22858) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
    #2 0x7f39dd747e49 in log_assert_failed /work/build/../../src/systemd/src/basic/log.c:940:9
    #3 0x4e4431 in writer_unref /work/build/../../src/systemd/src/journal-remote/journal-remote-write.c:80:1
    #4 0x4e3fd5 in writer_unrefp /work/build/../../src/systemd/src/journal-remote/journal-remote-write.h:27:1
    #5 0x4e3fd5 in writer_new /work/build/../../src/systemd/src/journal-remote/journal-remote-write.c:56:1
    #6 0x4e04bc in journal_remote_get_writer /work/build/../../src/systemd/src/journal-remote/journal-remote.c:125:21
    #7 0x4e0e0b in get_source_for_fd /work/build/../../src/systemd/src/journal-remote/journal-remote.c:181:13
    #8 0x4e0e0b in journal_remote_add_source /work/build/../../src/systemd/src/journal-remote/journal-remote.c:233:13
    #9 0x4df99f in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/journal-remote/fuzz-journal-remote.c:54:9
    #10 0x4e8f48 in NaloFuzzerTestOneInput (/build/fuzz-journal-remote+0x4e8f48)
    #11 0x507f53 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
    #12 0x50773a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
    #13 0x508e09 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:757:19
    #14 0x509ad5 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:895:5
    #15 0x4f8e3f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
    #16 0x4f9708 in LLVMFuzzerRunDriver /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:925:10
    #17 0x4e91c5 in main (/build/fuzz-journal-remote+0x4e91c5)
    #18 0x7f39dcce3082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
    #19 0x420bcd in _start (/build/fuzz-journal-remote+0x420bcd)

DEDUP_TOKEN: raise--abort--log_assert_failed
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: ABRT (/lib/x86_64-linux-gnu/libc.so.6+0x4300b) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee) in raise

Found by Nallocufzz.

2 years agoMerge pull request #27554 from ElvishJerricco/tmpfiles-c-escapes
Zbigniew Jędrzejewski-Szmek [Fri, 26 May 2023 13:42:48 +0000 (15:42 +0200)] 
Merge pull request #27554 from ElvishJerricco/tmpfiles-c-escapes

tmpfiles: Allow C escapes

2 years agovarious: fix error message for bus_wait_for_jobs_new() 27787/head
Zbigniew Jędrzejewski-Szmek [Fri, 26 May 2023 13:09:03 +0000 (15:09 +0200)] 
various: fix error message for bus_wait_for_jobs_new()

As pointed out by Mike Yuan in review of grandparent commit,
bus_wait_for_jobs_new() can also fail for non-oom reasons.

2 years agounits: order systemd-firstboot after systemd-tmpfiles-setup
Zbigniew Jędrzejewski-Szmek [Thu, 25 May 2023 11:36:17 +0000 (13:36 +0200)] 
units: order systemd-firstboot after systemd-tmpfiles-setup

We may copy files from factory to /etc. The default mkosi config has
factory/etc/vconsole.conf. systemd-firstboot would race with tmpfiles-setup,
and sometimes ask for the keymap, and sometimes not.

I guess that if there are files in factory, we shouldn't ask the user for
the same configuration.

2 years agofirstboot: synchronously wait for systemd-vconsole-setup.service/restart job
Zbigniew Jędrzejewski-Szmek [Thu, 25 May 2023 10:26:37 +0000 (12:26 +0200)] 
firstboot: synchronously wait for systemd-vconsole-setup.service/restart job

Requested in https://github.com/systemd/systemd/pull/27755#pullrequestreview-1443489520.

I dropped the info message about the job being requested, because we get
fairly verbose logs from starting the unit, and the additional message isn't
useful.

In the unit, the ordering before systemd-vconsole-setup.service is dropped,
because now it needs to happen in parallel, while systemd-firstboot.service
is running. This means that we may potentially execute vconsole-setup twice,
but it's fairly quick, so this doesn't matter much.

2 years agofstab-generator: use correct swap name var
Frantisek Sumsal [Fri, 26 May 2023 12:05:40 +0000 (14:05 +0200)] 
fstab-generator: use correct swap name var

Follow-up to 9445623363.

2 years agoMerge pull request #27563 from yuwata/fstab-generator
Lennart Poettering [Fri, 26 May 2023 09:52:19 +0000 (02:52 -0700)] 
Merge pull request #27563 from yuwata/fstab-generator

fstab-generator: support defining mount units through kernel command line

2 years agocore: change 'basename' to 'path_extract_filename'
Jordan Rome [Thu, 25 May 2023 21:40:58 +0000 (14:40 -0700)] 
core: change 'basename' to 'path_extract_filename'

This is part of a cleanup effort in the TODO doc.

Tested locally: `meson compile -C build && meson test -C build`

2 years agocore/unit: update bidirectional dependency simultaneously 27746/head
Yu Watanabe [Tue, 23 May 2023 08:49:16 +0000 (17:49 +0900)] 
core/unit: update bidirectional dependency simultaneously

Previously, if unit_add_dependency_hashmap() failed, then a
one-directional unit dependency reference might be created, and
triggeres use-after-free. See issue #27742 for more details.

This makes unit dependency always bidirectional, and cleanly revert
partial update on failure.

Fixes #27742.

2 years agocore/unit: search shared namespace in transitive relation of JoinsNamespaceOf=
Yu Watanabe [Thu, 25 May 2023 09:08:37 +0000 (18:08 +0900)] 
core/unit: search shared namespace in transitive relation of JoinsNamespaceOf=

Previously, dependency chain of JoinsNamespaceOf= did not work, e.g.
- a.service has JoinsNamespaceOf=b.service
- b.service has JoinsNamespaceOf=c.service
if, first c.service, next a.service, finally b.service is started,
then a.service is not joined to the namespace of c.service. And, as
mentioned in the document, the namespace used by b.service is not
deterministic.

This makes when searching exsiting namespace to be joined, all units in
the transitive dependency of JoinsNamespaceOf= are checked.

2 years agologinctl: use FORMAT_TIMESTAMP_RELATIVE_MONOTONIC 27786/head
Mike Yuan [Thu, 25 May 2023 10:35:08 +0000 (18:35 +0800)] 
loginctl: use FORMAT_TIMESTAMP_RELATIVE_MONOTONIC

Follow-up for #27769

Addresses https://github.com/systemd/systemd/pull/27769#discussion_r1205215743

2 years agologinctl: realign bus_properties_map
Mike Yuan [Thu, 25 May 2023 10:25:15 +0000 (18:25 +0800)] 
loginctl: realign bus_properties_map

2 years agosystemctl: list-units: use TABLE_TIMESTAMP_RELATIVE_MONOTONIC
Mike Yuan [Thu, 25 May 2023 10:23:17 +0000 (18:23 +0800)] 
systemctl: list-units: use TABLE_TIMESTAMP_RELATIVE_MONOTONIC

2 years agotime-util,format-table: add relative_monotonic variant for timestamp
Mike Yuan [Thu, 25 May 2023 09:47:57 +0000 (17:47 +0800)] 
time-util,format-table: add relative_monotonic variant for timestamp

2 years agotmpfiles: Allow C escapes 27554/head
Will Fancher [Sat, 6 May 2023 20:11:58 +0000 (16:11 -0400)] 
tmpfiles: Allow C escapes

Fixes #26955

2 years agotmpfiles: Test C-style escape sequences
Will Fancher [Fri, 26 May 2023 04:02:35 +0000 (00:02 -0400)] 
tmpfiles: Test C-style escape sequences

2 years agotest: split the ASan wrapper into smaller blocks and tidy it up a bit
Frantisek Sumsal [Thu, 25 May 2023 13:31:48 +0000 (15:31 +0200)] 
test: split the ASan wrapper into smaller blocks and tidy it up a bit

No functional change (hopefully), just making it easier on the eyes.

2 years agocore/unit: make JoinsNamespaceOf= implies the inverse dependency
Yu Watanabe [Mon, 22 May 2023 21:36:44 +0000 (06:36 +0900)] 
core/unit: make JoinsNamespaceOf= implies the inverse dependency

Previously, even if a.service has JoinsNamespaceOf=b.service, the
inverse direction of reference was not introduced.
Hence, a.service is started earlier than b.service, the namespace will
not shared with b.service.
Also, even if a.service had the reference to b.service, b.service did not.
If b.service is freed earlier, then unit_clear_dependencies() does not clear
the reference from a to b, and will cause use-after-free on unit_free() for
a.service.

Let's make JoinsNamespaceOf=b.service in a.service implies the inverse
dependency, i.e. JoinsNamespaceOf=a.service for b.service. Then, we can safely
free b.service.

2 years agocore/unit: drop doubled empty line
Yu Watanabe [Mon, 22 May 2023 21:03:52 +0000 (06:03 +0900)] 
core/unit: drop doubled empty line

2 years agotest: add tests for JoinsNamespaceOf=
Yu Watanabe [Wed, 24 May 2023 21:48:16 +0000 (06:48 +0900)] 
test: add tests for JoinsNamespaceOf=

To illustrate the current behavior of the dependency.

2 years agounits: Shut down networkd and resolved on switch-root
Daan De Meyer [Thu, 25 May 2023 16:13:02 +0000 (18:13 +0200)] 
units: Shut down networkd and resolved on switch-root

Let's explicitly order these against initrd-switch-root.target, so
that they are properly shut down before we switch root. Otherwise,
there's a race condition where networkd might only shut down after
switching root and after we've already we've loaded the unit graph,
meaning it won't be restarted in the rootfs.

Fixes #27718

2 years agorules: add rule for accel devices
Stanislaw Gruszka [Thu, 25 May 2023 09:44:00 +0000 (11:44 +0200)] 
rules: add rule for accel devices

Accel (Compute Acceleration) are new devices for AI/ML computation:
https://docs.kernel.org/accel/introduction.html

They are part of DRM subsystem. Add them to 'render' group since
no other appropriate group in standard linux systems exist. This
can be changed when proper common user-space components will emerge,
and new group for acceleration devices access will be established.

Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
2 years agogpt-auto-generator: also honor systemd.swap=no
David Tardon [Thu, 25 May 2023 07:03:10 +0000 (09:03 +0200)] 
gpt-auto-generator: also honor systemd.swap=no

2 years agoman: add trailing =
David Tardon [Thu, 25 May 2023 06:44:21 +0000 (08:44 +0200)] 
man: add trailing =

2 years agomeson: Create credstore directories
Daan De Meyer [Wed, 24 May 2023 13:32:17 +0000 (15:32 +0200)] 
meson: Create credstore directories

Let's make the creds directories a bit more discoverable and make it
easier for users to use them. This also allows us to fix the
mode to 0700 for /etc instead of the usual 0755 which is what probably
would happen if users had to create this directory themselves.

2 years agoresolved-dns-rr: use automatic cleanup
David Tardon [Thu, 25 May 2023 08:30:06 +0000 (10:30 +0200)] 
resolved-dns-rr: use automatic cleanup

Follow-up for #27770.

2 years agoupdate TODO
Lennart Poettering [Thu, 25 May 2023 12:33:45 +0000 (14:33 +0200)] 
update TODO

2 years agoMerge pull request #27358 from bluca/pe_mule
Lennart Poettering [Thu, 25 May 2023 10:56:06 +0000 (03:56 -0700)] 
Merge pull request #27358 from bluca/pe_mule

stub: allow loading and verifying kernel command line addons

2 years agomount-util: Downgrade log message to trace
Daan De Meyer [Thu, 25 May 2023 07:48:24 +0000 (09:48 +0200)] 
mount-util: Downgrade log message to trace

This debug log message is extremely noisy so let's downgrade it to
trace.

2 years agomkosi: Bump default timeout to 180s
Daan De Meyer [Thu, 25 May 2023 08:00:59 +0000 (10:00 +0200)] 
mkosi: Bump default timeout to 180s

Hopefully fixes #27778 where waiting for the root device to appear
times out before systemd-repart has a chance to run and create it.

2 years agoMerge pull request #26959 from poettering/creds-mount-dep-fix
Lennart Poettering [Thu, 25 May 2023 09:06:47 +0000 (02:06 -0700)] 
Merge pull request #26959 from poettering/creds-mount-dep-fix

credential ramfs mount order fixes

2 years agoMerge pull request #27483 from yuwata/udev-id-path-usb-revision
Zbigniew Jędrzejewski-Szmek [Thu, 25 May 2023 08:24:45 +0000 (10:24 +0200)] 
Merge pull request #27483 from yuwata/udev-id-path-usb-revision

udev: include USB revision in ID_PATH

2 years agoMerge pull request #27770 from mrc0mmand/more-nallocfuzz-shenanigans
Yu Watanabe [Thu, 25 May 2023 08:15:37 +0000 (17:15 +0900)] 
Merge pull request #27770 from mrc0mmand/more-nallocfuzz-shenanigans

A couple of fixes for potential issues during OOM situations

2 years agoMerge pull request #27769 from YHNdnzj/loginctl-followup
Yu Watanabe [Wed, 24 May 2023 20:52:06 +0000 (05:52 +0900)] 
Merge pull request #27769 from YHNdnzj/loginctl-followup

loginctl: some follow-ups

2 years agoMerge pull request #27723 from YHNdnzj/service-restart-cleanup
Yu Watanabe [Wed, 24 May 2023 20:14:52 +0000 (05:14 +0900)] 
Merge pull request #27723 from YHNdnzj/service-restart-cleanup

core: get rid of unused Service.will_auto_restart logic

2 years agotree-wide: check memstream buffer after closing the handle 27770/head
Frantisek Sumsal [Wed, 24 May 2023 11:29:52 +0000 (13:29 +0200)] 
tree-wide: check memstream buffer after closing the handle

When closing the FILE handle attached to a memstream, it may attempt to
do a realloc() that may fail during OOM situations, in which case we are
left with the buffer pointer pointing to NULL and buffer size > 0. For
example:

```
    #include <errno.h>
    #include <stdio.h>
    #include <stdlib.h>

    void *realloc(void *ptr, size_t size) {
        return NULL;
    }

    int main(int argc, char *argv[])
    {
        FILE *f;
        char *buf;
        size_t sz = 0;

        f = open_memstream(&buf, &sz);
        if (!f)
            return -ENOMEM;

        fputs("Hello", f);

        fflush(f);
        printf("buf: 0x%lx, sz: %lu, errno: %d\n",
                    (unsigned long) buf, sz, errno);
        fclose(f);
        printf("buf: 0x%lx, sz: %lu, errno: %d\n",
                    (unsigned long) buf, sz, errno);

        return 0;
    }
```

```
$ gcc -o main main.c
$ ./main
buf: 0x74d4a0, sz: 5, errno: 0
buf: 0x0, sz: 5, errno: 0
```

This might do unexpected things if the underlying code expects a valid
pointer to the memstream buffer after closing the handle.

Found by Nallocfuzz.

2 years agosystem-update-generator: drop pointless goto
David Tardon [Tue, 16 May 2023 05:39:32 +0000 (07:39 +0200)] 
system-update-generator: drop pointless goto

2 years agoMerge pull request #27173 from yuwata/update-utmp
Yu Watanabe [Wed, 24 May 2023 19:00:58 +0000 (04:00 +0900)] 
Merge pull request #27173 from yuwata/update-utmp

update-utmp: do not fail when PID1 is reexecuting

2 years agoMerge pull request #27773 from dtardon/timestamp-cleanup
Yu Watanabe [Wed, 24 May 2023 18:27:15 +0000 (03:27 +0900)] 
Merge pull request #27773 from dtardon/timestamp-cleanup

Use *timestamp_is_set() at more places