]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
11 months agonetwork: also synchronously update manager state file
Yu Watanabe [Tue, 24 Oct 2023 09:33:45 +0000 (18:33 +0900)] 
network: also synchronously update manager state file

11 months agonetwork: make link_save() static
Yu Watanabe [Tue, 24 Oct 2023 09:25:47 +0000 (18:25 +0900)] 
network: make link_save() static

11 months agonetwork: do not try to save link state file twice on boot
Yu Watanabe [Tue, 24 Oct 2023 09:13:08 +0000 (18:13 +0900)] 
network: do not try to save link state file twice on boot

On enumeration, (that is, before manager_start() is called), enumerated
links may already have the dirty flag. In that case, saving the state
file in manager_start() should clear the flag.

11 months agoMerge pull request #29681 from YHNdnzj/sleep-round-three
Mike Yuan [Tue, 24 Oct 2023 09:03:54 +0000 (17:03 +0800)] 
Merge pull request #29681 from YHNdnzj/sleep-round-three

sleep-config: cleanup round three

11 months agoMerge pull request #29679 from keszybz/drop-iovec-null
Yu Watanabe [Tue, 24 Oct 2023 08:05:45 +0000 (17:05 +0900)] 
Merge pull request #29679 from keszybz/drop-iovec-null

Drop IOVEC_NULL

11 months agobasic/iovec-util: use FOREACH_ARRAY in one more place 29679/head
Zbigniew Jędrzejewski-Szmek [Mon, 23 Oct 2023 20:30:28 +0000 (22:30 +0200)] 
basic/iovec-util: use FOREACH_ARRAY in one more place

11 months agobasic/iovec-util: drop TAKE_IOVEC
Zbigniew Jędrzejewski-Szmek [Mon, 23 Oct 2023 20:23:07 +0000 (22:23 +0200)] 
basic/iovec-util: drop TAKE_IOVEC

As suggested in
https://github.com/systemd/systemd/pull/29679#discussion_r1368678932.

11 months agosystemctl: fallback if logind doesn't support new flag
Luca Boccassi [Mon, 23 Oct 2023 15:43:33 +0000 (16:43 +0100)] 
systemctl: fallback if logind doesn't support new flag

Follow-up for 665a3d6d15c09428

11 months agoMerge pull request #29633 from yuwata/dhcp-ipv6-only-mode-follow-ups
Luca Boccassi [Mon, 23 Oct 2023 17:39:10 +0000 (18:39 +0100)] 
Merge pull request #29633 from yuwata/dhcp-ipv6-only-mode-follow-ups

dhcp: several follow-ups for IPv6 only mode

11 months agosleep-config: check sleep mode only when hibernation 29681/head
Mike Yuan [Mon, 23 Oct 2023 13:19:29 +0000 (21:19 +0800)] 
sleep-config: check sleep mode only when hibernation

With the previous change, this should only be used when
doing hibernation.

11 months agosleep-config: remove HibernateState= & HybridSleepState=, restrict
Mike Yuan [Fri, 20 Oct 2023 16:21:20 +0000 (00:21 +0800)] 
sleep-config: remove HibernateState= & HybridSleepState=, restrict
SuspendState= not to include "disk"

I don't know why these existed in the first place, but as I
justified in the comments, it's simply not sensible to allow
HibernateState= or HybridSleepState= to take values other than
'disk'. So let's just remove those options. Also, SuspendState=
should not contain 'disk'.

11 months agohibernate-util: add missing assertion
Mike Yuan [Sat, 21 Oct 2023 11:53:04 +0000 (19:53 +0800)] 
hibernate-util: add missing assertion

11 months agohibernate-resume: add missing static for arg_info
Mike Yuan [Mon, 23 Oct 2023 13:02:25 +0000 (21:02 +0800)] 
hibernate-resume: add missing static for arg_info

11 months agotimedatectl: add missing commands to the help output
Antonio Alvarez Feijoo [Mon, 23 Oct 2023 13:29:40 +0000 (15:29 +0200)] 
timedatectl: add missing commands to the help output

Follow up to 159a855b34c35484c28cf4b0178f93bc16447fac

11 months agobasic/iovec-util: drop IOVEC_NULL
Zbigniew Jędrzejewski-Szmek [Mon, 23 Oct 2023 12:59:17 +0000 (14:59 +0200)] 
basic/iovec-util: drop IOVEC_NULL

The macro isn't very useful, we can just use the direct setting to increase
readability.

11 months agobasic/iovec-util: always call the iovec "iovec"
Zbigniew Jędrzejewski-Szmek [Mon, 23 Oct 2023 12:51:43 +0000 (14:51 +0200)] 
basic/iovec-util: always call the iovec "iovec"

We were using "i", "iov", and "iovec" in variuos places. Let's be
consistent.

11 months agoMerge pull request #29674 from poettering/unexport-marshal-blob
Luca Boccassi [Mon, 23 Oct 2023 10:43:15 +0000 (11:43 +0100)] 
Merge pull request #29674 from poettering/unexport-marshal-blob

tpm2-util: make tpm2_marshal_blob()/tpm2_unmarshal_blob() static

11 months agoglyph-util: add 'full block' glyph
Lennart Poettering [Wed, 12 Jul 2023 20:28:12 +0000 (22:28 +0200)] 
glyph-util: add 'full block' glyph

11 months agopcrextend: split out word to measure code into shared helper file
Lennart Poettering [Sun, 16 Jul 2023 09:09:30 +0000 (11:09 +0200)] 
pcrextend: split out word to measure code into shared helper file

Let's split out the logic that actually generates the word to measure to
PCRs into a new helper file pcrextend-util.[ch].

This we can later reuse to calculate PCR measurement predictions ahead
of time.

11 months agoefi-api: export UUID converter calls
Lennart Poettering [Mon, 14 Aug 2023 11:29:07 +0000 (13:29 +0200)] 
efi-api: export UUID converter calls

(while exporting, do some minor simplifications)

11 months agotpm2-util: make tpm2_read_public() static, as we use it only internally in tpm2-util.c 29674/head
Lennart Poettering [Sat, 21 Oct 2023 14:33:41 +0000 (16:33 +0200)] 
tpm2-util: make tpm2_read_public() static, as we use it only internally in tpm2-util.c

11 months agotpm2-util: make tpm2_marshal_blob()/tpm2_unmarshal_blob() static
Lennart Poettering [Mon, 23 Oct 2023 08:18:41 +0000 (10:18 +0200)] 
tpm2-util: make tpm2_marshal_blob()/tpm2_unmarshal_blob() static

These are not used outside of tpm2-util.[ch], and the way they merge
public/private key pair into one blob is kinda specific to our
implementation, hence better should be hidden away, and not used for new
code anyway.

11 months agocreds-utils: fix read_full_file_full call in read_credential_with_decryption
Julien Malka [Mon, 23 Oct 2023 00:37:40 +0000 (00:37 +0000)] 
creds-utils: fix read_full_file_full call in read_credential_with_decryption

data was passed as a null pointer when an address was expected.
As a result, the assert was always tripped.

11 months agodocs: correct parenthesis placement in 'man/tmpfiles.d.xml'
NAHO [Sun, 22 Oct 2023 16:34:24 +0000 (18:34 +0200)] 
docs: correct parenthesis placement in 'man/tmpfiles.d.xml'

Correct the parenthesis placement in 'man/tmpfiles.d.xml' to prevent the
following formatting:

> lock ( shared or exclusive) is

11 months agotpm2-util: rename tpm2_calculate_name() → tpm2_calculate_pubkey_name()
Lennart Poettering [Sat, 21 Oct 2023 14:17:39 +0000 (16:17 +0200)] 
tpm2-util: rename tpm2_calculate_name() → tpm2_calculate_pubkey_name()

We'll soon have a function for determining the name of an NV index,
hence let's rename the existing function for the same of a public key to
make clear it's about public keys only.

11 months agoMerge pull request #29382 from YHNdnzj/sleep-round-two
Luca Boccassi [Sat, 21 Oct 2023 10:51:09 +0000 (11:51 +0100)] 
Merge pull request #29382 from YHNdnzj/sleep-round-two

shared/sleep-config,hibernate-util: cleanup round two

11 months agounits: modprobe@.service: don't unescape instance name
Martin Wilck [Fri, 20 Oct 2023 14:25:15 +0000 (16:25 +0200)] 
units: modprobe@.service: don't unescape instance name

modprobe treats "-" and "_" interchangeably, thereby avoiding frequent
errors because some module names contain dashes and others underscores.

Because modprobe@.service unescapes the instance name, an attempt to
start "modprobe@dm-crypt.service" will run "modprobe -abq dm/crypt",
which is doomed to fail. "modprobe@dm_crypt.service" will work as
expected. Thus unescaping the instance name has surprising side effects.
Use "%i" instead.

11 months agotest: install af_packet kernel module on openSUSE
Franck Bui [Fri, 20 Oct 2023 17:54:53 +0000 (19:54 +0200)] 
test: install af_packet kernel module on openSUSE

Currently needed by test-dhcp-server unit test, af_packet is not built-in on
openSUSE distributions.

11 months agoMerge pull request #29652 from yuwata/dhcp-cleanup-headers
Luca Boccassi [Sat, 21 Oct 2023 10:38:23 +0000 (11:38 +0100)] 
Merge pull request #29652 from yuwata/dhcp-cleanup-headers

dhcp: cleanup headers

11 months agoMerge pull request #29650 from YHNdnzj/more-followup
Luca Boccassi [Sat, 21 Oct 2023 10:37:38 +0000 (11:37 +0100)] 
Merge pull request #29650 from YHNdnzj/more-followup

Some more follow-ups for recent PRs

11 months agoshared/mount-util: log correct errno 29650/head
Mike Yuan [Fri, 20 Oct 2023 04:09:06 +0000 (12:09 +0800)] 
shared/mount-util: log correct errno

Follow-up for 5f48198af82e5a6f40adf887291fdd47bcecf64c

11 months agoman,docs: suffix directories with /
Mike Yuan [Fri, 20 Oct 2023 14:52:12 +0000 (22:52 +0800)] 
man,docs: suffix directories with /

11 months agocore/execute: use FOREACH_ARRAY and free_many more
Mike Yuan [Fri, 20 Oct 2023 06:54:49 +0000 (14:54 +0800)] 
core/execute: use FOREACH_ARRAY and free_many more

11 months agonetwork,dhcp: restart client with 'networkctl renew' when delayed by IPv6 only mode 29633/head
Yu Watanabe [Thu, 19 Oct 2023 16:35:03 +0000 (01:35 +0900)] 
network,dhcp: restart client with 'networkctl renew' when delayed by IPv6 only mode

This is convenient when the server supports IPv6 only mode.
Otherwise, we cannot request a new address during the client is waiting an
IPv6 connectivity. Note, the minimal timespan is 5min, and a server may
send a quite large value.

11 months agodhcp: split dhcp-internal.h into two 29652/head
Yu Watanabe [Fri, 20 Oct 2023 16:27:52 +0000 (01:27 +0900)] 
dhcp: split dhcp-internal.h into two

11 months agosd-dhcp-client: always use sd_dhcp_client.timeout_ipv6_only_mode for delaying subsequ...
Yu Watanabe [Thu, 19 Oct 2023 16:21:42 +0000 (01:21 +0900)] 
sd-dhcp-client: always use sd_dhcp_client.timeout_ipv6_only_mode for delaying subsequent task

Otherwise, sd_dhcp_client_set_ipv6_connectivity() may not work, as it
checks if the timer event source is enabled or not.

11 months agodhcp: move DHCP client specific definitions to dhcp-client-internal.h
Yu Watanabe [Fri, 20 Oct 2023 16:03:00 +0000 (01:03 +0900)] 
dhcp: move DHCP client specific definitions to dhcp-client-internal.h

11 months agosd-dhcp-client: add a short comment about IPv6 only mode
Yu Watanabe [Thu, 19 Oct 2023 15:16:39 +0000 (00:16 +0900)] 
sd-dhcp-client: add a short comment about IPv6 only mode

11 months agosd-dhcp-client: only send RENEW message when the client is in bound state
Yu Watanabe [Thu, 19 Oct 2023 15:01:15 +0000 (00:01 +0900)] 
sd-dhcp-client: only send RENEW message when the client is in bound state

Fixes an issue reported at
https://github.com/systemd/systemd/pull/29544#issuecomment-1762742561.

11 months agosd-dhcp-client: simplify the condition in sd_dhcp_client_get_lease()
Yu Watanabe [Thu, 19 Oct 2023 14:57:44 +0000 (23:57 +0900)] 
sd-dhcp-client: simplify the condition in sd_dhcp_client_get_lease()

The condition was outdated, e.g. SELECTING state does not have a lease.
See client_handle_offer() and client_enter_requesting().

The condition based on the state may become much complex in the future.
Let's use simpler condition.

11 months agodhcp: split out dhcp-network.h from dhcp-internal.h
Yu Watanabe [Fri, 20 Oct 2023 15:26:38 +0000 (00:26 +0900)] 
dhcp: split out dhcp-network.h from dhcp-internal.h

11 months agodhcp: move DHCPState to dhcp-client-internal.h
Yu Watanabe [Fri, 20 Oct 2023 15:46:39 +0000 (00:46 +0900)] 
dhcp: move DHCPState to dhcp-client-internal.h

All other definitions in dhcp-protocol.h are common for client and
server. Let's move DHCP client specific definitions.

11 months agofuzz: include library headers first
Yu Watanabe [Fri, 20 Oct 2023 15:28:57 +0000 (00:28 +0900)] 
fuzz: include library headers first

11 months agohibernate-util: introduce hibernation_is_safe 29382/head
Mike Yuan [Mon, 16 Oct 2023 05:10:01 +0000 (13:10 +0800)] 
hibernate-util: introduce hibernation_is_safe

After 7470b80763ac0f598ca1ef73d44763967119c18d, we refuse
to hibernate if we fail to write HibernateLocation EFI
variable and resume= is not set. Let's teach sleep_supported
to follow the practice too.

11 months agohibernate-util: rework find_hibernate_location
Mike Yuan [Thu, 28 Sep 2023 01:05:41 +0000 (09:05 +0800)] 
hibernate-util: rework find_hibernate_location

* "HibernateLocation" struct is renamed to HibernationDevice
  to avoid ambiguity with the EFI variable. Also, it no longer
  takes the reference to a SwapEntry object, since it's really
  unnecessary (only SwapEntry.path is used), but increases complexity.
* SwapEntry is no longer used externally.
* find_hibernate_location is split into read_swap_entries and
  find_suitable_hibernation_device. The former reads all swap entries
  into SwapEntries object for later use.
* Make use of btrfs_get_file_physical_offset_fd

Closes #25130

11 months agohibernate-util: read_fiemap: add missing asserts
Mike Yuan [Sat, 30 Sep 2023 15:32:08 +0000 (23:32 +0800)] 
hibernate-util: read_fiemap: add missing asserts

11 months agosleep-config: introduce sleep_supported_full that returns a reason
Mike Yuan [Mon, 16 Oct 2023 12:34:29 +0000 (20:34 +0800)] 
sleep-config: introduce sleep_supported_full that returns a reason

Preparation for later commits.

Also some other cleanups:
* Add assertions
* Use FOREACH_ARRAY

11 months agosleep-config: minor cleanup for can_sleep_{state,disk}
Mike Yuan [Wed, 27 Sep 2023 22:43:06 +0000 (06:43 +0800)] 
sleep-config: minor cleanup for can_sleep_{state,disk}

* Rename to sleep_{state,mode}_supported
* Treat unreadable/unwriable sysfs files as error

11 months agotest-btrfs-physical-offset: log correct errno
Mike Yuan [Sat, 30 Sep 2023 08:40:22 +0000 (16:40 +0800)] 
test-btrfs-physical-offset: log correct errno

11 months agostub: Ignore the boot counter when looking for .extra.d directory
Valentin David [Thu, 19 Oct 2023 21:13:45 +0000 (23:13 +0200)] 
stub: Ignore the boot counter when looking for .extra.d directory

If `foo+3-0.efi` is booted when there are some files in `foo.efi.extra.d`,
those files are ignored. But after the boot is blessed and the system rebooted,
those file are taken into account, and the boot is different from first
boot. This behavior is a bit puzzling.

Instead we now ignore the counter and always look for the extra files in
`foo.efi.extra.d` and always boot the same way.

11 months agomkfs-util: set timezone to UTC when copying files into fat partition
Malte Poll [Fri, 20 Oct 2023 12:59:41 +0000 (12:59 +0000)] 
mkfs-util: set timezone to UTC when copying files into fat partition

mcopy will set the modification time of created directories to the mtime
of the source directories but converts it to the timezone of the host.
This behavior is identical to Windows / DOS:

>  The FAT file system stores time values based on the local time of the computer.

-- https://learn.microsoft.com/en-us/windows/win32/sysinfo/file-times

To achieve reproducible builds, mcopy should be invoked with TZ=UTC.

Co-authored-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
11 months agotpm2: move event tag sd-boot/sd-stub to make measurements with into src/fundamental/
Lennart Poettering [Thu, 12 Oct 2023 14:28:38 +0000 (16:28 +0200)] 
tpm2: move event tag sd-boot/sd-stub to make measurements with into src/fundamental/

Ultimately we want to be able to recognize these in userspace, hence
make them available in both UEFI mode and userspace.

While we are at it, let's rename the fields a bit, reflecting more what
they measure, not what the metadata is that we store about them.

11 months agosort-utils: add generic uint16_t comparison call
Lennart Poettering [Sun, 16 Jul 2023 09:06:49 +0000 (11:06 +0200)] 
sort-utils: add generic uint16_t comparison call

11 months agoformat-table: add new table_get_current_column() helper
Lennart Poettering [Wed, 12 Jul 2023 20:50:25 +0000 (22:50 +0200)] 
format-table: add new table_get_current_column() helper

11 months agoformat-table: add new uint32_t hex field type
Lennart Poettering [Fri, 7 Jul 2023 15:26:33 +0000 (17:26 +0200)] 
format-table: add new uint32_t hex field type

11 months agoMerge pull request #29644 from poettering/json-iovec
Luca Boccassi [Fri, 20 Oct 2023 14:54:29 +0000 (15:54 +0100)] 
Merge pull request #29644 from poettering/json-iovec

add iovec/base64 json helpers and other iovec tweaks

11 months agoMerge pull request #29630 from DaanDeMeyer/manager-json
Daan De Meyer [Fri, 20 Oct 2023 14:42:12 +0000 (16:42 +0200)] 
Merge pull request #29630 from DaanDeMeyer/manager-json

Various refactoring in preparation for adding JSON dump to pid 1

11 months agoMerge pull request #29626 from bluca/auto_soft_reboot
Luca Boccassi [Fri, 20 Oct 2023 12:46:46 +0000 (13:46 +0100)] 
Merge pull request #29626 from bluca/auto_soft_reboot

systemctl: automatically softreboot/kexec if set up on reboot

11 months agorepart: port to new "struct iovec" JSON + primitive helpers 29644/head
Lennart Poettering [Fri, 20 Oct 2023 12:16:01 +0000 (14:16 +0200)] 
repart: port to new "struct iovec" JSON + primitive helpers

11 months agojson: add helpers for dispatching/building JSON with base64 struct iovecs
Lennart Poettering [Thu, 19 Oct 2023 15:41:01 +0000 (17:41 +0200)] 
json: add helpers for dispatching/building JSON with base64 struct iovecs

11 months agoiovec-util: add some useful helpers for dealing with iovecs that refer to dynamic...
Lennart Poettering [Thu, 19 Oct 2023 15:04:04 +0000 (17:04 +0200)] 
iovec-util: add some useful helpers for dealing with iovecs that refer to dynamic memory

11 months agotpm2-util: add line break where appropriate
Lennart Poettering [Thu, 19 Oct 2023 15:55:09 +0000 (17:55 +0200)] 
tpm2-util: add line break where appropriate

11 months agotpm2-util: add a bunch of line breaks for an overly long bitmask
Lennart Poettering [Thu, 19 Oct 2023 15:45:48 +0000 (17:45 +0200)] 
tpm2-util: add a bunch of line breaks for an overly long bitmask

11 months agojson: Introduce JSON_BUILD_CALLBACK 29630/head
Daan De Meyer [Fri, 20 Oct 2023 10:31:56 +0000 (12:31 +0200)] 
json: Introduce JSON_BUILD_CALLBACK

11 months agojson: Introduce JSON_BUILD_STRING_SET
Daan De Meyer [Thu, 19 Oct 2023 14:51:08 +0000 (16:51 +0200)] 
json: Introduce JSON_BUILD_STRING_SET

11 months agohashmap: Add extra uncounted entry to returned array from hashmap_dump_sorted()
Daan De Meyer [Fri, 20 Oct 2023 10:07:32 +0000 (12:07 +0200)] 
hashmap: Add extra uncounted entry to returned array from hashmap_dump_sorted()

This allows using the returned array as a strv.

11 months agomanager: Introduce manager_get_progress() helper
Daan De Meyer [Thu, 19 Oct 2023 14:49:08 +0000 (16:49 +0200)] 
manager: Introduce manager_get_progress() helper

11 months agounit: Move three helpers to unit.h
Daan De Meyer [Thu, 19 Oct 2023 14:45:23 +0000 (16:45 +0200)] 
unit: Move three helpers to unit.h

11 months agotimer: Add two more helper functions
Daan De Meyer [Thu, 19 Oct 2023 14:42:38 +0000 (16:42 +0200)] 
timer: Add two more helper functions

11 months agoswap: Move two functions to swap.h
Daan De Meyer [Thu, 19 Oct 2023 14:41:52 +0000 (16:41 +0200)] 
swap: Move two functions to swap.h

11 months agosocket: Add one more helper
Daan De Meyer [Thu, 19 Oct 2023 14:41:04 +0000 (16:41 +0200)] 
socket: Add one more helper

11 months agomount: Add more helpers
Daan De Meyer [Thu, 19 Oct 2023 14:38:47 +0000 (16:38 +0200)] 
mount: Add more helpers

11 months agoexecute: Add more helper functions
Daan De Meyer [Thu, 19 Oct 2023 14:37:35 +0000 (16:37 +0200)] 
execute: Add more helper functions

11 months agocore: Add two more to_string() functions
Daan De Meyer [Thu, 19 Oct 2023 14:35:52 +0000 (16:35 +0200)] 
core: Add two more to_string() functions

11 months agoAdd unit_type_to_capitalized_string()
Daan De Meyer [Thu, 19 Oct 2023 14:34:19 +0000 (16:34 +0200)] 
Add unit_type_to_capitalized_string()

11 months agoMerge pull request #29627 from poettering/io-split
Luca Boccassi [Fri, 20 Oct 2023 11:19:22 +0000 (12:19 +0100)] 
Merge pull request #29627 from poettering/io-split

split up io-util.[ch], and some clean-ups

11 months agorm-rf: Make sure we rewinddir() before readdir()
Daan De Meyer [Thu, 19 Oct 2023 17:42:07 +0000 (19:42 +0200)] 
rm-rf: Make sure we rewinddir() before readdir()

We don't know what state the passed in file descriptor is in. Let's
make sure we rewind it before iterating over it.

Fixes #29606

11 months agosystemctl: automatically softreboot/kexec if set up on reboot 29626/head
Luca Boccassi [Thu, 19 Oct 2023 12:58:03 +0000 (13:58 +0100)] 
systemctl: automatically softreboot/kexec if set up on reboot

Automatically softreboot if the nextroot has been set up with an OS
tree, or automatically kexec if a kernel has been loaded with kexec
--load.

Add SYSTEMCTL_SKIP_AUTO_KEXEC and SYSTEMCTL_SKIP_AUTO_SOFT_REBOOT to
skip the automated switchover.

11 months agocredentials: document that their path is stable for system services
Joerg Behrmann [Fri, 20 Oct 2023 09:35:04 +0000 (11:35 +0200)] 
credentials: document that their path is stable for system services

11 months agomkosi: Use RuntimeTrees= to mount sources
Daan De Meyer [Tue, 17 Oct 2023 14:03:42 +0000 (16:03 +0200)] 
mkosi: Use RuntimeTrees= to mount sources

Instead of using ExtraTrees=, let's use the new RuntimeTrees= option
to mount the full repository into the VM/container. Let's also store
the sources under /usr/src/systemd and update the gdbinit file and
vscode HACKING guide section to match the new location.

11 months agonetif-naming-scheme: disable NAMING_BRIDGE_MULTIFUNCTION_SLOT
Yu Watanabe [Wed, 23 Aug 2023 15:01:19 +0000 (00:01 +0900)] 
netif-naming-scheme: disable NAMING_BRIDGE_MULTIFUNCTION_SLOT

This effectively reverts 66425daf2c68793adf24a48a26d58add8662e83f.

The commit assumes that if the network interface has multifunctions,
then the function fields of the pci devices under the same PCI bridge
device are unique.
But it seems not, at least on some setups. See issue #28929.
Let's revert the change, and always refuse to set slot base naming if
a PCI bridge is detected.

Fixes #28929.

11 months agoMerge pull request #29618 from bonktree/fchmodat2
Luca Boccassi [Fri, 20 Oct 2023 09:49:46 +0000 (10:49 +0100)] 
Merge pull request #29618 from bonktree/fchmodat2

seccomp: get `fchmodat2(2)` covered by `RestrictSUIDSGID=`

11 months agoman: document the order in which we talk to DNS servers
Lennart Poettering [Wed, 18 Oct 2023 16:14:00 +0000 (18:14 +0200)] 
man: document the order in which we talk to DNS servers

11 months agoio-util: split out iovw_xyz into iovec-wrapper.h 29627/head
Lennart Poettering [Thu, 19 Oct 2023 14:24:20 +0000 (16:24 +0200)] 
io-util: split out iovw_xyz into iovec-wrapper.h

Let's split these APIs out, they are kinda their own thing.

11 months agoiovec-util: make IOVEC_INCREMENT a regular function too
Lennart Poettering [Thu, 19 Oct 2023 14:36:43 +0000 (16:36 +0200)] 
iovec-util: make IOVEC_INCREMENT a regular function too

Even more than with the previous commit, this is not a trivial function
and there's no reason to believe this will actually be inlined nor that
it would be beneficial.

11 months agoiovec-util: make IOVEC_MAKE_STRING() safer
Lennart Poettering [Thu, 19 Oct 2023 14:30:23 +0000 (16:30 +0200)] 
iovec-util: make IOVEC_MAKE_STRING() safer

Let's not accept arbitrary types, but only char* and const char*.

11 months agoiovec-util: make IOVEC_NULL const
Lennart Poettering [Thu, 19 Oct 2023 14:27:16 +0000 (16:27 +0200)] 
iovec-util: make IOVEC_NULL const

compound initialized structs can be placed im immutable memory if const,
hence there's benefit in making this one const too

11 months agoiovec-util: make IOVEC_TOTAL_SIZE() a regular function
Lennart Poettering [Thu, 19 Oct 2023 14:33:51 +0000 (16:33 +0200)] 
iovec-util: make IOVEC_TOTAL_SIZE() a regular function

The function isn't necessarily fast (it's O(n)), and there's no reason
to have it defined as inline function, since it's neither fast, nor
entirely trivial.

11 months agoio-util: split out "struct iovec" related calls into their own .c/.h files
Lennart Poettering [Thu, 19 Oct 2023 14:01:38 +0000 (16:01 +0200)] 
io-util: split out "struct iovec" related calls into their own .c/.h files

This is preparation for #28891, which adds a bunch more helpers around
"struct iovec", at which point this really deserves its own .c/.h file.

The idea is that we sooner or later can consider "struct iovec" as an
entirely generic mechanism to reference some binary blob, and is the
go-to type for this purpose whenever we need one.

11 months agoexecutor: return instead of assert on invalid command line arguments
Luca Boccassi [Thu, 19 Oct 2023 19:53:10 +0000 (20:53 +0100)] 
executor: return instead of assert on invalid command line arguments

Before the split, it made sense to assert, as checks were on setup.
But now these come from deserialization, and the fuzzer hits the
asserts, so simply return an error instead.

11 months agoman: mention that inhibit blocks soft-reboot too
Luca Boccassi [Thu, 19 Oct 2023 13:52:21 +0000 (14:52 +0100)] 
man: mention that inhibit blocks soft-reboot too

11 months agotest-recurse-dir: work around nftw() ignoring symlinks()
Zbigniew Jędrzejewski-Szmek [Thu, 19 Oct 2023 14:46:56 +0000 (16:46 +0200)] 
test-recurse-dir: work around nftw() ignoring symlinks()

We have a test where we compare the results from nftw() and our own
resurce_dit_at(). nftw() skips a dangling symlink when running under mkosi and
the test fails. I don't understand why nftw() does that, but in our code we
don't need to test and care about the details of nftw(), which we don't use,
outside of the one test, so let's just skip symlinks in the test.

Closes #29603.

11 months agoMerge pull request #29628 from mrc0mmand/systemd-executor-test
Luca Boccassi [Thu, 19 Oct 2023 18:39:39 +0000 (19:39 +0100)] 
Merge pull request #29628 from mrc0mmand/systemd-executor-test

test: slightly improve sd-executor's coverage

11 months agopidref: make PIDREF_NULL const
Lennart Poettering [Thu, 19 Oct 2023 15:09:41 +0000 (17:09 +0200)] 
pidref: make PIDREF_NULL const

That way compiler can put it in an immutable section

11 months agoMerge pull request #29629 from bluca/mount_tunnel_pidref
Luca Boccassi [Thu, 19 Oct 2023 17:59:22 +0000 (18:59 +0100)] 
Merge pull request #29629 from bluca/mount_tunnel_pidref

mount tunnel: use PidRef

11 months agoMerge pull request #29623 from YHNdnzj/core-followup
Luca Boccassi [Thu, 19 Oct 2023 17:04:40 +0000 (18:04 +0100)] 
Merge pull request #29623 from YHNdnzj/core-followup

Follow-ups for recent changes to core/

11 months agotest: skip Protect{Home,System}= tests with coverage builds
Frantisek Sumsal [Thu, 19 Oct 2023 13:13:07 +0000 (15:13 +0200)] 
test: skip Protect{Home,System}= tests with coverage builds

With coverage builds we disable Protect{Home,System}= via a service.d
dropin in /etc, which has, unfortunately, higher priority than our
transient systemd-run stuff. Let's just skip the affected tests in that
case instead of making the test setup even more complicated.

11 months agopid1,vconsole-setup: lock /dev/console instead of the tty device
Zbigniew Jędrzejewski-Szmek [Tue, 17 Oct 2023 17:43:31 +0000 (19:43 +0200)] 
pid1,vconsole-setup: lock /dev/console instead of the tty device

As requested in https://github.com/systemd/systemd/pull/27867#pullrequestreview-1567161854.
/dev/console, /dev/tty0, and /dev/ttyN are "different" device nodes
that may point to a single underlying device. We want to use a single
lock so that we don't get a race if different writers are using a different
device path, so let's just always lock around /dev/console.
This effectively makes the locking less granular.

Fixup for a0043bfa51281c2374878e2a98cf2a3ee10fd92c.
Fixes https://github.com/systemd/systemd/issues/28721.
Maybe fixes https://github.com/systemd/systemd/issues/28778 and
https://github.com/systemd/systemd/issues/28634.

11 months agotest: unify checking for user xattrs support in cgroupfs
Frantisek Sumsal [Thu, 19 Oct 2023 10:28:37 +0000 (12:28 +0200)] 
test: unify checking for user xattrs support in cgroupfs

Also, run the coredump forwarding test only if user xattrs are
supported.

11 months agomeson: generate proper version tag when git fails on permission errors
Zbigniew Jędrzejewski-Szmek [Thu, 19 Oct 2023 10:55:59 +0000 (12:55 +0200)] 
meson: generate proper version tag when git fails on permission errors

When building with mkosi I would get the following:

    [1/477] Generating version.h with a custom command
    fatal: detected dubious ownership in repository at '/work/src'
    To add an exception for this directory, call:

            git config --global --add safe.directory /work/src

and then the tag would be generated as 'v254-'. This is obviously some problem
with the setup, but we should handle this gracefully. Let's fall back to 'v254'
instead.

In the case where we have a repo but no tags, use --dirty=^ too, as in the case
with tags.

I tested four cases:
- normal checkout
- checkout with .git removed
- checkout with .git chowned to root
- checkout wiht all tags removed