]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 years agofdisk-util: add fdisk_partition_get_uuid_as_id128() helper
Lennart Poettering [Tue, 29 Nov 2022 10:54:22 +0000 (11:54 +0100)] 
fdisk-util: add fdisk_partition_get_uuid_as_id128() helper

Inspired by: #25534

3 years agokernel-install: Add uki layout
Joerg Behrmann [Wed, 23 Nov 2022 15:43:19 +0000 (16:43 +0100)] 
kernel-install: Add uki layout

Currently the kernel-install man page only documents the bls layout for use
with the boot loader spec type #1. 90-loaderentry.install uses this layout to
generate loader entries and copy the kernel image and initrd to $BOOT.

This commit documents a second layout "uki" and adds 90-uki-copy.install,
which copies a UKI "uki.efi" from the staging area or any file with the .efi
extension given on the command line to
$BOOT/EFI/Linux/$ENTRY_TOKEN-$KERNEl_VERSION(+$TRIES).efi

This allows for both locally generated and distro-provided UKIs to be handled
by kernel-install.

3 years agoupdate TODO
Lennart Poettering [Tue, 29 Nov 2022 09:47:39 +0000 (10:47 +0100)] 
update TODO

3 years agoMerge pull request #25132 from yuwata/core-device-inactivate-removed-device-on-switch...
Daan De Meyer [Tue, 29 Nov 2022 09:27:34 +0000 (10:27 +0100)] 
Merge pull request #25132 from yuwata/core-device-inactivate-removed-device-on-switching-root

core/device: inactivate removed device on switching root

3 years agorepart: Add split path to table output 25465/head
Daan De Meyer [Thu, 24 Nov 2022 19:08:09 +0000 (20:08 +0100)] 
repart: Add split path to table output

3 years agorepart: Make sure we cleanup image file on failure if we create it
Daan De Meyer [Thu, 24 Nov 2022 09:07:32 +0000 (10:07 +0100)] 
repart: Make sure we cleanup image file on failure if we create it

3 years agorepart: Inline Partition and Context typedefs
Daan De Meyer [Thu, 24 Nov 2022 09:05:32 +0000 (10:05 +0100)] 
repart: Inline Partition and Context typedefs

3 years agorepart: Remove leftover debug statement
Daan De Meyer [Thu, 24 Nov 2022 09:03:15 +0000 (10:03 +0100)] 
repart: Remove leftover debug statement

3 years agorepart: Move backing_fd, node and from_scratch variables into Context
Daan De Meyer [Thu, 24 Nov 2022 08:59:59 +0000 (09:59 +0100)] 
repart: Move backing_fd, node and from_scratch variables into Context

3 years agorepart: Make sure split partition files are cleaned up on failure
Daan De Meyer [Thu, 24 Nov 2022 08:50:04 +0000 (09:50 +0100)] 
repart: Make sure split partition files are cleaned up on failure

3 years agorepart: Refactor split names
Daan De Meyer [Wed, 23 Nov 2022 14:55:16 +0000 (15:55 +0100)] 
repart: Refactor split names

3 years agorepart: Make sure we clean up temporary files created in context_minimize()
Daan De Meyer [Thu, 24 Nov 2022 19:16:01 +0000 (20:16 +0100)] 
repart: Make sure we clean up temporary files created in context_minimize()

3 years agoMerge pull request #25508 from enr0n/test-various-fixes
Yu Watanabe [Tue, 29 Nov 2022 04:46:39 +0000 (13:46 +0900)] 
Merge pull request #25508 from enr0n/test-various-fixes

Fix test failures found in Ubuntu autopkgtest

3 years agoMerge pull request #25536 from yuwata/sd-netlink-several-fixes
Yu Watanabe [Tue, 29 Nov 2022 01:35:07 +0000 (10:35 +0900)] 
Merge pull request #25536 from yuwata/sd-netlink-several-fixes

sd-netlink: several fixes

3 years agoMerge pull request #25552 from yuwata/network-ndisc-trivial-fixes
Yu Watanabe [Tue, 29 Nov 2022 01:33:33 +0000 (10:33 +0900)] 
Merge pull request #25552 from yuwata/network-ndisc-trivial-fixes

network: NDisc: trivial fixes

3 years agoMerge pull request #25532 from Werkov/fix-cgtop-args
Luca Boccassi [Mon, 28 Nov 2022 21:20:47 +0000 (22:20 +0100)] 
Merge pull request #25532 from Werkov/fix-cgtop-args

cgtop: Do not rewrite -P or -k options

3 years agohwdb: Add support for Elgato Stream Pedal (#25550)
Tonći Galić [Mon, 28 Nov 2022 20:15:25 +0000 (21:15 +0100)] 
hwdb: Add support for Elgato Stream Pedal (#25550)

This adds the [Elgato Stream Pedal](https://www.elgato.com/en/stream-deck-pedal)
as part of the supported family

3 years agonetwork: drop invalid and unused flag 25552/head
Yu Watanabe [Mon, 28 Nov 2022 19:30:38 +0000 (04:30 +0900)] 
network: drop invalid and unused flag

Route.flags can only take RTNH_F_ONLINK, and other flags are silently
dropped.

3 years agonetwork: fix indentation
Yu Watanabe [Mon, 28 Nov 2022 19:30:12 +0000 (04:30 +0900)] 
network: fix indentation

3 years agotest: handle Debian's /etc/default/locale in testsuite-74.firstboot.sh 25508/head
Nick Rosbrook [Tue, 22 Nov 2022 17:50:33 +0000 (12:50 -0500)] 
test: handle Debian's /etc/default/locale in testsuite-74.firstboot.sh

This handles a Debian-specific quirk where /etc/default/locale is used
instead of /etc/locale.conf. There is currently special handling for
this in testsuite-73.sh, so the quirk should be handled here too for
consistency.

3 years agotest: make sure mount point exists in testsuite-64.sh
Nick Rosbrook [Tue, 22 Nov 2022 17:43:51 +0000 (12:43 -0500)] 
test: make sure mount point exists in testsuite-64.sh

3 years agoMerge pull request #25496 from DaanDeMeyer/repart-optimize
Luca Boccassi [Mon, 28 Nov 2022 14:51:32 +0000 (15:51 +0100)] 
Merge pull request #25496 from DaanDeMeyer/repart-optimize

repart: Prefer using loop devices to populate filesystems when available

3 years agoMerge pull request #25222 from medhefgo/stub-cmdline
Luca Boccassi [Mon, 28 Nov 2022 14:49:17 +0000 (15:49 +0100)] 
Merge pull request #25222 from medhefgo/stub-cmdline

stub: Fix cmdline handling

3 years agotest: Add tests for systemd-cgtop args parsing 25532/head
Michal Koutný [Fri, 25 Nov 2022 17:14:22 +0000 (18:14 +0100)] 
test: Add tests for systemd-cgtop args parsing

3 years agocgtop: Do not rewrite -P or -k options
Michal Koutný [Fri, 25 Nov 2022 16:50:27 +0000 (17:50 +0100)] 
cgtop: Do not rewrite -P or -k options

--recursive=no will overwrite possible -P or -k option hence making the
recursive disabling impossible.

Check what counting types the system supports (encoded in the ordering
of our enum) of and pick whatever user requests but is also supported.

Fixes: #25248
3 years agorepart: Prefer using loop devices to populate filesystems when available 25496/head
Daan De Meyer [Wed, 23 Nov 2022 11:00:01 +0000 (12:00 +0100)] 
repart: Prefer using loop devices to populate filesystems when available

Let's make sure we use loop devices if we have access to them and
only fall back to regular files if we can't use loop devices. We
prefer loop devices because when using mkfs --root options, we have
to populate a temporary staging tree which means we're copying every
file twice instead of once when using loop devices.

3 years agorepart: Make sure all files in the image are owned by root
Daan De Meyer [Wed, 23 Nov 2022 11:07:27 +0000 (12:07 +0100)] 
repart: Make sure all files in the image are owned by root

3 years agorepart: Move comment
Daan De Meyer [Wed, 23 Nov 2022 09:26:33 +0000 (10:26 +0100)] 
repart: Move comment

3 years agostub: Detect empty LoadOptions when run from EFI shell 25222/head
Jan Janssen [Wed, 2 Nov 2022 09:25:32 +0000 (10:25 +0100)] 
stub: Detect empty LoadOptions when run from EFI shell

The EFI shell will pass the entire command line to the application it
starts, which includes the file path of the stub binary. This prevents
us from using the built-in cmdline if the command line is otherwise
empty.

Fortunately, the EFI shell registers a protocol on any images it starts
this way. The protocol even lets us access the args individually, making
it easy to strip the stub path off.

Fixes: #25201
3 years agosystemctl: deprecate passing positional argument to reboot completely
Mike Yuan [Wed, 23 Nov 2022 18:39:15 +0000 (02:39 +0800)] 
systemctl: deprecate passing positional argument to reboot completely
(follow-up of #15958)

In #15958 we deprecated passing positional argument to reboot by
generate a warning. It's been two years now and I believe it can
be dropped completely, as per requested in #15773.

3 years agopam: add a call to pam_namespace 25502/head
Zbigniew Jędrzejewski-Szmek [Wed, 23 Nov 2022 15:09:56 +0000 (16:09 +0100)] 
pam: add a call to pam_namespace

A call to pam_namespace is required so that children of user@.service end up in
a namespace as expected. pam_namespace gets called as part of the stack that
creates a session (login, sshd, gdm, etc.) and those processes end up in a
namespace, but it also needs to be called from our stack which is parallel and
descends from pid1 itself.

The call to pam_namespace is similar to the call to pam_keyinit that was added
in ab79099d1684457d040ee7c28b2012e8c1ea9a4f. The pam stack for user@.service
creates a new session which is disconnected from the parent environment. Both
calls are not suitable for inclusion in the shared part of the stack (e.g.
@system-auth on Fedora/RHEL systems), because for example su/sudo/runuser
should not include them.

Fixes #17043 (Allow to execute user service into dedicated namespace
              if pam_namespace enabled)
Related to https://bugzilla.redhat.com/show_bug.cgi?id=1861836
(Polyinstantiation is ignored/bypassed in GNOME sessions)

3 years agoresolve: format zero-length RDATA according to rfc3597 25537/head
Evgeny Vereshchagin [Sat, 26 Nov 2022 12:02:46 +0000 (12:02 +0000)] 
resolve: format zero-length RDATA according to rfc3597

If the RDATA is of zero length, the text representation contains only
the \# token and the single zero representing the length.

3 years agotests: add a file triggering "applying zero offset to null pointer"
Evgeny Vereshchagin [Sat, 26 Nov 2022 11:57:22 +0000 (11:57 +0000)] 
tests: add a file triggering "applying zero offset to null pointer"

```
../src/basic/hexdecoct.c:66:44: runtime error: applying zero offset to null pointer
    #0 0x7f6022650c44 in hexmem /home/vagrant/systemd/build-fuzzers/../src/basic/hexdecoct.c:66:44
    #1 0x577583 in dns_resource_record_to_string /home/vagrant/systemd/build-fuzzers/../src/resolve/resolved-dns-rr.c:1140:21
    #2 0x563669 in LLVMFuzzerTestOneInput /home/vagrant/systemd/build-fuzzers/../src/resolve/fuzz-resource-record.c:25:39
    #3 0x44d2a1 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) (/home/vagrant/systemd/out/fuzz-resource-record+0x44d2a1) (BuildId: 88135c111396e9441a475302ccabd2f9a58c7e89)
    #4 0x42d32f in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) (/home/vagrant/systemd/out/fuzz-resource-record+0x42d32f) (BuildId: 88135c111396e9441a475302ccabd2f9a58c7e89)
    #5 0x434920 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (/home/vagrant/systemd/out/fuzz-resource-record+0x434920) (BuildId: 88135c111396e9441a475302ccabd2f9a58c7e89)
    #6 0x424006 in main (/home/vagrant/systemd/out/fuzz-resource-record+0x424006) (BuildId: 88135c111396e9441a475302ccabd2f9a58c7e89)
    #7 0x7f602142950f in __libc_start_call_main (/lib64/libc.so.6+0x2950f) (BuildId: 85c438f4ff93e21675ff174371c9c583dca00b2c)
    #8 0x7f60214295c8 in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x295c8) (BuildId: 85c438f4ff93e21675ff174371c9c583dca00b2c)
    #9 0x424044 in _start (/home/vagrant/systemd/out/fuzz-resource-record+0x424044) (BuildId: 88135c111396e9441a475302ccabd2f9a58c7e89)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/basic/hexdecoct.c:66:44 in
```

3 years agotests: fuzz dns resource records
Evgeny Vereshchagin [Fri, 25 Nov 2022 20:00:30 +0000 (20:00 +0000)] 
tests: fuzz dns resource records

It should help to catch issues like https://github.com/systemd/systemd/issues/19584,
https://github.com/systemd/systemd/issues/25449.

3 years agosd-netlink: append instead of prepend multipart message 25536/head
Yu Watanabe [Sat, 26 Nov 2022 00:46:40 +0000 (09:46 +0900)] 
sd-netlink: append instead of prepend multipart message

Previously, e.g., networkd enumerated network interfaces with ifindex
in a decreasing order, as sd-netlink inverses the order of the received
multipart messages.
Let's keep the order of the multipart messages. Hopefully this changes
no behavior, as our code do not depend on the order of the received
multipart messages.

Before:
===
Nov 26 09:35:10 systemd[1]: Starting Network Configuration...
Nov 26 09:35:11 systemd-networkd[36185]: wlp59s0: Saved new link: ifindex=3, iftype=ETHER(1), kind=n/a
Nov 26 09:35:12 systemd-networkd[36185]: enp0s31f6: Saved new link: ifindex=2, iftype=ETHER(1), kind=n/a
Nov 26 09:35:12 systemd-networkd[36185]: lo: Saved new link: ifindex=1, iftype=LOOPBACK(772), kind=n/a

After:
===
Nov 26 09:45:18 systemd[1]: Starting Network Configuration...
Nov 26 09:45:19 systemd-networkd[38372]: lo: Saved new link: ifindex=1, iftype=LOOPBACK(772), kind=n/a
Nov 26 09:45:19 systemd-networkd[38372]: enp0s31f6: Saved new link: ifindex=2, iftype=ETHER(1), kind=n/a
Nov 26 09:45:19 systemd-networkd[38372]: wlp59s0: Saved new link: ifindex=3, iftype=ETHER(1), kind=n/a

3 years agosd-netlink: do not link non-multipart messages
Yu Watanabe [Sat, 26 Nov 2022 00:35:53 +0000 (09:35 +0900)] 
sd-netlink: do not link non-multipart messages

Previously, if a single packet contains multiple non-multipart messages,
then the messages were linked and saved as a single entry, especially
even if the messages has different serial numbers. Though, not sure if
the kernel sends such packet. But at least for safety, let's link only
multipart messages.

3 years agosd-netlink: split out parse_message_one() from socket_read_message()
Yu Watanabe [Sat, 26 Nov 2022 00:17:14 +0000 (09:17 +0900)] 
sd-netlink: split out parse_message_one() from socket_read_message()

No functional change, just refactoring and preparation for later
commits.

3 years agosd-netlink: do not use serials currently queued
Yu Watanabe [Sat, 26 Nov 2022 01:14:00 +0000 (10:14 +0900)] 
sd-netlink: do not use serials currently queued

3 years agosd-netlink: also manage received messages by serial
Yu Watanabe [Sat, 26 Nov 2022 02:17:36 +0000 (11:17 +0900)] 
sd-netlink: also manage received messages by serial

Then, we can easily find the received message matching with requested
serial.

3 years agosd-netlink: reimplement received message queue
Yu Watanabe [Sat, 26 Nov 2022 01:10:58 +0000 (10:10 +0900)] 
sd-netlink: reimplement received message queue

By using OrderedSet and Hashmap, we can drop all memmove() calls.
No functional changes, just refactoring.

3 years agosd-netlink: introduce netlink_queue_received_message() and friend
Yu Watanabe [Sat, 26 Nov 2022 01:06:05 +0000 (10:06 +0900)] 
sd-netlink: introduce netlink_queue_received_message() and friend

No functional change, just refactoring.

3 years agosd-netlink: fix segfault
Yu Watanabe [Sat, 26 Nov 2022 00:57:16 +0000 (09:57 +0900)] 
sd-netlink: fix segfault

3 years agosd-netlink: fix possible use-after-free
Yu Watanabe [Thu, 24 Nov 2022 18:36:39 +0000 (03:36 +0900)] 
sd-netlink: fix possible use-after-free

When we receive a multi-part message and fail to parse it, then
the prviously received message is freed with the _cleanup_ attribute,
but still referenced by sd_netlink.rqueue_partial. That causes
use-after-free when we receive another multi-part message.

3 years agosd-netlink: return earlier when received invalid message
Yu Watanabe [Thu, 24 Nov 2022 18:33:52 +0000 (03:33 +0900)] 
sd-netlink: return earlier when received invalid message

3 years agosd-netlink: allocate read buffer when necessary
Yu Watanabe [Thu, 24 Nov 2022 17:56:42 +0000 (02:56 +0900)] 
sd-netlink: allocate read buffer when necessary

3 years agosd-netlink: check received size in socket_recv_message()
Yu Watanabe [Thu, 24 Nov 2022 17:55:32 +0000 (02:55 +0900)] 
sd-netlink: check received size in socket_recv_message()

No functional change, just refactoring and slightly shorten
socket_read_message().

3 years agosd-netlink: drop redundant 'else'
Yu Watanabe [Thu, 24 Nov 2022 17:41:57 +0000 (02:41 +0900)] 
sd-netlink: drop redundant 'else'

3 years agosd-netlink: always initialize return variable on success
Yu Watanabe [Thu, 24 Nov 2022 17:34:57 +0000 (02:34 +0900)] 
sd-netlink: always initialize return variable on success

3 years agofdisk: introduce common fdisk_new_context_fd() helper
Lennart Poettering [Wed, 23 Nov 2022 15:23:35 +0000 (16:23 +0100)] 
fdisk: introduce common fdisk_new_context_fd() helper

We do the same thing over and over again and it's a bit ugly, hence
let's unify the code for it at one common place.

3 years agoMerge pull request #25533 from keszybz/meson-fixups
Yu Watanabe [Sat, 26 Nov 2022 02:27:34 +0000 (11:27 +0900)] 
Merge pull request #25533 from keszybz/meson-fixups

Meson fixups

3 years agodissect: don't pre-open swap devices, we are not going to use them
Lennart Poettering [Tue, 25 Oct 2022 15:39:00 +0000 (17:39 +0200)] 
dissect: don't pre-open swap devices, we are not going to use them

3 years agorepart: Remove bogus check
Daan De Meyer [Fri, 25 Nov 2022 14:09:53 +0000 (15:09 +0100)] 
repart: Remove bogus check

The --empty option applies to the partition table of the block
device, not the number of definition files we've read. Also, even
if we don't find any definition files, let's not shortcut execution
so we can run repart on a device/loopback file to get information
on the partition table.

3 years agologind: Properly unescape names of lingering users
Michal Koutný [Fri, 25 Nov 2022 16:25:36 +0000 (17:25 +0100)] 
logind: Properly unescape names of lingering users

Filenames to store user linger requests are created with C-escaping.
When we enumerate the files to acquire ligering users, we use the
filenames verbatim. In the case C-escaping is not an identity map (such
as "DOMAIN\User"), we won't be able to start user instances of
such mangled users.

Unescape filenames when we treat them as usernames again.

Fixes: #25448
3 years agoMerge pull request #25530 from poettering/resolved-stub-name
Yu Watanabe [Fri, 25 Nov 2022 23:26:28 +0000 (08:26 +0900)] 
Merge pull request #25530 from poettering/resolved-stub-name

resolved: make _localdnsstub and _localdnsproxy resolve to 127.0.0.{53,54}

3 years agoFix typo
jcg [Sun, 20 Nov 2022 06:59:36 +0000 (14:59 +0800)] 
Fix typo

3 years agounits: Use BindsTo=systemd-networkd in systemd-networkd-wait-online.service
Daan De Meyer [Fri, 25 Nov 2022 13:32:20 +0000 (14:32 +0100)] 
units: Use BindsTo=systemd-networkd in systemd-networkd-wait-online.service

We don't want systemd-networkd-wait-online to start if systemd-networkd
is skipped due to condition failures. This is only guaranteed by BindsTo=
and not Requires=, so let's use BindsTo=

3 years agotests: add a file triggering crash in type_bitmap_to_json
Evgeny Vereshchagin [Fri, 25 Nov 2022 19:32:04 +0000 (19:32 +0000)] 
tests: add a file triggering crash in type_bitmap_to_json

It's a follow-up to https://github.com/systemd/systemd/pull/25518

3 years agoMerge pull request #25498 from medhefgo/stub-splash
Luca Boccassi [Fri, 25 Nov 2022 18:38:47 +0000 (19:38 +0100)] 
Merge pull request #25498 from medhefgo/stub-splash

stub: Fix splash alpha blending

3 years agopo: Translated using Weblate (Indonesian)
Andika Triwidada [Fri, 25 Nov 2022 08:19:58 +0000 (09:19 +0100)] 
po: Translated using Weblate (Indonesian)

Currently translated at 100.0% (193 of 193 strings)

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

3 years agomeson: regenerate meson rules 25533/head
Zbigniew Jędrzejewski-Szmek [Fri, 25 Nov 2022 15:26:29 +0000 (16:26 +0100)] 
meson: regenerate meson rules

Forgotten in 85bc6b05491fb4c9f40f8a0e8615ac5321efbea0.

3 years agomeson: resort imports
Zbigniew Jędrzejewski-Szmek [Wed, 16 Nov 2022 14:52:15 +0000 (15:52 +0100)] 
meson: resort imports

3 years agoresolved: introduce common macro for 127.0.0.2 IP address 25530/head
Lennart Poettering [Fri, 25 Nov 2022 13:50:59 +0000 (14:50 +0100)] 
resolved: introduce common macro for 127.0.0.2 IP address

3 years agoresolved: introduce the _localdnsstub and _localdnsproxy special hostnames for 127...
Lennart Poettering [Fri, 25 Nov 2022 11:15:56 +0000 (12:15 +0100)] 
resolved: introduce the _localdnsstub and _localdnsproxy special hostnames for 127.0.0.54 + 127.0.0.53

Let's give these special IP addresses names. After all name resolution
is our job here.

Fixes: #23623
3 years agoresolved: don't filter _gateway/_outbound twice
Lennart Poettering [Fri, 25 Nov 2022 11:13:20 +0000 (12:13 +0100)] 
resolved: don't filter _gateway/_outbound twice

We already denied being responsible for these names further up, no need
to test for them again.

3 years agoresolved: in dns stub always report "lo" as interface for "localhost"
Lennart Poettering [Fri, 25 Nov 2022 11:09:33 +0000 (12:09 +0100)] 
resolved: in dns stub always report "lo" as interface for "localhost"

Previously, we'd return the ifindex the user asked on, and if none was
specified "lo". Let's always return "lo".

This should be a better choice usually, since localhost addresses are
typically not reachable over arbitrary interfaces once SO_BINDTODEVICE
or so is used. Hence, let's report the interface that is always right
for these addresses.

3 years agoupdate TODO
Lennart Poettering [Fri, 25 Nov 2022 16:33:56 +0000 (17:33 +0100)] 
update TODO

3 years agomkfs-util: Drop batch (b) and n flags from mcopy
Daan De Meyer [Fri, 25 Nov 2022 11:54:33 +0000 (12:54 +0100)] 
mkfs-util: Drop batch (b) and n flags from mcopy

The batch flag is bugged on older versions of mcopy causing failures
such as:

```
Internal error, size too big
Streamcache allocation problem:: 5
```

It's also a little unclear what the batch flag actually does, so since
everything still works without it, it doesn't hurt to remove it.

The n flag only applies when copying from fat to unix which we don't do
so it doesn't make sense in this scenario.

3 years agoMerge pull request #25482 from DaanDeMeyer/repart-skip-partitions
Daan De Meyer [Fri, 25 Nov 2022 12:31:09 +0000 (13:31 +0100)] 
Merge pull request #25482 from DaanDeMeyer/repart-skip-partitions

repart: Add --skip-partitions=

3 years agorepart: Add --skip-partitions= 25482/head
Daan De Meyer [Tue, 22 Nov 2022 13:27:30 +0000 (14:27 +0100)] 
repart: Add --skip-partitions=

--include-partitions and --exclude-partitions now fully exclude
partitions from repart. Whenever a partition type is excluded, we
don't take any partitions of that type into account at all when
running systemd-repart.

--skip-partitions= is introduced to do what --exclude-partitions did
previously. Any skipped partitions are taken into acount when doing
size calculations, but are not yet populated.

Why do we need both concepts? Exclusion is needed so that we can
use shared repart definitions to generate bootable and non-bootable
images. When generating a non-bootable image, we use --exclude-partitions
to exclude the ESP partition. Skipping is needed so that we can
populate the root partition while skipping the ESP partition, get
the roothash of the root partition, use that to generate a UKI, and
finally populate the ESP partition with the UKI included.

3 years agoresolved: remove inappropriate assert()
Lennart Poettering [Thu, 24 Nov 2022 17:42:08 +0000 (18:42 +0100)] 
resolved: remove inappropriate assert()

A NULL Bitmap object is by all our code considered identical to an empty
bitmap. Hence let's remove the entirely unnecessary assert().

The assert() can be triggered if debug monitoring is used an an empty
NSEC or NSEC3 RR is included in an answer resolved returns.

it's not really a security issue since enabling debug monitoring is a
manual step requiring root privileges, that is off by default. Moreover,
it's a "clean" assert(), i.e. the worst that happens is tha a coredump
is generated and resolved restarted.

Fixes: #25449
3 years agoMerge pull request #25473 from yuwata/mount-tool-cleanups
Luca Boccassi [Thu, 24 Nov 2022 19:40:37 +0000 (20:40 +0100)] 
Merge pull request #25473 from yuwata/mount-tool-cleanups

mount-tool: several cleanups

3 years agounits: fix typo in Condition in systemd-boot-system-token
Luca Boccassi [Thu, 24 Nov 2022 10:01:59 +0000 (10:01 +0000)] 
units: fix typo in Condition in systemd-boot-system-token

/lib/systemd/system/systemd-boot-system-token.service:20: Unknown key name 'ConditionPathExists|' in section 'Unit', ignoring

Follow-up for 0a1d8ac77a21ae0741bdf4af08f3a71354805ff1

3 years agoMerge pull request #25500 from DaanDeMeyer/mcopy-skip-symlinks
Daan De Meyer [Thu, 24 Nov 2022 15:28:01 +0000 (16:28 +0100)] 
Merge pull request #25500 from DaanDeMeyer/mcopy-skip-symlinks

mkfs-util: Skip symlinks when calling mcopy

3 years agostub: Small code style changes 25498/head
Jan Janssen [Thu, 24 Nov 2022 13:03:01 +0000 (14:03 +0100)] 
stub: Small code style changes

No actual changes in behavior.

3 years agomkfs-util: Skip non files/directories when calling mcopy 25500/head
Daan De Meyer [Wed, 23 Nov 2022 13:12:38 +0000 (14:12 +0100)] 
mkfs-util: Skip non files/directories when calling mcopy

Only files and directories are supported by vfat. When we pass a
symlink to mcopy, it will try to dereference them and copy what the
symlink points at into the vfat partition instead. Let's avoid this
by skipping all unsupported file types when establishing the list of
top level targets that mcopy should copy.

We also use RECURSE_DIR_SORT everywhere when iterating directories
to make things more reproducible.

3 years agorecurse-dir: Handle RECURSE_DIR_ENSURE_TYPE in readdir_all()
Daan De Meyer [Thu, 24 Nov 2022 12:13:21 +0000 (13:13 +0100)] 
recurse-dir: Handle RECURSE_DIR_ENSURE_TYPE in readdir_all()

3 years agostub: Fix splash alpha blending
Jan Janssen [Wed, 23 Nov 2022 12:57:34 +0000 (13:57 +0100)] 
stub: Fix splash alpha blending

How to interpret the pixel format depends on the masks in the DIB header
(if present). Also, 16bpp (unlike 24bpp) can carry an alpha channel.
This was previously not accounted for.

3 years agodirent-util: Expose dirent_ensure_type()
Daan De Meyer [Thu, 24 Nov 2022 12:13:05 +0000 (13:13 +0100)] 
dirent-util: Expose dirent_ensure_type()

3 years agomkfs-util: Check if mcopy is installed
Daan De Meyer [Wed, 23 Nov 2022 09:05:23 +0000 (10:05 +0100)] 
mkfs-util: Check if mcopy is installed

3 years agosystemd: Default to OOMPolicy=continue for login session scopes 25385/head
Mark Laws [Thu, 24 Nov 2022 05:56:29 +0000 (14:56 +0900)] 
systemd: Default to OOMPolicy=continue for login session scopes

If the kernel OOM kills a process under a login session scope, we don't want to
kill the user's other processes for no good reason.

3 years agosystemd: Support OOMPolicy in scope units
Mark Laws [Mon, 14 Nov 2022 12:48:09 +0000 (21:48 +0900)] 
systemd: Support OOMPolicy in scope units

Closes #25376.

3 years agoMerge pull request #25509 from enr0n/oomd-unpriv-container-fix
Luca Boccassi [Thu, 24 Nov 2022 10:21:16 +0000 (11:21 +0100)] 
Merge pull request #25509 from enr0n/oomd-unpriv-container-fix

Fix `oomd_fetch_cgroup_oom_preference()` for unprivileged LXD containers

3 years agoshared: use move_pivot_root() for services
Christian Brauner [Wed, 23 Nov 2022 15:15:20 +0000 (16:15 +0100)] 
shared: use move_pivot_root() for services

Currently, services use mount_move_root() in order to setup the root
directory of services using a mount namespace. This relies on MS_MOVE
and chroot(). However, this has serious drawbacks even for relatively
simple mount propagation scenarios.

What systemd currently does is roughly equivalent to the following shell
code:

  unshare --mount --propagation=shared
  cd /
  mount --make-rslave /
  mkdir /new-root
  mount --rbind / /new-root
  cd /new-root
  mount --move /new-root /
  chroot .

This looks simple enough but has the consequence that two separate mount
trees exist for the lifetime of the service. The first one was created
when the mount namespace was created, and the second one when a new
mount for the rootfs was created. The first mount tree sticks around as
a shadow mount tree. Both mount trees are dependent mounts with the host
rootfs as their dominating mount.

Now, when mount propagation is triggered by the host by e.g.,

   mount --bind /opt /mnt

it means that two propagation events are generated. I'm skipping over
the exact kernel details as they aren't that important. The gist is that
for every propagation event that is generated a second one is generated
for the shadow mount tree. In other words, the kernel creates two copies
for each mount that is propagated instead of one.

This isn't necessary. We can simply change the sequence above to:

  unshare --mount --propagation=shared
  cd /
  mount --make-rslave /
  mkdir /new-root
  # stash fd to old rootfs
  # stash fd to new rootfs
  mount --rbind / /new-root
  mkdir /new-root
  cd /new-root
  pivot_root . .
  # new root is tucked under old root
  # chdir into old rootfs via stashed fd
  umount -l /old-root

The pivot_root allows us to get rid of the old mount tree that was
created when the mount namespace was created. So after this sequence
only one mount tree is alive. Plus, it's safer and nicer. Moving mounts
isn't pleasnt.

This patch doesn't convert nspawn yet as the requirements are more
tricky given that it wants to preserve the rootfs as a shared mount
which goes against pivot_root() requirements.

Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
3 years agomount: use device enumerator to find matching loopback block device 25473/head
Yu Watanabe [Tue, 22 Nov 2022 02:22:20 +0000 (11:22 +0900)] 
mount: use device enumerator to find matching loopback block device

No functional change, just refactoring.

3 years agomount: split umount_by_device() into two
Yu Watanabe [Tue, 22 Nov 2022 02:04:33 +0000 (11:04 +0900)] 
mount: split umount_by_device() into two

No functional change, just refactoring and preparation for later
commits.

3 years agomount: make acquire_mount_where_for_loop_dev() take sd-device object
Yu Watanabe [Tue, 22 Nov 2022 02:43:57 +0000 (11:43 +0900)] 
mount: make acquire_mount_where_for_loop_dev() take sd-device object

No functional change, just refactoring.

3 years agoMerge pull request #25483 from poettering/ppoll-usec-eintr
Yu Watanabe [Thu, 24 Nov 2022 00:42:48 +0000 (09:42 +0900)] 
Merge pull request #25483 from poettering/ppoll-usec-eintr

ppoll() + EINTR fixes

3 years agocore: add possibility to not track certain unit types
Michal Sekletar [Wed, 7 Sep 2022 15:37:34 +0000 (17:37 +0200)] 
core: add possibility to not track certain unit types

3 years agoportable: add a few more useful debug log messages
Luca Boccassi [Wed, 23 Nov 2022 16:06:48 +0000 (16:06 +0000)] 
portable: add a few more useful debug log messages

When attaching and /etc/systemd/system.attached can't be created or used
(eg: dead symlink) the logs are pretty much useless as even at debug
level there's no indication of what is going wrong.
Add some debug logs, and return a more specific error string over D-Bus.

3 years agooomd: fix unreachable test case in test-oomd-util 25509/head
Nick Rosbrook [Tue, 22 Nov 2022 16:30:03 +0000 (11:30 -0500)] 
oomd: fix unreachable test case in test-oomd-util

This conditional with !empty_or_root(ctx->path) always returns false
because the most recent oomd_cgroup_context_acquire() call was with the
root cgroup. Make sure this test case can be reached by checking cgroup
instead of ctx->path.

While here, use an unused uid (61183) instead of the nobody uid so the
test case does not fail in unprivileged LXD containers.

3 years agooomd: always allow root-owned cgroups to set ManagedOOMPreference
Nick Rosbrook [Tue, 22 Nov 2022 15:33:55 +0000 (10:33 -0500)] 
oomd: always allow root-owned cgroups to set ManagedOOMPreference

Commit 652a4efb66a ("oomd: loosen the restriction on ManagedOOMPreference")
made the change to allow ManagedOOMPreference on a cgroup candidate when
the monitored cgroup and cgroup candidate are owned by the same user.

The commit assumed that this check was sufficient to continue allowing
ManagedOOMPreference on all cgroups owned by root. However, it caused a
regression for unprivileged LXD containers where e.g. /sys/fs/cgroup is
owned by nobody (uid=65534).

Fix this by explicitly allowing the ManagedOOMPreference if uid == 0 in
oomd_fetch_cgroup_oom_preference().

3 years agoRevert "find-esp: Relax filesystem root directory check"
Daan De Meyer [Wed, 23 Nov 2022 12:28:57 +0000 (13:28 +0100)] 
Revert "find-esp: Relax filesystem root directory check"

This reverts commit d91a5f6481d35e28148fe46bc490bb4f34656947.

This is the wrong approach as we don't detect the UUID and devid
of valid ESP/XBOOTLDR partitions.

3 years agohwdb: remove fuzz and deadzone for Simucube wheel bases.
Bernd Steinhauser [Wed, 23 Nov 2022 14:07:25 +0000 (15:07 +0100)] 
hwdb: remove fuzz and deadzone for Simucube wheel bases.

For these devices the axes are setup via a special
configuration tool. udev should not apply additional
fuzz or deadzone.

Reference for the product IDs:
https://granitedevices.com/wiki/Simucube_product_USB_interface_documentation
This also indicates that there are a total of 8 axes.

3 years agoMerge pull request #25486 from keszybz/kernel-install-header
Lennart Poettering [Wed, 23 Nov 2022 16:36:44 +0000 (17:36 +0100)] 
Merge pull request #25486 from keszybz/kernel-install-header

Add "File created by …" header to BLS entries

3 years agopam: align second and third columns
Zbigniew Jędrzejewski-Szmek [Wed, 23 Nov 2022 15:05:48 +0000 (16:05 +0100)] 
pam: align second and third columns

In our template file, we have jinja2 template markers, so the file
looks fairly messy. But once it's rendered, it looks pretty clean, except
that the columns are unaligned becuase of "-" in some lines in the first
column. Let's make them aligned.

3 years agoTODO: add item about mnt_fstype_is_netfs()
Zbigniew Jędrzejewski-Szmek [Wed, 23 Nov 2022 11:43:28 +0000 (12:43 +0100)] 
TODO: add item about mnt_fstype_is_netfs()

3 years agorepart: Make parse_filter_partitions() more generic
Daan De Meyer [Tue, 22 Nov 2022 13:03:54 +0000 (14:03 +0100)] 
repart: Make parse_filter_partitions() more generic

3 years agorepart: Rename arg_filter_partitions_size to arg_n_filter_partitions
Daan De Meyer [Tue, 22 Nov 2022 12:59:18 +0000 (13:59 +0100)] 
repart: Rename arg_filter_partitions_size to arg_n_filter_partitions

3 years agokernel-install: add header to generate entry files 25486/head
Zbigniew Jędrzejewski-Szmek [Tue, 22 Nov 2022 14:59:21 +0000 (15:59 +0100)] 
kernel-install: add header to generate entry files

I was looking at a bug in bugzilla about some boot loader issue, and it was
hard to say if the boot entry files were generated by our plugin or something
else. Add a header to make this clear.

kernel-install invokes the plugins via absolute path always, so $0 gives as
the full path the location where the plugin is installed. This is what we want:

  title      Fedora Linux 37 (Workstation Edition)
  # Boot Loader Specification type#1 entry
  # File created by /usr/lib/kernel/install.d/90-loaderentry.install (systemd 252-409-g5028904^)

3 years agofind-esp: Relax filesystem root directory check
Daan De Meyer [Mon, 21 Nov 2022 19:41:22 +0000 (20:41 +0100)] 
find-esp: Relax filesystem root directory check

When relaxed checks are requested, let's not require the efi/xbootldr
directory to be the root of the filesystem. When building images, image
builders might install all efi/xbootldr files to a regular directory
first before packing them up into a partition. To allow bootctl to be
used in such scenarios to install systemd-boot, we need to relax the
fsroot check.