]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
4 years agomeson: allow extra net naming schemes to be defined during configuration 20865/head
Zbigniew Jędrzejewski-Szmek [Tue, 28 Sep 2021 08:12:36 +0000 (10:12 +0200)] 
meson: allow extra net naming schemes to be defined during configuration

In upstream, we have a linearly-growing list of net-naming-scheme defines;
we add a new one for every release where we make user-visible changes to the
naming scheme.

But the general idea was that downstream distributions could define their
own combinations (or even just their own names for existing combinations),
so provide stability for their users. So far this required patching of the
netif-naming-scheme.c and .h files to add the new lines.

With this patch, patching is not required:

$ meson configure build \
  -Dextra-net-naming-schemes=gargoyle=v238+npar_ari+allow_rerenames,gargoyle2=gargoyle+nspawn_long_hash \
  -Ddefault-net-naming-scheme=gargoyle2

or even

$ meson configure build \
  -Dextra-net-naming-schemes=gargoyle=v238+npar_ari+allow_rerenames,gargoyle2=gargoyle+nspawn_long_hash,latest=v249 \
  -Ddefault-net-naming-scheme=gargoyle2

The syntax is a comma-separated list of NAME=name+name+…
This syntax is a bit scary, but any typos result in compilation errors,
so I think it should be OK in practice.

With this approach, we don't allow users to define arbitrary combinations:
what is allowed is still defined at compilation time, so it's up to the
distribution maintainers to provide reasonable combinations. In this regard,
the only difference from status quo is that it's much easier to do (and harder
to do incorrectly, for example by forgetting to add a name to one of the
maps).

4 years agomeson: drop the list of valid net naming schemes
Zbigniew Jędrzejewski-Szmek [Tue, 28 Sep 2021 07:33:30 +0000 (09:33 +0200)] 
meson: drop the list of valid net naming schemes

We used 'combo' type for the scheme list. For a while we forgot to add
new names, and recently aa0a23ec86 added v241, v243, v245, and v247.
I want to allow defining new values during configuration, which means
that we can't use meson to verify the list of options. So any value is
allowed, but then two tests are added: one that will fail compilation if some
invalid name is given (other than "latest"), and one that converts
DEFAULT_NET_NAMING_SCHEME to a NamingScheme pointer.

4 years agonetif-naming: inline one iterator variable
Zbigniew Jędrzejewski-Szmek [Tue, 28 Sep 2021 06:55:18 +0000 (08:55 +0200)] 
netif-naming: inline one iterator variable

4 years agoMerge pull request #20846 from yuwata/sd-lldp-tx
Yu Watanabe [Tue, 28 Sep 2021 02:29:34 +0000 (11:29 +0900)] 
Merge pull request #20846 from yuwata/sd-lldp-tx

network: move LLDP transmission feature to libsystemd-network

4 years agoMerge pull request #20855 from dannf/update-net-name-schemes
Yu Watanabe [Tue, 28 Sep 2021 02:28:07 +0000 (11:28 +0900)] 
Merge pull request #20855 from dannf/update-net-name-schemes

Update net name schemes

4 years agoresolved: suppress writing DNS server info into /etc/resolv.conf for non-standard...
Lennart Poettering [Mon, 27 Sep 2021 12:28:16 +0000 (14:28 +0200)] 
resolved: suppress writing DNS server info into /etc/resolv.conf for non-standard UDP ports

glibc doesn't support this, hence don#t generate it.

Fixes: #20836
4 years agoparse-util: prefix load average macros with LOAD_AVG_
Luca Boccassi [Mon, 27 Sep 2021 13:49:47 +0000 (14:49 +0100)] 
parse-util: prefix load average macros with LOAD_AVG_

Follow-up for #20839

4 years agoRemind developers to update the list of net naming schemes that can be selected as... 20855/head
dann frazier [Mon, 27 Sep 2021 17:08:37 +0000 (11:08 -0600)] 
Remind developers to update the list of net naming schemes that can be selected as a build-time defaults.

4 years agoAdd remaining supported schemes as options for default-net-naming-scheme
dann frazier [Mon, 27 Sep 2021 17:00:53 +0000 (11:00 -0600)] 
Add remaining supported schemes as options for default-net-naming-scheme

4 years agonetwork: use sd-lldp-tx 20846/head
Yu Watanabe [Sun, 26 Sep 2021 10:13:20 +0000 (19:13 +0900)] 
network: use sd-lldp-tx

4 years agosd-lldp-tx: introduce sd-lldp-tx
Yu Watanabe [Sun, 26 Sep 2021 08:07:34 +0000 (17:07 +0900)] 
sd-lldp-tx: introduce sd-lldp-tx

4 years agohostname-util: introduce get_pretty_hostname()
Yu Watanabe [Sun, 26 Sep 2021 10:53:00 +0000 (19:53 +0900)] 
hostname-util: introduce get_pretty_hostname()

4 years agosd-lldp: introduce SD_LLDP_OUI_IANA_MUD macro
Yu Watanabe [Sun, 26 Sep 2021 11:19:54 +0000 (20:19 +0900)] 
sd-lldp: introduce SD_LLDP_OUI_IANA_MUD macro

4 years agosd-lldp: constify OUI
Yu Watanabe [Mon, 27 Sep 2021 16:32:40 +0000 (01:32 +0900)] 
sd-lldp: constify OUI

4 years agosd-lldp-rx: split out enum definitions
Yu Watanabe [Sun, 26 Sep 2021 11:03:51 +0000 (20:03 +0900)] 
sd-lldp-rx: split out enum definitions

4 years agosd-lldp-rx: rename sd_lldp -> sd_lldp_rx
Yu Watanabe [Sun, 26 Sep 2021 03:39:36 +0000 (12:39 +0900)] 
sd-lldp-rx: rename sd_lldp -> sd_lldp_rx

4 years agotest: also rename {test,fuzz}-lldp.c
Yu Watanabe [Sun, 26 Sep 2021 03:34:41 +0000 (12:34 +0900)] 
test: also rename {test,fuzz}-lldp.c

4 years agosd-lldp: rename sd-lldp.[ch] -> sd-lldp-rx.[ch]
Yu Watanabe [Sun, 26 Sep 2021 02:51:17 +0000 (11:51 +0900)] 
sd-lldp: rename sd-lldp.[ch] -> sd-lldp-rx.[ch]

4 years agomeson: sort files
Yu Watanabe [Sun, 26 Sep 2021 02:45:03 +0000 (11:45 +0900)] 
meson: sort files

4 years agoMerge pull request #20768 from pdmorrow/shutdown_cgroup_ctrl
Lennart Poettering [Mon, 27 Sep 2021 11:44:54 +0000 (13:44 +0200)] 
Merge pull request #20768 from pdmorrow/shutdown_cgroup_ctrl

cgroups: apply StartupAllowedCPUs= and StartupAllowedMemoryNodes= during shutdown

4 years agoMerge pull request #20849 from keszybz/man-page-tags-and-links
Zbigniew Jędrzejewski-Szmek [Mon, 27 Sep 2021 10:09:48 +0000 (12:09 +0200)] 
Merge pull request #20849 from keszybz/man-page-tags-and-links

Add license tags to doc pages, fixups and more internal links in man pages

4 years agohwbd: 60-sensor.hwdb: Add Lenovo ThinkPad Yoga 11e 5th Gen (Type: 20LN, Gemini Lake)
Kay Siver Bø [Sat, 25 Sep 2021 10:37:29 +0000 (12:37 +0200)] 
hwbd: 60-sensor.hwdb: Add Lenovo ThinkPad Yoga 11e 5th Gen (Type: 20LN, Gemini Lake)

4 years agoman: mention pages with more settings at end of each option list 20849/head
Zbigniew Jędrzejewski-Szmek [Mon, 27 Sep 2021 07:09:30 +0000 (09:09 +0200)] 
man: mention pages with more settings at end of each option list

For some unit types we have hundreds of options, and the reader may easily miss
that more options are described in other pages. We already mentioned this in
the introduction and then at the top of the option list, but it can't hurt to
repeat the information.

Also, add an (almost empty) Options section for the unit types which don't have
any custom options. It is nicer to have the same page structure in all cases,
so people can jump between pages for different types more easily.

4 years agoman: refresh description of sysvinit compat for services
Zbigniew Jędrzejewski-Szmek [Mon, 27 Sep 2021 06:43:10 +0000 (08:43 +0200)] 
man: refresh description of sysvinit compat for services

The existing text must have been written before systemd-sysv-generator was
created. We don't create the wrappers dynamically since a long time.

Also add more links and make the description conditional on "if compat
is enabled".

4 years agoman: minor grammar fixups in systemd-cryptenroll
Zbigniew Jędrzejewski-Szmek [Fri, 24 Sep 2021 07:12:02 +0000 (09:12 +0200)] 
man: minor grammar fixups in systemd-cryptenroll

4 years agodocs: add spdx tags to all .md files
Zbigniew Jędrzejewski-Szmek [Tue, 14 Sep 2021 14:05:21 +0000 (16:05 +0200)] 
docs: add spdx tags to all .md files

I have no idea if this is going to cause rendering problems, and it is fairly
hard to check. So let's just merge this, and if it github markdown processor
doesn't like it, revert.

4 years agoman: cross-reference DeviceAllow= and PrivateDevices=
Zbigniew Jędrzejewski-Szmek [Wed, 8 Sep 2021 13:46:17 +0000 (15:46 +0200)] 
man: cross-reference DeviceAllow= and PrivateDevices=

They are somewhat similar, but not easy to discover, esp. considering that
they are described in different pages.

For PrivateDevices=, split out the first paragraph that gives the high-level
overview. (The giant second paragraph could also use some heavy editing to break
it up into more digestible chunks, alas.)

4 years agomeson: refuse implicit int <-> pointer conversion
Yu Watanabe [Fri, 24 Sep 2021 15:16:20 +0000 (00:16 +0900)] 
meson: refuse implicit int <-> pointer conversion

Before:
```
Compiling C object src/libsystemd-network/libsystemd-network.a.p/dhcp6-option.c.o
../src/libsystemd-network/dhcp6-option.c: In function ‘dhcp6_option_parse_ia’:
../src/libsystemd-network/dhcp6-option.c:633:70: warning: passing argument 3 of ‘dhcp6_option_parse’ makes pointer from integer without a cast [-Wint-conversion]
  633 |                 r = dhcp6_option_parse(option_data, option_data_len, offset, &subopt, &subdata_len, &subdata);
      |                                                                      ^~~~~~
      |                                                                      |
      |                                                                      size_t {aka long unsigned int}
../src/libsystemd-network/dhcp6-option.c:358:25: note: expected ‘size_t *’ {aka ‘long unsigned int *’} but argument is of type ‘size_t’ {aka ‘long unsigned int’}
  358 |                 size_t *offset,
      |                 ~~~~~~~~^~~~~~
```

After:
```
../src/libsystemd-network/dhcp6-option.c: In function ‘dhcp6_option_parse_ia’:
../src/libsystemd-network/dhcp6-option.c:633:70: error: passing argument 3 of ‘dhcp6_option_parse’ makes pointer from integer without a cast [-Werror=int-conversion]
  633 |                 r = dhcp6_option_parse(option_data, option_data_len, offset, &subopt, &subdata_len, &subdata);
      |                                                                      ^~~~~~
      |                                                                      |
      |                                                                      size_t {aka long unsigned int}
../src/libsystemd-network/dhcp6-option.c:358:25: note: expected ‘size_t *’ {aka ‘long unsigned int *’} but argument is of type ‘size_t’ {aka ‘long unsigned int’}
  358 |                 size_t *offset,
      |                 ~~~~~~~~^~~~~~
cc1: some warnings being treated as errors
```

4 years agobasic: delete loadavg.h copy
Luca Boccassi [Fri, 24 Sep 2021 16:28:27 +0000 (17:28 +0100)] 
basic: delete loadavg.h copy

loadavg.h is an internal header of the Linux source repository, and as
such it is licensed as GPLv2-only, without syscall exception.

We use it only for 4 macros, which are simply doing some math calculations
that cannot thus be subject to copyright.
Reimplement the same calculations in another internal header and delete
loadavg.h from our tree.

4 years agouser-record: switch the default LUKS PBKDF to argon2id to match cryptsetup
nl6720 [Fri, 24 Sep 2021 10:22:18 +0000 (13:22 +0300)] 
user-record: switch the default LUKS PBKDF to argon2id to match cryptsetup

cryptsetup 2.4.0 changed the default LUKS2 PBKDF to argon2id.
See https://gitlab.com/cryptsetup/cryptsetup/-/commit/db775417909db0f0b07168d07fdf8813e3ca94fe.

4 years agoman: fix a reference in timedatectl man page
Anssi Hannula [Fri, 24 Sep 2021 12:26:21 +0000 (15:26 +0300)] 
man: fix a reference in timedatectl man page

timedatectl(1) says the synchronization service list generation is
described "below", but in reality it is documented in
systemd-timedated.service(8).

Fix the sentence to reference the correct man page.

4 years agoman: Startup* updates for systemd.resource-control 20768/head
Peter Morrow [Fri, 17 Sep 2021 10:13:39 +0000 (11:13 +0100)] 
man: Startup* updates for systemd.resource-control

All Startup*= directives now also apply to the shutdown phase as well as
boot phase.

4 years agofuzz: list directives in alphabetical order
Peter Morrow [Thu, 16 Sep 2021 11:33:16 +0000 (12:33 +0100)] 
fuzz: list directives in alphabetical order

4 years agocgroup: re-evaluate startup units during shutdown as well
Peter Morrow [Thu, 16 Sep 2021 11:21:20 +0000 (12:21 +0100)] 
cgroup: re-evaluate startup units during shutdown as well

Apply startup cgroup configuration options to the shutdown phase as
well. I.e. all directives prefixed with Startup are applied during
boot and shutdown. For example:

StartupAllowedCPU= applies during boot and shutdown.
AllowedCPUs= applies during normal runtime.

4 years agoRevert "mkosi: turn off qemu headless mode"
Lennart Poettering [Fri, 24 Sep 2021 12:20:31 +0000 (14:20 +0200)] 
Revert "mkosi: turn off qemu headless mode"

This reverts commit a02c1239cc8064d6dc34279b027a264cfa1ebf07.

(Sorry, I pushed this directly to 'main' by accident)

4 years agomain: use strv_extendf() where appropriate
Lennart Poettering [Fri, 24 Sep 2021 09:05:00 +0000 (11:05 +0200)] 
main: use strv_extendf() where appropriate

4 years agopo: Translated using Weblate (Indonesian)
Andika Triwidada [Fri, 24 Sep 2021 11:05:02 +0000 (13:05 +0200)] 
po: Translated using Weblate (Indonesian)

Currently translated at 100.0% (189 of 189 strings)

Co-authored-by: Andika Triwidada <andika@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/id/
Translation: systemd/main

4 years agolink: connect 5 more properties to ethtool features
Anita Zhang [Fri, 24 Sep 2021 08:19:00 +0000 (01:19 -0700)] 
link: connect 5 more properties to ethtool features

Sets up the follow properties and their corresponding ethtool feature:
- ReceiveVLANCTAGHardwareAcceleration == rx-vlan-hw-parse (or rxvlan)
- TransmitVLANCTAGHardwareAcceleration == tx-vlan-hw-insert (or txvlan)
- ReceiveVLANCTAGFilter == rx-vlan-filter
- TransmitVLANSTAGHardwareAcceleration == tx-vlan-stag-hw-insert
- NTupleFilter == rx-ntuple-filter (or ntuple)

4 years agoMerge pull request #20826 from yuwata/network-sd-event-source-disable-unref
Lennart Poettering [Fri, 24 Sep 2021 11:25:31 +0000 (13:25 +0200)] 
Merge pull request #20826 from yuwata/network-sd-event-source-disable-unref

network: disable event sources before unref them

4 years agolibsystemd-network: disable event sources before unref them 20826/head
Yu Watanabe [Fri, 24 Sep 2021 08:26:35 +0000 (17:26 +0900)] 
libsystemd-network: disable event sources before unref them

Fixes #20825.

4 years agonetwork: disable event sources before unref them
Yu Watanabe [Fri, 24 Sep 2021 08:26:10 +0000 (17:26 +0900)] 
network: disable event sources before unref them

4 years agoMerge pull request #20789 from poettering/initrd-cpio
Lennart Poettering [Thu, 23 Sep 2021 19:17:05 +0000 (21:17 +0200)] 
Merge pull request #20789 from poettering/initrd-cpio

efi-stub: when booting a kernel foo.efi then pack foo.efi.extra.d/*.{cred,raw} as an initrd

4 years agosmack-util: tiny simplification
Lennart Poettering [Thu, 23 Sep 2021 15:08:58 +0000 (17:08 +0200)] 
smack-util: tiny simplification

4 years agoboot: prefer IMAGE_VERSION from os-release as version string 20789/head
Lennart Poettering [Thu, 23 Sep 2021 15:48:26 +0000 (17:48 +0200)] 
boot: prefer IMAGE_VERSION from os-release as version string

If the field exists it's probably the best version we have for sorting,
since it will change on every single OS image update.

4 years agoman: document the new systemd-boot drop-in driver dir logic
Lennart Poettering [Tue, 21 Sep 2021 15:28:16 +0000 (17:28 +0200)] 
man: document the new systemd-boot drop-in driver dir logic

4 years agoman: the sd-boot menu is probably more "textual" then "graphical", hence don't lie
Lennart Poettering [Tue, 21 Sep 2021 14:52:57 +0000 (16:52 +0200)] 
man: the sd-boot menu is probably more "textual" then "graphical", hence don't lie

(also, most communication happens between boot loader and OS, only
seldom stuff goes the other way, hence mention that the boot loader
first)

4 years agoman: add man page for the systemd UEFI stub
Lennart Poettering [Tue, 21 Sep 2021 14:52:24 +0000 (16:52 +0200)] 
man: add man page for the systemd UEFI stub

Fixes: #17215
4 years agoboot: add get_os_indications_supported() helper
Lennart Poettering [Tue, 21 Sep 2021 20:13:23 +0000 (22:13 +0200)] 
boot: add get_os_indications_supported() helper

We inquire the EFI var for this at two places, let's add a helper that
queries it and gracefully handles it if we can't get it, by returning a
zero mask, i.e. no features supported.

4 years agostub: various modernizations to linux.c
Lennart Poettering [Tue, 21 Sep 2021 20:00:06 +0000 (22:00 +0200)] 
stub: various modernizations to linux.c

Let's make some stuff const. Most importanly call AllocatePages() with
a pointer to an EFI_PHYSICAL_ADDRESS instead of a pointer to a
pointer. On 64bit this makes no difference, but on i386 this is simply
not correct, since EFI_PHYSICAL_ADDRESS is 64bit there, even though
pointers are 32bit.

4 years agoboot: add helper for converting EFI_PHYSICAL_ADDRESS to a pointer
Lennart Poettering [Tue, 21 Sep 2021 19:57:51 +0000 (21:57 +0200)] 
boot: add helper for converting EFI_PHYSICAL_ADDRESS to a pointer

This isn't trivial when trying to be compatible with 32bit archs, hence
add a set of helper macro-like functions that make the conversion safe.

4 years agoboot: move TPM conditionalization into measure.h header
Lennart Poettering [Tue, 21 Sep 2021 13:39:47 +0000 (15:39 +0200)] 
boot: move TPM conditionalization into measure.h header

Let's move conditionalization of tpm_log_load_options() into the
measure.h to encapsulate the ifdeffery a bit more.

4 years agoboot: port more code over to get_file_info_harder()
Lennart Poettering [Tue, 21 Sep 2021 13:29:03 +0000 (15:29 +0200)] 
boot: port more code over to get_file_info_harder()

4 years agoboot: port more code to readdir_harder()
Lennart Poettering [Tue, 21 Sep 2021 13:24:50 +0000 (15:24 +0200)] 
boot: port more code to readdir_harder()

4 years agoboot: use _cleanup_freepool_ at more places
Lennart Poettering [Tue, 21 Sep 2021 13:20:40 +0000 (15:20 +0200)] 
boot: use _cleanup_freepool_ at more places

4 years agoboot: port more code to use open_directory() helper
Lennart Poettering [Tue, 21 Sep 2021 13:13:29 +0000 (15:13 +0200)] 
boot: port more code to use open_directory() helper

4 years agoboot: automatically load drop-in EFI drivers off the ESP
Lennart Poettering [Tue, 21 Sep 2021 12:47:05 +0000 (14:47 +0200)] 
boot: automatically load drop-in EFI drivers off the ESP

Fixes: #15617
4 years agoboot: split out code that loads the various menu entries into helper call
Lennart Poettering [Tue, 21 Sep 2021 12:45:55 +0000 (14:45 +0200)] 
boot: split out code that loads the various menu entries into helper call

Just some refactoring, no real code changes.

4 years agoboot: split out code that sets various EFI vars from main()
Lennart Poettering [Tue, 21 Sep 2021 12:36:56 +0000 (14:36 +0200)] 
boot: split out code that sets various EFI vars from main()

Just some refactoring, no actual code changes.

4 years agostub: make splash image payload const
Lennart Poettering [Mon, 20 Sep 2021 15:26:48 +0000 (17:26 +0200)] 
stub: make splash image payload const

4 years agostub: show splash screen earlier
Lennart Poettering [Tue, 21 Sep 2021 17:33:01 +0000 (19:33 +0200)] 
stub: show splash screen earlier

let's move showing of the splash screen to the earliest place we know
the splash bmp address. After all a splash screen is all about showing
as early as we can. This matters as doing TPM stuff or packing up a
large cpio might take time.

While we are at it, move the conditionalization of the splash screen
into the function instead of doing it ahead of calling it. This should
encapsulate things more nicely.

4 years agostub: split out code that sets the various efi vars into function of its own
Lennart Poettering [Tue, 21 Sep 2021 17:28:18 +0000 (19:28 +0200)] 
stub: split out code that sets the various efi vars into function of its own

Just some refactoring, no code changes beyond the splitting out.

4 years agoboot: unify code that measures image options/kernel command line
Lennart Poettering [Tue, 21 Sep 2021 17:27:25 +0000 (19:27 +0200)] 
boot: unify code that measures image options/kernel command line

4 years agoboot: stop making TPM PCR to measure kernel command line into configurable
Lennart Poettering [Mon, 20 Sep 2021 13:10:33 +0000 (15:10 +0200)] 
boot: stop making TPM PCR to measure kernel command line into configurable

Everyone appears to use PCR 8 for this, hence I think it's safe to
hardcode that in systemd too.

It's also documented, like here:

https://www.gnu.org/software/grub/manual/grub/html_node/Measured-Boot.html

or here:

https://github.com/rhboot/shim/blob/main/README.tpm

(And the previous name was a bit confusing, since we don't actually just
measure one thing anymore, but mutliple things into multiple PCRs...)

4 years agostub: when booting a kernel foo.efi then pack foo.efi.extra.d/*.{cred,raw} up as...
Lennart Poettering [Mon, 20 Sep 2021 11:47:32 +0000 (13:47 +0200)] 
stub: when booting a kernel foo.efi then pack foo.efi.extra.d/*.{cred,raw} up as synthetic initrd

This adds support for the EFI stub to look for credential files and
sysext files next to the EFI kernel image being loaded, and pack them up
in an initrd cpio image, and pass them to the kernel.

Specifically, for a kernel image foo.efi it looks for
foo.efi.extra.d/*.cred and packs these files up in an initrd, placing it
inside a directory /.extra/credentials/. It then looks for
foo.efi.extra.d/*.raw and pack these files up in an initrd, placing them
inside a directory /.extra/sysexts/. It then concatenates any other
initrd with these two initrds, so they are combined.

Or in other words auxiliary files placed next to the kernel image are
picked up automatically by the EFI stub and be made available in the
initrd in the /.extra/ directory.

What's the usecase for this? This is supposed to be useful in context of
implementing fully trusted initrds, i.e. initrds that are not built
locally on the system and unsigned/unmeasured – as we do things
currently —, but instead are built by the vendor, and measured to TPM.
The idea is that a basic initrd is always linked into the kernel EFI
image anyway. This will already be sufficient for many cases. However,
in some cases it is necessary to parameterize initrds, or to extend the
basic initrds with additional subsystems (e.g. think complex storage, or
passing server info/certificates/… to initrds). The idea is that the
parameterization is done using the "credentials" logic we already have
in systemd, with these credential files (which can optionally be
encrypted+authenticated by TPM2) being placed in the ESP next to the
kernel image. And the initrd extension via the "sysext" logic we already
have in systemd too.

Note that the files read by this code are not verified immediately, they
are copied *as-is* and placed into /.extra/ in the initrd. In a trusted
environment they need to be validated later, but before first use. For
the credentials logic this should be done via the TPM2
encryption/authentication logic. For the sysext stuff the idea is that
this is done via signed images, as implemented by #20691.

4 years agoboot: generalize sorting code
Lennart Poettering [Mon, 20 Sep 2021 12:07:42 +0000 (14:07 +0200)] 
boot: generalize sorting code

Let's make this generic, so that we can reuse it elsewhere later.

4 years agoboot: add a bunch of new helper calls
Lennart Poettering [Mon, 20 Sep 2021 11:47:44 +0000 (13:47 +0200)] 
boot: add a bunch of new helper calls

4 years agoboot: add a way to indicate overflow in ALIGN_TO()
Lennart Poettering [Fri, 17 Sep 2021 08:48:46 +0000 (10:48 +0200)] 
boot: add a way to indicate overflow in ALIGN_TO()

4 years agoupdate TODO
Lennart Poettering [Thu, 23 Sep 2021 15:07:25 +0000 (17:07 +0200)] 
update TODO

4 years agomkosi: turn off qemu headless mode
Lennart Poettering [Fri, 17 Sep 2021 09:16:36 +0000 (11:16 +0200)] 
mkosi: turn off qemu headless mode

We ship the mkosi files to make sure we can test our own code. A good
chunk of our code (and the main reason to use qemu rather than nspawn)
is the EFI code, i.e. in sd-boot and the EFI stub. Hence it's bad idea
to use qemu headless mode, since that means we bypass all that.

Let's hence toggle the defaults here, but keep the line in place, to
make it easy to switch back if someone wants the speed, rather than the
testing.

4 years agobootctl: Fix update not adding EFI entry if Boot IDs are non-consecutive
Anssi Hannula [Thu, 23 Sep 2021 09:08:05 +0000 (12:08 +0300)] 
bootctl: Fix update not adding EFI entry if Boot IDs are non-consecutive

"bootctl update" tries to add sd-boot to the EFI boot loader list if it
is not already there. To do so, it uses find_slot() which finds the
proper BootXXXX slot ID to use and also returns 1 if an existing sd-boot
entry was found at this ID or 0 if it is a new unused ID. In "update"
case install_variables() only writes the entry in case 0 (no existing
entry).

However, find_slot() erroneously returns 1 if it finds a gap in the Boot
IDs (i.e. when not resorting to max(ids) + 1). This causes
"bootctl update" to not add a missing systemd-boot boot entry if the
existing BootXXXX entry IDs are not consecutive.

Fix that by returning 0 in find_slot() when an empty gap ID is selected
to make it match the behavior when selecting an empty non-gap ID.

4 years agodocs: clarify order of events in cgroup scope creation
Alberto Mardegan [Thu, 23 Sep 2021 12:48:06 +0000 (15:48 +0300)] 
docs: clarify order of events in cgroup scope creation

4 years agouserdb: fix if-else to allow NameServiceSwitch lookups
Dan Streetman [Tue, 21 Sep 2021 21:47:55 +0000 (17:47 -0400)] 
userdb: fix if-else to allow NameServiceSwitch lookups

Fixes: #20809. Bug introduced in 8fbb1941f1a8c3d9eda920891b2b51a67f2a2375
4 years agosd-dhcp6-client: ignore IAs whose IAID do not match client's IAID
Yu Watanabe [Wed, 22 Sep 2021 07:35:56 +0000 (16:35 +0900)] 
sd-dhcp6-client: ignore IAs whose IAID do not match client's IAID

But do not refuse whole message.

Fixes #20803.

4 years agoMerge pull request #20736 from keszybz/ioprio-simplification
Luca Boccassi [Wed, 22 Sep 2021 14:46:50 +0000 (15:46 +0100)] 
Merge pull request #20736 from keszybz/ioprio-simplification

Use a simple kernel-compatible header for ioprio

4 years agoMerge pull request #20806 from fbuihuu/test-make-debug-tools-optional
Luca Boccassi [Wed, 22 Sep 2021 11:01:59 +0000 (12:01 +0100)] 
Merge pull request #20806 from fbuihuu/test-make-debug-tools-optional

test: make the installation of the debug tools optional in the image

4 years agoGet rid of ioprio.h and add a minimalistic reimplementation of the api 20736/head
Zbigniew Jędrzejewski-Szmek [Tue, 14 Sep 2021 14:45:07 +0000 (16:45 +0200)] 
Get rid of ioprio.h and add a minimalistic reimplementation of the api

4 years agoDefine ioprio_{get,set} the same as other compat syscalls
Zbigniew Jędrzejewski-Szmek [Tue, 14 Sep 2021 14:27:32 +0000 (16:27 +0200)] 
Define ioprio_{get,set} the same as other compat syscalls

4 years agovariuos: add missing includes
Zbigniew Jędrzejewski-Szmek [Tue, 14 Sep 2021 18:17:52 +0000 (20:17 +0200)] 
variuos: add missing includes

4 years agoMerge pull request #20767 from bluca/portable_extract_selinux
Zbigniew Jędrzejewski-Szmek [Wed, 22 Sep 2021 10:57:30 +0000 (12:57 +0200)] 
Merge pull request #20767 from bluca/portable_extract_selinux

portable: copy SELinux label when extracting units from images

4 years agoAdd Logitech USB-PS/2 M-BT96A to hwdb
John Lindgren [Wed, 22 Sep 2021 00:10:04 +0000 (20:10 -0400)] 
Add Logitech USB-PS/2 M-BT96A to hwdb

4 years agoMerge pull request #20756 from benzea/benzea/usb-persist
Luca Boccassi [Wed, 22 Sep 2021 09:50:07 +0000 (10:50 +0100)] 
Merge pull request #20756 from benzea/benzea/usb-persist

hwdb: Permit unsetting power/persist for USB devices

4 years agoMerge pull request #20800 from keszybz/smack-compilatio-fix
Yu Watanabe [Wed, 22 Sep 2021 07:56:37 +0000 (16:56 +0900)] 
Merge pull request #20800 from keszybz/smack-compilatio-fix

smack: move helper function to smack-util.c

4 years agotest: wc is needed by test/units/testsuite-50.sh 20806/head
Franck Bui [Wed, 22 Sep 2021 07:04:52 +0000 (09:04 +0200)] 
test: wc is needed by test/units/testsuite-50.sh

4 years agotest: make the installation of the debug tools optional in the image
Franck Bui [Wed, 22 Sep 2021 06:37:34 +0000 (08:37 +0200)] 
test: make the installation of the debug tools optional in the image

4 years agoMerge pull request #20652 from OnkelUlla/fix_systemd.netdev_manpage
Yu Watanabe [Wed, 22 Sep 2021 06:34:21 +0000 (15:34 +0900)] 
Merge pull request #20652 from OnkelUlla/fix_systemd.netdev_manpage

Some Fixes for SYSTEMD.NETDEV(5)

4 years agounit: install the systemd-bless-boot.service only if we have gnu-efi
Frantisek Sumsal [Tue, 21 Sep 2021 20:47:42 +0000 (22:47 +0200)] 
unit: install the systemd-bless-boot.service only if we have gnu-efi

Follow-up to #20591.

4 years agohwdb: update fingerprint autosuspend rules 20756/head
Benjamin Berg [Fri, 17 Sep 2021 10:57:31 +0000 (12:57 +0200)] 
hwdb: update fingerprint autosuspend rules

This pulls in a few new devices and adds ID_PERSIST=0.

4 years agohwdb: Permit unsetting power/persist for USB devices
Benjamin Berg [Wed, 15 Sep 2021 16:37:24 +0000 (18:37 +0200)] 
hwdb: Permit unsetting power/persist for USB devices

The USB persist feature allows devices that can retain their state when
powered down to work across suspend/resume. This is in particular useful
for USB drives.

However, the persist feature can get in the way for devices that are
unable to retain their state when power is lost. An example of such
stateful devices are fingerprint readers where USB persist should be
disabled to ensure userspace can detect whether the USB device had a
power loss during system suspend.

This will initially be used by the libfprint autosuspend hwdb.

Closes: #20754
4 years agomeson: ignore -Dsmack-run-label= if -Dsmack=false 20800/head
Zbigniew Jędrzejewski-Szmek [Tue, 21 Sep 2021 17:53:20 +0000 (19:53 +0200)] 
meson: ignore -Dsmack-run-label= if -Dsmack=false

Compilation would fail because we could have HAVE_SMACK_RUN_LABEL without
HAVE_SMACK. This doesn't make much sense, so let's just make -Dsmack=false
completely disable smack.

Also, the logic in smack-setup.c seems dubious: '#ifdef SMACK_RUN_LABEL'
would evaluate to true even if -Dsmack-run-label='' is used. I think
this was introduced in the conversion to meson:
8b197c3a8a57c3f7c231b39e5660856fd9580c80 added

AC_ARG_WITH(smack-run-label,
AS_HELP_STRING([--with-smack-run-label=STRING],
        [run systemd --system with a specific SMACK label]),
        [AC_DEFINE_UNQUOTED(SMACK_RUN_LABEL, ["$withval"], [Run with a smack label])],
        [])

i.e. it really was undefined if not specified. And it was same
still in 72cdb3e783174dcf9223a49f03e3b0e2ca95ddb8 when configure.ac
was dropped.

So let's use the single conditional HAVE_SMACK_RUN_LABEL everywhere.

4 years agomkosi: Fix CI
Daan De Meyer [Fri, 17 Sep 2021 09:57:39 +0000 (10:57 +0100)] 
mkosi: Fix CI

\#20629 moved the mkosi configs to mkosi.default.d/ so we were building
for the host distro (Ubuntu) in each CI configuration. To fix it, we
write the distro we want to test to a mkosi.default file and mkosi
will apply the other necessary configs automatically from mkosi.default.d/<distro>

This commit also removes unnecessary CLI options that are already handled
by the config files.

4 years agosmack: move helper function to smack-util.c
Zbigniew Jędrzejewski-Szmek [Tue, 21 Sep 2021 16:29:23 +0000 (18:29 +0200)] 
smack: move helper function to smack-util.c

The function was in basic/fileio.c, but it's more appropriate to
keep it out of src/basic.

Fixes compilation with -Dsmack-run-label= set.

4 years agoMerge pull request #20690 from DaanDeMeyer/oomd-user-services
Luca Boccassi [Tue, 21 Sep 2021 14:39:48 +0000 (15:39 +0100)] 
Merge pull request #20690 from DaanDeMeyer/oomd-user-services

oom: Support for user services

4 years agomeson: fix creation of man pages indices
Zbigniew Jędrzejewski-Szmek [Tue, 21 Sep 2021 08:59:13 +0000 (10:59 +0200)] 
meson: fix creation of man pages indices

Fixes #20795. Bug introduced in f12c5d36a9a162f833987b03fbf0b65248581cbb.

4 years agoDrop bundled copy of linux/if_arp.h
Zbigniew Jędrzejewski-Szmek [Wed, 15 Sep 2021 14:33:05 +0000 (16:33 +0200)] 
Drop bundled copy of linux/if_arp.h

As far as I can see, we use this to get a list of ARPHRD_* defines (used in
particular for Type= in .link files). If we drop our copy, and build against
old kernel headers, the user will have a shorter list of types available.  This
seems OK, and I don't think it's worth carrying our own version of this file
just to have newest possible entries.

7c5b9952c4f6e2b72f90edbe439982528b7cf223 recently updated this file, but we'd
have to update it every time the kernel adds new entries. But if we look at
the failure carefully:

src/basic/arphrd-from-name.gperf:65:16: error: ‘ARPHRD_MCTP’ undeclared (first use in this function); did you mean ‘ARPHRD_FCPP’?
   65 | MCTP, ARPHRD_MCTP
      |                ^~
      |                ARPHRD_FCPP

we see that the list we were generating was from the system headers, so it was
only as good as the system headers anyway, without the newer entries in our
bundled copy, if there were any. So let's make things simpler by always using
system headers.

And if somebody wants to fix things so that we always have the newest list,
then we should just generate and store the converted list, not the full header.

4 years agoMerge pull request #20790 from poettering/boot-fixes
Lennart Poettering [Tue, 21 Sep 2021 09:35:04 +0000 (11:35 +0200)] 
Merge pull request #20790 from poettering/boot-fixes

various EFI/boot fixes

4 years agostub: prepare section pointers in separate steps 20790/head
Lennart Poettering [Fri, 17 Sep 2021 08:15:57 +0000 (10:15 +0200)] 
stub: prepare section pointers in separate steps

In a follow-up patch we are going to modify the initrd, hence prepare
the pointers/"physical addresses" to it, first, so that we can do so
easily.

Also, do some other tweaks and cleanups to physical address/pointer
conversion.

4 years agostub: use proper enums instead of hardcoded numeric indexes for identifying PE sections
Lennart Poettering [Thu, 16 Sep 2021 21:59:39 +0000 (23:59 +0200)] 
stub: use proper enums instead of hardcoded numeric indexes for identifying PE sections

4 years agoboot: ReallocatePool() supports NULL pointers as first argument
Lennart Poettering [Mon, 20 Sep 2021 12:06:23 +0000 (14:06 +0200)] 
boot: ReallocatePool() supports NULL pointers as first argument

Just like userspace realloc() the EFIlib ReallocatePool() function is
happy to use a NULL pointer as input, in which case it is equivalent to
AllocatePool(). See:

https://github.com/vathpela/gnu-efi/blob/269ef9dbc77ebec2723e0e6ae082bbca9516f5f1/lib/misc.c#L57

4 years agoboot: modernize measure.c
Lennart Poettering [Mon, 20 Sep 2021 11:33:18 +0000 (13:33 +0200)] 
boot: modernize measure.c

Let's use _cleanup_freepool_, compound literals for initialization,
OFFSETOF() and let's remove some unnecessary casts.

No change in behaviour.

4 years agoboot: move TCG/TPM protocol definitions into missing_efi.h
Lennart Poettering [Mon, 20 Sep 2021 11:32:12 +0000 (13:32 +0200)] 
boot: move TCG/TPM protocol definitions into missing_efi.h

That's what it is for...