]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
13 months agoMerge pull request #28870 from ssahani/rto-min-network
Luca Boccassi [Fri, 18 Aug 2023 08:23:45 +0000 (09:23 +0100)] 
Merge pull request #28870 from ssahani/rto-min-network

network: Route - allow to set TCP RTO

13 months agoMerge pull request #28846 from ssahani/custom-duid-dhcp4-26745
Luca Boccassi [Fri, 18 Aug 2023 08:23:30 +0000 (09:23 +0100)] 
Merge pull request #28846 from ssahani/custom-duid-dhcp4-26745

network: DHCP6 client- Allow to send manual DUID

13 months agoMerge pull request #28697 from 1awesomeJ/new_bsod
Luca Boccassi [Thu, 17 Aug 2023 23:20:04 +0000 (00:20 +0100)] 
Merge pull request #28697 from 1awesomeJ/new_bsod

systemd-bsod: Add "--continuous" option

13 months agoMake systemd-bsod not a public binary 28697/head
OMOJOLA JOSHUA [Thu, 17 Aug 2023 13:12:31 +0000 (14:12 +0100)] 
Make systemd-bsod not a public binary

13 months agodissect: Set SYSTEMD_DISSECT_DEVICE to path of loop device
Daan De Meyer [Thu, 17 Aug 2023 13:07:57 +0000 (15:07 +0200)] 
dissect: Set SYSTEMD_DISSECT_DEVICE to path of loop device

For some use cases we want to operate on the loop device that
systemd-dissect has attached the loop device to, so let's make that
easily accessible.

13 months agoCI: network dhcp6 - Add test for custom client identifier 28846/head
Susant Sahani [Thu, 17 Aug 2023 13:50:02 +0000 (19:20 +0530)] 
CI: network dhcp6 - Add test for custom client identifier

13 months agonetwork: DHCP6 client- Allow to send manual DUID
Susant Sahani [Tue, 15 Aug 2023 13:26:19 +0000 (18:56 +0530)] 
network: DHCP6 client- Allow to send manual DUID

```
[DHCPv6]
DUIDType=custom
DUIDRawData=00:00:ab:11:f9:2a:c2:77:29:f9:5c:00
```

```
Client Identifier
    Option: Client Identifier (1)
    Length: 12
    DUID: 0000ab11f92ac27729f95c00
    DUID Type: Unknown (0)
```

13 months agoCI: network - Add test for route TCP RTO 28870/head
Susant Sahani [Thu, 17 Aug 2023 18:19:32 +0000 (23:49 +0530)] 
CI: network - Add test for route TCP RTO

13 months agonetwork: Route - allow to set TCP RTO
Susant Sahani [Thu, 17 Aug 2023 12:07:14 +0000 (17:37 +0530)] 
network: Route - allow to set TCP RTO

13 months agotest: Check that SELinux policy is available before running SELinux test (#28868)
Johannes Segitz [Thu, 17 Aug 2023 17:04:53 +0000 (19:04 +0200)] 
test: Check that SELinux policy is available before running SELinux test (#28868)

* test: Check that SELinux policy is available before running SELinux test

---------

Co-authored-by: Frantisek Sumsal <frantisek@sumsal.cz>
13 months agoMerge pull request #28832 from dtardon/list-clear
Luca Boccassi [Thu, 17 Aug 2023 15:27:43 +0000 (16:27 +0100)] 
Merge pull request #28832 from dtardon/list-clear

Add LIST_CLEAR() helper that empties the list

13 months agoMerge pull request #28869 from DaanDeMeyer/repart-trailing
Daan De Meyer [Thu, 17 Aug 2023 12:55:03 +0000 (14:55 +0200)] 
Merge pull request #28869 from DaanDeMeyer/repart-trailing

repart: Make sure we keep trailing slashes in ExcludeFiles=

13 months agosystemd-bsod: Add "--continuous" option
OMOJOLA JOSHUA [Sun, 6 Aug 2023 16:09:27 +0000 (17:09 +0100)] 
systemd-bsod: Add "--continuous" option

13 months agoMerge pull request #28751 from yuwata/mount-revert
Luca Boccassi [Thu, 17 Aug 2023 12:03:36 +0000 (13:03 +0100)] 
Merge pull request #28751 from yuwata/mount-revert

Revert "mount: check right before invoking /bin/umount if it makes sense"

13 months agomeson: Use rsync to copy test data directories
Daan De Meyer [Wed, 16 Aug 2023 19:22:57 +0000 (21:22 +0200)] 
meson: Use rsync to copy test data directories

install_subdir() does not copy symlinks but copies the file they
point to. We also get a very ugly warning in the meson install
output:

"""
Warning: trying to copy a symlink that points to a file. This will copy the file,
but this will be changed in a future version of Meson to copy the symlink as is. Please update your
build definitions so that it will not break when the change happens.
"""

Let's fix both problems at once by using rsync which does the right
thing. Verified by running systemd-dissect --mtree on both the install
output before and after and all the symlinks are now correctly preserved.

13 months agorepart: Make sure we keep trailing slashes in ExcludeFiles= 28869/head
Daan De Meyer [Thu, 17 Aug 2023 11:00:27 +0000 (13:00 +0200)] 
repart: Make sure we keep trailing slashes in ExcludeFiles=

We conditionalize behavior based on whether these paths have trailing
slashes or not, so let's make sure we keep them intact.

13 months agoparse-helpers: Add PATH_KEEP_TRAILING_SLASH
Daan De Meyer [Thu, 17 Aug 2023 11:11:11 +0000 (13:11 +0200)] 
parse-helpers: Add PATH_KEEP_TRAILING_SLASH

13 months agopath-util: Add path_simplify_full()
Daan De Meyer [Thu, 17 Aug 2023 11:09:19 +0000 (13:09 +0200)] 
path-util: Add path_simplify_full()

Sometimes its useful to keep a trailing slash in the path so let's
add path_simplify_full() and a flag to do just that.

13 months agobus-polkit: don't propagate error from polkit
David Tardon [Thu, 17 Aug 2023 05:49:35 +0000 (07:49 +0200)] 
bus-polkit: don't propagate error from polkit

An error reply from polkit is a valid case and should not be propagated
as failure of async_polkit_callback(). It should only be saved here.
It'll be returned by bus_verify_polkit_async() later, when it's called
for the same method again.

Follow-up for #26365.

13 months agosystemd-stub: ignore EFI shell unauthenticated kernel command line if we are in confi...
Emanuele Giuseppe Esposito [Thu, 10 Aug 2023 13:21:41 +0000 (09:21 -0400)] 
systemd-stub: ignore EFI shell unauthenticated kernel command line if we are in confidential vms

13 months agoopen-file: add missing assert 28832/head
David Tardon [Mon, 14 Aug 2023 15:01:41 +0000 (17:01 +0200)] 
open-file: add missing assert

13 months agosystemctl-show: rename cleanup function
David Tardon [Mon, 14 Aug 2023 14:09:16 +0000 (16:09 +0200)] 
systemctl-show: rename cleanup function

13 months agotree-wide: use LIST_POP()
David Tardon [Mon, 14 Aug 2023 14:32:55 +0000 (16:32 +0200)] 
tree-wide: use LIST_POP()

13 months agotree-wide: use LIST_CLEAR()
David Tardon [Mon, 14 Aug 2023 14:07:46 +0000 (16:07 +0200)] 
tree-wide: use LIST_CLEAR()

13 months agolist: add LIST_CLEAR() helper that empties the list
David Tardon [Wed, 9 Aug 2023 14:35:08 +0000 (16:35 +0200)] 
list: add LIST_CLEAR() helper that empties the list

13 months agocore/mount: disable timer event source when USEC_INFINITY 28751/head
Yu Watanabe [Thu, 10 Aug 2023 01:23:59 +0000 (10:23 +0900)] 
core/mount: disable timer event source when USEC_INFINITY

Setting USEC_INFINITY to timer event source should not cause any
problem. But, disabling timer event source should be preferable.

[zjs: simplify the call to sd_event_source_set_enabled()]

13 months agoMerge pull request #28862 from DaanDeMeyer/swap 28892/head
Luca Boccassi [Wed, 16 Aug 2023 21:24:18 +0000 (22:24 +0100)] 
Merge pull request #28862 from DaanDeMeyer/swap

mkosi: Add a swap partition

13 months agomkosi: Add a swap partition 28862/head
Daan De Meyer [Wed, 16 Aug 2023 14:17:44 +0000 (16:17 +0200)] 
mkosi: Add a swap partition

systemd-oomd keeps complaining about the lack of swap partition, so
let's add one.

13 months agorepart: Default to swap format for swap partitions
Daan De Meyer [Wed, 16 Aug 2023 14:53:02 +0000 (16:53 +0200)] 
repart: Default to swap format for swap partitions

13 months agodocumentation: add man page data for confext
Maanya Goenka [Wed, 16 Aug 2023 16:57:31 +0000 (16:57 +0000)] 
documentation: add man page data for confext

13 months agoMerge pull request #28758 from keszybz/negative-errno-macro
Luca Boccassi [Wed, 16 Aug 2023 16:18:45 +0000 (17:18 +0100)] 
Merge pull request #28758 from keszybz/negative-errno-macro

Use macros to reduce indentation in errno error handling

13 months agojournalctl: minor follow-up for --lines=
Mike Yuan [Wed, 16 Aug 2023 12:35:15 +0000 (20:35 +0800)] 
journalctl: minor follow-up for --lines=

Follow-up for 8d6791d2aa98c989101f572278e9b0a63edfec42

Addresses https://github.com/systemd/systemd/pull/28777#discussion_r1295790102

13 months agocore: stage /run/host/os-release with a symlink to avoid possible race condition
Luca Boccassi [Sun, 13 Aug 2023 21:29:25 +0000 (22:29 +0100)] 
core: stage /run/host/os-release with a symlink to avoid possible race condition

If someone reads /run/host/os-release at the exact same time it is being updated, and it
is large enough, they might read a half-written file. This is very unlikely as
os-release is typically small and very rarely changes, but it is not
impossible.

Bind mount a staging directory instead of the file, and symlink the file
into into, so that we can do atomic file updates and close this gap.
Atomic replacement creates a new inode, so existing bind mounts would
continue to see the old file, and only new services would see the new file.
The indirection via the directory allows to work around this, as the
directory is fixed and never changes so the bind mount is always valid,
and its content is shared with all existing services.

Fixes https://github.com/systemd/systemd/issues/28794

Follow-up for 3f37a82545d461ab

13 months agoMerge pull request #28859 from poettering/btrfs-subvol-fix
Daan De Meyer [Wed, 16 Aug 2023 14:03:54 +0000 (16:03 +0200)] 
Merge pull request #28859 from poettering/btrfs-subvol-fix

btrfs: create subvol fix

13 months agobtrfs: use ERRNO_IS_NOT_SUPPORTED() where appropriate 28859/head
Lennart Poettering [Wed, 16 Aug 2023 10:12:07 +0000 (12:12 +0200)] 
btrfs: use ERRNO_IS_NOT_SUPPORTED() where appropriate

13 months agobtrfs: drop O_PATH from dir_fd passed to btrfs_subvol_make() if needed
Lennart Poettering [Wed, 16 Aug 2023 10:11:06 +0000 (12:11 +0200)] 
btrfs: drop O_PATH from dir_fd passed to btrfs_subvol_make() if needed

Let's make sure btrfs_subvol_make() can operate on O_PATH fds, just like
mkdirat().

Fixes a bunch of tmpfiles errors at boot if we try to create btrfs
subvols, introduced by e54c79ccc2e90a375640815b05f28ec22664e44c

Fixes: e54c79ccc2e90a375640815b05f28ec22664e44c
13 months agojournalctl: support --lines=+N for showing the oldest N entries
Mike Yuan [Thu, 10 Aug 2023 17:41:03 +0000 (01:41 +0800)] 
journalctl: support --lines=+N for showing the oldest N entries

After f58269510727964cb5c10e7d2f9849c442ea1f80, the wrong behavior
occurred when --since= and --lines= are both specified is fixed.
However, it seems that the old behavior is already being somewhat
widely used, and the function itself makes sense, i.e. to allow --lines=
to output the first N journal entries.

Therefore, let's support prefixing the number for --lines= with '+',
and provide such functionality.

Related: #28746

13 months agoMerge pull request #28854 from keszybz/mailmap-and-license-info
Luca Boccassi [Wed, 16 Aug 2023 11:34:22 +0000 (12:34 +0100)] 
Merge pull request #28854 from keszybz/mailmap-and-license-info

Mailmap and license info

13 months agohwdb: update autosuspend rules
Luca Boccassi [Wed, 16 Aug 2023 01:08:08 +0000 (02:08 +0100)] 
hwdb: update autosuspend rules

ninja -C build update-hwdb-autosuspend

13 months agomanager: fix error handling after failure to set up child 28758/head
Zbigniew Jędrzejewski-Szmek [Thu, 10 Aug 2023 08:59:55 +0000 (10:59 +0200)] 
manager: fix error handling after failure to set up child

exec_child() is supposed to set *exit_status when returning failure.
Unfortunately, we didn't do that in two cases. The result would be:
- a bogus error message "Failed at step SUCCESS spawning foo: …",
- a bogus success exit status.

Bugs introduced in 390902012c5177b6b01bc634b2e9c704073d9e7d and
ad21e542b20f0fb292d1958d3a759bf3403522c2.

The code is reworked to add some asserts and not set exit_status in the caller
so that it's clearer (also to the compiler) that it needs to be set.

13 months agoshared/barrier: remove parens
Zbigniew Jędrzejewski-Szmek [Thu, 10 Aug 2023 08:19:57 +0000 (10:19 +0200)] 
shared/barrier: remove parens

13 months agonspawn,shared: make ERRNO_IS_SECCOMP_FATAL an inline func with _NEG_ variant
Zbigniew Jędrzejewski-Szmek [Thu, 10 Aug 2023 08:18:12 +0000 (10:18 +0200)] 
nspawn,shared: make ERRNO_IS_SECCOMP_FATAL an inline func with _NEG_ variant

Also rebreak comments and lines.

No functional change.

13 months agoshared/kbd-util: simplify error handling in keymap_exists()
Zbigniew Jędrzejewski-Szmek [Thu, 10 Aug 2023 08:02:34 +0000 (10:02 +0200)] 
shared/kbd-util: simplify error handling in keymap_exists()

Once we know the return value, we can just return it, no need to
exit the loop.

13 months agovarious: use _NEG_ macros to reduce indentation
Zbigniew Jędrzejewski-Szmek [Wed, 9 Aug 2023 15:03:15 +0000 (17:03 +0200)] 
various: use _NEG_ macros to reduce indentation

No functional change intended.

13 months agolibsystemd-network: use _NEG_ macros to reduce indentation
Zbigniew Jędrzejewski-Szmek [Thu, 10 Aug 2023 07:58:50 +0000 (09:58 +0200)] 
libsystemd-network: use _NEG_ macros to reduce indentation

No functional change intended.

13 months agolibsystemd: use _NEG_ macros, adjust some comments
Zbigniew Jędrzejewski-Szmek [Thu, 10 Aug 2023 07:58:28 +0000 (09:58 +0200)] 
libsystemd: use _NEG_ macros, adjust some comments

No functional change.

13 months agomanager: use _NEG_ macros to reduce indentation, reword comments, drop parens
Zbigniew Jędrzejewski-Szmek [Thu, 10 Aug 2023 07:16:15 +0000 (09:16 +0200)] 
manager: use _NEG_ macros to reduce indentation, reword comments, drop parens

13 months agoerrno-util: allow ERRNO_IS_* to accept types wider than int
Zbigniew Jędrzejewski-Szmek [Wed, 9 Aug 2023 16:21:13 +0000 (18:21 +0200)] 
errno-util: allow ERRNO_IS_* to accept types wider than int

This is useful if the variable is ssize_t and we don't want to trigger a
warning or truncation.

With gcc (gcc-13.2.1-1.fc38.x86_64), the resulting systemd binary is identical,
so I assume that the compiler is able to completely optimize away the type.

13 months agosd-id128: introduce ERRNO_IS_NEG_MACHINE_ID_UNSET
Zbigniew Jędrzejewski-Szmek [Wed, 9 Aug 2023 15:51:24 +0000 (17:51 +0200)] 
sd-id128: introduce ERRNO_IS_NEG_MACHINE_ID_UNSET

13 months agoshared/cgroup-show: do not format path twice
Zbigniew Jędrzejewski-Szmek [Wed, 9 Aug 2023 14:43:28 +0000 (16:43 +0200)] 
shared/cgroup-show: do not format path twice

Also, invert the "negative" condition to positive so that it matches the assert
right above. Also, print the path in the debug message.

13 months agotree-wide: use cocinnelle to apply _NEG_ macros
Zbigniew Jędrzejewski-Szmek [Wed, 9 Aug 2023 14:41:58 +0000 (16:41 +0200)] 
tree-wide: use cocinnelle to apply _NEG_ macros

13 months agobasic/errno-util: add wrappers which only accept negative errno
Zbigniew Jędrzejewski-Szmek [Wed, 9 Aug 2023 14:36:38 +0000 (16:36 +0200)] 
basic/errno-util: add wrappers which only accept negative errno

We do 'IN_SET(r, -CONST1, -CONST2)', instead of 'IN_SET(-r, CONST1, CONST2)'
because -r is undefined if r is the minimum value (i.e. INT_MIN). But we know
that the constants are small, so their negative values are fine.

13 months agoMark all base64 files as generated 28854/head
Zbigniew Jędrzejewski-Szmek [Sat, 12 Aug 2023 13:50:34 +0000 (15:50 +0200)] 
Mark all base64 files as generated

This makes them ignored by license review.

13 months agobsod: fix license tag
Zbigniew Jędrzejewski-Szmek [Sat, 12 Aug 2023 13:37:13 +0000 (15:37 +0200)] 
bsod: fix license tag

13 months agomailmap: "reduce contributor count by 13"
Zbigniew Jędrzejewski-Szmek [Fri, 11 Aug 2023 16:32:24 +0000 (18:32 +0200)] 
mailmap: "reduce contributor count by 13"

This merges the counts for a few people who existed with and without accents,
or with different capitalizations, and suffixes. Also, stop overriding
NeilBrown's spelling of the name.

Note: IIUC, we have two Luca Bruno's: lucab@debian.net is not the same as the
other Luca BRUNO who works on coreos.

@@ -386 +385,0 @@
-     2 Damjan Georgievski
@@ -401 +399,0 @@
-     1 Daniel Berrange
@@ -425 +423 @@
-    11 Daniel P. Berrangé
+    12 Daniel P. Berrangé
@@ -888 +885,0 @@
-     1 Jiri Pirko
@@ -891 +888 @@
-     1 Jiří Pírko
+     2 Jiří Pírko
@@ -1105 +1102 @@
-    12 Luca BRUNO
+    18 Luca BRUNO
@@ -1107 +1104 @@
-     8 Luca Bruno
+     2 Luca Bruno
@@ -1160,2 +1157 @@
-     1 Marc-Andre Lureau
-    17 Marc-André Lureau
+    18 Marc-André Lureau
@@ -1313,2 +1309 @@
-    31 Michal Sekletar
-   168 Michal Sekletár
+   199 Michal Sekletár
@@ -1383,3 +1378 @@
-     2 Neal Gompa
-     1 Neal Gompa (ニール・ゴンパ)
-    12 Neil Brown
+     3 Neal Gompa (ニール・ゴンパ)
@@ -1387,0 +1381 @@
+    12 NeilBrown
@@ -1494,2 +1488 @@
-     1 Perry Yuan
-     1 Perry.Yuan
+     3 Perry Yuan
@@ -1941,2 +1934 @@
-     2 Viktar Vauchkevich
-     2 Viktar Vaŭčkievič
+     4 Viktar Vaŭčkievič
@@ -2016,2 +2008 @@
-     1 Yao Wei
-     1 Yao Wei (魏銘廷)
+     2 Yao Wei (魏銘廷)
@@ -2145 +2135,0 @@
-     1 gdamjan
@@ -2256 +2245,0 @@
-     1 perry_yuan
@@ -2331 +2320 @@
-    18 Дамјан Георгиевски
+    21 Дамјан Георгиевски

13 months agoupdate TODO
Lennart Poettering [Wed, 16 Aug 2023 09:40:31 +0000 (11:40 +0200)] 
update TODO

13 months agoupdate TODO
Lennart Poettering [Wed, 16 Aug 2023 09:37:56 +0000 (11:37 +0200)] 
update TODO

13 months agoupdate TODO
Lennart Poettering [Wed, 16 Aug 2023 09:31:31 +0000 (11:31 +0200)] 
update TODO

13 months agoMerge pull request #28733 from goenkam/maanya/systemd-scoped
Luca Boccassi [Wed, 16 Aug 2023 09:12:46 +0000 (10:12 +0100)] 
Merge pull request #28733 from goenkam/maanya/systemd-scoped

core: add confext support for ExtensionImages= and ExtensionDirectories=

13 months agotools: update-hwdb-autosuspend.sh: Point at HEAD, not master branch
Brian Norris [Wed, 16 Aug 2023 00:19:49 +0000 (17:19 -0700)] 
tools: update-hwdb-autosuspend.sh: Point at HEAD, not master branch

Many Chromium projects have moved from 'master' to 'main', where
'master' is no longer updated. Point at HEAD instead, which should
always represent the default branch.

I don't actually rerun/regenerate the database, since I don't really run
systemd environments to test that update on.

13 months agotest: add test for confext service-scoped support 28733/head
Maanya Goenka [Mon, 14 Aug 2023 18:29:13 +0000 (18:29 +0000)] 
test: add test for confext service-scoped support

13 months agoallow ExtensionImages= and ExtensionDirectories= settings to support confext images
Maanya Goenka [Tue, 8 Aug 2023 21:57:53 +0000 (21:57 +0000)] 
allow ExtensionImages= and ExtensionDirectories= settings to support confext images

13 months agoadd an @ option for confext
Maanya Goenka [Tue, 8 Aug 2023 21:37:36 +0000 (21:37 +0000)] 
add an @ option for confext

13 months agoMerge pull request #28839 from DaanDeMeyer/repart-followups
Luca Boccassi [Tue, 15 Aug 2023 15:40:05 +0000 (16:40 +0100)] 
Merge pull request #28839 from DaanDeMeyer/repart-followups

Repart followups

13 months agorepart: Add verity configuration section and options
Michael A Cassaniti [Fri, 11 Aug 2023 09:30:11 +0000 (19:30 +1000)] 
repart: Add verity configuration section and options

13 months agoMerge pull request #28838 from DaanDeMeyer/repart-subvolume
Daan De Meyer [Tue, 15 Aug 2023 12:56:10 +0000 (14:56 +0200)] 
Merge pull request #28838 from DaanDeMeyer/repart-subvolume

mkosi: Create a few subvolumes in the root partition

13 months agorepart: Massage the minimize for XFS a bit 28839/head
Daan De Meyer [Tue, 15 Aug 2023 10:58:28 +0000 (12:58 +0200)] 
repart: Massage the minimize for XFS a bit

A 1.5 multiplier doesn't seem to be sufficient for XFS as seen in
mkosi CI. Let's increase it to 2 for XFS to hopefully get better
results.

13 months agoresolved: fixed bugs reported in varlink statistics (#28796)
Kiran Vemula [Tue, 15 Aug 2023 10:45:58 +0000 (16:15 +0530)] 
resolved: fixed bugs reported in varlink statistics (#28796)

Fixes https://github.com/systemd/systemd/issues/28791

Follow-up for bc837621a38efbaff14fbe33bfe5c34dac805343

13 months agomkosi: Update to v15.1 release 28838/head
Daan De Meyer [Tue, 15 Aug 2023 08:35:56 +0000 (10:35 +0200)] 
mkosi: Update to v15.1 release

13 months agomkosi: Create a few subvolumes in the root partition
Daan De Meyer [Tue, 15 Aug 2023 08:33:34 +0000 (10:33 +0200)] 
mkosi: Create a few subvolumes in the root partition

Let's exercise the repart Subvolumes= setting by creating a few
subvolumes in the root partition when we create it.

13 months agorepart: Rework read-only logic
Daan De Meyer [Tue, 15 Aug 2023 08:32:45 +0000 (10:32 +0200)] 
repart: Rework read-only logic

verity sig partitions can't actually be marked read-only, so let's
not do that to avoid an ugly warning about that. Instead, let's just
make sure that we mark verity hash and verity data partitions as
read-only.

13 months agorepart: Allow using Subvolumes= with automatic --offline
Daan De Meyer [Tue, 15 Aug 2023 08:31:47 +0000 (10:31 +0200)] 
repart: Allow using Subvolumes= with automatic --offline

If we fail to allocate a loopback device and subvolumes are configured,
we fail instead of falling back to a regular file.

13 months agop11kit: check the flags associated with the slot instead of flags associated with...
Warren [Tue, 15 Aug 2023 10:28:14 +0000 (20:28 +1000)] 
p11kit: check the flags associated with the slot instead of flags associated with the token

The logic around checking PKCS11 tokens (used by systemd-cryptenroll) contains a bug.
The code is checking the flags field of a pkcs11 token_info structure against a set of flags defined for the pkcs11 slot_info structure. This PR changes the check so that the correct structure's flag field is being checked.
(Reference to the PKCS#11 spec:http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/os/pkcs11-base-v2.40-os.html, section CK_SLOT_INFO).

13 months agomkfs-util: Don't set MKE2FS_DEVICE_PHYS_SECTSIZE
Daan De Meyer [Tue, 15 Aug 2023 10:10:14 +0000 (12:10 +0200)] 
mkfs-util: Don't set MKE2FS_DEVICE_PHYS_SECTSIZE

We only care about the logical sector size and if the physical sector
size isn't set and we're operating on a file, mke2fs will default the
physical sector size to the logical block size anyway.

This change makes sure that if we're operating on a block device and
set an explicit logical sector size, that doesn't affect the physical
sector size.

13 months agorepart: Put function call closer to its error handling
Daan De Meyer [Tue, 15 Aug 2023 10:09:31 +0000 (12:09 +0200)] 
repart: Put function call closer to its error handling

13 months agoMerge pull request #28812 from DaanDeMeyer/sector-size
Luca Boccassi [Tue, 15 Aug 2023 09:16:24 +0000 (10:16 +0100)] 
Merge pull request #28812 from DaanDeMeyer/sector-size

repart: Use 4096 as the fallback sector size for verity/luks/filesystems

13 months agoMerge pull request #28833 from DaanDeMeyer/copy-subvolume
Daan De Meyer [Tue, 15 Aug 2023 07:53:02 +0000 (09:53 +0200)] 
Merge pull request #28833 from DaanDeMeyer/copy-subvolume

repart: Add Subvolumes= setting

13 months agosysupdate: Use sector size for partition size calculations
Michael A Cassaniti [Fri, 11 Aug 2023 12:05:45 +0000 (22:05 +1000)] 
sysupdate: Use sector size for partition size calculations

13 months agoMerge pull request #28829 from DaanDeMeyer/mount-fd
Daan De Meyer [Tue, 15 Aug 2023 07:04:45 +0000 (09:04 +0200)] 
Merge pull request #28829 from DaanDeMeyer/mount-fd

tree-wide: Mount file descriptors via /proc/<pid>/fd

13 months agoMerge pull request #28835 from mrc0mmand/more-tests
Luca Boccassi [Tue, 15 Aug 2023 00:54:52 +0000 (01:54 +0100)] 
Merge pull request #28835 from mrc0mmand/more-tests

test: add coverage for #27953

13 months agofd-util: Use /proc/pid/fd instead of /proc/self/fd 28829/head
Daan De Meyer [Mon, 14 Aug 2023 19:57:59 +0000 (21:57 +0200)] 
fd-util: Use /proc/pid/fd instead of /proc/self/fd

Currently, we mount via file descriptors using /proc/self/fd. This
works, but it means that in /proc/mounts and various other files,
the source of the mount will be listed as /proc/self/fd/xxx. For other
software that parses these files, /proc/self/fd/xxx doesn't mean anything,
or worse, it means the completely wrong thing, as it will refer to one of
their own file descriptors instead.

Let's improve the situation by using /proc/pid/fd instead. This allows
processes parsing /proc/mounts to do the right thing more often than not.
One scenario where even this doesn't work if when containers are involved,
as with the pid namespace unshared, even /proc/pid/fd will mean the wrong
thing, but it's no worse than /proc/self/fd which will always means the wrong
thing.

This also doesn't work if we mount via file descriptor and then exit, as the pid will
be gone, but it does work as long as the process that did the mount is alive, which
makes it useful for systemd-dissect --with for example if the program we run in the
image wants to parse /proc/mounts.

13 months agotest: explicitly specify a UTF-8 locale for UTF-8 shenanigans 28835/head
Frantisek Sumsal [Mon, 14 Aug 2023 18:09:31 +0000 (20:09 +0200)] 
test: explicitly specify a UTF-8 locale for UTF-8 shenanigans

As things don't work well without it:

$ LANG=C printf "\ufffe\n"
\uFFFE

13 months agotest: add coverage for #27953
Frantisek Sumsal [Mon, 14 Aug 2023 17:35:37 +0000 (19:35 +0200)] 
test: add coverage for #27953

13 months agotest: drop unnecessary log level setup
Frantisek Sumsal [Mon, 14 Aug 2023 17:12:08 +0000 (19:12 +0200)] 
test: drop unnecessary log level setup

As we do that globally via a dropin.

13 months agorepart: Add Subvolumes= setting 28833/head
Daan De Meyer [Mon, 14 Aug 2023 14:44:30 +0000 (16:44 +0200)] 
repart: Add Subvolumes= setting

This setting indicates which directories in the target partition
should be btrfs subvolumes. If set, we'll try to create these
directories as subvolumes.

Note that this only works when running as root without --offline,
as mkfs.btrfs does not support creating subvolumes.

13 months agomkdir: Add support for creating subvolumes to mkdir_p_root()
Daan De Meyer [Mon, 14 Aug 2023 14:39:39 +0000 (16:39 +0200)] 
mkdir: Add support for creating subvolumes to mkdir_p_root()

We pass in the paths which should be subvolumes and try to create
those as subvolumes if we can.

13 months agocopy: Add support for creating subvolumes to copy_tree_at()
Daan De Meyer [Mon, 14 Aug 2023 13:33:15 +0000 (15:33 +0200)] 
copy: Add support for creating subvolumes to copy_tree_at()

The subvolumes set is a set of source inodes similar to how the
denylist hashmap contains source inodes as keys. It indicates
directories in the source tree that should become subvolumes in
the target tree.

13 months agofs-util: Add XO_SUBVOLUME flag for xopenat()
Daan De Meyer [Mon, 14 Aug 2023 13:32:22 +0000 (15:32 +0200)] 
fs-util: Add XO_SUBVOLUME flag for xopenat()

When specified, xopenat() will try to create a btrfs subvolume and
fall back to creating a regular directory.

13 months agobtrfs-util: Move subvolume creation to basic/btrfs.h
Daan De Meyer [Mon, 14 Aug 2023 13:15:08 +0000 (15:15 +0200)] 
btrfs-util: Move subvolume creation to basic/btrfs.h

Also make btrfs_subvol_make() an openat style function.

13 months agopath-util: Make ret argument optional for path_extract_directory()
Daan De Meyer [Mon, 14 Aug 2023 16:29:25 +0000 (18:29 +0200)] 
path-util: Make ret argument optional for path_extract_directory()

13 months agoMerge pull request #28828 from DaanDeMeyer/sysupdate-fdisk
Daan De Meyer [Mon, 14 Aug 2023 12:23:03 +0000 (14:23 +0200)] 
Merge pull request #28828 from DaanDeMeyer/sysupdate-fdisk

fdisk-util: Make fdisk_new_context_fd() more generic

13 months agodissect-image: Fix mount_point_is_available()
Daan De Meyer [Sun, 13 Aug 2023 20:16:28 +0000 (22:16 +0200)] 
dissect-image: Fix mount_point_is_available()

We call dir_is_empty() to check if the directory is empty but don't
take the result into account when returning from the function.

13 months agotree-wide: Always include <net/if.h> before related linux headers
Daan De Meyer [Mon, 14 Aug 2023 10:54:40 +0000 (12:54 +0200)] 
tree-wide: Always include <net/if.h> before related linux headers

Otherwise, we get redefinition errors if <net/if.h> is included later
on by another header.

13 months agorepart: Use 4096 as the fallback sector size for verity/luks/filesystems 28812/head
Daan De Meyer [Sat, 12 Aug 2023 11:30:46 +0000 (13:30 +0200)] 
repart: Use 4096 as the fallback sector size for verity/luks/filesystems

When we don't know the sector size of the actual block device, because
we're building an image in a loopback file and no sector size was specified
explicitly, let's use 4096 as the sector size for filesystems, verity and
LUKS. This should be the most compatible option, since 4096 will also work
on devices with sector size 512 or 2048.

For the actual GPT partition table size, we stick with 512 as the default
value since UEFI firmware and the kernel will only try to read the GPT
partition table from the first LBA on the device and the sector size for
most devices is still 512. It can also be trivially modified when copying
the image to another device using --copy-from + --sector-size.

13 months agotree-wide: Use fdisk_new_context_at() more 28828/head
Daan De Meyer [Mon, 14 Aug 2023 08:42:43 +0000 (10:42 +0200)] 
tree-wide: Use fdisk_new_context_at() more

13 months agofdisk-util: Make fdisk_new_context_fd() more generic
Daan De Meyer [Mon, 14 Aug 2023 08:27:57 +0000 (10:27 +0200)] 
fdisk-util: Make fdisk_new_context_fd() more generic

Let's make this an openat() style function so we can also pass a
device path.

13 months agoMerge pull request #28827 from gioele/docs-fix-network-online-example-unit
Daan De Meyer [Mon, 14 Aug 2023 08:08:20 +0000 (10:08 +0200)] 
Merge pull request #28827 from gioele/docs-fix-network-online-example-unit

docs/NETWORK_ONLINE: Move `Type=`, `RemainAfterExit=` to `[Service]` + Use `until` instead of `while !`

13 months agodocs/NETWORK_ONLINE: Use `until` instead of `while !` 28827/head
Gioele Barabucci [Mon, 14 Aug 2023 06:53:16 +0000 (08:53 +0200)] 
docs/NETWORK_ONLINE: Use `until` instead of `while !`

`until` is the standard POSIX shell builtin to be used when waiting for
a condition to appear.

13 months agodocs/NETWORK_ONLINE: Move `Type=`, `RemainAfterExit=` to `[Service]`
Gioele Barabucci [Mon, 14 Aug 2023 06:50:46 +0000 (08:50 +0200)] 
docs/NETWORK_ONLINE: Move `Type=`, `RemainAfterExit=` to `[Service]`

`Type=` and `RemainAfterExit=` belong in `[Service]`, not `[Unit]`.

Fixes #28826

13 months agoRevert "mount: check right before invoking /bin/umount if it makes sense"
Yu Watanabe [Thu, 10 Aug 2023 02:26:43 +0000 (11:26 +0900)] 
Revert "mount: check right before invoking /bin/umount if it makes sense"

This reverts commit 1483892a421ca34bc841a8e8b1f385744c0407ed.

As the commit says, it does not solve the race. Moreover, it introduces
an regression #28410.

Also, checking by `path_is_mount_point()` may trigger automount. From
statx(2),
> AT_NO_AUTOMOUNT
>     Don't automount the terminal ("basename") component of pathname
>     if it is a directory that is an automount point.
Similar statements can be found in fstatat(2), which is used in the
fallback call for statx() in glibc, and name_to_handle_at(2), which is
used as the fallback when statx() failed.
So, `path_is_mount_point()` may _do_ trigger automount for parent paths.
That should be avoided especially on shutdown.

The original issue #25527 that is 'fixed' by the commit is not serious,
and should be fixed by making umount command handle path gracefully:
https://github.com/util-linux/util-linux/issues/2132

Fixes #28410.