]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
2 years agonspawn: remove cgroup socket 25575/head
Christian Brauner [Wed, 30 Nov 2022 14:01:27 +0000 (15:01 +0100)] 
nspawn: remove cgroup socket

Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
2 years agonspawn: remove pty socket
Christian Brauner [Wed, 30 Nov 2022 13:59:52 +0000 (14:59 +0100)] 
nspawn: remove pty socket

Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
2 years agonspawn: remove rtnl socket
Christian Brauner [Wed, 30 Nov 2022 13:50:43 +0000 (14:50 +0100)] 
nspawn: remove rtnl socket

Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
2 years agonspawn: s/kmsg_socket_pair/fd_inner_socket_pair/g
Christian Brauner [Wed, 30 Nov 2022 13:47:53 +0000 (14:47 +0100)] 
nspawn: s/kmsg_socket_pair/fd_inner_socket_pair/g

Also stop stashing the kmsg fifo fd in the socket. Just retrieve it in
the parent and have the parent hold on to it.

Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
2 years agonspawn: s/fd_socket_pair/fd_outer_socket_pair/g
Christian Brauner [Wed, 30 Nov 2022 13:44:07 +0000 (14:44 +0100)] 
nspawn: s/fd_socket_pair/fd_outer_socket_pair/g

Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
2 years agonspawn: remove uid socket
Christian Brauner [Wed, 30 Nov 2022 13:38:04 +0000 (14:38 +0100)] 
nspawn: remove uid socket

Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
2 years agonspawn: remove uuid socket
Christian Brauner [Wed, 30 Nov 2022 13:35:19 +0000 (14:35 +0100)] 
nspawn: remove uuid socket

Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
2 years agonspawn: remove pid socket
Christian Brauner [Wed, 30 Nov 2022 13:28:07 +0000 (14:28 +0100)] 
nspawn: remove pid socket

Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
2 years agonspawn: s/notify_socket/fd_socket/g
Christian Brauner [Wed, 30 Nov 2022 13:22:53 +0000 (14:22 +0100)] 
nspawn: s/notify_socket/fd_socket/g

Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
2 years agodoc: add an example code to lock the whole disk
January [Thu, 24 Nov 2022 13:13:17 +0000 (21:13 +0800)] 
doc: add an example code to lock the whole disk

add an example to leverage `libsystemd` infrastructure to get the whole disk of a block device and take BSD lock on it #25046

2 years agoexecute: Pass AT_FDCWD instead of -1
Daan De Meyer [Tue, 13 Dec 2022 10:50:01 +0000 (10:50 +0000)] 
execute: Pass AT_FDCWD instead of -1

Let's enforce that callers pass AT_FDCWD as read_dfd to load_credential()
to avoid an assert() in read_full_file_full() if read_dfd is -1.

2 years agomkosi: Drop i686 packages
Daan De Meyer [Tue, 13 Dec 2022 12:14:49 +0000 (12:14 +0000)] 
mkosi: Drop i686 packages

These are only needed for some kernel selftests but they prevent
building the mkosi image on aarch64 systems so let's drop them
until mkosi has support for conditional configuration so we can
only add these packages on the right architecture.

2 years agoMerge pull request #25713 from keszybz/hwdb-matching
Yu Watanabe [Tue, 13 Dec 2022 09:13:27 +0000 (18:13 +0900)] 
Merge pull request #25713 from keszybz/hwdb-matching

Restore backwards compat in 60-evdev.rules

2 years agocryptsetup-fido2: Try all FIDO2 key slots when opening LUKS volume
Peter Cai [Sat, 29 Oct 2022 23:00:53 +0000 (19:00 -0400)] 
cryptsetup-fido2: Try all FIDO2 key slots when opening LUKS volume

After #25268, it is now possible to check whether a credential
is present on a FIDO2 token without actually attempting to retrieve said
credential. However, when cryptsetup plugins are not enabled, the
fallback unlock routines are not able to make multiple attempts with
multiple different FIDO2 key slots.

Instead of looking for one FIDO2 key slot when trying to unlock, we now
attempt to use all key slots applicable.

Fixes #19208.

2 years agoMerge pull request #25375 from PeterCxy/fido2-fixups
Luca Boccassi [Mon, 12 Dec 2022 20:48:09 +0000 (21:48 +0100)] 
Merge pull request #25375 from PeterCxy/fido2-fixups

Fixups for FIDO2 pre-flight checks

2 years agoUpdate 60-evdev.hwdb (#25704)
uerdogan [Mon, 12 Dec 2022 20:46:50 +0000 (21:46 +0100)] 
Update 60-evdev.hwdb (#25704)

This solves Debian Bug report 1008760:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1008760.

Solution was inspired by this kernel bug report message:
https://bugzilla.kernel.org/show_bug.cgi?id=204967#c15.

My measured pad dimensions with a ruler were 85x44mm.
But I decided to take the 2x size reported by the current kernel
when invoking the touchpad-edge-detector command from the
libdev-tools package. Because this comment claims that the old
vs new kernel reportings differ by factor 2:
https://bugzilla.kernel.org/show_bug.cgi?id=204967#c3 .

Therefore I have used this command to get the new entry to 60-evdev.hwdb:

"root@pb:~# touchpad-edge-detector 80x34 /dev/input/event2
Touchpad ETPS/2 Elantech Touchpad on /dev/input/event2

Move one finger around the touchpad to detect the actual edges
Kernel says: x [0..1254], y [0..528]
Touchpad sends: x [0..2472], y [-524..528] -^C

Touchpad size as listed by the kernel: 40x17mm
User-specified touchpad size: 80x34mm
Calculated ranges: 2472/1052

Suggested udev rule:
# <Laptop model description goes here>
evdev:name:ETPS/2 Elantech Touchpad:dmi:bvnPackardBell:bvrV1.21:bd08/09/2012:br21.240:svnPackardBell:pnEasyNoteTS11HR:pvrV1.21:rvnPackardBell:rnSJV50_HR:rvrBaseBoardVersion:cvnPackardBell:ct10:cvrV1.21:*
 EVDEV_ABS_00=0:2472:31
 EVDEV_ABS_01=-524:528:31
 EVDEV_ABS_35=0:2472:31
 EVDEV_ABS_36=-524:528:31
"

2 years agoudevadm: emit deprecation notice in udevadm hwdb
Zbigniew Jędrzejewski-Szmek [Mon, 12 Dec 2022 13:11:46 +0000 (14:11 +0100)] 
udevadm: emit deprecation notice in udevadm hwdb

This tool was "deprecated" back in 65eb4378c3e1de25383d8cd606909e64c71edc80,
but only by removing documentation. This is somewhat surprising, but udevadm
hwdb --update and systemd-hwdb update generate different databases. udevadm
runs in compat mode and (as far as I have been able to figure out from a quick
look), it omits filename information and does some other changes to the
datastructures. The consuming code (udev) is the same in both cases, so this
"compatibility mode" seems very strange. But I don't think it's worth trying to
figure out why things were done this way. Let's just push people towards the
new code.

Inspired by https://github.com/systemd/systemd/issues/25698#issuecomment-1346298094.

2 years agosysroot: Support x-systemd.makefs
Will Fancher [Sun, 11 Dec 2022 01:44:17 +0000 (20:44 -0500)] 
sysroot: Support x-systemd.makefs

2 years agoMerge pull request #25646 from yuwata/sd-id128-enomedium
Luca Boccassi [Mon, 12 Dec 2022 20:42:36 +0000 (21:42 +0100)] 
Merge pull request #25646 from yuwata/sd-id128-enomedium

sd-id128: make sd_id128_get_machine() return -ENOMEDIUM when not initialized

2 years agoupdate TODO
Lennart Poettering [Mon, 12 Dec 2022 14:43:38 +0000 (15:43 +0100)] 
update TODO

2 years agoMerge pull request #25615 from DaanDeMeyer/mkosi-kconfig
Luca Boccassi [Mon, 12 Dec 2022 14:30:07 +0000 (15:30 +0100)] 
Merge pull request #25615 from DaanDeMeyer/mkosi-kconfig

mkosi: Rework kconfig handling

2 years agoMerge pull request #25692 from yuwata/resolve-rr-txt
Luca Boccassi [Mon, 12 Dec 2022 13:13:16 +0000 (14:13 +0100)] 
Merge pull request #25692 from yuwata/resolve-rr-txt

resolve: drop recurstion from TXT field handling

2 years agosd-id128: fold do_sync flag into Id128FormatFlag 25646/head
Yu Watanabe [Thu, 8 Dec 2022 20:37:12 +0000 (05:37 +0900)] 
sd-id128: fold do_sync flag into Id128FormatFlag

2 years agoman: mention that sd_id128_get_boot() and friend may return -ENOSYS
Yu Watanabe [Thu, 8 Dec 2022 06:49:02 +0000 (15:49 +0900)] 
man: mention that sd_id128_get_boot() and friend may return -ENOSYS

And drop to mention sd_id128_get_boot_app_specific() may return -ENOENT
or -ENOMEDIUM. The function does not read /etc/machine-id. But reads a
file in the procfs, which is a kind of the kernel API. Hence the
failures are caused only when the system has wrong setup.

2 years agosd-id128: make sd_id128_get_boot() and friend return -ENOSYS when /proc/ is not mounted
Yu Watanabe [Mon, 12 Dec 2022 13:03:52 +0000 (22:03 +0900)] 
sd-id128: make sd_id128_get_boot() and friend return -ENOSYS when /proc/ is not mounted

2 years agosd-id128: make sd_id128_get_boot() and friend return -ENOMEDIUM
Yu Watanabe [Thu, 8 Dec 2022 06:48:25 +0000 (15:48 +0900)] 
sd-id128: make sd_id128_get_boot() and friend return -ENOMEDIUM

2 years agoman: mention sd_id128_get_machine() or friend may return -ENOPKG
Yu Watanabe [Thu, 8 Dec 2022 06:43:26 +0000 (15:43 +0900)] 
man: mention sd_id128_get_machine() or friend may return -ENOPKG

2 years agotest: add tests for "uninitialized" string handling by id128_read_fd()
Yu Watanabe [Thu, 8 Dec 2022 06:18:28 +0000 (15:18 +0900)] 
test: add tests for "uninitialized" string handling by id128_read_fd()

2 years agosd-id128: make id128_read() or friends return -ENOPKG when the file contents is ...
Yu Watanabe [Thu, 8 Dec 2022 05:30:31 +0000 (14:30 +0900)] 
sd-id128: make id128_read() or friends return -ENOPKG when the file contents is "uninitialized"

Then, this drops ID128_PLAIN_OR_UNINIT. Also, this renames
Id128Format -> Id128FormatFlag, and make it bitfield.

Fixes #25634.

2 years agosd-id128: several cleanups
Yu Watanabe [Thu, 8 Dec 2022 05:20:03 +0000 (14:20 +0900)] 
sd-id128: several cleanups

- use SD_ID128_STRING_MAX or friend,
- use sizeof(sd_id128_t),
- use newly introduced ascii_ishex().

2 years agostring-util: introduce ascii_ishex()
Yu Watanabe [Thu, 8 Dec 2022 05:13:47 +0000 (14:13 +0900)] 
string-util: introduce ascii_ishex()

2 years agoudev-builtin-keyboard: update description 25713/head
Zbigniew Jędrzejewski-Szmek [Mon, 12 Dec 2022 12:37:08 +0000 (13:37 +0100)] 
udev-builtin-keyboard: update description

2 years agoudev: rework 60-evdev.rules to be "additive"
Zbigniew Jędrzejewski-Szmek [Mon, 12 Dec 2022 11:52:12 +0000 (12:52 +0100)] 
udev: rework 60-evdev.rules to be "additive"

We would execute up to four hwdb match patterns (+ the keyboard builtin):
After the first hit, we would skip the other patterns, because of the GOTO="evdev_end"
action.

57bb707d48131f4daad2b1b746eab586eb66b4f3 (rules: Add extended evdev/input match
rules for event nodes with the same name), added an additional match with
":phys:<phys>:ev:<ev>" inserted. This breaks backwards compatibility for user
hwdb patterns, because we quit after the first match.

In general hwdb properties are "additive". We often have a general rule that
matches a wider class and then some specific overrides. E.g. in this particular
case, we have a match for all trackpoints, and then a bunch of model-specific
settings.

So let's change the rules to try all the match patterns and combine the
received properties. We execute builtin-keyboard once at the end, if there was
at least one match.

Fixes #25698. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2152226.

This also impacts other cases which I think would be very confusing for users.
Since we quit after a first successful match, if we had e.g. a match for
'evdev:input:b*v*p*' in out database, and the user added a match using
'evdev:name:*', which is the approach we document in the .hwdb files and which
users quite often use, it would be silently ignored. What's worse, if we added
our 'evdev:input:b*v*p*' match at a later point, user's match would stop
working. If we combine all the properties, we get more stable behaviour.

2 years agoMerge pull request #25707 from yuwata/sd-device-fix-double-free
Luca Boccassi [Mon, 12 Dec 2022 12:26:42 +0000 (13:26 +0100)] 
Merge pull request #25707 from yuwata/sd-device-fix-double-free

sd-device: fix double-free

2 years agoupdate TODO
Lennart Poettering [Mon, 12 Dec 2022 11:59:16 +0000 (12:59 +0100)] 
update TODO

2 years agotest: name_assign_type sysattr never exists for enumerated devices 25707/head
Yu Watanabe [Mon, 12 Dec 2022 06:04:02 +0000 (15:04 +0900)] 
test: name_assign_type sysattr never exists for enumerated devices

As we filtered out network devices in the test.

2 years agosd-device: fix double-free
Yu Watanabe [Mon, 12 Dec 2022 05:16:09 +0000 (14:16 +0900)] 
sd-device: fix double-free

If an attribute is read but the value is not used (i.e. ret_value is NULL),
then sd_device_get_sysattr_value() mistakenly frees the read data even though
it is cached internally.

Fixes a bug introduced by acfc2a1d15560084e077ffb3be472cd117e9020a.

Fixes #25702.

2 years agopo: Translated using Weblate (Portuguese)
Hugo Carvalho [Sat, 10 Dec 2022 12:19:51 +0000 (13:19 +0100)] 
po: Translated using Weblate (Portuguese)

Currently translated at 100.0% (193 of 193 strings)

Co-authored-by: Hugo Carvalho <hugokarvalho@hotmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/pt/
Translation: systemd/main

2 years agoAdd mount matrix for VisionBook 12Wr Tab
Lycowolf [Sun, 11 Dec 2022 11:16:52 +0000 (12:16 +0100)] 
Add mount matrix for VisionBook 12Wr Tab

2 years agolibfido2-util: Refactor pre-flight failure handling 25375/head
Peter Cai [Wed, 23 Nov 2022 13:43:22 +0000 (08:43 -0500)] 
libfido2-util: Refactor pre-flight failure handling

`fido2_is_cred_in_specific_token()` should simply not return error codes
for non-fatal errors. For example, `-ENODEV` can be safely translated to
a `false` return value. When the pre-flight request is not supported, we
should simply return true to instruct the caller to attempt to use the
device anyway.

All error codes returned by the funtion should now be fatal and logged
at error level. Non-fatal errors should only appear in debug logs.

2 years agolibfido2-util: Perform pre-flight checks as well when a specific device path is given
Peter Cai [Mon, 14 Nov 2022 02:58:43 +0000 (21:58 -0500)] 
libfido2-util: Perform pre-flight checks as well when a specific device path is given

This prevents unnecessary user interactions when `fido2-device` is set to
something other than `auto` -- a case overlooked in the original PR #23577
(and later #25268).

We do not move pre-flight checks to `fido2_use_hmac_hash_specific_token`
because the behaviors are different between different cases: when the
device path is NULL, we try to automatically choose the correct device,
in which case pre-flight errors should be "soft" errors, without
spamming the tty with error outputs; but when a specific device path is
given, a pre-flight request that determined the non-existence of the
credential should be treated the same as a failed assertion request.

2 years agolibfido2-util: Disable pre-flight checks for credentials with UV
Peter Cai [Mon, 14 Nov 2022 02:12:45 +0000 (21:12 -0500)] 
libfido2-util: Disable pre-flight checks for credentials with UV

According to the FIDO2 spec, tokens may not support pre-flight checks
for credentials requiring UV, at least not without at least
`pinUvAuthParam` or `uv = true`. Originally, in #25268, this was
handled by passing a PIN to satisfy `pinUvAuthParams`, but this is not
ideal, since `pinUvAuthParam` can be obtained from either a PIN
or a UV verification. Forcing the user to enter the PIN here (which is
often just the fallback option on UV devices) is no better than just
trying out each device with the actual assertion request.

As a result, this commit disables pre-flight checks when the credential
requires UV, and instead reverts to the old behavior (trying out each
device and each key slot, requiring multiple user interactions) for this
type of credentials.

2 years agorepart: support erofs
Lennart Poettering [Fri, 9 Dec 2022 15:08:54 +0000 (16:08 +0100)] 
repart: support erofs

So, i think "erofs" is probably the better, more modern alternative to
"squashfs". Many of the benefits don't matter too much to us I guess,
but there's one thing that stands out: erofs has a UUID in the
superblock, squashfs has not. Having an UUID in the superblock matters
if the file systems are used in an overlayfs stack, as overlayfs uses
the UUIDs to robustly and persistently reference inodes on layers in
case of metadata copy-up.

Since we probably want to allow such uses in overlayfs as emplyoed by
sysext (and the future syscfg) we probably should ramp up our erofs game
early on. Hence let's natively support erofs, test it, and in fact
mention it in the docs before squashfs even.

2 years agomount-setup: don't need to mount /sys/fs/pstore if there is no ENABLE_PSTORE
jcg [Fri, 9 Dec 2022 12:45:39 +0000 (20:45 +0800)] 
mount-setup: don't need to mount /sys/fs/pstore if there is no ENABLE_PSTORE

2 years agoresolve: add missing assertion 25692/head
Yu Watanabe [Sat, 10 Dec 2022 01:25:53 +0000 (10:25 +0900)] 
resolve: add missing assertion

2 years agoresolve: shorten code a bit
Yu Watanabe [Sat, 10 Dec 2022 01:25:38 +0000 (10:25 +0900)] 
resolve: shorten code a bit

2 years agoresolve: drop recursion in TXT field handling
Yu Watanabe [Sat, 10 Dec 2022 01:21:41 +0000 (10:21 +0900)] 
resolve: drop recursion in TXT field handling

Fixes #25683.

2 years agoci: Labeler improvements
Daan De Meyer [Fri, 9 Dec 2022 11:10:09 +0000 (12:10 +0100)] 
ci: Labeler improvements

- Mention "/please-review" in the contributing guide
- Remove "needs-rebase" on push
- Don't add "please-review" if a green label is set
- Don't add please-review label to draft PRs
- Add please-review when a PR moves out of draft

2 years agoMerge pull request #25636 from thom311/th/wcast-align-fixes
Zbigniew Jędrzejewski-Szmek [Fri, 9 Dec 2022 14:03:45 +0000 (15:03 +0100)] 
Merge pull request #25636 from thom311/th/wcast-align-fixes

all: avoid various "-Wcast-align=strict" warnings

2 years agoall: avoid various "-Wcast-align=strict" warnings 25636/head
Thomas Haller [Thu, 1 Dec 2022 13:07:22 +0000 (14:07 +0100)] 
all: avoid various "-Wcast-align=strict" warnings

2 years agoMerge pull request #25653 from yuwata/base64_append
Zbigniew Jędrzejewski-Szmek [Thu, 8 Dec 2022 20:22:32 +0000 (21:22 +0100)] 
Merge pull request #25653 from yuwata/base64_append

hexdecoct: several fixes for base64_append()

2 years agofuzz: shorten filename of testcase 25653/head
Yu Watanabe [Thu, 8 Dec 2022 19:58:01 +0000 (04:58 +0900)] 
fuzz: shorten filename of testcase

Follow-up for 46dc071985ff487f5ccf20808531168a6add73d3 and
76519cecc749a3d0e2054fd6db8a99143666e123.

2 years agoresolve: optimize conversion of TXT fields to json
Yu Watanabe [Wed, 7 Dec 2022 00:35:41 +0000 (09:35 +0900)] 
resolve: optimize conversion of TXT fields to json

Fixes oss-fuzz#54080 (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=54080).

Fixes #25654.

2 years agohexdecoct: fix NULL pointer dereferences in hexmem()
Yu Watanabe [Wed, 7 Dec 2022 00:06:48 +0000 (09:06 +0900)] 
hexdecoct: fix NULL pointer dereferences in hexmem()

Fixes oss-fuzz#54090 (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=54090).

Fixes #25655.

2 years agohexdecoct: add missing NULL check
Yu Watanabe [Tue, 6 Dec 2022 21:58:23 +0000 (06:58 +0900)] 
hexdecoct: add missing NULL check

Fixes oss-fuzz#54065 (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=54065).

Fixes #25650.

2 years agotest: add tests for base64_append()
Yu Watanabe [Tue, 6 Dec 2022 22:01:48 +0000 (07:01 +0900)] 
test: add tests for base64_append()

2 years agohexdecoct: several cleanups for base64_append()
Yu Watanabe [Tue, 6 Dec 2022 21:49:17 +0000 (06:49 +0900)] 
hexdecoct: several cleanups for base64_append()

- add missing assertions,
- use size_t for buffser size or memory index,
- handle empty input more gracefully,
- return the length or the result string,
- fix off-by-one issue when the prefix is already long enough.

2 years agohwdb: add Positivo-vaio Pro PW key toggle touchpad (#25669)
Edson Juliano Drosdeck [Thu, 8 Dec 2022 19:51:09 +0000 (16:51 -0300)] 
hwdb: add Positivo-vaio Pro PW key toggle touchpad (#25669)

2 years agoci: Add/Drop labels on pull request activity and comment
Daan De Meyer [Thu, 8 Dec 2022 15:25:03 +0000 (16:25 +0100)] 
ci: Add/Drop labels on pull request activity and comment

When a pull request is opened/updated, add "please-review" and
remove a few other labels.

When a comment is made with /please-review on a PR. Add the
"please-review" label to the PR.

2 years agosocket-util: add CMSG_TYPED_DATA() as type-safe wrapper around CMSG_DATA()
Lennart Poettering [Thu, 8 Dec 2022 16:48:34 +0000 (17:48 +0100)] 
socket-util: add CMSG_TYPED_DATA() as type-safe wrapper around CMSG_DATA()

2 years agofundamental: add CAST_ALIGN_PTR() macro
Thomas Haller [Mon, 5 Dec 2022 22:11:13 +0000 (23:11 +0100)] 
fundamental: add CAST_ALIGN_PTR() macro

2 years agoMerge pull request #25662 from msizanoen1/s2h-nosuspend-user-proc
Lennart Poettering [Thu, 8 Dec 2022 16:24:52 +0000 (17:24 +0100)] 
Merge pull request #25662 from msizanoen1/s2h-nosuspend-user-proc

sleep: always thaw user.slice even if freezing failed

2 years agoMerge pull request #25667 from poettering/sha256-align-fix
Lennart Poettering [Thu, 8 Dec 2022 16:24:17 +0000 (17:24 +0100)] 
Merge pull request #25667 from poettering/sha256-align-fix

sha256 alignment fixes/rework

2 years agoMerge pull request #25665 from poettering/dissect-memory
Lennart Poettering [Thu, 8 Dec 2022 16:23:15 +0000 (17:23 +0100)] 
Merge pull request #25665 from poettering/dissect-memory

dissect: add a mode for operating on an in-memory copy of a DDI, inst…

2 years agofs-util: make chmod_and_chown_at() work with empty path and AT_FDCWD
Yu Watanabe [Wed, 7 Dec 2022 00:51:30 +0000 (09:51 +0900)] 
fs-util: make chmod_and_chown_at() work with empty path and AT_FDCWD

Follow-up for 7d000133c2fbf4b5986185ccfc0273a2428972a9.

Fixes CID#1500608.

2 years agosha256: port to new generic IS_ALIGNED32() macro 25667/head
Lennart Poettering [Wed, 7 Dec 2022 17:19:29 +0000 (18:19 +0100)] 
sha256: port to new generic IS_ALIGNED32() macro

This drops the special casing for s390 and other archs, which was
cargo-culted from glibc. Given it's not obvious why it exists, and is at
best an optimization let's simply avoid it, in particular as the archs
are relatively non-mainstream.

Inspired by: #25636

2 years agomacro: add generic IS_ALIGNED32() anf friends
Lennart Poettering [Wed, 7 Dec 2022 17:31:27 +0000 (18:31 +0100)] 
macro: add generic IS_ALIGNED32() anf friends

Let's generalize (and invert) the UNALIGNED32_P() macro from the sha256
code, and let's add a test for it.

2 years agosha256: move to unaligned_write_ne32()
Lennart Poettering [Wed, 7 Dec 2022 17:13:12 +0000 (18:13 +0100)] 
sha256: move to unaligned_write_ne32()

2 years agofundamental: split out unaligned_{read|write}_ne{16,32,64}() helpers into unaligned...
Lennart Poettering [Wed, 7 Dec 2022 17:10:42 +0000 (18:10 +0100)] 
fundamental: split out unaligned_{read|write}_ne{16,32,64}() helpers into unaligned-fundamental.h

Let's allow using this in code shared between userspace and EFI mode.

Also, don't implement these functions via endianness conversions given
we don't actually want to convert endianess here.

2 years agosha256: external headers should be included with <>
Lennart Poettering [Wed, 7 Dec 2022 17:32:38 +0000 (18:32 +0100)] 
sha256: external headers should be included with <>

2 years agoMerge pull request #25180 from keszybz/ukify
Lennart Poettering [Thu, 8 Dec 2022 14:11:18 +0000 (15:11 +0100)] 
Merge pull request #25180 from keszybz/ukify

ukify: add helper to create UKIs

2 years agocore: pending_freezer_{message => invocation} 25662/head
msizanoen1 [Thu, 8 Dec 2022 01:35:32 +0000 (02:35 +0100)] 
core: pending_freezer_{message => invocation}

Rename the field to reflect the new semantics.

2 years agocore/sleep: set timeout for freeze/thaw operation to 1.5 seconds
msizanoen1 [Wed, 7 Dec 2022 16:22:05 +0000 (23:22 +0700)] 
core/sleep: set timeout for freeze/thaw operation to 1.5 seconds

A FreezeUnit operation can hang due to the presence of kernel threads
(see last 2 commits). Keeping the default configuration will mean the
system will hang for 25 seconds in suspend waiting for the response. 1.5
seconds should be sufficient for most cases.

2 years agocore/cgroup: ignore kernel cgroup.events when thawing
msizanoen1 [Wed, 7 Dec 2022 16:09:33 +0000 (23:09 +0700)] 
core/cgroup: ignore kernel cgroup.events when thawing

The `frozen` state can be `0` while the processes are indeed frozen (see
last commit). Therefore do not respect cgroup.events when checking
whether thawing is necessary.

2 years agotest: add simple test for new --in-memory switch for systemd-dissect 25665/head
Lennart Poettering [Thu, 8 Dec 2022 11:46:41 +0000 (12:46 +0100)] 
test: add simple test for new --in-memory switch for systemd-dissect

2 years agoman: add doc for new --in-memory switch of systemd-dissect
Lennart Poettering [Thu, 8 Dec 2022 11:46:24 +0000 (12:46 +0100)] 
man: add doc for new --in-memory switch of systemd-dissect

2 years agodissect: add a mode for operating on an in-memory copy of a DDI, instead of directly...
Lennart Poettering [Thu, 8 Dec 2022 11:46:09 +0000 (12:46 +0100)] 
dissect: add a mode for operating on an in-memory copy of a DDI, instead of directly on it

This is useful for operating in ephemeral, writable mode on any image,
including read-only ones. It also has the benefit of not keeping the
image file's filesystem busy.

Inspired by the discussions in #25648

2 years agoloop-util: add new loop_device_make_by_path_memory() helper
Lennart Poettering [Thu, 8 Dec 2022 11:45:48 +0000 (12:45 +0100)] 
loop-util: add new loop_device_make_by_path_memory() helper

This uses the new memfd_clone_fd() call to make an in-memory copy of
some file before setting up a loopback block device on it.

2 years agodata-fd-util: add new memfd_clone_fd() helper
Lennart Poettering [Thu, 8 Dec 2022 11:45:26 +0000 (12:45 +0100)] 
data-fd-util: add new memfd_clone_fd() helper

This adds a new helper for cloning any file's contents (or block device contents) into a new memfd.

2 years agocryptsetup: retry TPM2 unseal operation if it fails with TPM2_RC_PCR_CHANGED
Antonio Alvarez Feijoo [Wed, 7 Dec 2022 15:52:27 +0000 (16:52 +0100)] 
cryptsetup: retry TPM2 unseal operation if it fails with TPM2_RC_PCR_CHANGED

Quoting "Trusted Platform Module Library - Part 3: Commands (Rev. 01.59)":

"pcrUpdateCounter – this parameter is updated by TPM2_PolicyPCR(). This value
may only be set once during a policy. Each time TPM2_PolicyPCR() executes, it
checks to see if policySession->pcrUpdateCounter has its default state,
indicating that this is the first TPM2_PolicyPCR(). If it has its default value,
then policySession->pcrUpdateCounter is set to the current value of
pcrUpdateCounter. If policySession->pcrUpdateCounter does not have its default
value and its value is not the same as pcrUpdateCounter, the TPM shall return
TPM_RC_PCR_CHANGED.

If this parameter and pcrUpdateCounter are not the same, it indicates that PCR
have changed since checked by the previous TPM2_PolicyPCR(). Since they have
changed, the previous PCR validation is no longer valid."

The TPM will return TPM_RC_PCR_CHANGED if any PCR value changes (no matter
which) between validating the PCRs binded to the enrollment and unsealing the
HMAC key, so this patch adds a retry mechanism in this case.

Fixes #24906

2 years agoman: mention that DefaultRouteOnDevice= create the IPv4 default route
Yu Watanabe [Thu, 8 Dec 2022 04:17:15 +0000 (13:17 +0900)] 
man: mention that DefaultRouteOnDevice= create the IPv4 default route

And add an example setting for creating an IPv6 default route.

Closes #25440.

2 years agoMerge pull request #25672 from jelly/FirwmwareName
Yu Watanabe [Thu, 8 Dec 2022 07:04:36 +0000 (16:04 +0900)] 
Merge pull request #25672 from jelly/FirwmwareName

Extend hostnamed DMI firmware properties

2 years agoMerge pull request #25564 from poettering/dissect-discover
Yu Watanabe [Thu, 8 Dec 2022 03:29:07 +0000 (12:29 +0900)] 
Merge pull request #25564 from poettering/dissect-discover

systemd-dissect: add simple "--discover" command

2 years agoMerge pull request #25666 from poettering/selinux-getconf-fixup
Yu Watanabe [Thu, 8 Dec 2022 03:23:29 +0000 (12:23 +0900)] 
Merge pull request #25666 from poettering/selinux-getconf-fixup

selinux getXYZcon() NULL return fixes

2 years agooomd: print dry run output at INFO level
Jade Lovelace [Wed, 7 Dec 2022 19:14:30 +0000 (11:14 -0800)] 
oomd: print dry run output at INFO level

Otherwise, the dry run isn't much use since it would be logged at debug
and not seen.

2 years agotest: wait for the monitoring service to become active
Frantisek Sumsal [Wed, 7 Dec 2022 19:44:07 +0000 (20:44 +0100)] 
test: wait for the monitoring service to become active

Otherwise we might start querying resolved too early, causing the
monitoring service to miss stuff:

```
[ 1103.149474] testsuite-75.sh[35]: + systemd-run -u resmontest.service -p Type=notify resolvectl monitor
[ 1103.353803] testsuite-75.sh[423]: Running as unit: resmontest.service
[ 1103.353989] testsuite-75.sh[35]: + knotc zone-begin test.
[ 1103.354160] testsuite-75.sh[425]: OK
...
[ 1103.355298] testsuite-75.sh[35]: + knotc reload
[ 1103.355363] testsuite-75.sh[438]: Reloaded
[ 1103.355536] testsuite-75.sh[35]: + : '--- nss-resolve/nss-myhostname tests'
[ 1103.355536] testsuite-75.sh[35]: + run getent -s resolve hosts ns1.unsigned.test
[ 1103.356127] testsuite-75.sh[443]: + getent -s resolve hosts ns1.unsigned.test
[ 1103.356505] testsuite-75.sh[444]: + tee /tmp/tmp.bXg5Uj5Jkk
[ 1103.359591] resolvectl[424]: → Q: ns1.unsigned.test IN AAAA
[ 1103.359591] resolvectl[424]: ← S: success
[ 1103.359850] testsuite-75.sh[444]: 10.0.0.1        ns1.unsigned.test
[ 1103.359939] resolvectl[424]: → Q: ns1.unsigned.test IN A
[ 1103.359939] resolvectl[424]: ← S: success
[ 1103.359939] resolvectl[424]: ← A: ns1.unsigned.test IN A 10.0.0.1
[ 1103.360149] testsuite-75.sh[35]: + grep -qE '^10\.0\.0\.1\s+ns1\.unsigned\.test' /tmp/tmp.bXg5Uj5Jkk
[ 1103.362119] systemd[1]: Starting resmontest.service...
[ 1103.362633] systemd[1]: Started resmontest.service.
[ 1103.363263] testsuite-75.sh[35]: + monitor_check_rr 'ns1.unsigned.test IN A 10.0.0.1'
[ 1103.363263] testsuite-75.sh[35]: + local 'match=ns1.unsigned.test IN A 10.0.0.1'
[ 1103.363377] testsuite-75.sh[35]: + set +o pipefail
[ 1103.363836] testsuite-75.sh[458]: + journalctl -u resmontest.service -f --full
[ 1103.364042] testsuite-75.sh[459]: + grep -m1 'ns1.unsigned.test IN A 10.0.0.1'
...
Trying to halt container. Send SIGTERM again to trigger immediate termination.
Container TEST-75 terminated by signal KILL.
```

2 years agojournald: prevent segfault on empty attr/current
Space Meyer [Wed, 7 Dec 2022 13:11:30 +0000 (14:11 +0100)] 
journald: prevent segfault on empty attr/current

getpidcon() might set con to NULL, even when it returned a 0 return
code[0]. The subsequent strlen(con) will then cause a segfault.

Alternatively the behaviour could also be changed in getpidcon. I
don't know whether the libselinux folks are comitted to the current
behaviour, but the getpidcon man page doesn't really make it obvious
this case could happen.

[0] https://github.com/SELinuxProject/selinux/blob/fb7f35495fbad468d6efa76c5fed727659903038/libselinux/src/procattr.c#L155-L158

2 years agocore/unit: allow overriding an ongoing freeze operation
msizanoen1 [Wed, 7 Dec 2022 13:46:01 +0000 (20:46 +0700)] 
core/unit: allow overriding an ongoing freeze operation

Sometimes a freeze operation can hang due to the presence of kernel
threads inside the unit cgroup (e.g. QEMU-KVM). This ensures that the
ThawUnit operation invoked by systemd-sleep at wakeup always thaws the
unit.

2 years agocore/cgroup: thaw slice of unit when thawing unit
msizanoen1 [Wed, 7 Dec 2022 09:32:05 +0000 (16:32 +0700)] 
core/cgroup: thaw slice of unit when thawing unit

This ensures starting a new unit under a frozen slice work as expected.

2 years agocore/slice: skip member units without realized cgroup during freeze or thaw
msizanoen1 [Wed, 7 Dec 2022 09:38:05 +0000 (16:38 +0700)] 
core/slice: skip member units without realized cgroup during freeze or thaw

This ensures that services with `RemainAfterExit` but without any
process running won't cause failure during freeze.

2 years agosleep: always thaw user.slice even if freezing failed
msizanoen1 [Wed, 7 Dec 2022 09:54:13 +0000 (16:54 +0700)] 
sleep: always thaw user.slice even if freezing failed

`FreezeUnit` can fail even when some units did got frozen, causing some
user units to be frozen. A possible symptom is `user@.service` being
frozen while still being able to log in over SSH.

2 years agoMerge pull request #25632 from keszybz/chroot-fix
Luca Boccassi [Wed, 7 Dec 2022 19:51:47 +0000 (20:51 +0100)] 
Merge pull request #25632 from keszybz/chroot-fix

Add trivial check for preset operation in chroot

2 years agoMerge pull request #25465 from DaanDeMeyer/repart-workspace
Luca Boccassi [Wed, 7 Dec 2022 19:45:23 +0000 (20:45 +0100)] 
Merge pull request #25465 from DaanDeMeyer/repart-workspace

repart: Cleanup created files on failure

2 years agohostnamed: expose FirmwareDate dbus property 25672/head
Jelle van der Waa [Wed, 7 Dec 2022 16:33:50 +0000 (17:33 +0100)] 
hostnamed: expose FirmwareDate dbus property

Expose /sys/class/dmi/id/bios_date as dbus property in hostnamed.

2 years agohostnamed: expose FirmwareVendor as dbus property
Jelle van der Waa [Tue, 6 Dec 2022 17:23:18 +0000 (18:23 +0100)] 
hostnamed: expose FirmwareVendor as dbus property

Expose /sys/class/dmi/id/bios_vendor as dbus property in hostnamed.

2 years agodissect: add simple --discover command 25564/head
Lennart Poettering [Tue, 29 Nov 2022 15:39:06 +0000 (16:39 +0100)] 
dissect: add simple --discover command

2 years agodiscover-image: store image class in Image object too, if known
Lennart Poettering [Tue, 29 Nov 2022 15:40:15 +0000 (16:40 +0100)] 
discover-image: store image class in Image object too, if known

2 years agodiscover-image: add stringification helpers for ImageClass
Lennart Poettering [Tue, 29 Nov 2022 15:38:48 +0000 (16:38 +0100)] 
discover-image: add stringification helpers for ImageClass

2 years agoukify: allow multiple initrds 25180/head
Zbigniew Jędrzejewski-Szmek [Sat, 26 Nov 2022 13:31:57 +0000 (14:31 +0100)] 
ukify: allow multiple initrds

If given, multiple initrds are concatenated into a temporary file which then
becomes the .initrd section.

It is also possible to give no initrd. After all, some machines boot without an
initrd, and it should be possible to use the stub without requiring an initrd.
(The stub might not like this, but this is something to fix there.)

2 years agoci: install pefile
Zbigniew Jędrzejewski-Szmek [Fri, 25 Nov 2022 18:14:42 +0000 (19:14 +0100)] 
ci: install pefile