]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 years agojournal: Add --convert= command to journalctl 22998/head
Daan De Meyer [Thu, 29 Sep 2022 10:07:54 +0000 (12:07 +0200)] 
journal: Add --convert= command to journalctl

--convert writes the journal files read by journalctl to the given
location. The location should be specified as a full journal file
path (e.g. /a/b/c/converted.journal). The directory specifies where
the converted journal files will be stored. The filename specifies
the naming convention the converted journal files will follow.

3 years agojournal: Store offsets to tail entry array objects in chain
Daan De Meyer [Fri, 21 Jan 2022 18:29:41 +0000 (18:29 +0000)] 
journal: Store offsets to tail entry array objects in chain

Previously, we'd iterate an entry array from start to end every time
we added an entry offset to it. To speed up this operation, we cache
the last entry array in the chain and how many items it contains.
This allows the addition of an entry to the chain to be done in
constant time instead of linear time as we don't have to iterate
the entire chain anymore every time we add an entry.

3 years agojournal: Introduce journal_file_data_payload()
Daan De Meyer [Thu, 29 Sep 2022 10:09:09 +0000 (12:09 +0200)] 
journal: Introduce journal_file_data_payload()

journal_file_data_payload() retrieves the payload of a Data object,
optionally decompressing it and checking to see if matches a given
field. This function replaces all the decompression code in the sd-journal
codebase with a single function.

This commit should not introduce any changes in sd-journal behavior.

3 years agojournal: Use 32-bit entry item object offsets in compact mode
Daan De Meyer [Tue, 2 Nov 2021 20:50:39 +0000 (20:50 +0000)] 
journal: Use 32-bit entry item object offsets in compact mode

To do this, we move EntryItem out of journal-def.h and turn it into
a host only struct in native endian mode so we can still use it to
ship the necessary info around.

Aside from that, the changes are pretty simple, we introduce some
extra functions to access the right field depending on the mode and
convert all the other code to use those functions instead of
accessing the raw fields.

We also drop the unused entry item hash field in compact mode. We
already stopped doing anything with this field a while ago, now we
actually drop it from the format in compact mode.

3 years agojournal: Use 32-bit entry array offsets in compact mode
Daan De Meyer [Sat, 23 Oct 2021 21:36:47 +0000 (22:36 +0100)] 
journal: Use 32-bit entry array offsets in compact mode

Before:

OBJECT TYPE      ENTRIES SIZE
Unused           0       0B
Data             3610336 595.7M
Field            5310    285.2K
Entry            3498326 1.2G
Data Hash Table  29  103.1M
Field Hash Table 29      151.3K
Entry Array      605991  1011.6M
Tag              0  0B
Total            7720021 2.9G

After:

OBJECT TYPE      ENTRIES SIZE
Unused           0  0B
Data             3562667 591.0M
Field            3971    213.6K
Entry            3498566 1.2G
Data Hash Table  20  71.1M
Field Hash Table 20  104.3K
Entry Array  582647  505.0M
Tag              0  0B
Total            7647891 2.4G

3 years agojournal: Don't allocate objects above UINT32_MAX in compact mode
Daan De Meyer [Wed, 3 Nov 2021 14:37:55 +0000 (14:37 +0000)] 
journal: Don't allocate objects above UINT32_MAX in compact mode

To allow storing offsets as 32-bit, we should never allocate objects
outside of the 32-bit range.

3 years agojournal: Run unit tests with and without compact mode enabled
Daan De Meyer [Fri, 21 Jan 2022 15:19:26 +0000 (15:19 +0000)] 
journal: Run unit tests with and without compact mode enabled

3 years agojournal: Enable compact mode
Daan De Meyer [Sat, 23 Oct 2021 21:43:00 +0000 (22:43 +0100)] 
journal: Enable compact mode

We also add an environment variable $SYSTEMD_JOURNAL_COMPACT that
can be used to disable compact mode if needed (similar to
$SYSTEMD_JOURNAL_KEYED_HASH).

3 years agojournal: Add compact mode
Daan De Meyer [Sat, 23 Oct 2021 21:24:56 +0000 (22:24 +0100)] 
journal: Add compact mode

This adds a new flag in preparation for incompatible journal changes
which will be gated behind this flag. The max file size of journal
files in compact mode is limited to 4 GiB.

3 years agoMerge pull request #24511 from martinetd/bpf1
Zbigniew Jędrzejewski-Szmek [Thu, 6 Oct 2022 17:01:33 +0000 (19:01 +0200)] 
Merge pull request #24511 from martinetd/bpf1

libbpf: Add libbpf 1.0.0 compat

3 years agorepart: always honour `--discard=no`
Arnaud Ferraris [Tue, 4 Oct 2022 16:52:33 +0000 (18:52 +0200)] 
repart: always honour `--discard=no`

Currently, even if `--discard=no` is passed to `systemd-repart`, the
`context_discard_gap_after()` function still runs normally, discarding
e.g. all blocks between the GPT and the start of the first partition.

This can lead to issues on some embedded devices, where this space
holds the bootloader and shouldn't be modified (creating a protective
partition there is not always possible due to the specifics of the boot
process of some ARM-based SoC's).

This commit ensures passing `--discard=no` would be enough to ensure
the bootloader isn't wiped in such cases.

Signed-off-by: Arnaud Ferraris <arnaud.ferraris@gmail.com>
3 years agomeson: Require TPM2 for measuring utilities
Michal Koutný [Thu, 6 Oct 2022 09:59:58 +0000 (11:59 +0200)] 
meson: Require TPM2 for measuring utilities

I happened to run build with openssl but no tpm2 and ran into issues
like:

        [313/1382] Compiling C object systemd-measure.p/src_boot_measure.c.o
        FAILED: systemd-measure.p/src_boot_measure.c.o
        cc -Isystemd-measure.p -I. -I.. -Isrc/basic -I../src/basic -Isrc/fundamental -I../src/fundamental -Isrc/systemd -I../src/systemd -I../src/libsystemd/sd-bus -I../src/libsystemd/sd-device -I../src/libsystemd/sd-event -I../src/libsystemd/sd-hwdb -I../src/libsystemd/sd-id128 -I../src/libsystemd/sd-journal -I../src/libsystemd/sd-netlink -I../src/libsystemd/sd-network -I../src/libsystemd/sd-resolve -Isrc/shared -I../src/shared -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O0 -g -Wno-missing-field-initializers -Wno-unused-parameter -Wdate-time -Wendif-labels -Werror=format=2 -Werror=format-signedness -Werror=implicit-function-declaration -Werror=incompatible-pointer-types -Werror=int-conversion -Werror=overflow -Werror=override-init -Werror=return-type -Werror=shift-count-overflow -Werror=shift-overflow=2 -Werror=undef -Wfloat-equal -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wsuggest-attribute=noreturn -Wunused-function -Wwrite-strings -Wno-unused-result -Werror=missing-declarations -Werror=missing-prototypes -fdiagnostics-show-option -fno-common -fno-strict-aliasing -fstack-protector -fstack-protector-strong -fvisibility=hidden --param=ssp-buffer-size=4 -fno-omit-frame-pointer -Werror=shadow -include config.h -DOPENSSL_LOAD_CONF -MD -MQ systemd-measure.p/src_boot_measure.c.o -MF systemd-measure.p/src_boot_measure.c.o.d -o systemd-measure.p/src_boot_measure.c.o -c ../src/boot/measure.c
        ../src/boot/measure.c: In function ‘verb_sign’:
        ../src/boot/measure.c:710:48: error: variable ‘c’ has initializer but incomplete type
          710 |         _cleanup_(tpm2_context_destroy) struct tpm2_context c = {};

        [308/1382] Compiling C object systemd-pcrphase.p/src_boot_pcrphase.c.o
        FAILED: systemd-pcrphase.p/src_boot_pcrphase.c.o
        cc -Isystemd-pcrphase.p -I. -I.. -Isrc/basic -I../src/basic -Isrc/fundamental -I../src/fundamental -Isrc/systemd -I../src/systemd -I../src/libsystemd/sd-bus -I../src/libsystemd/sd-device -I../src/libsystemd/sd-event -I../src/libsystemd/sd-hwdb -I../src/libsystemd/sd-id128 -I../src/libsystemd/sd-journal -I../src/libsystemd/sd-netlink -I../src/libsystemd/sd-network -I../src/libsystemd/sd-resolve -Isrc/shared -I../src/shared -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O0 -g -Wno-missing-field-initializers -Wno-unused-parameter -Wdate-time -Wendif-labels -Werror=format=2 -Werror=format-signedness -Werror=implicit-function-declaration -Werror=incompatible-pointer-types -Werror=int-conversion -Werror=overflow -Werror=override-init -Werror=return-type -Werror=shift-count-overflow -Werror=shift-overflow=2 -Werror=undef -Wfloat-equal -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wsuggest-attribute=noreturn -Wunused-function -Wwrite-strings -Wno-unused-result -Werror=missing-declarations -Werror=missing-prototypes -fdiagnostics-show-option -fno-common -fno-strict-aliasing -fstack-protector -fstack-protector-strong -fvisibility=hidden --param=ssp-buffer-size=4 -fno-omit-frame-pointer -Werror=shadow -include config.h -DOPENSSL_LOAD_CONF -MD -MQ systemd-pcrphase.p/src_boot_pcrphase.c.o -MF systemd-pcrphase.p/src_boot_pcrphase.c.o.d -o systemd-pcrphase.p/src_boot_pcrphase.c.o -c ../src/boot/pcrphase.c
        ../src/boot/pcrphase.c: In function ‘determine_banks’:
        ../src/boot/pcrphase.c:117:24: error: unknown type name ‘TPMI_ALG_HASH’
          117 |         _cleanup_free_ TPMI_ALG_HASH *algs = NULL;

Guarding the utilites with HAVE_TPM2 fixes the issue for me.

This complements #24811.

3 years agolibbpf: add compat helpers for libbpf down to 0.1.0 24511/head
Dominique Martinet [Fri, 30 Sep 2022 10:25:18 +0000 (19:25 +0900)] 
libbpf: add compat helpers for libbpf down to 0.1.0

- new symbols are available from libbpf 0.6.0 so could be used with
libbpf.so.0, but we're sure the old symbols will be there and this
simplifies code
- detection at runtime should always work, regardless of whether systemd
has been compiled with older or newer libbpf and runs with older or newer
libbpf

3 years agoFix key toggle touchpad and programmable buttom for Positivo N14
drosdeck [Wed, 5 Oct 2022 19:48:32 +0000 (15:48 -0400)] 
Fix key toggle touchpad and programmable buttom for Positivo N14

3 years agoata_id: Fixed getting Response Code from SCSI Sense Data (#24921)
Aleksey Vasenev [Wed, 5 Oct 2022 19:33:53 +0000 (22:33 +0300)] 
ata_id: Fixed getting Response Code from SCSI Sense Data (#24921)

The Response Code is contained in the first byte of the SCSI Sense Data.
Bit number 7 is reserved or has a different meaning for some Response Codes
and is set to 1 for some drives.

3 years agoTry to load libbpf.so.1 as well
Daan De Meyer [Fri, 9 Sep 2022 08:38:03 +0000 (10:38 +0200)] 
Try to load libbpf.so.1 as well

libbpf had a soname bump. Our usage of libbpf is compatible with
both libbpf.so.0 and libbpf.so.1, so let's try to load from both.

3 years agolibbpf: Remove use of deprecated APIs
Daan De Meyer [Wed, 31 Aug 2022 09:59:52 +0000 (11:59 +0200)] 
libbpf: Remove use of deprecated APIs

3 years agoBump libbpf version to 0.7
Daan De Meyer [Fri, 9 Sep 2022 08:27:57 +0000 (10:27 +0200)] 
Bump libbpf version to 0.7

We already depend on the skeleton APIs introduced in libbpf 0.7 so
let's bump our minimum version to reflect that.

We don't enforce bpf compilation on mkosi anymore since not all
distros have sufficiently up-to-date libbpf available.

3 years agotest: configure ldconfig's cache in the minimal verity images
Frantisek Sumsal [Wed, 5 Oct 2022 13:26:16 +0000 (15:26 +0200)] 
test: configure ldconfig's cache in the minimal verity images

The glibc stuff on ppc64le C8S is a little bit wild, as there are two
versions:

```
$ ldconfig -p | grep libc.so
        libc.so.6 (libc6,64bit, hwcap: "power9", OS ABI: Linux 3.10.0) => /lib64/glibc-hwcaps/power9/libc-2.28.so
        libc.so.6 (libc6,64bit, OS ABI: Linux 3.10.0) => /lib64/libc.so.6
```

and with `/etc/ld.so.cache` present all binaries use the first one:

```
$ ldd /bin/cat
        linux-vdso64.so.1 (0x00007fffa8070000)
        libc.so.6 => /lib64/glibc-hwcaps/power9/libc-2.28.so (0x00007fffa7e20000)
        /lib64/ld64.so.2 (0x00007fffa8090000)
```

However, without the cache the binaries will fall back to `/lib64/libc.so.6`
which breaks tests that use the minimal verity images (like TEST-29),
because we install only the first version (that's shown by `ldd` at
the time the images are created):

```
[   91.595343] testsuite-29.sh[747]: + portablectl --profile=trusted attach --now --runtime /usr/share/minimal_0.raw minimal-app0
         Starting systemd-portabled.service...
[  OK  ] Started systemd-portabled.service.
         Starting minimal-app0-foo.service...
         Starting minimal-app0.service...
[  104.432217] cat[858]: cat: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
[  104.435080] cat[857]: cat: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
[FAILED] Failed to start minimal-app0.service.
See 'systemctl status minimal-app0.service' for details.
```

```
$ chroot /var/tmp/systemd-test.nMHPfc/minimal/
/bin/bash: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
```

With the ldconfig's cache it seems to work as expected:
```
$ chroot /var/tmp/systemd-test.gVtYLg/minimal
bash-4.4# cat --version
cat (GNU coreutils) 8.30
...
```

3 years agoMerge pull request #24877 from brauner/namespace_utils
Luca Boccassi [Tue, 4 Oct 2022 20:59:48 +0000 (21:59 +0100)] 
Merge pull request #24877 from brauner/namespace_utils

namespace-util: add an initial set of tweaks

3 years agorepart: Drop usage of CHASE_WARN
Daan De Meyer [Tue, 4 Oct 2022 11:35:36 +0000 (13:35 +0200)] 
repart: Drop usage of CHASE_WARN

CHASE_WARN only makes sense when CHASE_SAFE or CHASE_NO_AUTOFS are
used. repart uses neither so let's drop usage of CHASE_WARN.

3 years agoNEWS: even more news
Luca Boccassi [Tue, 4 Oct 2022 18:12:50 +0000 (20:12 +0200)] 
NEWS: even more news

3 years agomount-util: use in_same_namespace() 24877/head
Christian Brauner [Sat, 1 Oct 2022 10:03:25 +0000 (12:03 +0200)] 
mount-util: use in_same_namespace()

Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
3 years agonspawn: use in_same_namespace() helper
Christian Brauner [Fri, 30 Sep 2022 13:05:02 +0000 (15:05 +0200)] 
nspawn: use in_same_namespace() helper

3 years agonamespace-util: add in_same_namespace()
Christian Brauner [Fri, 30 Sep 2022 13:02:52 +0000 (15:02 +0200)] 
namespace-util: add in_same_namespace()

Add a helper for the canonical way to determine whether two namespaces
are identical.

3 years agonsflags: replace namespace_flag_map with general namespace_info introduced earlier
Christian Brauner [Fri, 30 Sep 2022 13:02:18 +0000 (15:02 +0200)] 
nsflags: replace namespace_flag_map with general namespace_info introduced earlier

3 years agonamespace-util: add namespace_info
Christian Brauner [Fri, 30 Sep 2022 12:21:01 +0000 (14:21 +0200)] 
namespace-util: add namespace_info

3 years agoMerge pull request #24900 from yuwata/network-ndisc-drop-outdated
Lennart Poettering [Tue, 4 Oct 2022 16:03:25 +0000 (18:03 +0200)] 
Merge pull request #24900 from yuwata/network-ndisc-drop-outdated

network: ndisc: fix zero lifetime handling

3 years agobus: Process authentication after write
Marius Vollmer [Fri, 30 Sep 2022 08:11:04 +0000 (11:11 +0300)] 
bus: Process authentication after write

Once everything has been written, a server bus might now process a
pending "BEGIN" and start the bus.

3 years agoNEWS: more news
Luca Boccassi [Tue, 4 Oct 2022 12:53:44 +0000 (13:53 +0100)] 
NEWS: more news

3 years agoNEWS: typos
Luca Boccassi [Tue, 4 Oct 2022 12:04:35 +0000 (13:04 +0100)] 
NEWS: typos

3 years agoMerge pull request #24913 from keszybz/hwdb-252-2
Lennart Poettering [Tue, 4 Oct 2022 11:43:48 +0000 (13:43 +0200)] 
Merge pull request #24913 from keszybz/hwdb-252-2

hwdb update

3 years agoudev-builtin-net_id: reading phys_port_name may be refused with EOPNOTSUPP
Yu Watanabe [Tue, 4 Oct 2022 06:29:25 +0000 (15:29 +0900)] 
udev-builtin-net_id: reading phys_port_name may be refused with EOPNOTSUPP

If reading the sysattr failed with such error, the whole operation in
net_id builtin command will fail, and the interface will not be renamed.

Fixes a bug introduced by 5bbcfbaa11a92732f9bbc8d5f77e9311e6ac3d56.

3 years agoUpdate NEWS
Luca Boccassi [Tue, 4 Oct 2022 10:33:50 +0000 (11:33 +0100)] 
Update NEWS

3 years agoupdate TODO
Lennart Poettering [Tue, 4 Oct 2022 09:55:33 +0000 (11:55 +0200)] 
update TODO

3 years agohwdb: run "update-hwdb-autosuspend" 24913/head
Zbigniew Jędrzejewski-Szmek [Tue, 4 Oct 2022 08:43:47 +0000 (10:43 +0200)] 
hwdb: run "update-hwdb-autosuspend"

3 years agohwdb: run "update-hwdb"
Zbigniew Jędrzejewski-Szmek [Tue, 4 Oct 2022 08:43:12 +0000 (10:43 +0200)] 
hwdb: run "update-hwdb"

As usual, it seems to be mostly additions and corrections.

3 years agoFix key toggle touchpad and programmable buttom for Positivo Motion CW14Q01P #24909
drosdeck [Mon, 3 Oct 2022 18:52:24 +0000 (14:52 -0400)] 
Fix key toggle touchpad and programmable buttom for Positivo Motion CW14Q01P #24909

3 years agotmpfiles: fix assert
Topi Miettinen [Mon, 3 Oct 2022 15:13:42 +0000 (18:13 +0300)] 
tmpfiles: fix assert

Oct 03 17:33:20 systemd-tmpfiles[872]: Assertion 'IN_SET(i->type, CREATE_BLOCK_DEVICE|CREATE_CHAR_DEVICE)' failed at src/tmpfiles/tmpfiles.c:1837, function create_device(). Aborting.

I think this is caused by the line:
b! /dev/private/smartmontools-dev/sda 0660 root disk - 8:0

3 years agonetwork: ndisc: do not accept too many DNS servers or domains 24900/head
Yu Watanabe [Mon, 3 Oct 2022 15:06:46 +0000 (00:06 +0900)] 
network: ndisc: do not accept too many DNS servers or domains

If there exists multiple routers, then the previous logic may introduce
too many DNS servers or domains.

3 years agonetwork: ndisc: drop addresses and friends when RA with zero lifetime is received
Yu Watanabe [Mon, 3 Oct 2022 02:54:20 +0000 (11:54 +0900)] 
network: ndisc: drop addresses and friends when RA with zero lifetime is received

Routers may send options with zero lifetime if previously announced
information is outdated. Hence, if we receive such messages, then we
need to drop relevant addresses or friends.

See e.g. https://www.rfc-editor.org/rfc/rfc4861#section-12.

Follow-up for 2ccada8dc4a3571468a335808fd6fe49b8c6c6dd.

3 years agonetwork: make sec_to_usec() map 0sec -> 0usec
Yu Watanabe [Mon, 3 Oct 2022 03:42:40 +0000 (12:42 +0900)] 
network: make sec_to_usec() map 0sec -> 0usec

Zero lifetime in RA is special, and we should not assign possibly very
short lifetime addresses or friends.

This should not change anything at least now, preparation for later
commits. Note, DHCPv4 and v6 code also uses it, but sd-dhcp-client and
sd-dhcp6-client already filtered messages with zero lifetime. Hence,
the change should not affect DHCP code.

3 years agonetwork: ndisc: also introduce timer event source to drop outdated settings
Yu Watanabe [Mon, 3 Oct 2022 15:19:13 +0000 (00:19 +0900)] 
network: ndisc: also introduce timer event source to drop outdated settings

Otherwise, settings based on previously received RA messages will never
removed without receiving a new RA message.

3 years agonetwork: ndisc: drop outdated settings before processing RA message
Yu Watanabe [Mon, 3 Oct 2022 03:18:49 +0000 (12:18 +0900)] 
network: ndisc: drop outdated settings before processing RA message

Otherwise, e.g. if a router is replaced, then the previously received
settings may never dropped.

Follow-up for 2ccada8dc4a3571468a335808fd6fe49b8c6c6dd.

3 years agonetwork: ndisc: address_get() returns 0 on success
Yu Watanabe [Mon, 3 Oct 2022 14:57:48 +0000 (23:57 +0900)] 
network: ndisc: address_get() returns 0 on success

After the commit 3b6a3bdebfb555754fdc6ee507e3f6964de7b61c, address_get()
does not return 1.

3 years agonetwork: introduce {address,route}_remove_and_drop()
Yu Watanabe [Mon, 3 Oct 2022 03:39:56 +0000 (12:39 +0900)] 
network: introduce {address,route}_remove_and_drop()

Preparation for later commits.

3 years agonetwork: ndisc: ignore prefix option with link-local prefix
Yu Watanabe [Mon, 3 Oct 2022 01:12:23 +0000 (10:12 +0900)] 
network: ndisc: ignore prefix option with link-local prefix

See https://www.rfc-editor.org/rfc/rfc4861#section-4.6.2.

3 years agonetwork: ndisc: read prefix earlier
Yu Watanabe [Mon, 3 Oct 2022 03:28:41 +0000 (12:28 +0900)] 
network: ndisc: read prefix earlier

No functional changes.

3 years agoTODO: tmpfiles.d m/M
Luca Boccassi [Mon, 3 Oct 2022 14:28:11 +0000 (15:28 +0100)] 
TODO: tmpfiles.d m/M

3 years agorepart: Use chase_symlinks() instead of path_join()
Daan De Meyer [Mon, 3 Oct 2022 08:09:24 +0000 (10:09 +0200)] 
repart: Use chase_symlinks() instead of path_join()

Let's properly resolve symlinks and check if the source actually
exists.

3 years agoMerge pull request #23213 from bluca/jammy
Luca Boccassi [Mon, 3 Oct 2022 12:58:09 +0000 (13:58 +0100)] 
Merge pull request #23213 from bluca/jammy

Fixes for Jammy CI

3 years agotest-70: check if LUKS2 plugins are actually installed, not just supported 23213/head
Luca Boccassi [Sun, 2 Oct 2022 19:12:02 +0000 (20:12 +0100)] 
test-70: check if LUKS2 plugins are actually installed, not just supported

We don't build them in Debian/Ubuntu yet, even though cryptsetup supports them

3 years agorepart: workaround spurious maybe-uninitialized warning
Luca Boccassi [Sun, 2 Oct 2022 19:11:21 +0000 (20:11 +0100)] 
repart: workaround spurious maybe-uninitialized warning

Build fails on Ubuntu Jammy

3 years agonetwork: fix use-after-free
Yu Watanabe [Mon, 3 Oct 2022 03:35:29 +0000 (12:35 +0900)] 
network: fix use-after-free

If the lifetime of the route is already expired, do not try to
configure it.

Fixes a use-after-free, as the Request object is already freed, thus, we
cannot use Route or Link stored in Request object.

3 years agoresolve: drop remaining references for Monitor=
Yu Watanabe [Mon, 3 Oct 2022 00:29:45 +0000 (09:29 +0900)] 
resolve: drop remaining references for Monitor=

Follow-up for b25d819aee10b79a1c972d25be81a238448134dd.

3 years agonetwork: don't forget old RAs when a new one arrives
Thomas Hebb [Thu, 29 Sep 2022 06:40:35 +0000 (23:40 -0700)] 
network: don't forget old RAs when a new one arrives

IPv6 Neighbor Discovery lets us autoconfigure a link's IPv6 addresses,
routes, DNS servers, and DNS search domains by listening for Router
Advertisement (RA) packets broadcast by one or more routers on the link.
Each RA can contain zero or more "options," each describing one piece of
configuration (e.g. a single route).

Currently, when we receive an RA from a router, we delete any addresses,
routes, etc. that originated from that router's previous RAs unless
they're also present as options in the new RA.

That behavior is a violation of RFC 4861[1]. In Section 9, the RFC
states that

    Senders MAY send a subset of options in different packets. ... Thus,
    a receiver MUST NOT associate any action with the absence of an
    option in a particular packet. This protocol specifies that
    receivers should only act on the expiration of timers and on the
    information that is received in the packets.

Several other passages in the RFC reiterate this. Section 6.2.3:

    A router MAY choose not to include some or all options when sending
    unsolicited Router Advertisements.

Section 6.3.4:

    Hosts accept the union of all received information; the receipt of a
    Router Advertisement MUST NOT invalidate all information received in
    a previous advertisement or from another source.

At least one consumer router in production today, the Google Nest Wifi,
often sends RAs that omit its global IPv6 prefix. When current versions
of systemd-networkd receive those RAs, they immediately delete the
interface's global IPv6 address, which breaks IPv6 connectivity.

Fix the issue by removing the invalidation logic entirely. It's not
needed at all, since we already invalidate addresses, routes, and DNS
configuration when the interface goes down or their lifetimes expire.

This fix does have the side effect of preventing changes to the .network
file (e.g. denylisted prefixes, whether to add routes from RAs) from
taking effect as soon as a new RA arrives. Instead, a full interface
reconfiguration is needed. But triggering those changes on RA receipt
was already rather arbitrary and out of the administrator's control, so
I think this change is fine.

commit 69203fba700e ("network: ndisc: remove old addresses and routes
after at least one SLAAC address becomes ready") introduced this
behavior. commit 50550722e3ba fixed it partially, by preventing one
router's RAs from invalidating another router's configuration.

[1] https://www.rfc-editor.org/rfc/rfc4861

Fixes: 69203fba700e ("network: ndisc: remove old addresses and routes after at least one SLAAC address becomes ready")
3 years agoresolve: fix typo
Yu Watanabe [Mon, 3 Oct 2022 00:23:37 +0000 (09:23 +0900)] 
resolve: fix typo

3 years agorepart: Take --root into account in read only filesystems shortcut
Daan De Meyer [Sun, 2 Oct 2022 19:37:31 +0000 (21:37 +0200)] 
repart: Take --root into account in read only filesystems shortcut

3 years agoMerge pull request #24897 from mrc0mmand/TEST-64-sanitiers-open-scsi
Yu Watanabe [Sun, 2 Oct 2022 22:51:50 +0000 (07:51 +0900)] 
Merge pull request #24897 from mrc0mmand/TEST-64-sanitiers-open-scsi

test: pre-load ASan's DSO for iscsi-init.service

3 years agotest: pre-load ASan's DSO for iscsi-init.service 24897/head
Frantisek Sumsal [Sun, 2 Oct 2022 20:51:56 +0000 (22:51 +0200)] 
test: pre-load ASan's DSO for iscsi-init.service

The iscsi-init.service calls `sh` which might, in certain circumstances,
pull in instrumented systemd NSS modules causing `sh` to fail. Let's mitigate
this by pulling in an env file crafted by `create_asan_wrapper()` that
(among others) pre-loads ASan's DSO.

3 years agotest: introduce a simple environment file for test service
Frantisek Sumsal [Fri, 23 Sep 2022 22:00:36 +0000 (07:00 +0900)] 
test: introduce a simple environment file for test service

3 years agorepart: Don't fail on missing verity sig partition
Daan De Meyer [Sun, 2 Oct 2022 08:51:53 +0000 (10:51 +0200)] 
repart: Don't fail on missing verity sig partition

Also, provide a proper error message when we fail to find a verity
sibling partition.

3 years agotest: expand the expression in `cleanup_initdir()`
Frantisek Sumsal [Sat, 1 Oct 2022 19:56:08 +0000 (21:56 +0200)] 
test: expand the expression in `cleanup_initdir()`

Otherwise we might unexpectedly return 1 if the `get_bool` call fails.

If the `get_bool` part in `get_bool "$TEST_SETUP_CLEANUP_ROOTDIR" &&  _umount_dir "${initdir:?}"`
fails, the whole expression will short-circuit evaluate to 1, and since it's
the last expression in the function it's also it's return value, which doesn't
reflect the original intent of the expression:

```
# BUILD_DIR=$PWD/build make -C test/TEST-64-UDEV-STORAGE/ setup run TESTCASES=testcase_always_skip
make: Entering directory '/home/fsumsal/repos/@systemd/systemd/test/TEST-64-UDEV-STORAGE'
TEST-64-UDEV-STORAGE SETUP: systemd-udev storage tests
Reusing existing image /var/tmp/systemd-test.uPbJZ9/default.img → /var/tmp/systemd-test.uPbJZ9/default.img
TEST-64-UDEV-STORAGE RUN: systemd-udev storage tests
------ testcase_always_skip: BEGIN ------
Skipping...
------ testcase_always_skip: END (SKIP) ------
Passed tests: 0
    *
Skipped tests: 1
    * testcase_always_skip
Failed tests: 0
    *
TEST-64-UDEV-STORAGE RUN: systemd-udev storage tests [OK]
make: Leaving directory '/home/fsumsal/repos/@systemd/systemd/test/TEST-64-UDEV-STORAGE'

# BUILD_DIR=$PWD/build make -C test/TEST-64-UDEV-STORAGE/ setup run TESTCASES=testcase_always_skip
make: Entering directory '/home/fsumsal/repos/@systemd/systemd/test/TEST-64-UDEV-STORAGE'
TEST-64-UDEV-STORAGE SETUP: systemd-udev storage tests
Reusing existing image /var/tmp/systemd-test.uPbJZ9/default.img → /var/tmp/systemd-test.uPbJZ9/default.img
make: *** [Makefile:4: setup] Error 1
make: Leaving directory '/home/fsumsal/repos/@systemd/systemd/test/TEST-64-UDEV-STORAGE'
```

3 years agotest: drop the explicit bus assignment for the pci-bridge
Frantisek Sumsal [Sat, 1 Oct 2022 18:56:01 +0000 (20:56 +0200)] 
test: drop the explicit bus assignment for the pci-bridge

as it doesn't work with the Q35 chipset due to a different topology.
Auto-assignment seems to work with both Q35 and i440FX chipsets.

3 years agoMerge pull request #24878 from keszybz/condition-first-boot
Luca Boccassi [Sat, 1 Oct 2022 18:30:21 +0000 (19:30 +0100)] 
Merge pull request #24878 from keszybz/condition-first-boot

Tweak condition first boot to use the same logic in pid1 and units

3 years agohwdb: Add Fn+F12 on HP Dragonfly G2 and mute extra rfkill keys
Maxim Mikityanskiy [Sat, 1 Oct 2022 11:28:44 +0000 (14:28 +0300)] 
hwdb: Add Fn+F12 on HP Dragonfly G2 and mute extra rfkill keys

Add new key mappings for the HP Elite Dragonfly G2 laptop:

1. Map Fn+F12 (HP Programmable Key) to prog1.

2. Unmap Fn+F11 (Airplane mode) from atkbd and Intel HID events, as this
   key is also reported by HP Wireless hotkeys.

3 years agoman: Update systemd.killMode docs
Clyde Byrd III [Tue, 8 Mar 2022 23:26:33 +0000 (15:26 -0800)] 
man: Update systemd.killMode docs

3 years agobuild(deps): bump ninja from 1.10.2.3 to 1.10.2.4 in /.github/workflows
dependabot[bot] [Sat, 1 Oct 2022 11:01:11 +0000 (11:01 +0000)] 
build(deps): bump ninja from 1.10.2.3 to 1.10.2.4 in /.github/workflows

Bumps [ninja](https://github.com/ninja-build/ninja) from 1.10.2.3 to 1.10.2.4.
- [Release notes](https://github.com/ninja-build/ninja/releases)
- [Commits](https://github.com/ninja-build/ninja/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
3 years agoci: pin stefanbuck/github-issue-parser to a tagged release
Frantisek Sumsal [Sat, 1 Oct 2022 11:09:28 +0000 (13:09 +0200)] 
ci: pin stefanbuck/github-issue-parser to a tagged release

Since [0] got resolved ([1]) we can finally pin the action to a tagged
release (v2.0.4 ATTOW) and let Dependabot to do its job by updating it
to the latest tagged release when it becomes available.

Replaces: #24886

[0] https://github.com/stefanbuck/github-issue-parser/issues/23
[1] https://github.com/stefanbuck/github-issue-parser/pull/39

3 years agobuild(deps): bump actions/labeler from 4.0.0 to 4.0.1
dependabot[bot] [Sat, 1 Oct 2022 09:02:58 +0000 (09:02 +0000)] 
build(deps): bump actions/labeler from 4.0.0 to 4.0.1

Bumps [actions/labeler](https://github.com/actions/labeler) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/actions/labeler/releases)
- [Commits](https://github.com/actions/labeler/compare/9fd24f1f9d6ceb64ba34d181b329ee72f99978a0...e54e5b338fbd6e6cdb5d60f51c22335fc57c401e)

---
updated-dependencies:
- dependency-name: actions/labeler
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
3 years agobuild(deps): bump redhat-plumbers-in-action/differential-shellcheck
dependabot[bot] [Sat, 1 Oct 2022 09:03:02 +0000 (09:03 +0000)] 
build(deps): bump redhat-plumbers-in-action/differential-shellcheck

Bumps [redhat-plumbers-in-action/differential-shellcheck](https://github.com/redhat-plumbers-in-action/differential-shellcheck) from 3.0.1 to 3.1.1.
- [Release notes](https://github.com/redhat-plumbers-in-action/differential-shellcheck/releases)
- [Changelog](https://github.com/redhat-plumbers-in-action/differential-shellcheck/blob/main/CHANGELOG.md)
- [Commits](https://github.com/redhat-plumbers-in-action/differential-shellcheck/compare/a14889568f6210b361eb29e16f3b07f512fca846...1b1b75e42f0694c1012228513b21617a748c866e)

---
updated-dependencies:
- dependency-name: redhat-plumbers-in-action/differential-shellcheck
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
3 years agobuild(deps): bump meson from 0.63.1 to 0.63.2 in /.github/workflows
dependabot[bot] [Sat, 1 Oct 2022 09:03:12 +0000 (09:03 +0000)] 
build(deps): bump meson from 0.63.1 to 0.63.2 in /.github/workflows

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

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

Signed-off-by: dependabot[bot] <support@github.com>
3 years agoman: add cross-links about preset operations 24878/head
Zbigniew Jędrzejewski-Szmek [Fri, 30 Sep 2022 13:31:40 +0000 (15:31 +0200)] 
man: add cross-links about preset operations

3 years agomanager: fix/change evaluation of ConditionFirstBoot
Zbigniew Jędrzejewski-Szmek [Fri, 30 Sep 2022 10:50:40 +0000 (12:50 +0200)] 
manager: fix/change evaluation of ConditionFirstBoot

The code to evaluate the kernel command line option was busted because it
was doing 'return b == !!r' at a point where 'r > 0'. Thus we'd return "true"
in both cases:

$ SYSTEMD_PROC_CMDLINE=systemd.condition-first-boot build/systemd-analyze condition 'ConditionFirstBoot=true'
test.service: ConditionFirstBoot=true succeeded.
Conditions succeeded.
$ SYSTEMD_PROC_CMDLINE=systemd.condition-first-boot build/systemd-analyze condition 'ConditionFirstBoot=false'
test.service: ConditionFirstBoot=false succeeded.
Conditions succeeded.

We only use 'ConditionFirstBoot=true' in units, so this wasn't noticed.

But I think the logic is broken in general: the condition should evaluate as
true only during initial boot. If we rerun the units at later points, we should
not consider ConditionFirstBoot to be true.

Also, the first boot logic is also used in pid1 itself. AFAICT, for two
things: in first boot machine-id is initialized transiently (this allows
first-boot operations to be restarted if boot fails), and preset-all is
executed. But this logic was different and separate from the logic to
evaluate ConditionFirstBoot. The distinction is abolished, and the operations
in pid1 now use the same logic as ConditionFirstBoot, which means that the
kernel command line option is checked, and condition_test_first_boot()
just tests whether pid1 thinks we're in first boot.

This makes things easier to grok for the user: there's just one condition for
"first boot" and it applies to both pid1 and units.

3 years agodocs/CONTRIBUTING: strenghten language about ABI stability, fix links, other tweaks
Zbigniew Jędrzejewski-Szmek [Fri, 30 Sep 2022 15:26:34 +0000 (17:26 +0200)] 
docs/CONTRIBUTING: strenghten language about ABI stability, fix links, other tweaks

The text made it sound like breaking ABI in libsystemd is allowed with good reasons.
In fact, we plan never to do this, so make the language stronger.

Also remind people about distro forums for reporting bugs. Those are probably a
better place than systemd-devel for new users.

Also, add some missing articles and apostrophes, fix URLs, remove repeated phrases,
etc.

3 years agoRevert "bpf: fix is_allow_list section"
James Hilliard [Fri, 30 Sep 2022 21:42:22 +0000 (15:42 -0600)] 
Revert "bpf: fix is_allow_list section"

GCC was modified to use the same default section as LLVM, as such
this is no longer required.

Details:
https://github.com/gcc-mirror/gcc/commit/a0aafbc324aa90421f0ce99c6f5bbf64ed163da6

This reverts commit e8b1e9cf1095f9d6d0f1e2dce2503e25fec2e6c5.

3 years agomeson: set minimum libbpf/bpftool versions for bpf-gcc
James Hilliard [Sat, 1 Oct 2022 00:09:53 +0000 (00:09 +0000)] 
meson: set minimum libbpf/bpftool versions for bpf-gcc

We need the following libbpf commits for bpf-gcc compatibility:
 - https://github.com/libbpf/libbpf/commit/3d484ca47339b23afb2ec7c508ed9a3a5cf1d287
 - https://github.com/libbpf/libbpf/commit/b31ca3fa0e62fde6aa66f855136e29e088ad9dde

These are first present in libbpf 1.0.0 and bpftool 7.0.0.

3 years agoMerge pull request #24829 from yuwata/blockdev-new-from-fd
Luca Boccassi [Fri, 30 Sep 2022 19:07:49 +0000 (20:07 +0100)] 
Merge pull request #24829 from yuwata/blockdev-new-from-fd

blockdev-util: introduce block_device_new_from_fd() and _path()

3 years agoMerge pull request #24749 from yuwata/dissect-image-file
Luca Boccassi [Fri, 30 Sep 2022 19:02:19 +0000 (20:02 +0100)] 
Merge pull request #24749 from yuwata/dissect-image-file

dissect-image: introduce dissect_image_file() which works for regular file instead of block device

3 years agoresolve: unsupported DNSSEC algorithms are considered INSECURE; not BOGUS
Jacek Migacz [Wed, 21 Sep 2022 06:23:22 +0000 (08:23 +0200)] 
resolve: unsupported DNSSEC algorithms are considered INSECURE; not BOGUS

Resolves: #19824

3 years agoMerge pull request #24639 from yuwata/test-mountpoint-util
Zbigniew Jędrzejewski-Szmek [Fri, 30 Sep 2022 15:34:21 +0000 (17:34 +0200)] 
Merge pull request #24639 from yuwata/test-mountpoint-util

test-mountpoint-util: support running on a mount namespace with another mount on /proc

3 years agomissing_sched: add CLONE_NEWTIME
Christian Brauner [Fri, 30 Sep 2022 12:59:38 +0000 (14:59 +0200)] 
missing_sched: add CLONE_NEWTIME

3 years agoMerge pull request #24853 from poettering/resolved-monitor-fixes
Luca Boccassi [Fri, 30 Sep 2022 14:46:13 +0000 (15:46 +0100)] 
Merge pull request #24853 from poettering/resolved-monitor-fixes

resolved: various monitor fixes

3 years agoMerge pull request #24739 from keszybz/coredump-formatting
Luca Boccassi [Fri, 30 Sep 2022 14:42:15 +0000 (15:42 +0100)] 
Merge pull request #24739 from keszybz/coredump-formatting

Improve formatting of package metadata in coredumps

3 years agofirstboot: add debug logging
Zbigniew Jędrzejewski-Szmek [Fri, 30 Sep 2022 09:48:12 +0000 (11:48 +0200)] 
firstboot: add debug logging

$ SYSTEMD_LOG_LEVEL=debug build/systemd-firstboot --prompt-root-password
Found container virtualization systemd-nspawn.
Found /etc/locale.conf, assuming locale information has been configured.
Failed to read credential firstboot.keymap, ignoring: No such device or address
Prompting for keymap was not requested.
Found /etc/localtime, assuming timezone has been configured.
Prompting for hostname was not requested.
Found /etc/machine-id, assuming machine-id has been configured.
Found /etc/passwd and /etc/shadow, assuming root account has been initialized.
Creation of /etc/kernel/cmdline was not requested, skipping.

3 years agosystemctl: color ignored exit status in yellow, not red
Christian Hesse [Fri, 30 Sep 2022 08:26:43 +0000 (10:26 +0200)] 
systemctl: color ignored exit status in yellow, not red

If the executable path is prefixed with "-", an exit code of the command
normally considered a failure (i.e. non-zero exit status or abnormal exit
due to signal) is recorded, but has no further effect and is considered
equivalent to success.

Let's honor this with `systemctl status`, and color ignored exit status
in yellow, not red.

3 years agogenerator: skip fsck if fsck command is missing
Jonas Kümmerlin [Thu, 29 Sep 2022 16:51:03 +0000 (18:51 +0200)] 
generator: skip fsck if fsck command is missing

This is useful for systems which don't have any fsck.

We already skip emitting the fsck dependency when the fsck.$fstype helper
is missing, but fstab-generator doesn't necessarily know the fstype when
handling the root= parameter.

Previously, systemd-fsck was started for these mounts and then exited
immediately because it couldn't find the fsck.$fstype helper.

3 years agoportablectl: add --force attach/detach
Luca Boccassi [Thu, 29 Sep 2022 21:41:55 +0000 (22:41 +0100)] 
portablectl: add --force attach/detach

Allows to skip check that ensures units must not be running.

I have a use case that would use reattach, except the orchestrator
is using a non-standard versioning scheme, so image matching cannot
work. As a workaround, need to be able to detach and then attach
manually, without stopping the units to avoid extended downtimes
and loss of FD store.

3 years agoupdate TODO 24853/head
Lennart Poettering [Fri, 30 Sep 2022 12:14:33 +0000 (14:14 +0200)] 
update TODO

3 years agotest: rework resolved monitoring test
Lennart Poettering [Fri, 30 Sep 2022 08:04:37 +0000 (10:04 +0200)] 
test: rework resolved monitoring test

Let's remove some sleep loops, and instead:

1. Use Type=notify to wait until "resolvectl monitor" successfully
   installed its monitor, so that we know that queries enqueued later
   will definitely be seen.

2. Use "grep -m1" to watch "journalctl -f" output to wait precisely for
   the RR data we want to see, and immediately exit.

This shortens code quite a bit, and should make it more robust.

3 years agoresolvectl: add new "monitor" verb
Lennart Poettering [Wed, 28 Sep 2022 10:46:21 +0000 (12:46 +0200)] 
resolvectl: add new "monitor" verb

3 years agoMerge pull request #24831 from poettering/dbus-dump-doc
Franck Bui [Fri, 30 Sep 2022 12:23:59 +0000 (14:23 +0200)] 
Merge pull request #24831 from poettering/dbus-dump-doc

man: clarify that D-Bus Dump() call is a debugging interface with no guarantees

3 years agoresolved: beef up monitor protocol, include full query info
Lennart Poettering [Wed, 28 Sep 2022 10:46:09 +0000 (12:46 +0200)] 
resolved: beef up monitor protocol, include full query info

3 years agoresolved: add dns_question_merge() helper
Lennart Poettering [Thu, 29 Sep 2022 16:26:44 +0000 (18:26 +0200)] 
resolved: add dns_question_merge() helper

Very similar to dns_answer_merge(), but for DnsQuestion objects instead
of DnsAnswer.

3 years agoresolved: add generic formatters for RRs into JSON
Lennart Poettering [Wed, 28 Sep 2022 15:17:23 +0000 (17:17 +0200)] 
resolved: add generic formatters for RRs into JSON

For now we can use it to send broken-down records of JSON via the
monitor logic, but one day we can certainly reuse for dumping the
caches, or to implement a ResolveRecord() varlink call one day.

3 years agoresolved: split out helper for allocating DnsResourceRecord object from raw data
Lennart Poettering [Wed, 28 Sep 2022 10:44:43 +0000 (12:44 +0200)] 
resolved: split out helper for allocating DnsResourceRecord object from raw data

No change in behaviour, just some refactoring.

3 years agoresolved: split out main server listening code from manager_varlink_init()
Lennart Poettering [Tue, 27 Sep 2022 12:50:53 +0000 (14:50 +0200)] 
resolved: split out main server listening code from manager_varlink_init()

Just some minor refactoring, to make binding the two sockets (main +
minitor) symmetric

3 years agoresolved: don't make monitoring optional
Lennart Poettering [Tue, 27 Sep 2022 12:29:18 +0000 (14:29 +0200)] 
resolved: don't make monitoring optional

The socket is only accessible to privileged clients anyway, no need to
add another (user unfriendly) restriction via opt-in setting. let's just
allow this for privileged clients, mirroring "busctl monitor", or
"tcpdump" and similar, which all just work if you have privs.

(This does not break API, since we never did a release witht the
"Monitor" dbus property or config setting in place, i.e. with
cb456374e096f0ebe9b70d7ddd98e16a4be24ee6)

3 years agoresolved: rename 'notification' → 'monitor'
Lennart Poettering [Tue, 27 Sep 2022 12:28:32 +0000 (14:28 +0200)] 
resolved: rename 'notification' → 'monitor'

We expose this externally already as "monitor", name it internally the
same way. (Which is nice since it mirrors busctl monitor)

3 years agosd-event: add helper for exiting event loop on SIGTERM/SIGINT
Lennart Poettering [Wed, 28 Sep 2022 09:42:05 +0000 (11:42 +0200)] 
sd-event: add helper for exiting event loop on SIGTERM/SIGINT

In many (most?) of our event loops we want to exit once SIGTERM/SIGINT
is seen. Add a common helper for that, that does the right things in a
single call.