]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
22 months agobtrfs-util: apparently btrfs ioctls return unaligned data. deal with it. 31284/head
Lennart Poettering [Mon, 12 Feb 2024 11:50:36 +0000 (12:50 +0100)] 
btrfs-util: apparently btrfs ioctls return unaligned data. deal with it.

Kinda sad, that interfaces like this exist in 2024. But let's deal with
it: before we access "struct btrfs_ioctl_search_header" let's copy it
out, and access it only in the aligned copy.

Fixes: #31282
22 months agobtrfs-util: use memdup_suffix0() instead of strndup() at one more place
Lennart Poettering [Mon, 12 Feb 2024 14:32:25 +0000 (15:32 +0100)] 
btrfs-util: use memdup_suffix0() instead of strndup() at one more place

The structure we copy this out is a large (unaligned) binary blob, hence
let's better use the memdup_suffix0() so that gcc doesn't make
assumption about the source being a valid string.

22 months agobtrfs-util: rework btrfs_is_nocow_fd() around fd_is_fs_type() + read_attr_fd()
Lennart Poettering [Mon, 12 Feb 2024 11:55:47 +0000 (12:55 +0100)] 
btrfs-util: rework btrfs_is_nocow_fd() around fd_is_fs_type() + read_attr_fd()

Let's our safer helpers where appropriate.

22 months agocore/load-fragment: fix typo (sanety -> sanity)
Mike Yuan [Mon, 12 Feb 2024 13:44:23 +0000 (21:44 +0800)] 
core/load-fragment: fix typo (sanety -> sanity)

Follow-up for 435e1098ee9f1175bf60a181771a6e5983bef923

22 months agoMerge pull request #31242 from poettering/socket-uid-account
Lennart Poettering [Mon, 12 Feb 2024 13:07:51 +0000 (14:07 +0100)] 
Merge pull request #31242 from poettering/socket-uid-account

pid1: make MaxConnectionsPerSource= do something useful on AF_UNIX sockets

22 months agomissing: change our close_range() syscall wrapper to map glibc's
Lennart Poettering [Mon, 12 Feb 2024 10:23:54 +0000 (11:23 +0100)] 
missing: change our close_range() syscall wrapper to map glibc's

So glibc exposes a close_range() syscall wrapper now, but they decided
to use "unsigned" as type for the fds. Which is a bit weird, because fds
are universally understood to be "int". The kernel internally uses
"unsigned", both for close() and for close_range(), but weirdly,
userspace didn't fix that for close_range() unlike what they did for
close()... Weird.

But anyway, let's follow suit, and make our wrapper match glibc's.

Fixes #31270

22 months agoservice: Demote log level of NotifyAccess= messages to debug
Michal Koutný [Fri, 9 Feb 2024 15:03:00 +0000 (16:03 +0100)] 
service: Demote log level of NotifyAccess= messages to debug

The situation is a service like

        Type=notify
        NotifyAccess=main

and the service uses some of the systemd helper utilities, e.g.
coredumpctl. The service process will pass NOTIFY_SOCKET to the helper
child (accidentally) and the result is a spurious notification and
the warning message:

> Jan 18 09:38:01 host systemd[1]: sdnotify.service: Got notification message from PID 13736, but reception only permitted for main PID 13549

Notification from helpers seem like an unintentional composition of the
commit c118b577fa ("coredumpctl: define main through macro") and commit
6b636c2d27 ("main-func: send main exit code to parent via sd_notify() on
exit"). The former used the handy macro for a main function, the latter
equipped any main function with the notification. (Further extended in
the commit 623a00020f ("notify: Add EXIT_STATUS field").)

Since notification from systemd utitilities are meant to extend
rudimentary exit()/wait() pair generally, they may happen to land into
service's NOTIFY_SOCKET. Tone down messages of notification that won't
match NotifyAccess=.

22 months agoMerge pull request #31076 from CodethinkLabs/vmspawn/directory_image_support
Lennart Poettering [Mon, 12 Feb 2024 11:20:16 +0000 (12:20 +0100)] 
Merge pull request #31076 from CodethinkLabs/vmspawn/directory_image_support

[vmspawn] directory type image support

22 months agoMerge pull request #31028 from yuwata/journalctl-raise
Mike Yuan [Mon, 12 Feb 2024 11:16:15 +0000 (19:16 +0800)] 
Merge pull request #31028 from yuwata/journalctl-raise

journalctl: call all cleanup functions before raise()

22 months agoMerge pull request #31181 from fbuihuu/gpt-auto-more-defensive
Mike Yuan [Mon, 12 Feb 2024 11:12:17 +0000 (19:12 +0800)] 
Merge pull request #31181 from fbuihuu/gpt-auto-more-defensive

gpt-auto-generator: be more defensive when checking the presence of E…

22 months agotest: add a simple test for MaxConnectionsPerSocket= 31242/head
Lennart Poettering [Wed, 7 Feb 2024 14:08:22 +0000 (15:08 +0100)] 
test: add a simple test for MaxConnectionsPerSocket=

22 months agounits: enable MaxConnectionsPerSocket= for all our Accept=yes units
Lennart Poettering [Wed, 7 Feb 2024 12:19:54 +0000 (13:19 +0100)] 
units: enable MaxConnectionsPerSocket= for all our Accept=yes units

Let's make sure that user's cannot DoS services for other users so
easily, and enable MaxConnectionsPerSocket= by default for all of them.

Note that this is mostly paranoia for systemd-pcrextend.socket and
systemd-sysext.socket: the socket is only accessible to root anyway,
hence the accounting shouldn#t change anything. But this is just a
safety net, in preparation that we open up some functionality of these
services sooner or later.

22 months agopid1: make MaxConnectionsPerSource= also work for AF_UNIX sockets
Lennart Poettering [Wed, 7 Feb 2024 09:11:44 +0000 (10:11 +0100)] 
pid1: make MaxConnectionsPerSource= also work for AF_UNIX sockets

The setting currently puts limits on connections per IP address and
AF_UNIX CID. Let's extend it to cover AF_UNIX too, where it puts a limit
on connections per UID.

This is particularly useful for the various Accept=yes Varlink services
we now have, as it means, the number of per-user instance services
cannot grow without bounds.

22 months agoMerge pull request #30209 from yuwata/sd-journal-reduce-fstat
Yu Watanabe [Mon, 12 Feb 2024 10:38:24 +0000 (19:38 +0900)] 
Merge pull request #30209 from yuwata/sd-journal-reduce-fstat

sd-journal: potentially reduce number of fstat call

22 months agovmspawn: add support for --bind(-ro)= 31076/head
Sam Leonard [Wed, 13 Dec 2023 16:54:34 +0000 (16:54 +0000)] 
vmspawn: add support for --bind(-ro)=

22 months agovmspawn: document --directory and --private-users
Sam Leonard [Mon, 4 Dec 2023 17:33:12 +0000 (17:33 +0000)] 
vmspawn: document --directory and --private-users

22 months agovmspawn: add support for --private-users
Sam Leonard [Mon, 4 Dec 2023 18:54:40 +0000 (18:54 +0000)] 
vmspawn: add support for --private-users

22 months agonspawn: use parse_userns_uid_range
Sam Leonard [Tue, 30 Jan 2024 13:24:49 +0000 (13:24 +0000)] 
nspawn: use parse_userns_uid_range

22 months agobasic/namespace-util: add parse_userns_uid_range
Sam Leonard [Tue, 30 Jan 2024 13:24:22 +0000 (13:24 +0000)] 
basic/namespace-util: add parse_userns_uid_range

22 months agovmspawn: add support for -D/--directory
Sam Leonard [Wed, 24 Jan 2024 15:02:06 +0000 (15:02 +0000)] 
vmspawn: add support for -D/--directory

22 months agofirstboot: validate keymap entry
Eric Daigle [Fri, 9 Feb 2024 07:09:34 +0000 (23:09 -0800)] 
firstboot: validate keymap entry

As described in #30940, systemd-firstboot currently does not perform
any validation on keymap entry, allowing nonexistent keymaps to be
written to /etc/vconsole.conf. This commit adds validation checks
based on those already performed on locale entry, preventing invalid
keymaps from being set.

Closes #30940

m

22 months agoMerge pull request #31149 from YHNdnzj/restart-force-oneshot
Frantisek Sumsal [Mon, 12 Feb 2024 09:20:09 +0000 (10:20 +0100)] 
Merge pull request #31149 from YHNdnzj/restart-force-oneshot

core/service: allow RestartForceExitStatus= for oneshot service

22 months agoNEWS: gpt-auto-generator will become more defensive with ESP and XBOOTLDR 31181/head
Franck Bui [Mon, 12 Feb 2024 08:31:07 +0000 (09:31 +0100)] 
NEWS: gpt-auto-generator will become more defensive with ESP and XBOOTLDR

22 months agogpt-auto-generator: be more defensive when checking the presence of ESP in fstab
Franck Bui [Wed, 7 Feb 2024 12:41:48 +0000 (13:41 +0100)] 
gpt-auto-generator: be more defensive when checking the presence of ESP in fstab

Looking for the ESP node is useful to shortcut things but if we're told that
the node is not referenced in fstab that doesn't necessarily mean that ESP is
not mounted via fstab. Indeed the check is not reliable in all cases. Firstly
because it assumes that udev already set the symlinks up. This is not the case
for initrd-less boots. Secondly the devname of the ESP partition can be wrongly
constructed by the dissect code. For example, the approach which consists in
appending "p<partnum>" suffix to construct the partition devname from the disk
devname doesn't work for DM devices.

Hence this patch makes the logic more defensive and do not mount neither ESP
nor XBOOTLDR automatically if any path in paths that starts with /efi or /boot
exists.

22 months agoMerge pull request #30138 from yuwata/udev-processing-flag
Yu Watanabe [Mon, 12 Feb 2024 02:38:57 +0000 (11:38 +0900)] 
Merge pull request #30138 from yuwata/udev-processing-flag

udev: introduce ID_PROCESSING flag

22 months agotest: show error messages to stderr
Yu Watanabe [Sun, 21 Jan 2024 05:21:12 +0000 (14:21 +0900)] 
test: show error messages to stderr

Otherwise, 'meson test' hides the messages on failure.

22 months agorepart: fix typo
Yu Watanabe [Sun, 11 Feb 2024 17:52:34 +0000 (02:52 +0900)] 
repart: fix typo

Follow-up for 1a0541d44c78ced78a566051ec8f63417370aeaa.

22 months agologs-show: get timestamp and boot ID only when necessary 30209/head
Yu Watanabe [Tue, 2 Jan 2024 19:28:25 +0000 (04:28 +0900)] 
logs-show: get timestamp and boot ID only when necessary

Previously, get_display_timestamp() is unconditionally called even if we
will show logs in e.g. json format.
This drops unnecessary call of get_display_timestamp().

This also makes journal fields in each entry parsed only once in
output_short(). Still output_verbose() twice though.

This should improve performance of dumping journals.

Replaces #29365.

Co-authored-by: Costa Tsaousis <costa@netdata.cloud>
22 months agosd-journal: drop to use Hashmap to manage journal files per boot ID
Yu Watanabe [Tue, 2 Jan 2024 19:28:11 +0000 (04:28 +0900)] 
sd-journal: drop to use Hashmap to manage journal files per boot ID

As reported at https://github.com/systemd/systemd/pull/30209#issuecomment-1831344431,
using hashmap in frequently called function reduces performance.
Let's replace it with a single array and bsearch.

Replaces #29366.

Co-authored-by: Costa Tsaousis <costa@netdata.cloud>
22 months agotree-wide: set SD_JOURNAL_ASSUME_IMMUTABLE where appropriate
Yu Watanabe [Tue, 2 Jan 2024 19:28:08 +0000 (04:28 +0900)] 
tree-wide: set SD_JOURNAL_ASSUME_IMMUTABLE where appropriate

Co-authored-by: Costa Tsaousis <costa@netdata.cloud>
22 months agosd-journal: introduce SD_JOURNAL_ASSUME_IMMUTABLE flag
Yu Watanabe [Tue, 2 Jan 2024 19:28:06 +0000 (04:28 +0900)] 
sd-journal: introduce SD_JOURNAL_ASSUME_IMMUTABLE flag

The flag can be used when it is not necessary to follow journal file
update.

Co-authored-by: Costa Tsaousis <costa@netdata.cloud>
22 months agojournalctl: call all cleanup functions before raise() 31028/head
Yu Watanabe [Sat, 20 Jan 2024 13:14:14 +0000 (22:14 +0900)] 
journalctl: call all cleanup functions before raise()

Note, even with this, memory allocated internally by glibc is not freed.
But, at least, memory explicitly allocated by us is freed cleanly even
Ctrl-C is pressed during 'journalctl --follow'.

Closes #30995.

22 months agomain-func: make _DEFINE_MAIN_FUNC() take short function
Yu Watanabe [Sun, 21 Jan 2024 02:53:27 +0000 (11:53 +0900)] 
main-func: make _DEFINE_MAIN_FUNC() take short function

No functional change, just refactoring.

22 months agosd-journal: make journal_file_read_tail_timestamp() notify to the caller that some...
Yu Watanabe [Tue, 2 Jan 2024 19:28:03 +0000 (04:28 +0900)] 
sd-journal: make journal_file_read_tail_timestamp() notify to the caller that some new journal entries added

Tiny optimization for journal_file_find_newest_for_boot_id().

22 months agosd-journal: cache last entry offset and journal file state
Yu Watanabe [Tue, 2 Jan 2024 19:27:59 +0000 (04:27 +0900)] 
sd-journal: cache last entry offset and journal file state

When the offset of the last entry object (or last object for journal
files generated by an old journald) is not changed, the timestamps
should be updated by journal_file_read_tail_timestamp() are unchanged.
So, we can drop to call fstat() in the function.

As, the journal header is always mapped, so we can read the offset and
journal file state without calling fstat.
Still, when the last entry offset is changed, we may need to call fstat()
to read the entry object. But, hopefully the number of fstat() call
can be reduced.

22 months agoRevert "test: temporarily disable test_sysctl" 30138/head
Yu Watanabe [Tue, 2 Jan 2024 19:34:59 +0000 (04:34 +0900)] 
Revert "test: temporarily disable test_sysctl"

This reverts commit 8ed7800d7b0674c278513968e1bea1ebd4320c4f.

22 months agonetwork: do not enter initialized state when the interface is being processed by...
Yu Watanabe [Tue, 2 Jan 2024 19:34:56 +0000 (04:34 +0900)] 
network: do not enter initialized state when the interface is being processed by udevd

Fixes #30056.

22 months agoudev-util: introduce device_is_processing() helper function
Yu Watanabe [Tue, 2 Jan 2024 19:34:54 +0000 (04:34 +0900)] 
udev-util: introduce device_is_processing() helper function

22 months agoudev-util: use device_get_property_bool() at one more place
Yu Watanabe [Sun, 11 Feb 2024 16:13:50 +0000 (01:13 +0900)] 
udev-util: use device_get_property_bool() at one more place

22 months agoudev: introduce ID_PROCESSING=1 boolean property
Yu Watanabe [Tue, 2 Jan 2024 19:34:47 +0000 (04:34 +0900)] 
udev: introduce ID_PROCESSING=1 boolean property

This indicates that the device is being processed by udevd.

22 months agoMerge pull request #30260 from yuwata/sd-journal-cleanups
Yu Watanabe [Sun, 11 Feb 2024 16:07:11 +0000 (01:07 +0900)] 
Merge pull request #30260 from yuwata/sd-journal-cleanups

sd-journal: further cleanups

22 months agoRevert "packit: temporarily build systemd without BPF stuff"
Frantisek Sumsal [Sun, 11 Feb 2024 14:55:14 +0000 (15:55 +0100)] 
Revert "packit: temporarily build systemd without BPF stuff"

The latest Rawhide compose (20240210.n.1) finished successfully and made
it to the mirrors, so let's drop the bpftool workaround.

This reverts commit 8a0ec8852ccc5674420ae72483dc4f5b2a4fb752.

22 months agocore/service: allow RestartForceExitStatus= for oneshot services 31149/head
Mike Yuan [Wed, 31 Jan 2024 17:25:49 +0000 (01:25 +0800)] 
core/service: allow RestartForceExitStatus= for oneshot services

I think this was just overlooked in #13754, which removed
the restriction of Restart= on Type=oneshot services.
There's no reason to prevent RestartForceExitStatus=
now that Restart= has been allowed.

Closes #31148

22 months agoman/systemd.service: document that Restart=always/on-success are refused
Mike Yuan [Wed, 31 Jan 2024 19:37:52 +0000 (03:37 +0800)] 
man/systemd.service: document that Restart=always/on-success are refused
by oneshot services

22 months agocore/service: make error msg match with conditions
Mike Yuan [Wed, 31 Jan 2024 17:47:35 +0000 (01:47 +0800)] 
core/service: make error msg match with conditions

This was discussed in
https://github.com/systemd/systemd/pull/13754#discussion_r333395362.
I think we should actually list "success" Restart= settings instead.
There are more error statuses than success ones after all, and this
list hasn't really changed for quite some time.

22 months agorepart: Add --generate-fstab= and --generate-crypttab= options
Daan De Meyer [Mon, 25 Dec 2023 22:11:22 +0000 (23:11 +0100)] 
repart: Add --generate-fstab= and --generate-crypttab= options

These can be used along with two new settings MountPoint= and
EncryptedVolume= to write fstab and crypttab entries to the given
paths respectively in the root directory that repart is operating on.

This is useful to cover scenarios that aren't covered by the
Discoverable Partitions Spec. For example when one wants to mount
/home as a separate btrfs subvolume. Because multiple btrfs subvolumes
can be mounted from the same partition, we allow specifying MountPoint=
multiple times to add multiple entries for the same partition.

22 months agoMerge pull request #31273 from mrc0mmand/test-55-arch-gcc
Luca Boccassi [Sat, 10 Feb 2024 11:37:53 +0000 (11:37 +0000)] 
Merge pull request #31273 from mrc0mmand/test-55-arch-gcc

test: make the MemoryHigh= limit a bit more generous with sanitizers

22 months agoMerge pull request #31261 from bluca/repart_engine
Luca Boccassi [Fri, 9 Feb 2024 21:28:59 +0000 (21:28 +0000)] 
Merge pull request #31261 from bluca/repart_engine

repart: support engines and providers

22 months agotest: clean up the code a bit 31273/head
Frantisek Sumsal [Fri, 9 Feb 2024 17:53:19 +0000 (18:53 +0100)] 
test: clean up the code a bit

22 months agotest: make the MemoryHigh= limit a bit more generous with sanitizers
Frantisek Sumsal [Fri, 9 Feb 2024 17:44:58 +0000 (18:44 +0100)] 
test: make the MemoryHigh= limit a bit more generous with sanitizers

When we're running with sanitizers, sd-executor might pull in a
significant chunk of shared libraries on startup, that can cause a lot
of memory pressure and put us in the front when sd-oomd decides to go on
a killing spree. This is exacerbated further on Arch Linux when built
with gcc, as Arch ships unstripped gcc-libs so sd-executor pulls in over
30M of additional shared libs on startup:

~# lddtree build-san/systemd-executor
build-san/systemd-executor (interpreter => /lib64/ld-linux-x86-64.so.2)
    libasan.so.8 => /usr/lib/libasan.so.8
        libstdc++.so.6 => /usr/lib/libstdc++.so.6
        libm.so.6 => /usr/lib/libm.so.6
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1
    libsystemd-core-255.so => /root/systemd/build-san/src/core/libsystemd-core-255.so
        libaudit.so.1 => /usr/lib/libaudit.so.1
            libcap-ng.so.0 => /usr/lib/libcap-ng.so.0
...
    libseccomp.so.2 => /usr/lib/libseccomp.so.2
    libubsan.so.1 => /usr/lib/libubsan.so.1
    libc.so.6 => /usr/lib/libc.so.6

~# ls -Llh /usr/lib/libasan.so.8 /usr/lib/libstdc++.so.6 /usr/lib/libubsan.so.1
-rwxr-xr-x 1 root root 9.7M Feb  2 10:36 /usr/lib/libasan.so.8
-rwxr-xr-x 1 root root  21M Feb  2 10:36 /usr/lib/libstdc++.so.6
-rwxr-xr-x 1 root root 3.2M Feb  2 10:36 /usr/lib/libubsan.so.1

Sanitized libsystemd-core.so is also quite big:

~# ls -Llh /root/systemd/build-san/src/core/libsystemd-core-255.so /usr/lib/systemd/libsystemd-core-255.so
-rwxr-xr-x 1 root root  26M Feb  8 19:04 /root/systemd/build-san/src/core/libsystemd-core-255.so
-rwxr-xr-x 1 root root 5.9M Feb  7 12:03 /usr/lib/systemd/libsystemd-core-255.so

22 months agoMerge pull request #29960 from CodethinkLabs/vmspawn/mkosi-features
Daan De Meyer [Fri, 9 Feb 2024 17:39:54 +0000 (18:39 +0100)] 
Merge pull request #29960 from CodethinkLabs/vmspawn/mkosi-features

vmspawn: add features required by mkosi

22 months agoMerge pull request #31269 from poettering/vconsole-enodev
Lennart Poettering [Fri, 9 Feb 2024 17:04:09 +0000 (18:04 +0100)] 
Merge pull request #31269 from poettering/vconsole-enodev

vconsole/pid1: handle ENODEV on /dev/console somewhat graceful

22 months agoMerge pull request #31268 from poettering/bpf-device-fixes
Luca Boccassi [Fri, 9 Feb 2024 16:34:52 +0000 (16:34 +0000)] 
Merge pull request #31268 from poettering/bpf-device-fixes

bpf-devices: various smaller fixes

22 months agosystemctl: fix typo
Yu Watanabe [Fri, 9 Feb 2024 15:34:02 +0000 (00:34 +0900)] 
systemctl: fix typo

Follow-up for 1baa0415ae612266c77016567390a8232a60d9db.

22 months agotest: add tests for journal_file_next_entry() 30260/head
Yu Watanabe [Tue, 2 Jan 2024 19:30:32 +0000 (04:30 +0900)] 
test: add tests for journal_file_next_entry()

22 months agosd-journal: do not read unnecessary object
Yu Watanabe [Tue, 2 Jan 2024 19:30:29 +0000 (04:30 +0900)] 
sd-journal: do not read unnecessary object

In journal_file_next_entry(), if the passed offset matches an entry object,
then generic_array_bisect() returns the object, but the object we
requested is the next (or previous) object. Hence, we should not validate
the object returned by generic_array_bisect(), otherwise it may fail
when the journal is corrupted.

Note the validity of the entry object that should be returned by
journal_file_next_entry() will be checked in the following generic_array_get().
So, when journal_file_next_entry() succeeds, the returned object is
always validated.

22 months agobuild(deps): bump systemd/mkosi
dependabot[bot] [Fri, 9 Feb 2024 11:46:22 +0000 (11:46 +0000)] 
build(deps): bump systemd/mkosi

Bumps [systemd/mkosi](https://github.com/systemd/mkosi) from dbce89aabda438ba58080366631b2c242e365f21 to 070528fec478fc93af7ec057a5d2fd0045123c99.
- [Release notes](https://github.com/systemd/mkosi/releases)
- [Changelog](https://github.com/systemd/mkosi/blob/main/NEWS.md)
- [Commits](https://github.com/systemd/mkosi/compare/dbce89aabda438ba58080366631b2c242e365f21...070528fec478fc93af7ec057a5d2fd0045123c99)

---
updated-dependencies:
- dependency-name: systemd/mkosi
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
22 months agosd-journal: always put verified object into the chain cache
Yu Watanabe [Tue, 2 Jan 2024 19:30:24 +0000 (04:30 +0900)] 
sd-journal: always put verified object into the chain cache

Let's consider the case that
- the first array contains valid entries,
- all entries in the second array are corrupted.

Then, when we are going to upwards, and a call of generic_array_bisect()
matches the last entry of the first array, then the second array was
cached with last_index == UINT64_MAX, instead of the first array with
its last entry.
Hence, when generic_array_bisect() is called next time, the function call
of test() always fail. So, the cache entry is mostly meaningless.

Let's always store valid cache entry.

22 months agosd-journal: drop duplicated tests in generic_array_bisect()
Yu Watanabe [Tue, 2 Jan 2024 19:30:18 +0000 (04:30 +0900)] 
sd-journal: drop duplicated tests in generic_array_bisect()

When left == right (== 0), generic_array_bisec_step() does not update
left and right. So the following test is exactly the same.

22 months agorepart: support OpenSSL engines/providers for signing 31261/head
Luca Boccassi [Wed, 11 Oct 2023 18:23:40 +0000 (19:23 +0100)] 
repart: support OpenSSL engines/providers for signing

The provider API which is new requires providers, which are not
widely available and don't work very well yet, so also use a
fallback with the legacy engine API.

22 months agoopenssl: add helper to load key from provider/engine
Luca Boccassi [Thu, 12 Oct 2023 09:22:20 +0000 (10:22 +0100)] 
openssl: add helper to load key from provider/engine

It's not the literal private key, but EVP_PKEY becomes a reference
to the engine/provider that OpenSSL knows how to use later

22 months agobpf-devices: if a device node is referenced which doesn't exist, downgrade log message 31268/head
Lennart Poettering [Fri, 9 Feb 2024 11:28:10 +0000 (12:28 +0100)] 
bpf-devices: if a device node is referenced which doesn't exist, downgrade log message

Currently in many of our test cases you'll see a warning about a tun
device not being around. Let's make that quiet, since if there's no such
device there's no point in adding it to a policy anyway, and it makes
useless noise go away.

We keep the warning as a warning if a device node is missing for other
errors than ENOENT.

22 months agobpf-devices: normalize the return handling of functions that put together policy
Lennart Poettering [Fri, 9 Feb 2024 11:26:50 +0000 (12:26 +0100)] 
bpf-devices: normalize the return handling of functions that put together policy

under some conditions we suppress generating BPF programs. Let's
systematically return 0 when we do this, and 1 if we did actually
soething, instead of second guessing this in the caller.

This is not only more correct, but allows us to suppress BPF programs in
more cases in later commits.

22 months agobpf-devices: normalize how we pass around major/minor values
Lennart Poettering [Fri, 9 Feb 2024 11:21:26 +0000 (12:21 +0100)] 
bpf-devices: normalize how we pass around major/minor values

There's some unclarity whether major/minor of device nodes are supposed
to be "unsigned" or "dev_t". Various codebases assume the latter, but
glibc's major()/minor() types actually return a value typed to
"unsigned". On glibc dev_t is actually 64bit even if the kernel only
exposes 32bit. Hence this distinction kinda matters.

Let's clean things up a bit with handling: let's followe glibc's type
system here, and use unsigned (and not int).

Also let's pass invalid major/minor values around as UINT_MAX rather
than via pointers, to match how we usually do this, and to shorten our
code a bit. This is safe, since given the linux dev_t space being 32bit
only we can't possibly have a valid major or minor this hight, given
they must be smaller in size. While other archs disagree on the types of
major/minor, they also tend to have similar limits. In fact on FreeBSD
for example major()/minor() returns a signed int. Which would hence also
mean that UINT_MAX cannot be a valid major or minor.

22 months agoMerge pull request #31243 from YHNdnzj/systemctl-disable-now-template
Luca Boccassi [Fri, 9 Feb 2024 14:29:50 +0000 (14:29 +0000)] 
Merge pull request #31243 from YHNdnzj/systemctl-disable-now-template

systemctl: support disable/mask --now with unit template

22 months agoMerge pull request #31224 from mrc0mmand/packit-bpftool-workaround
Luca Boccassi [Fri, 9 Feb 2024 13:48:13 +0000 (13:48 +0000)] 
Merge pull request #31224 from mrc0mmand/packit-bpftool-workaround

packit: temporarily build systemd without BPF stuff

22 months agoMerge pull request #31264 from poettering/sysext-help
Luca Boccassi [Fri, 9 Feb 2024 13:46:28 +0000 (13:46 +0000)] 
Merge pull request #31264 from poettering/sysext-help

sysext: tweaks to the systemd-sysext/systemd-confext --help text

22 months agopid1,vconsole-setup: gracefully handle if /dev/vconsole is not accessible due to... 31269/head
Lennart Poettering [Fri, 9 Feb 2024 11:55:27 +0000 (12:55 +0100)] 
pid1,vconsole-setup: gracefully handle if /dev/vconsole is not accessible due to ENODEV

I think this is generally the right thing to do and is just an extension
of the existing ENOENT check.

Prompted by: #31257

22 months agodev-setup: normalize logging around lock_dev_console()
Lennart Poettering [Fri, 9 Feb 2024 11:54:03 +0000 (12:54 +0100)] 
dev-setup: normalize logging around lock_dev_console()

Previously this function would log loudly in some cases but not in
others. Clean this up, and dont log at all, matching our coding style
which says we should either log in all error cases or in none.

Both callers of this function do logging already, hence no need to
duplicate it here.

22 months agovmspawn: accept kvm/vhost-vsock device fds through sd_listen 29960/head
Sam Leonard [Thu, 18 Jan 2024 12:32:10 +0000 (12:32 +0000)] 
vmspawn: accept kvm/vhost-vsock device fds through sd_listen

22 months agovmspawn: add nic configuration
Sam Leonard [Fri, 10 Nov 2023 17:32:25 +0000 (17:32 +0000)] 
vmspawn: add nic configuration

22 months agovmspawn: add initrd configuration option
Sam Leonard [Fri, 8 Dec 2023 13:32:34 +0000 (13:32 +0000)] 
vmspawn: add initrd configuration option

22 months agoInstall pacman in Arch Linux image
Daan De Meyer [Fri, 9 Feb 2024 11:43:43 +0000 (12:43 +0100)] 
Install pacman in Arch Linux image

We install apt and dnf in the other images as well, so lets be
consistent and install pacman in the Arch image as well.

22 months agotest: adjust test-path to fail gracefully with the new pidfd_spawn stuff 31224/head
Frantisek Sumsal [Fri, 9 Feb 2024 11:40:29 +0000 (12:40 +0100)] 
test: adjust test-path to fail gracefully with the new pidfd_spawn stuff

Since 2e106312e2 the test unit fails with 'resources' result instead of
'exit-code', which the test didn't account for when running unprivileged.

Before 2e106312e2:
$ /root/systemd/build/test-path
Failed to start transient scope unit: Interactive authentication required.
Couldn't allocate a scope unit for this test, proceeding without.
...
-.slice: Failed to enable/disable controllers on cgroup /user.slice/user-1000.slice/session-1.scope, ignoring: Permission denied
app.slice: Failed to create cgroup /user.slice/user-1000.slice/session-1.scope/app.slice: Permission denied
-.slice: Failed to enable/disable controllers on cgroup /user.slice/user-1000.slice/session-1.scope, ignoring: Permission denied
app.slice: Failed to create cgroup /user.slice/user-1000.slice/session-1.scope/app.slice: Permission denied
...
line 151: path-exists.path: state = running; result = success (left: 29986250)
line 151: path-exists.service: state = start; result = success
path-exists.service: Main process exited, code=exited, status=219/CGROUP
path-exists.service: Failed with result 'exit-code'.
line 151: path-exists.path: state = running; result = success (left: 29985948)
line 151: path-exists.service: state = failed; result = exit-code
Failed to start service path-exists.service, aborting test: failed/exit-code

After 2e106312e2:
$ /root/systemd/build/test-path
Failed to start transient scope unit: Interactive authentication required.
Couldn't allocate a scope unit for this test, proceeding without.
...
-.slice: Failed to enable/disable controllers on cgroup /user.slice/user-1000.slice/session-1.scope, ignoring: Permission denied
app.slice: Failed to create cgroup /user.slice/user-1000.slice/session-1.scope/app.slice: Permission denied
-.slice: Failed to enable/disable controllers on cgroup /user.slice/user-1000.slice/session-1.scope, ignoring: Permission denied
app.slice: Failed to create cgroup /user.slice/user-1000.slice/session-1.scope/app.slice: Permission denied
path-exists.service: Failed to spawn executor: No such file or directory
path-exists.service: Failed to spawn 'start' task: No such file or directory
path-exists.service: Failed with result 'resources'.

22 months agopackit: temporarily build systemd without BPF stuff
Frantisek Sumsal [Tue, 6 Feb 2024 16:48:34 +0000 (17:48 +0100)] 
packit: temporarily build systemd without BPF stuff

The kernel-tools meta-package was retired in Rawhide, but its
replacement has not landed, yet. Until that happens, let's build without
the bpf-framework stuff.

22 months agovmspawn: synthesise root= argument for direct kernel boot
Sam Leonard [Wed, 20 Dec 2023 09:03:01 +0000 (09:03 +0000)] 
vmspawn: synthesise root= argument for direct kernel boot

22 months agovmspawn: add kernel configuration options
Sam Leonard [Fri, 10 Nov 2023 11:56:49 +0000 (11:56 +0000)] 
vmspawn: add kernel configuration options

22 months agovmspawn: add swtpm feature
Sam Leonard [Tue, 7 Nov 2023 14:04:11 +0000 (14:04 +0000)] 
vmspawn: add swtpm feature

22 months agopath-lookup: add runtime_directory for resolving $RUNTIME_DIRECTORY
Sam Leonard [Tue, 23 Jan 2024 13:39:32 +0000 (13:39 +0000)] 
path-lookup: add runtime_directory for resolving $RUNTIME_DIRECTORY

22 months agoAdd systemd.default_debug_tty=
Daan De Meyer [Thu, 8 Feb 2024 09:54:54 +0000 (10:54 +0100)] 
Add systemd.default_debug_tty=

Let's allow configuring the debug tty independently of enabling/disabling
the debug shell. This allows mkosi to configure the correct tty while
leaving enabling/disabling the debug tty to the user.

22 months agosemaphore: temporarily pin autopkgtest to v5.32
Frantisek Sumsal [Fri, 9 Feb 2024 09:30:08 +0000 (10:30 +0100)] 
semaphore: temporarily pin autopkgtest to v5.32

The latest commit (ATTOW) [0] calls adduser with --logmsglevel, which is
not a valid flag for adduser on Ubuntu Focal/Jammy.

[0] https://salsa.debian.org/ci-team/autopkgtest/-/commit/9c033b3db453acaa103bae03a4a5dcebe3858089

22 months agoman: add missing "=" after setting name
Yu Watanabe [Fri, 9 Feb 2024 10:03:19 +0000 (19:03 +0900)] 
man: add missing "=" after setting name

Follow-up for b93bf1bf9fb8f091c52588c5fc9edef6225f4ed3.

22 months agoMerge pull request #31230 from mrc0mmand/test-seccomp
Frantisek Sumsal [Fri, 9 Feb 2024 09:39:23 +0000 (10:39 +0100)] 
Merge pull request #31230 from mrc0mmand/test-seccomp

process-util: use only the least significant byte from personality()

22 months agoREADME: update link to CentOS CI
Yu Watanabe [Fri, 9 Feb 2024 09:08:58 +0000 (18:08 +0900)] 
README: update link to CentOS CI

22 months agoman: fix typo
Yu Watanabe [Fri, 9 Feb 2024 08:49:44 +0000 (17:49 +0900)] 
man: fix typo

Follow-up for 631cf7f0040234d2bca81bdfdf9efecc4fb5f40f.

22 months agosysext: output an appropriate blurb for the mode we are executed in 31264/head
Lennart Poettering [Fri, 9 Feb 2024 08:40:11 +0000 (09:40 +0100)] 
sysext: output an appropriate blurb for the mode we are executed in

22 months agosysext: point to the right man page for the mode we are invoked in
Lennart Poettering [Fri, 9 Feb 2024 08:37:23 +0000 (09:37 +0100)] 
sysext: point to the right man page for the mode we are invoked in

22 months agosysext: rename "directory_name" field to "full_identifier"
Lennart Poettering [Fri, 9 Feb 2024 08:32:53 +0000 (09:32 +0100)] 
sysext: rename "directory_name" field to "full_identifier"

So the field contains simply the full name of the command being invoked,
hence rename the field to match the contents, and to mirror the
"short_identifier" field.

Interestingly, the field is apparently not actually used by anything
though! But we are not going to remove it, since a follow-up commit will
start making use of it.

22 months agosysext: fix --help indenting/line breaking
Lennart Poettering [Fri, 9 Feb 2024 08:32:00 +0000 (09:32 +0100)] 
sysext: fix --help indenting/line breaking

Let's make sure there's an empty line after the explanatory text like we
usually do it, and do not indent the 2nd line more than the 1st

22 months agoMerge pull request #31172 from yuwata/network-bond-port
Yu Watanabe [Fri, 9 Feb 2024 08:32:29 +0000 (17:32 +0900)] 
Merge pull request #31172 from yuwata/network-bond-port

network: do not bring down bonding port on reconfigure

22 months agoMerge pull request #31247 from yuwata/network-make-reload-bus-method-synchronous
Yu Watanabe [Fri, 9 Feb 2024 08:32:07 +0000 (17:32 +0900)] 
Merge pull request #31247 from yuwata/network-make-reload-bus-method-synchronous

network: make Reload bus method synchronous

22 months agosystemctl: allow --now only if not install_client_side() 31243/head
Mike Yuan [Wed, 7 Feb 2024 22:42:10 +0000 (06:42 +0800)] 
systemctl: allow --now only if not install_client_side()

22 months agosystemctl: support disable/mask --now with unit template
Mike Yuan [Wed, 7 Feb 2024 14:15:05 +0000 (22:15 +0800)] 
systemctl: support disable/mask --now with unit template

Closes #15620
Replaces #28240

22 months agobasic/unit-name: introduce unit_name_replace_instance_full
Mike Yuan [Thu, 8 Feb 2024 10:31:37 +0000 (18:31 +0800)] 
basic/unit-name: introduce unit_name_replace_instance_full
that optionally accepts a globbed instance

22 months agosystemctl-util: some modernizations
Mike Yuan [Wed, 7 Feb 2024 15:33:07 +0000 (23:33 +0800)] 
systemctl-util: some modernizations

22 months agobasic/unit-name: include param name in function prototype
Mike Yuan [Wed, 7 Feb 2024 13:55:19 +0000 (21:55 +0800)] 
basic/unit-name: include param name in function prototype

22 months agotest: drop unnecessary sleep 31247/head
Yu Watanabe [Thu, 8 Feb 2024 03:55:07 +0000 (12:55 +0900)] 
test: drop unnecessary sleep

Now, 'Reload' dbus method is synchronous. It is not necessary to wait
for link enter configuring state.

22 months agonetwork: make Reload bus method synchronous
Yu Watanabe [Thu, 8 Feb 2024 03:47:39 +0000 (12:47 +0900)] 
network: make Reload bus method synchronous

Prompted by https://github.com/systemd/systemd/pull/30085#discussion_r1401534107.

Note, like Reconfigure bus method, even reconfiguration for an interface is
triggered by Reload method, the method only wait for the link enters
configuring state (or unmanaged state if no matching .network file exists).
Users still need to invoke systemd-networkd-wait-online if it is
necessary to wait for the interface enters configured state after Reload
medhod.

22 months agotest-network: add test case for issue #31165 31172/head
Yu Watanabe [Fri, 2 Feb 2024 02:20:25 +0000 (11:20 +0900)] 
test-network: add test case for issue #31165

22 months agonetwork: do not bring down a bonding port interface when it is already joined
Yu Watanabe [Fri, 2 Feb 2024 02:10:45 +0000 (11:10 +0900)] 
network: do not bring down a bonding port interface when it is already joined

Follow-up for 9f913d37a01f71e559d099bff280827f8817d8c5.

Fixes #31165.