]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
2 years agotpm2: sort tpm2 symbol list 27628/head
Dan Streetman [Thu, 16 Feb 2023 23:10:55 +0000 (18:10 -0500)] 
tpm2: sort tpm2 symbol list

Only cosmetic, no functional change.

2 years agotpm2: remove all extern tpm2-tss symbols
Dan Streetman [Fri, 5 May 2023 23:49:49 +0000 (19:49 -0400)] 
tpm2: remove all extern tpm2-tss symbols

These library syms should be restricted to use only in tpm2-util.c,
and all other code should use simpler functions exported in tpm2-util.h.

Also move the Esys_Freep() cleanup function into tpm-util.c, and make
tpm2-tss symbols static.

2 years agotpm: remove external calls to dlopen_tpm2()
Dan Streetman [Fri, 5 May 2023 23:53:32 +0000 (19:53 -0400)] 
tpm: remove external calls to dlopen_tpm2()

The calls outside tpm2-util.c are redundant, as tpm2_context_new()
is always called immediately after, which then calls dlopen_tpm2().

2 years agoMerge pull request #27766 from rphibel/cleanup-cgroups-before-cleaning-units
Daan De Meyer [Wed, 31 May 2023 12:48:42 +0000 (14:48 +0200)] 
Merge pull request #27766 from rphibel/cleanup-cgroups-before-cleaning-units

Don't GC unit if it is in cgroup_empty_queue

2 years agoMerge pull request #26969 from DaanDeMeyer/xopenat-label
Daan De Meyer [Wed, 31 May 2023 12:35:50 +0000 (14:35 +0200)] 
Merge pull request #26969 from DaanDeMeyer/xopenat-label

fs-util: Add labelling support to xopenat()

2 years agoMerge pull request #27860 from poettering/loopback-no-prefix-route
Lennart Poettering [Wed, 31 May 2023 12:03:04 +0000 (14:03 +0200)] 
Merge pull request #27860 from poettering/loopback-no-prefix-route

loopback-setup: only create a single loopback route when configuring 'lo'

2 years agofs-util: Add XOpenFlags with XO_LABEL flag to have xopenat() MAC label files/dirs 26969/head
Daan De Meyer [Sun, 26 Mar 2023 17:48:57 +0000 (19:48 +0200)] 
fs-util: Add XOpenFlags with XO_LABEL flag to have xopenat() MAC label files/dirs

2 years agolabel: Introduce LabelOps to do pre/post labelling operations
Daan De Meyer [Sun, 26 Mar 2023 16:20:41 +0000 (18:20 +0200)] 
label: Introduce LabelOps to do pre/post labelling operations

By default, label_ops is initialized with a NULL pointer which translates
to noop labelling operations. In mac_selinux_init() and the new mac_smack_init(),
we initialize label_ops with a MAC specific LabelOps pointer.

We also introduce mac_init() to initialize any configured MACs and replace all
usages of mac_selinux_init() with mac_init().

2 years agoMerge pull request #27848 from keszybz/man-page-fixes
Luca Boccassi [Wed, 31 May 2023 10:13:51 +0000 (11:13 +0100)] 
Merge pull request #27848 from keszybz/man-page-fixes

Man page fixes

2 years agoMerge pull request #27858 from mrc0mmand/followups
Luca Boccassi [Wed, 31 May 2023 10:09:53 +0000 (11:09 +0100)] 
Merge pull request #27858 from mrc0mmand/followups

Use structured initialization in two more places

2 years agoMerge pull request #27853 from keszybz/various-bits-and-pieces-included-to-reuse...
Luca Boccassi [Wed, 31 May 2023 10:08:36 +0000 (11:08 +0100)] 
Merge pull request #27853 from keszybz/various-bits-and-pieces-included-to-reuse-the-ci-run

Various bits and pieces included to reuse the ci run

2 years agoMerge pull request #27840 from mrc0mmand/gcc-13
Luca Boccassi [Wed, 31 May 2023 10:07:22 +0000 (11:07 +0100)] 
Merge pull request #27840 from mrc0mmand/gcc-13

ci: add gcc-13, drop gcc-12

2 years agoMerge pull request #27519 from yuwata/journalctl-fixes
Luca Boccassi [Wed, 31 May 2023 10:05:54 +0000 (11:05 +0100)] 
Merge pull request #27519 from yuwata/journalctl-fixes

journalctl: several fixes and cleanups for --follow

2 years agoMerge pull request #27835 from keszybz/test-58-repart-modernization
Luca Boccassi [Wed, 31 May 2023 10:00:18 +0000 (11:00 +0100)] 
Merge pull request #27835 from keszybz/test-58-repart-modernization

Cleanup/simplifications for TEST-58-repart

2 years agotest-fstab-generator: fix test on systemd with systemd-boot
Zbigniew Jędrzejewski-Szmek [Tue, 30 May 2023 20:53:43 +0000 (22:53 +0200)] 
test-fstab-generator: fix test on systemd with systemd-boot

(… or other boot loaders implementing the Boot Loader Interface.)

Fixes #27857.

2 years agotest-loopback: run test in network + user namespace 27860/head
Lennart Poettering [Wed, 31 May 2023 07:41:26 +0000 (09:41 +0200)] 
test-loopback: run test in network + user namespace

This way it can actually do useful testing even when unprivileged.

2 years agoloopback-setup: clean up logging
Lennart Poettering [Wed, 31 May 2023 07:57:33 +0000 (09:57 +0200)] 
loopback-setup: clean up logging

All users of loopback_setup() ignore the return values (with the notable
exception of the test cases). Hence let's adjust the log messaging to
always log at LOG_WARNING level at most, and suffix messages with ",
ignoring", to make clear these failures are ignored.

2 years agoloopback-setup: set IFA_F_NOPREFIXROUTE when configuring 'lo' ipv6 address
Lennart Poettering [Wed, 31 May 2023 07:42:45 +0000 (09:42 +0200)] 
loopback-setup: set IFA_F_NOPREFIXROUTE when configuring 'lo' ipv6 address

Otherwise the kernel will set up two routes to ::1, one in the "main",
and one in the "local" routing table.

Fixes: #25819
2 years agotmpfiles: use same credstore perms everywhere
Lennart Poettering [Tue, 30 May 2023 13:13:38 +0000 (15:13 +0200)] 
tmpfiles: use same credstore perms everywhere

In b6033b706028a64e9affb79050ced1ad9a4f5b43 support was added to create
{/etc|/run}/credstore{|.encrypted} via tmpfiles.d with perms 0000. These
perms are so restrictive that not even root can access them unless it
has CAP_DAC_OVERRIDE capability. This is creates the dirs at boot time

In 24039e1207c169b18adf5234ad300ea3ba1b671e support was added to create
/etc/credstore with perm 0700 from meson.build at build time.

This patch makes unifies the two parts:

1. creates both /etc/credstore *and* /etc/credstore.encrypted in both
   places (the build system still won't create them in /run/, since
   that's pointless since not shipped, and the runtime won't create the
   dirs below /usr/lib/, since that's not generically writable anyway).

2. Both at runtime and at build time we'll create the dirs with mode
   0700. This is easier for packaging tools to handle since they
   generally react pretty negatively on dirs they can't enumerate.

2 years agosd-network: use structured initialization 27858/head
Frantisek Sumsal [Tue, 30 May 2023 19:29:54 +0000 (21:29 +0200)] 
sd-network: use structured initialization

And squash one unnecessary assignment.

2 years agojournal-remote: use structured initialization
Frantisek Sumsal [Tue, 30 May 2023 19:18:08 +0000 (21:18 +0200)] 
journal-remote: use structured initialization

2 years agocore,shared: add a couple of asserts 27840/head
Frantisek Sumsal [Tue, 30 May 2023 10:40:19 +0000 (12:40 +0200)] 
core,shared: add a couple of asserts

To appease the LTO overlords:

In file included from ../../../../src/basic/macro.h:446,
                 from ../../../../src/shared/blockdev-util.h:8,
                 from ../../../../src/shared/creds-util.c:11:
../../../../src/shared/creds-util.c: In function 'get_credential_host_secret':
../../../../src/shared/creds-util.c:379:52: error: '%s' directive argument is null [-Werror=format-overflow=]
  379 |                                 log_debug_errno(r, "Credential secret %s/%s appeared while we were creating it, rereading.",
      |                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../src/basic/log.h:214:86: note: in definition of macro 'log_full_errno_zerook'
  214 |                         ? log_internal(_level, _e, PROJECT_FILE, __LINE__, __func__, __VA_ARGS__) \
      |                                                                                      ^~~~~~~~~~~
../../../../src/basic/log.h:250:41: note: in expansion of macro 'log_full_errno'
  250 | #define log_debug_errno(error, ...)     log_full_errno(LOG_DEBUG,   error, __VA_ARGS__)
      |                                         ^~~~~~~~~~~~~~
../../../../src/shared/creds-util.c:379:33: note: in expansion of macro 'log_debug_errno'
  379 |                                 log_debug_errno(r, "Credential secret %s/%s appeared while we were creating it, rereading.",
      |                                 ^~~~~~~~~~~~~~~
../../../../src/shared/creds-util.c:379:74: note: format string is defined here
  379 |                                 log_debug_errno(r, "Credential secret %s/%s appeared while we were creating it, rereading.",
      |                                                                          ^~
cc1: some warnings being treated as errors

../../../../src/core/transaction.c: In function 'transaction_verify_order_one':
../../../../src/core/transaction.c:338:38: error: '%s' directive argument is null [-Werror=format-overflow=]
  338 |                 sprintf(ans + size, "%s%s", unit_log_field, *unit_id);
      |                                      ^~
cc1: some warnings being treated as errors

2 years agoci: add gcc-13, drop gcc-12
Frantisek Sumsal [Tue, 30 May 2023 07:07:39 +0000 (09:07 +0200)] 
ci: add gcc-13, drop gcc-12

2 years agotest-dlopen: allow loading of multiple libraries 27853/head
Zbigniew Jędrzejewski-Szmek [Tue, 18 Apr 2023 09:37:52 +0000 (11:37 +0200)] 
test-dlopen: allow loading of multiple libraries

This is useful for debugging, for example if we want to test multiple different
dlls being loaded in the same namespace.

2 years agoshared/loop-util: add comment
Zbigniew Jędrzejewski-Szmek [Tue, 30 May 2023 13:56:45 +0000 (15:56 +0200)] 
shared/loop-util: add comment

Requested in https://github.com/systemd/systemd/commit/afbe20b7d4ed4c3aebbd1b3de00b9b7385dd0ae8#r115653459.

2 years agotests: drop unnecessary redirection of stderr
Zbigniew Jędrzejewski-Szmek [Mon, 29 May 2023 10:28:34 +0000 (12:28 +0200)] 
tests: drop unnecessary redirection of stderr

command -v doesn't print anything to stderr, let's use the canonical
form with just >/dev/null.

2 years agodissect: use pager for --help
Zbigniew Jędrzejewski-Szmek [Tue, 23 May 2023 19:26:57 +0000 (21:26 +0200)] 
dissect: use pager for --help

This output is already too long to fit on an normal terminal, and the
interesting parts are towards the top.

2 years agobasic/user-util: attach pointer symbol to return type, not function
Zbigniew Jędrzejewski-Szmek [Tue, 23 May 2023 11:46:59 +0000 (13:46 +0200)] 
basic/user-util: attach pointer symbol to return type, not function

Surrounding code was predominantly using this style already, let's make things
consistent.

2 years agolabel: Rename to label-util.h
Daan De Meyer [Sun, 26 Mar 2023 16:01:07 +0000 (18:01 +0200)] 
label: Rename to label-util.h

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 agoman: extend description of .target a bit 27848/head
Zbigniew Jędrzejewski-Szmek [Tue, 30 May 2023 11:35:18 +0000 (13:35 +0200)] 
man: extend description of .target a bit

The man page is reference documentation, so we shouldn't write too much
duplicate things here, but we can make the text a bit more approachable. This
rewords and extends the documentation as requested and suggested in #24231 and
adds some hints for the user.

Closes #24231.

2 years agoman/systemd-gpt-auto-generator: mention that swap may be on luks too
Zbigniew Jędrzejewski-Szmek [Tue, 30 May 2023 09:28:48 +0000 (11:28 +0200)] 
man/systemd-gpt-auto-generator: mention that swap may be on luks too

Fixes #25972.

2 years agoman/systemctl: say that kexec loads the kernel, mention --force
Zbigniew Jędrzejewski-Szmek [Tue, 30 May 2023 09:12:26 +0000 (11:12 +0200)] 
man/systemctl: say that kexec loads the kernel, mention --force

Fixes #24588.
Fixes #15029.

2 years agoman/repart: document partition creation order
Zbigniew Jędrzejewski-Szmek [Tue, 30 May 2023 08:43:29 +0000 (10:43 +0200)] 
man/repart: document partition creation order

Fixes #22974.

The text is reworded a bit too. In particular, it's "partitions" that are not
reordered, not "partition table slots". If we were reordering things, we'd move
the partitions between slots. The slots themselves are not moveable.

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 agoFix failing test 27766/head
Richard Phibel [Mon, 29 May 2023 22:45:09 +0000 (00:45 +0200)] 
Fix failing test

In test-execute, only the unit was started, not the slice. Because of
that the slice cgroup was pruned even if it was still needed. From what
I can tell, this is because, in the test, we don't have all the
mechanics that starts the slice for a service. To fix the issue the
slice is started manually.

2 years agomeson: use -Werror=strict-flex-arrays
Frantisek Sumsal [Tue, 30 May 2023 08:30:15 +0000 (10:30 +0200)] 
meson: use -Werror=strict-flex-arrays

2 years agoboot: make Event a standard-conforming flexible array
Frantisek Sumsal [Tue, 30 May 2023 08:21:26 +0000 (10:21 +0200)] 
boot: make Event a standard-conforming flexible array

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 agoTEST-58: remove whitespace between redirection operator and its argument 27835/head
Zbigniew Jędrzejewski-Szmek [Mon, 29 May 2023 18:54:44 +0000 (20:54 +0200)] 
TEST-58: remove whitespace between redirection operator and its argument

2 years agoTEST-58: add echo calls to print what is happening
Zbigniew Jędrzejewski-Szmek [Mon, 29 May 2023 18:54:20 +0000 (20:54 +0200)] 
TEST-58: add echo calls to print what is happening

This makes it easier to identify the relevant test in the logs when
something fails.

2 years agoTEST-58: create config files as root
Zbigniew Jędrzejewski-Szmek [Mon, 29 May 2023 18:52:33 +0000 (20:52 +0200)] 
TEST-58: create config files as root

There is really no reason to go out of our way to create the config files as
the unprivileged user. And in the logs, the runas calls are quite verbose,
distracting from the interesting stuff. Also add .defs/.imgs/.root to the
temporary paths to make them easier to distinguish in the logs.

2 years agotest/README: fix advice for testsuite debugging
Zbigniew Jędrzejewski-Szmek [Mon, 29 May 2023 21:18:55 +0000 (23:18 +0200)] 
test/README: fix advice for testsuite debugging

KERNEL_APPEND="systemd.unit=multi-user.target" is not very useful, because the
machine will still shut down as soon as the tests succeeds or fails. But
INTERACTIVE_DEBUG=1 works great, so let's simplify the instructions and
recommend that.

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 agocore: Handle cgroup pruning in on_cgroup_empty_event
Richard Phibel [Thu, 25 May 2023 17:49:11 +0000 (19:49 +0200)] 
core: Handle cgroup pruning in on_cgroup_empty_event

This change removes the pruning of cgroups for FAILED/INACTIVE units
from per-unit-type handlers and moves it in on_cgroup_empty_event.

2 years agocore: Don't GC unit if it is in cgroup_empty_queue
Richard Phibel [Tue, 23 May 2023 14:09:40 +0000 (16:09 +0200)] 
core: Don't GC unit if it is in cgroup_empty_queue

The gc_unit_queue is dispatched before the cgroup_empty_queue.  Because
of this, when we enter in on_cgroup_empty_event, the unit in
cgroup_empty_queue may already have been freed and we don't clean up the
corresponding cgroup. With this change, we prevent the unit from being
garbage collected if it is in the cgroup_empty_queue.

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 agojournalctl: fix --follow with non-matching filter 27519/head
Yu Watanabe [Sun, 28 May 2023 05:28:32 +0000 (14:28 +0900)] 
journalctl: fix --follow with non-matching filter

When there is no matching entry stored in journal, then initial call of
`sd_journal_previous()` following `sd_journal_seek_tail()` returns
zero, and does not move the read pointer.
In the main loop, on every journal event, we call `sd_journal_next()`,
even though the current location is tail, and it takes no effect.

In such a case, we need to call `sd_journal_previous()` instead of
`sd_journal_next()`.

2 years agosd-journal: introduce sd_journal_step_one()
Yu Watanabe [Sun, 28 May 2023 05:20:27 +0000 (14:20 +0900)] 
sd-journal: introduce sd_journal_step_one()

After the commit 7a4ee861615101ddd2f95056cf30e69e41da86ce,
sd_journal_next() following sd_journal_seek_tail() takes no-op,
and we need to call sd_journal_previous(). This may be useful in
some cases, e.g. to fix the issue explained in the previous commit.

2 years agotest: add testcase for 'journalctl --follow --cursor-file='
Yu Watanabe [Fri, 26 May 2023 21:12:09 +0000 (06:12 +0900)] 
test: add testcase for 'journalctl --follow --cursor-file='

Also, add a FIXME comment to illustrate the issue uncovered after by
7a4ee861615101ddd2f95056cf30e69e41da86ce.

2 years agojournalctl: also update cursor with --follow
Yu Watanabe [Thu, 4 May 2023 00:36:27 +0000 (09:36 +0900)] 
journalctl: also update cursor with --follow

Fixes #26746.

2 years agojournalctl: replace ppoll() loop with sd_event_loop()
Yu Watanabe [Wed, 3 May 2023 23:38:53 +0000 (08:38 +0900)] 
journalctl: replace ppoll() loop with sd_event_loop()

No functional change, just refactoring.

2 years agojournalctl: split out show()
Yu Watanabe [Wed, 3 May 2023 23:13:59 +0000 (08:13 +0900)] 
journalctl: split out show()

No functional changes, just refactoring.

2 years agojournalctl: split out update_cursor()
Yu Watanabe [Thu, 4 May 2023 00:29:25 +0000 (09:29 +0900)] 
journalctl: split out update_cursor()

No functional change, just refactoring.

2 years agojournalctl: split out action_list_fields()
Yu Watanabe [Wed, 3 May 2023 21:51:40 +0000 (06:51 +0900)] 
journalctl: split out action_list_fields()

No functional change, just refactoring.

2 years agojournalctl: fix --no-tail handling
Yu Watanabe [Thu, 4 May 2023 01:09:37 +0000 (10:09 +0900)] 
journalctl: fix --no-tail handling

Fixes a bug introduced by 62f21ec91ad8e7e24079962f4df066b0094fe68d.

2 years agojournalctl: use correct variable to check if --since is specified
Yu Watanabe [Thu, 4 May 2023 00:42:42 +0000 (09:42 +0900)] 
journalctl: use correct variable to check if --since is specified

2 years agojournalctl: always initialize global variables
Yu Watanabe [Thu, 4 May 2023 00:39:50 +0000 (09:39 +0900)] 
journalctl: always initialize global variables

That's not necessary, as they are initialized with zero, but for safety
and readability.

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.