]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
7 months agonetwork/ndisc: remove conflicting routes on configuring routes based on newly received RA
Yu Watanabe [Fri, 2 Feb 2024 03:30:32 +0000 (12:30 +0900)] 
network/ndisc: remove conflicting routes on configuring routes based on newly received RA

The linux kernel does not update several parameters, e.g. RTA_PREF.
Hence, when we configure routes based on a RA, we need to remove
existing conflicting routes.

Fixes #28426 and #28439.

7 months agonetwork/route: remove existing route if some property conflict with requested ones
Yu Watanabe [Fri, 2 Feb 2024 03:18:33 +0000 (12:18 +0900)] 
network/route: remove existing route if some property conflict with requested ones

Fixes #28853.

7 months agonetwork: rename link_drop_managed_xyz() -> link_drop_static_xyz()
Yu Watanabe [Fri, 9 Feb 2024 05:33:07 +0000 (14:33 +0900)] 
network: rename link_drop_managed_xyz() -> link_drop_static_xyz()

As networkd does not configure nexthops, neighbors, or routing policy rules
dynamically, this only changes link_drop_managed_addresses(). Previously
it also removed dynamic addresses, but with this commit, now it only
removes static addresses. Note, link_drop_managed_routes() has removed
only static routes, so this commit only changes its name.

Note. as commented in the code, the dynamic addresses will be removed
on lease expiration or stopping client, and link_drop_managed_xyz() are
called on reconfiguration or so, and at that time, all dynamic
addressing clients are stopped or restarted, so this should not
effective behavior change.

7 months agonetwork/ndisc: also drop SLAAC addresses and routes on reconfiguring
Yu Watanabe [Fri, 9 Feb 2024 05:50:46 +0000 (14:50 +0900)] 
network/ndisc: also drop SLAAC addresses and routes on reconfiguring

Especially, this is important for routes, as link_drop_managed_routes()
removes only static routes, rather than non-foreign routes.

7 months agotest-network: allow to specify multiple interfaces to wait_online() without square...
Yu Watanabe [Fri, 9 Feb 2024 09:26:37 +0000 (18:26 +0900)] 
test-network: allow to specify multiple interfaces to wait_online() without square bracket

7 months agoMerge pull request #28761 from esposem/cmdline_manager
Luca Boccassi [Wed, 14 Feb 2024 13:56:31 +0000 (13:56 +0000)] 
Merge pull request #28761 from esposem/cmdline_manager

bootctl: handle UKI cmdline addons

7 months agoMerge pull request #31283 from CodethinkLabs/vmspawn/start_from_template
Luca Boccassi [Wed, 14 Feb 2024 13:55:04 +0000 (13:55 +0000)] 
Merge pull request #31283 from CodethinkLabs/vmspawn/start_from_template

vmspawn: Support being invoked from a template unit

7 months agoMerge pull request #31319 from poettering/journal-tighten-memfd-flags
Lennart Poettering [Wed, 14 Feb 2024 13:40:46 +0000 (14:40 +0100)] 
Merge pull request #31319 from poettering/journal-tighten-memfd-flags

journald: tighten checks on incoming memfds a bit

7 months agoMerge pull request #31314 from yuwata/network-ndisc-check-conflicting-address
Yu Watanabe [Wed, 14 Feb 2024 13:19:05 +0000 (22:19 +0900)] 
Merge pull request #31314 from yuwata/network-ndisc-check-conflicting-address

network/ndisc: check conflicting address

7 months agomeson: do not attempt to install tests when they are disabled
Luca Boccassi [Tue, 13 Feb 2024 13:43:49 +0000 (13:43 +0000)] 
meson: do not attempt to install tests when they are disabled

If -Dtests=false but -Dinstall-tests=true the build will fail, as some tests will
be pulled in the build but not their prerequisites. It doesn't make sense to ask
for tests to be installed if they are disabled.

FAILED: test-acd
cc  -o test-acd test-acd.p/src_libsystemd-network_test-acd.c.o -flto -Wl,--as-needed -Wl,--no-undefined -pie -fstack-protector -Wl,-z,relro -specs=/usr/share/debhelper/dh_package_notes/debian-package-notes.specs -g -O2 -ffile-prefix-map=/tmp/s=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -ffat-lto-objects -Wdate-time -D_FORTIFY_SOURCE=2 '-Wl,-rpath,$ORIGIN/src/shared:XXXXXXXXXXXXXXX' -Wl,-rpath-link,/tmp/s/obj-x86_64-linux-gnu/src/shared -Wl,--start-group src/shared/libsystemd-shared-255.so src/libsystemd-network/libsystemd-network.a -Wl,--end-group -Wl,--fatal-warnings -Wl,-z,now -Wl,-z,relro -Wl,--warn-common -Wl,--gc-sections -Wl,--fatal-warnings -Wl,-z,now -Wl,-z,relro -Wl,--warn-common -Wl,--gc-sections
/usr/bin/ld: /tmp/cc0oYwFZ.ltrans0.ltrans.o: in function `main':
./obj-x86_64-linux-gnu/./obj-x86_64-linux-gnu/<artificial>:85:(.text.startup+0x33): undefined reference to `test_setup_logging'
collect2: error: ld returned 1 exit status

7 months agojournald: rebreak some comments 31319/head
Lennart Poettering [Wed, 14 Feb 2024 09:56:09 +0000 (10:56 +0100)] 
journald: rebreak some comments

7 months agojournald: when getting journal data via memfd, check flags are valid
Lennart Poettering [Wed, 14 Feb 2024 09:55:22 +0000 (10:55 +0100)] 
journald: when getting journal data via memfd, check flags are valid

Add some extra safety checks: refuse weird open flags.

And while we are at it, also use stat_verify_regular()

7 months agobootctl: discover and pring global UKI PE addons 28761/head
Emanuele Giuseppe Esposito [Thu, 21 Sep 2023 11:59:24 +0000 (07:59 -0400)] 
bootctl: discover and pring global UKI PE addons

An UKI final command line is not just made of the content of .cmdline,
but also from the addons that are inserted in
/boot/efi/EFI/Linux/<UKI_NAME>.efi.extra.d (local addons) and /boot/efi/loader/addons
(global addons).

Therefore bootclt "status" and "list" should also include these addons
when printing the UKI command line.

Support for /boot/efi/EFI/Linux/<UKI_NAME>.efi.extra.d is already present,
so now cover addons present in /boot/efi/loader/addons (global addons).

Example (assume UKI_NAME=devel):
$ bootctl
ukiCmdline: console=tty0 console=ttyS0
  globalAddon: loader/addons/global.addon.efi
      cmdline: └─quiet
   localAddon: devel.efi.extra.d/rpm_addon.addon.efi
      cmdline: └─this is a normal addon
 finalCmdline: console=tty0 console=ttyS0 quiet this is a normal addon

7 months agobootctl: discover local UKI PE addons
Emanuele Giuseppe Esposito [Thu, 21 Sep 2023 06:21:42 +0000 (02:21 -0400)] 
bootctl: discover local UKI PE addons

An UKI final command line is not just made of the content of .cmdline,
but also from the addons that are inserted in
/boot/efi/EFI/Linux/<UKI_NAME>.efi.extra.d (local addons) and
/boot/efi/loader/addons (global addons).

Therefore bootclt "status" and "list" should also include these addons
when printing the UKI command line.

Right now, discover addons present in
/boot/efi/EFI/Linux/<UKI_NAME>.efi.extra.d.

Example output (assume UKI_NAME=devel):
$ bootctl
ukiCmdline: console=tty0 console=ttyS0
   localAddon: devel.efi.extra.d/rpm_addon.addon.efi
      cmdline: └─this is a normal addon
 finalCmdline: console=tty0 console=ttyS0 this is a normal addon

7 months agobootspec: refactor find_sections
Emanuele Giuseppe Esposito [Thu, 21 Sep 2023 06:18:32 +0000 (02:18 -0400)] 
bootspec: refactor find_sections

Prepare for the incoming changes that introduce PE addons support.
Addons will contain a .cmdline section, but not .osrel.

7 months agoupdate TODO
Lennart Poettering [Wed, 14 Feb 2024 09:56:35 +0000 (10:56 +0100)] 
update TODO

7 months agohashmap: Add helper to dump sorted keys
Adrian Vovk [Fri, 19 Jan 2024 01:48:24 +0000 (20:48 -0500)] 
hashmap: Add helper to dump sorted keys

Currently, hashmap_dump_sorted sorts by key and then returns the values
in order sorted by key. This commit adds another helper that does the
same but returns the sorted keys instead

7 months agosd-journal: drop unused function prototype
Yu Watanabe [Wed, 14 Feb 2024 01:32:33 +0000 (10:32 +0900)] 
sd-journal: drop unused function prototype

Follow-up for 8b4fbbb0a121028c9304e96df322ce491f551e34.

The function was renamed and moved by
035b0f8fe8c1883b17d864f15f99846ab206099d.
Maybe the prototype is mistakenly re-introduced on rebase.

7 months agocore/load-fragment: modernize config_parse_socket_listen
Mike Yuan [Tue, 13 Feb 2024 19:35:37 +0000 (03:35 +0800)] 
core/load-fragment: modernize config_parse_socket_listen

Prompted by #31304

7 months agoMerge pull request #31206 from AdrianVovk/user-record-fields
Lennart Poettering [Wed, 14 Feb 2024 08:22:23 +0000 (09:22 +0100)] 
Merge pull request #31206 from AdrianVovk/user-record-fields

Added some more user record fields

7 months agoenv-util: Add helper to store current log level
Adrian Vovk [Sat, 20 Jan 2024 00:46:07 +0000 (19:46 -0500)] 
env-util: Add helper to store current log level

This is useful after a fork but before an exec into a binary that uses
systemd's logging utilities. For example, this should be used in dbus
services that fork off worker processes: currently, the log level set by
the LogControl dbus API will be lost because of the exec, and the worker
process will not have the correct log level set.

7 months agoMerge pull request #31297 from AdrianVovk/sha256-util-lib
Lennart Poettering [Wed, 14 Feb 2024 08:19:56 +0000 (09:19 +0100)] 
Merge pull request #31297 from AdrianVovk/sha256-util-lib

basic: Add some sha256 helper functions

7 months agocore: allow to specify /dev/rfkill for ListenSpecial=
Yu Watanabe [Tue, 13 Feb 2024 19:13:32 +0000 (04:13 +0900)] 
core: allow to specify /dev/rfkill for ListenSpecial=

Follow-up for 8049bce6195f8dc5901cb4f60f1ac56206de887b.

Fixes #31294.

7 months agoformat-utils: Expose FORMAT_UID and FORMAT_GID
Adrian Vovk [Fri, 2 Feb 2024 20:03:54 +0000 (15:03 -0500)] 
format-utils: Expose FORMAT_UID and FORMAT_GID

This pulls this generally useful helper out of sysusers and into the
util lib, and updates the places throughout the codebase where it makes
sense to use it.

7 months agohomed: Add some missing asserts
Adrian Vovk [Thu, 1 Feb 2024 16:16:44 +0000 (11:16 -0500)] 
homed: Add some missing asserts

These functions expect secrets to be passed in (some even dereference
the variables), but fail to assert that they're non-null. So this commit
adds some assertions

7 months agonetwork/ndisc: check if there exists a conflicting address 31314/head
Yu Watanabe [Wed, 14 Feb 2024 04:39:48 +0000 (13:39 +0900)] 
network/ndisc: check if there exists a conflicting address

Follow-up for 0a0c2672dbd22dc85d660e5baa7e1bef701beb88.

Before the commit, if a conflicting address exists or already requested,
then the configuration of newly requested address (especially, prefix
length) is mostly ignored silently.

However, after the commit, even if there exists a conflicting address,
networkd anyway tries to configure the newly requested address, and
enter failed state. Such situation can be triggered, e.g. when the DHCPv6
client is started earlier than NDisc, by WithoutRA=solicit.

Fixes #31263.

7 months agonetwork/ndisc: drop unnecessary ownership transfer
Yu Watanabe [Wed, 14 Feb 2024 04:46:51 +0000 (13:46 +0900)] 
network/ndisc: drop unnecessary ownership transfer

Follow-up for e217da13803518fb9592a18b0ec7dade513878a0.

7 months agonetwork/dhcp6: use address_can_update() at one more place
Yu Watanabe [Wed, 14 Feb 2024 04:27:00 +0000 (13:27 +0900)] 
network/dhcp6: use address_can_update() at one more place

In address_can_update(), only prefix length is checked for IPv6
addresses. So, this should not change any behavior.

7 months agonetwork/address: drop requirement of Address.link and .network in address_can_update()
Yu Watanabe [Wed, 14 Feb 2024 04:02:56 +0000 (13:02 +0900)] 
network/address: drop requirement of Address.link and .network in address_can_update()

This also rename arguments.
No functional change, just refactoring.

7 months agouser-record: Add languages field 31206/head
Adrian Vovk [Sun, 4 Feb 2024 17:27:01 +0000 (12:27 -0500)] 
user-record: Add languages field

This field is like preferredLanguage, but takes a priority list of
languages instead. If an app isn't translated into a user's primary
language, it can fall back to one of the other languages in the list
thus making the app more accessible to the user.

For instance: in my experience, many Ukrainians are fluent in Russian,
often significantly better than English (especially if they are of a
generation that grew up during the USSR). Such a person might set this
new variable to ["uk_UA.UTF-8", "ru_UA.UTF-8"] so that software that
lacks Ukrainian translations will first try Russian translations before
defaulting to English.

Fixes #31290

7 months agolocale-util: Restrict valid locales
Adrian Vovk [Sun, 4 Feb 2024 17:18:08 +0000 (12:18 -0500)] 
locale-util: Restrict valid locales

This further restricts the charset of locales to better reflect what
locales actually look like.

This allows us to safely join locale names using the `:` character, for
instance, which cannot appear in a locale name and is used by the
`$LANGUAGE` env var

7 months agopam_systemd: Let user record override env vars
Adrian Vovk [Sun, 4 Feb 2024 16:56:05 +0000 (11:56 -0500)] 
pam_systemd: Let user record override env vars

The user record should be the source of truth for the user's environment
variables, and the user should be able to override them in much the same
way that they can if they simply append the variable to their ~/.profile

For example, before $LANG would never get set to the user's preferred
language, because the service manager always ensures that $LANG is set
to something (either the localed config, or a compiled-in default). Thus
the user's preferredLanguage setting was always ignored

7 months agovarlink: fix dead code
Luca Boccassi [Tue, 13 Feb 2024 17:42:59 +0000 (17:42 +0000)] 
varlink: fix dead code

'e' is already checked in the previous branch, no need to check it again,
it cannot be NULL.

CID#1534465

Follow-up for 9bca9891834e0e71484e2e1b38ac59b3ce257043

7 months agotest: fix typo
Yu Watanabe [Tue, 13 Feb 2024 19:04:09 +0000 (04:04 +0900)] 
test: fix typo

Follow-up for d02018afdb15ca84f02775c5c5ed0ade39475ffa.

7 months agotest: fix typo
Yu Watanabe [Tue, 13 Feb 2024 19:03:07 +0000 (04:03 +0900)] 
test: fix typo

Follow-up for 3456c89ac26872f4befa2bdf7c260529932e3909.

7 months agocryptsetup: fix typo
Yu Watanabe [Tue, 13 Feb 2024 19:01:36 +0000 (04:01 +0900)] 
cryptsetup: fix typo

Follow-up for c5daf14c88ba44cefabe052de93a29d28b6b0175.

7 months agobasic: Add some sha256 helper functions 31297/head
Adrian Vovk [Sat, 13 Jan 2024 16:08:12 +0000 (11:08 -0500)] 
basic: Add some sha256 helper functions

Adds a util function to sha256 an open fd (moved from dissect). Also
adds functions to check if a string contains a valid sha256 hash, and
parse it into a sha256 array.

7 months agotools: fix typo
Yu Watanabe [Tue, 13 Feb 2024 18:58:31 +0000 (03:58 +0900)] 
tools: fix typo

Follow-up for 6d55e3a3641b35dd2bb4306711b4db4004bf6817.

7 months agocore: escape spaces when serializing as well
Frantisek Sumsal [Mon, 12 Feb 2024 17:32:03 +0000 (18:32 +0100)] 
core: escape spaces when serializing as well

Otherwise they might get stripped when reading the serialized data back.

Resolves: #31214

7 months agofundamental: Add overflow-safe math helpers 31296/head
Adrian Vovk [Wed, 17 Jan 2024 19:48:45 +0000 (14:48 -0500)] 
fundamental: Add overflow-safe math helpers

ADD_SAFE/SUB_SAFE/MUL_SAFE do addition/subtraction/multiplication
respectively with an overflow check. If an overflow occurs these return
false, otherwise true. Example: (c = a + b) would become ADD_SAFE(&c, a,
b)

INC_SAFE/DEC_SAFE/MUL_ASSIGN_SAFE are like above but they also reassign
the first argument. Example: (a += b) would become INC_SAFE(&a, b)

7 months agoUse tilde for rc tag versioning
Daan De Meyer [Tue, 13 Feb 2024 13:00:50 +0000 (14:00 +0100)] 
Use tilde for rc tag versioning

tilde sorts lower in the version comparison spec:
https://uapi-group.org/specifications/specs/version_format_specification/

➜  systemd git:(strip) systemd-analyze compare-versions 249\~rc1 249
249\~rc1 < 249
➜  systemd git:(strip) systemd-analyze compare-versions 249-rc1 249
249-rc1 > 249

Also update tools/meson-vcs-tag.sh to use carets instead of hyphens
for the git part of the version as carets are allowed to be part of
a version by pacman while hyphens are not and both sort higher than
a version without the git part.

7 months agovmspawn: add template unit to start systemd-vmspawn -M 31283/head
Sam Leonard [Wed, 7 Feb 2024 17:22:39 +0000 (17:22 +0000)] 
vmspawn: add template unit to start systemd-vmspawn -M

7 months agovmspawn: search for machines when only passed -M/--machine=
Sam Leonard [Wed, 7 Feb 2024 14:51:21 +0000 (14:51 +0000)] 
vmspawn: search for machines when only passed -M/--machine=

7 months agovmspawn: discover bootloader for directory type images
Sam Leonard [Wed, 7 Feb 2024 13:38:37 +0000 (13:38 +0000)] 
vmspawn: discover bootloader for directory type images

7 months agovmspawn: support multiple initrds via merging
Sam Leonard [Thu, 8 Feb 2024 16:42:02 +0000 (16:42 +0000)] 
vmspawn: support multiple initrds via merging

7 months agopo: Translated using Weblate (Korean)
김인수 [Tue, 13 Feb 2024 09:36:49 +0000 (10:36 +0100)] 
po: Translated using Weblate (Korean)

Currently translated at 100.0% (227 of 227 strings)

Co-authored-by: 김인수 <simmon@nplob.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/ko/
Translation: systemd/main

7 months agoMerge pull request #30380 from keszybz/tmpfiles-dry-run
Lennart Poettering [Tue, 13 Feb 2024 08:45:50 +0000 (09:45 +0100)] 
Merge pull request #30380 from keszybz/tmpfiles-dry-run

Make tmpfiles/sysusers nicer with local files and implement tmpfiles --dry-run

7 months agocryptsetup: Add optional support for linking volume key in keyring.
Ondrej Kozina [Wed, 31 Jan 2024 12:11:21 +0000 (13:11 +0100)] 
cryptsetup: Add optional support for linking volume key in keyring.

cryptsetup 2.7.0 adds feature to link effective volume key in custom
kernel keyring during device activation. It can be used later to pass
linked volume key to other services.

For example: kdump enabled systems installed on LUKS2 device.
This feature allows it to store volume key linked in a kernel keyring
to the kdump reserved memory and reuse it to reactivate LUKS2 device
in case of kernel crash.

7 months agoupdate TODO
Lennart Poettering [Tue, 13 Feb 2024 08:12:49 +0000 (09:12 +0100)] 
update TODO

7 months agoMerge pull request #31271 from fbuihuu/test-69-debugging-improvements
Frantisek Sumsal [Mon, 12 Feb 2024 20:14:43 +0000 (21:14 +0100)] 
Merge pull request #31271 from fbuihuu/test-69-debugging-improvements

Test 69 debugging improvements

7 months agoMerge pull request #31284 from poettering/btrfs-alignment
Lennart Poettering [Mon, 12 Feb 2024 16:50:13 +0000 (17:50 +0100)] 
Merge pull request #31284 from poettering/btrfs-alignment

btrfs: various clean-ups including alignment fixes

7 months agoFix OOMPolicy= version in manpage of systemd.scope
cunshunxia [Wed, 24 Jan 2024 03:23:19 +0000 (11:23 +0800)] 
Fix OOMPolicy= version in manpage of systemd.scope

OOMPolicy in scope units is separately supported in
version v253, so I think it cannot be directly used
in the manpage with the version from the service.

fix:#30836

7 months agoMerge pull request #31162 from poettering/tint-tweaks
Luca Boccassi [Mon, 12 Feb 2024 16:47:09 +0000 (16:47 +0000)] 
Merge pull request #31162 from poettering/tint-tweaks

ptyfwd: some tweaks to terminal handling

7 months agotest/test-shutdown.py: optionally display the test I/Os in a dedicated log file 31271/head
Franck Bui [Thu, 8 Feb 2024 15:12:41 +0000 (16:12 +0100)] 
test/test-shutdown.py: optionally display the test I/Os in a dedicated log file

Given that the test involves screen(1), sending various control sequences to
resize/clear the screen, most of the logs sent from the python script were
nearly impossible to read or mixed with other messages sent to the console
hence making the debug harder when the test is run manually.

This patch introduces an option to redirect the pexpect IOs into a file (to be
used in $STATEDIR/TEST-69-SHUTDOWN/run-nspawn).

The pexpect logs are also enabled later so the boot logs are skipped since
those are already included in the journal.

7 months agoMerge pull request #31233 from poettering/pcrlock-varlink
Lennart Poettering [Mon, 12 Feb 2024 14:48:03 +0000 (15:48 +0100)] 
Merge pull request #31233 from poettering/pcrlock-varlink

pcrlock: add simple Varlink API + some varlinkctl tweaks

7 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
7 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.

7 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.

7 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

7 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

7 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

7 months agoTODO: add --dry-run/-n 30380/head
Zbigniew Jędrzejewski-Szmek [Thu, 14 Dec 2023 14:32:45 +0000 (15:32 +0100)] 
TODO: add --dry-run/-n

7 months agoTEST-22: add --dry-run calls
Zbigniew Jędrzejewski-Szmek [Fri, 8 Dec 2023 09:17:04 +0000 (10:17 +0100)] 
TEST-22: add --dry-run calls

aCdDefLprRwxXz are tested with --dry-run.
I added a primitive test of bc.
There were no tests for AhHt, and I didn't add those either.

7 months agosystemd-tmpfiles: use statx_mount_same
Zbigniew Jędrzejewski-Szmek [Fri, 15 Dec 2023 12:27:44 +0000 (13:27 +0100)] 
systemd-tmpfiles: use statx_mount_same

It was pointed out in review that the preexisting code should be updated
(https://github.com/systemd/systemd/pull/30380#discussion_r1426899180).

7 months agotmpfiles: implement --dry-run
Zbigniew Jędrzejewski-Szmek [Fri, 8 Dec 2023 08:50:38 +0000 (09:50 +0100)] 
tmpfiles: implement --dry-run

The idea is simple: skip the final operation that creates or removes things
or changes the attributes, but otherwise go through the rest of the code.
This results in quite a lot of fairly repetitive conditions in the low-level
code. Another approach would be to print earlier, at a higher level, but then
we'd have less precise information about what is about to happen.

7 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=.

7 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

7 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()

7 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…

7 months agoupdate TODO 31233/head
Lennart Poettering [Wed, 7 Feb 2024 10:41:59 +0000 (11:41 +0100)] 
update TODO

7 months agotest: add brief test for prclock varlink interfaces and varlinkctl --collect
Lennart Poettering [Wed, 7 Feb 2024 10:51:11 +0000 (11:51 +0100)] 
test: add brief test for prclock varlink interfaces and varlinkctl --collect

7 months agovarlinkctl: if "call" verb is used, imply "-j"
Lennart Poettering [Wed, 7 Feb 2024 10:45:33 +0000 (11:45 +0100)] 
varlinkctl: if "call" verb is used, imply "-j"

For the other verbs turning off JSON mode makes sense, but for "call"
not so much, after all the contents of a method call reply is JSON we
couldn't really show any other way.

Hence, when JSON output was not configured otherwise in "call", default
to the same as -j.

7 months agovarlinkctl: add new --collect switch
Lennart Poettering [Wed, 7 Feb 2024 10:20:05 +0000 (11:20 +0100)] 
varlinkctl: add new --collect switch

It exposes the varlink_collect() call we internally provide: it collects
all responses of a method call that is issued with the "more" method
call flag. It then returns the result as a single JSON array.

7 months agovarlink: rework varlink_collect()
Lennart Poettering [Thu, 8 Feb 2024 10:34:49 +0000 (11:34 +0100)] 
varlink: rework varlink_collect()

This reworks varlink_collect() so that it is not just a wrapper around
varlink_observe(), varlink_bind_reply() and others. It becomes a first
class operation.

This has various benefits:

1. Memory management is normalized: the reply json variant is now
   tracked as part of the varlink object, and thus we do not pass
   ownership to the caller. This is just like we do it for simple method
   calls and removes a lot of confusion.
2. The bind reply/user data pointer can be used for user stuff, we'll
   not silently override this.
3. We enforce an overall time-out operation on the whole thing, so that
   this synchronous operation does no longer block forever.

7 months agovarlink: properly return reply flags to callers
Lennart Poettering [Thu, 8 Feb 2024 10:33:15 +0000 (11:33 +0100)] 
varlink: properly return reply flags to callers

We so far have a reply flags return parameter on varlink_call_full(),
but we return 0 always. Let's fix that, and return the actual flags we
see.

7 months agovarlink: enforce a maximum size limit on replies collected via varlink_collect()
Lennart Poettering [Wed, 7 Feb 2024 10:41:20 +0000 (11:41 +0100)] 
varlink: enforce a maximum size limit on replies collected via varlink_collect()

We should not allow servers to blow up client's memory without bounds,
hence set a (high) limit on replies we'll collect before failing.

7 months agopcrlock: add basic Varlink interface
Lennart Poettering [Fri, 2 Feb 2024 14:17:09 +0000 (15:17 +0100)] 
pcrlock: add basic Varlink interface

This can be used to make or delete a PCR policy via Varlink. It can also
be used to query the current event log in CEL format.

7 months agopcrlock: split out generation of CEL objects into helper func
Lennart Poettering [Fri, 2 Feb 2024 14:15:22 +0000 (15:15 +0100)] 
pcrlock: split out generation of CEL objects into helper func

This way, we can reuse it later to generate Varlink replies

No change in behaviour, just some trivial split out.

7 months agopcrlock: use log_setup()
Lennart Poettering [Fri, 2 Feb 2024 12:30:43 +0000 (13:30 +0100)] 
pcrlock: use log_setup()

7 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=

7 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.

7 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.

7 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

7 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)=

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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.

7 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

7 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.

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

Follow-up for 1a0541d44c78ced78a566051ec8f63417370aeaa.

7 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>
7 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>
7 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>
7 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>