]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
12 months agobattery-util: move battery_is_discharging_and_low() to battery-util.[ch]
Lennart Poettering [Mon, 5 Jun 2023 09:56:31 +0000 (11:56 +0200)] 
battery-util: move battery_is_discharging_and_low() to battery-util.[ch]

This moves a first batch of functions from sleep-config.[ch] over to
battery-util.[ch].

In the long run we should probably move even more stuff over, i.e.
anything that deals with the battery sysfs driver interface.

No code change.

12 months agobattery-util: split out code that checks AC power state into its own .c/.h pair
Lennart Poettering [Mon, 5 Jun 2023 09:49:35 +0000 (11:49 +0200)] 
battery-util: split out code that checks AC power state into its own .c/.h pair

No code change, just some splitting out of the relevant code from
udev-util.[ch].

This makes sense on its own, but is also prepartion to move the code
that checks for low battery state into battery-util.[ch], too.

12 months agoadd support for KSM
Stefan Roesch [Tue, 28 Feb 2023 20:39:35 +0000 (12:39 -0800)] 
add support for KSM

This adds support for KSM (kernel samepage merging). It adds a new
boolean parameter called MemoryKSM to enable the feature. The feature
can only be enabled with newer kernels.

12 months agochase: fix triggering assertion
Yu Watanabe [Mon, 5 Jun 2023 04:20:42 +0000 (13:20 +0900)] 
chase: fix triggering assertion

12 months agoci: Report results from CIFuzz using SARIF
jonathanmetzman [Mon, 5 Jun 2023 05:37:34 +0000 (01:37 -0400)] 
ci: Report results from CIFuzz using SARIF

Upload results from CIFuzz using SARIF.
This will allow CIFuzz to report issues in the security tab.
This is a better UI than having to look through logs.
TODO(google/oss-fuzz#10452): Add proper descriptions of UBSAN bugs.

12 months agopath-util: fix typo in comment
Gaël PORTAY [Mon, 5 Jun 2023 04:42:02 +0000 (06:42 +0200)] 
path-util: fix typo in comment

The comment makes a reference to the function fchmod_path() but this
function does not exist in the source tree.

However, the function fchmod_opath() exists; it was introduced by the
commit 4dfaa528d451aa7926be4f1b4cf8d0ffe338421d.

As the comment tells, the function futimens_opath() introduced by the
commit f25bff5eaf6881717e873f27c26f2e8264517c16 is similar to the
function fchmod_opath(); therefore, it should reference it.

This fixes the typo in the comment by referencing the proper function
fchmod_opath().

12 months agoMerge pull request #27907 from mrc0mmand/quick-test-tweaks
Yu Watanabe [Sat, 3 Jun 2023 20:22:53 +0000 (05:22 +0900)] 
Merge pull request #27907 from mrc0mmand/quick-test-tweaks

test: a couple of tweaks for recent CI fails

12 months agoMerge pull request #27908 from weblate/weblate-systemd-master
Frantisek Sumsal [Sat, 3 Jun 2023 15:54:46 +0000 (17:54 +0200)] 
Merge pull request #27908 from weblate/weblate-systemd-master

Translations update from Fedora Weblate

12 months agopo: Translated using Weblate (Korean) 27908/head
김인수 [Sat, 3 Jun 2023 15:48:02 +0000 (17:48 +0200)] 
po: Translated using Weblate (Korean)

Currently translated at 100.0% (193 of 193 strings)

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

12 months agopo: Translated using Weblate (Basque)
Asier Sarasua Garmendia [Sat, 3 Jun 2023 15:48:02 +0000 (17:48 +0200)] 
po: Translated using Weblate (Basque)

Currently translated at 16.5% (32 of 193 strings)

po: Added translation using Weblate (Basque)

Co-authored-by: Asier Sarasua Garmendia <asier.sarasua@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/eu/
Translation: systemd/main

12 months agoumount: /usr/ should never be unmounted regardless of HAVE_SPLIT_USR or not
Lennart Poettering [Sat, 3 Jun 2023 07:17:45 +0000 (09:17 +0200)] 
umount: /usr/ should never be unmounted regardless of HAVE_SPLIT_USR or not

Whether we put some binaries in /bin or in /usr/bin should not have any
effect on unmounting during shutdown. Even if people split /usr/ off we
should not try to unmount it, no matter what as it is simply where
binaries are placed.

12 months agotest: drop the --recursive=no test 27907/head
Frantisek Sumsal [Sat, 3 Jun 2023 11:38:29 +0000 (13:38 +0200)] 
test: drop the --recursive=no test

As the outcome also depends on availability of the PID namespace, so
the test might (and does) unexpectedly pass in some environments.

12 months agotest: ignore missing coverage in TEST-82-SOFTREBOOT
Frantisek Sumsal [Sat, 3 Jun 2023 07:49:04 +0000 (09:49 +0200)] 
test: ignore missing coverage in TEST-82-SOFTREBOOT

As we temporarily mount rootfs read-only there.

12 months agosysupdate.d: Add way to drop binaries into $BOOT
Adrian Vovk [Fri, 26 May 2023 04:47:47 +0000 (00:47 -0400)] 
sysupdate.d: Add way to drop binaries into $BOOT

As described in the BLS, we should place binaries into the XBOOTLDR
directory if it is available, otherwise into the ESP. Thus, we might
need to put binaries into /boot or into /efi depending on the existence
of the XBOOTLDR partition.

With this change, we introduce a new PathRelativeTo= config option that
makes this functionality possible

12 months agoMerge pull request #27904 from DaanDeMeyer/lsm
Luca Boccassi [Fri, 2 Jun 2023 22:57:21 +0000 (23:57 +0100)] 
Merge pull request #27904 from DaanDeMeyer/lsm

mkosi: Enable more options

12 months agoMerge pull request #27903 from mrc0mmand/test-followups
Luca Boccassi [Fri, 2 Jun 2023 22:56:58 +0000 (23:56 +0100)] 
Merge pull request #27903 from mrc0mmand/test-followups

test: a couple of systemd-{coredump,pstore,run} followups

12 months agoMerge pull request #27435 from poettering/renew-reboot
Lennart Poettering [Fri, 2 Jun 2023 21:27:45 +0000 (23:27 +0200)] 
Merge pull request #27435 from poettering/renew-reboot

pid1: add a new method of rebooting: userspace only under the name "soft-reboot"

12 months agoMerge pull request #27896 from poettering/umount-detach-rework
Lennart Poettering [Fri, 2 Jun 2023 19:47:09 +0000 (21:47 +0200)] 
Merge pull request #27896 from poettering/umount-detach-rework

shutdown: refactoring + tone down log message a bit

12 months agoMerge pull request #27902 from poettering/round-up
Lennart Poettering [Fri, 2 Jun 2023 19:46:50 +0000 (21:46 +0200)] 
Merge pull request #27902 from poettering/round-up

add ROUND_UP() macro for rounding integer up to next multiple of some value

12 months agoupdate TODO 27435/head
Lennart Poettering [Tue, 2 May 2023 10:39:59 +0000 (12:39 +0200)] 
update TODO

12 months agotest: add integration test for soft reboots incl. fdstore passing
Lennart Poettering [Wed, 3 May 2023 13:05:12 +0000 (15:05 +0200)] 
test: add integration test for soft reboots incl. fdstore passing

12 months agotest: disable SoftReboot() in dfuzzer test for now
Lennart Poettering [Wed, 3 May 2023 07:37:55 +0000 (09:37 +0200)] 
test: disable SoftReboot() in dfuzzer test for now

As requested:

https://github.com/systemd/systemd/pull/27435#issuecomment-1527810336

12 months agoman: document the soft reboot operation
Lennart Poettering [Wed, 3 May 2023 08:33:01 +0000 (10:33 +0200)] 
man: document the soft reboot operation

12 months agofstab-util: consider /run/nextroot/ among extrinsic mounts
Lennart Poettering [Fri, 2 Jun 2023 15:51:37 +0000 (17:51 +0200)] 
fstab-util: consider /run/nextroot/ among extrinsic mounts

This way we'll not add deps for the mount point that unmount it during
shutdown. This is similar as for /run/initramfs/ which we want to
transition into during shutdown.

This way we don't have to add "-o x-initrd.mount" to all bind mounts for
/run/nextroot anymore to make it survive the reboot, it will be implied.

12 months agomount-setup: exclude /run/nextroot/ from relabelling
Lennart Poettering [Fri, 2 Jun 2023 15:50:50 +0000 (17:50 +0200)] 
mount-setup: exclude /run/nextroot/ from relabelling

Just like /run/initramfs/ the data in /run/nextroot/ should be a
self-contained OS tree, and not require labelling, hence don't.

12 months agoswitch-root: automatically make target switch root dir a mount point
Lennart Poettering [Fri, 2 Jun 2023 16:24:27 +0000 (18:24 +0200)] 
switch-root: automatically make target switch root dir a mount point

Let's make sure implicitly that the target directory is a mount point,
instead of doing so manually beforehand. This allows us to drop this
step from the transition into the /run/initramfs/ dir at shutdown.

During the initrd→host transition the switch root operations so far
where towards pre-existing mount points, but there are cetrainly
usecases where it might make sense to siwtch into arbitrary
subdirectories, too.

12 months agomount-util: add fd_make_mount_point() helper
Lennart Poettering [Fri, 2 Jun 2023 16:23:44 +0000 (18:23 +0200)] 
mount-util: add fd_make_mount_point() helper

12 months agomkosi: Enable more options 27904/head
Daan De Meyer [Fri, 2 Jun 2023 15:25:23 +0000 (17:25 +0200)] 
mkosi: Enable more options

We build with support for selinux/apparmor where applicable but
disable them at runtime as even in permissive mode they're horribly
broken.

12 months agotest: probe a couple more paths in systemd-run 27903/head
Frantisek Sumsal [Fri, 2 Jun 2023 14:53:45 +0000 (16:53 +0200)] 
test: probe a couple more paths in systemd-run

12 months agoswitch-root: disable sync() again when we switch root during shutdown
Lennart Poettering [Fri, 19 May 2023 13:52:43 +0000 (15:52 +0200)] 
switch-root: disable sync() again when we switch root during shutdown

Our shutdown binary that takes over as PID 1 when shutting down puts
great efforts into a sync() that comes with a time-out once sync'ing
process stops. If we'd add another dumb sync() here, we kinda defeat all
it is good for. Hence, let's keep the sync() in for most codepats, but
let's disable it for the final shutdown logic when we transition back
into the exitrd. After all we sync()ed more than enough here, no need to
sync() even more.

12 months agoswitch-root: introduce SwitchRootFlags flags parameter to switch_root()
Lennart Poettering [Fri, 19 May 2023 13:48:12 +0000 (15:48 +0200)] 
switch-root: introduce SwitchRootFlags flags parameter to switch_root()

Let's replace the current boolean param with a proper flags param. With
a single flag this doesn't appear to make much sense, though it does
already make things more readable I think.

However, once we add a second flag, it starts to make more sense.

Also, while we are at it, condition the "istmp" determinaton with this
flag too, since we only need it when the flag is set.

12 months agoswitch-root: always use MS_BIND to move api vfs over
Lennart Poettering [Tue, 16 May 2023 12:57:31 +0000 (14:57 +0200)] 
switch-root: always use MS_BIND to move api vfs over

We previously would use MS_MOVE to move the old procfs, sysfs, /dev/ and
/run to the new place in some places, and MS_BIND in others.

The logic when to use MS_MOVE and when to use MS_BIND was pretty
arbitrary so far: we'd use MS_MOVE during the initrd → host transition
and MS_BIND when transitioning from host into the exitrd during
shutdown.

Traditionally, using MS_MOVE was preferable, because we didn't bother
with unmounting the old mount hierarchy before the switch root, and thus
using MS_MOVE did some clean-up as side-effect (because the old mounts
went away this way). But since we nowadays properly umount all remaining
mount points (since 268d1244e87a35ff8dff56c92ef375ebf69d462e) when
transitioning it's pointless.

Let's just use MS_BIND always. Let's tweak it though: let's use
MS_BIND|MS_REC for the kernel API VFS, and MS_BIND without MS_REC for
/run/. The latter reflects the fact that the submounts /run/ has usually
are not so much about just accessing kernel APIs but about auxiliary
user resources. Hence let's only move the main mount over for that.

While we are at it, also set up the base filesystem *before* we move the
mounts from the old to the new root, since the base filesystem setup
logic creates various needed inodes for us, which we really should make
use of instead of creating on our own.

12 months agosystemctl: add "systemctl soft-reboot" command
Lennart Poettering [Thu, 27 Apr 2023 19:56:20 +0000 (21:56 +0200)] 
systemctl: add "systemctl soft-reboot" command

12 months agologind: add support for 'soft-reboot' reboots
Lennart Poettering [Thu, 27 Apr 2023 19:56:14 +0000 (21:56 +0200)] 
logind: add support for 'soft-reboot' reboots

12 months agopid1: add "soft-reboot" reboot method
Lennart Poettering [Thu, 27 Apr 2023 15:23:18 +0000 (17:23 +0200)] 
pid1: add "soft-reboot" reboot method

This adds a new mechanism for rebooting, a form of "userspace reboot"
hereby dubbed "soft-reboot". It will stop all services as in a usual
shutdown, possibly transition into a new root fs and then issue a fresh
initial transaction. The kernel is not replaced.

File descriptors can be passed over, thus opening the door for leaving
certain resources around between such reboots.

Usecase: this is an extremely quick way to reset userspace fully when
updating image based systems, without going through a full
hardware/firmware/boot loader/kernel/initrd cycle. It minimizes "grayout time"
for OS updates. (In particular when combined with kernel live patching)

12 months agotree-wide: port various pieces of code over to ROUND_UP() 27902/head
Lennart Poettering [Fri, 2 Jun 2023 14:40:29 +0000 (16:40 +0200)] 
tree-wide: port various pieces of code over to ROUND_UP()

There's probably more than we can convert to this.

12 months agotest-macro: add ROUND_UP() macro for rounding up to next multiple
Lennart Poettering [Fri, 2 Jun 2023 14:34:32 +0000 (16:34 +0200)] 
test-macro: add ROUND_UP() macro for rounding up to next multiple

In case of overflow will return -1 cast to the first parameter type.

12 months agocoverage: add a wrapper for execvpe()
Frantisek Sumsal [Fri, 2 Jun 2023 14:25:06 +0000 (16:25 +0200)] 
coverage: add a wrapper for execvpe()

It's the exactly same stuff as for execveat() - gcov doesn't have a
wrapper for execvpe() so introduce our own.

12 months agoMerge pull request #27849 from DaanDeMeyer/sign-pcr
Daan De Meyer [Fri, 2 Jun 2023 14:16:41 +0000 (16:16 +0200)] 
Merge pull request #27849 from DaanDeMeyer/sign-pcr

mkosi: Sign expected PCRs

12 months agoshutdown: tone down failure messages a bit 27896/head
Lennart Poettering [Fri, 2 Jun 2023 09:20:21 +0000 (11:20 +0200)] 
shutdown: tone down failure messages a bit

If we are not able to detach all MD/DM/loopback devices this is not
necessarily a failure, it's simply because we might be running off them.
Hence let's tone down our language a bit, and just say "Unable to"
rather than "Failed to".

12 months agodetach-loopback: also don't bother detaching loopback block device /usr/ is running off
Lennart Poettering [Fri, 2 Jun 2023 09:42:08 +0000 (11:42 +0200)] 
detach-loopback: also don't bother detaching loopback block device /usr/ is running off

While we are at it, let's also clean this up a bit: unlike DM/MD devices
loopback devices are likely partitioned, hence trace the block device
through the partition layer and LUKS.

12 months agodetach-md: similar to the DM case, also don't try to detach MD device backing /usr/
Lennart Poettering [Fri, 2 Jun 2023 09:41:40 +0000 (11:41 +0200)] 
detach-md: similar to the DM case, also don't try to detach MD device backing /usr/

12 months agoshutdown: don't attempt to detach DM volume backing /usr/
Lennart Poettering [Fri, 2 Jun 2023 09:08:07 +0000 (11:08 +0200)] 
shutdown: don't attempt to detach DM volume backing /usr/

Since we run off /usr/ it makes no sense to attempt to try to detach any
DM device backing it. Hence skip it just like we skip detaching the DM
device backing the root fs.

Addresses: https://github.com/systemd/systemd/issues/27682#issuecomment-1573328188

12 months agodetach-loopback: also decouple from umount.h
Lennart Poettering [Fri, 2 Jun 2023 09:02:16 +0000 (11:02 +0200)] 
detach-loopback: also decouple from umount.h

Let's introduce LoopbackDevice as replacement for MountPoint, with just
the fields we actually need.

12 months agodetach-md: also decouple structures from umount.h
Lennart Poettering [Fri, 2 Jun 2023 08:57:10 +0000 (10:57 +0200)] 
detach-md: also decouple structures from umount.h

12 months agodetach-dm: decouple from umount.[ch]
Lennart Poettering [Fri, 2 Jun 2023 08:54:03 +0000 (10:54 +0200)] 
detach-dm: decouple from umount.[ch]

Let's also define our own little structure here with just the fields we
need.

12 months agodetach-swap: decouple from umount.h
Lennart Poettering [Fri, 2 Jun 2023 08:51:08 +0000 (10:51 +0200)] 
detach-swap: decouple from umount.h

So far detach-swap.[ch] were still using the MountPoint structure to
store swap device info in. Since it was only using a single field of it
sharing the whole structure is kinda pointless. Hence, let's decouple
this and only add the field we really need.

12 months agoumount: split out swap detachment code too
Lennart Poettering [Fri, 2 Jun 2023 08:46:17 +0000 (10:46 +0200)] 
umount: split out swap detachment code too

12 months agoumount: split out loopback detach code
Lennart Poettering [Fri, 2 Jun 2023 08:36:39 +0000 (10:36 +0200)] 
umount: split out loopback detach code

Like the similar commits, no actual code changes, just splitting up
large C files.

12 months agoumount: similar as previous commit, split out DM detaching
Lennart Poettering [Fri, 2 Jun 2023 08:31:55 +0000 (10:31 +0200)] 
umount: similar as previous commit, split out DM detaching

12 months agoumount: split out MD detaching code from umount.c
Lennart Poettering [Fri, 2 Jun 2023 08:25:19 +0000 (10:25 +0200)] 
umount: split out MD detaching code from umount.c

umount.c does so much stuff, and MD detaching is relatively separate,
hence split it out into its own .c/.h file pair.

12 months agodissect-image: fix partition label version compare
Lennart Poettering [Fri, 2 Jun 2023 10:25:09 +0000 (12:25 +0200)] 
dissect-image: fix partition label version compare

The logic was borked: if we find multiple partitions of the same
designator, we should first prefer the better arch, and then prefer the
better version, and then the first found. Fix that.

Fixes: #27897
12 months agomkosi: Only lower device timeout instead of all timeouts 27849/head
Daan De Meyer [Wed, 31 May 2023 14:19:21 +0000 (16:19 +0200)] 
mkosi: Only lower device timeout instead of all timeouts

We only really care about lowering the device timeout so we get to
a shell faster when the root device doesn't appear so let's only
lower that timeout instead of lowering all default timeouts.

12 months agocore: Add systemd.default_device_timeout_sec= cmdline option
Daan De Meyer [Wed, 31 May 2023 14:16:21 +0000 (16:16 +0200)] 
core: Add systemd.default_device_timeout_sec= cmdline option

12 months agomkosi: Sign expected PCRs
Daan De Meyer [Tue, 30 May 2023 12:09:44 +0000 (14:09 +0200)] 
mkosi: Sign expected PCRs

This is now possible without a TMP device so let's start signing
PCRs when building images with mkosi.

12 months agomkosi: Remove file blacklisting erofs module in opensuse initrd
Daan De Meyer [Fri, 2 Jun 2023 13:42:34 +0000 (15:42 +0200)] 
mkosi: Remove file blacklisting erofs module in opensuse initrd

12 months agomkosi: Enable set -e in postinst script
Daan De Meyer [Fri, 2 Jun 2023 13:42:14 +0000 (15:42 +0200)] 
mkosi: Enable set -e in postinst script

12 months agomkosi: Move python3-pytest-flakes to build packages on opensuse
Daan De Meyer [Fri, 2 Jun 2023 13:41:45 +0000 (15:41 +0200)] 
mkosi: Move python3-pytest-flakes to build packages on opensuse

12 months agomkosi: Add missing tss2 dependencies
Daan De Meyer [Fri, 2 Jun 2023 13:41:12 +0000 (15:41 +0200)] 
mkosi: Add missing tss2 dependencies

12 months agomeson: Add missing tss2-tcti-device dependency
Daan De Meyer [Fri, 2 Jun 2023 13:40:35 +0000 (15:40 +0200)] 
meson: Add missing tss2-tcti-device dependency

12 months agomkosi: Update to latest
Daan De Meyer [Thu, 1 Jun 2023 10:45:45 +0000 (12:45 +0200)] 
mkosi: Update to latest

12 months agofstab-generator: if we mount via roothash=/usrhash= let's imply "ro" mount option
Lennart Poettering [Fri, 2 Jun 2023 07:54:18 +0000 (09:54 +0200)] 
fstab-generator: if we mount via roothash=/usrhash= let's imply "ro" mount option

If we discover the root or /usr/ fs via roothash=/usrhash= we know the
file system mounted on it will be read-only, since Verity volumes are by
definition immutable. Hence, let's imply the "ro" mount option for them.

This way the "kernel: /dev/mapper/usr: Can't open blockdev" boot-time
log message goes away, reported here:

https://github.com/systemd/systemd/issues/27682

(I do wonder though why erofs even tries to open the block device as
writable, that sounds utterly pointless for a file system that carries
the fact it is read-only even in the name...)

12 months agotest: sync with the fake binary before killing it
Frantisek Sumsal [Fri, 2 Jun 2023 11:24:32 +0000 (13:24 +0200)] 
test: sync with the fake binary before killing it

On faster machines we might be too fast and kill the fake binary during
fork() which then makes kernel report a "wrong" binary in the coredump,
e.g.:

[   31.408078] testsuite-74.sh[548]: + /tmp/make-dump /tmp/test-dump SIGTRAP
[   31.409720] testsuite-74.sh[560]: + bin=/tmp/test-dump
[   31.409720] testsuite-74.sh[560]: + sig=SIGTRAP
[   31.409720] testsuite-74.sh[560]: + ulimit -c unlimited
[   31.409720] testsuite-74.sh[560]: + pid=561
[   31.409720] testsuite-74.sh[560]: + sleep 1
[   31.409720] testsuite-74.sh[560]: + kill -s SIGTRAP 561
[   31.409720] testsuite-74.sh[560]: + wait 561
[   31.491757] systemd[1]: Created slice system-systemd\x2dcoredump.slice.
[   31.524488] systemd[1]: Started systemd-coredump@0-563-0.service.
[   31.616372] systemd-coredump[564]: [🡕] Process 561 (make-dump) of user 0 dumped core.

                                      Stack trace of thread 561:
                                      #0  0x00007ff86bb49af7 _Fork (libc.so.6 + 0xd4af7)
                                      #1  0x00007ff86bb4965f __libc_fork (libc.so.6 + 0xd465f)
                                      #2  0x000055e88011b0ad make_child (bash + 0x550ad)
                                      #3  0x000055e8800fd05f n/a (bash + 0x3705f)
                                      #4  0x000055e880100116 execute_command_internal (bash + 0x3a116)
                                      #5  0x000055e8801011f2 execute_command_internal (bash + 0x3b1f2)
                                      #6  0x000055e8801025b6 execute_command (bash + 0x3c5b6)
                                      #7  0x000055e8800f134b reader_loop (bash + 0x2b34b)
                                      #8  0x000055e8800e757d main (bash + 0x2157d)
                                      #9  0x00007ff86ba98850 n/a (libc.so.6 + 0x23850)
                                      #10 0x00007ff86ba9890a __libc_start_main (libc.so.6 + 0x2390a)
                                      #11 0x000055e8800e83b5 _start (bash + 0x223b5)
                                      ELF object binary architecture: AMD x86-64
[   31.666617] testsuite-74.sh[560]: /tmp/make-dump: line 12:   561 Trace/breakpoint trap   (core dumped) "$bin" infinity
...
$ coredumpctl list --file system.journal
TIME                         PID UID GID SIG     COREFILE EXE            SIZE
Fri 2023-06-02 10:42:10 CEST 561   0   0 SIGTRAP journal  /usr/bin/bash     -
Fri 2023-06-02 10:42:11 CEST 570   0   0 SIGABRT journal  /tmp/test-dump    -
Fri 2023-06-02 10:42:12 CEST 582   0   0 SIGTRAP missing  /tmp/test-dump    -
Fri 2023-06-02 10:42:13 CEST 593   0   0 SIGABRT missing  /tmp/test-dump    -

12 months agotest: clean up our mess after the pstore test
Frantisek Sumsal [Fri, 2 Jun 2023 08:07:57 +0000 (10:07 +0200)] 
test: clean up our mess after the pstore test

12 months agoMerge pull request #27891 from mrc0mmand/more-tests-again
Frantisek Sumsal [Fri, 2 Jun 2023 08:05:17 +0000 (10:05 +0200)] 
Merge pull request #27891 from mrc0mmand/more-tests-again

test: improve systemd-pstore tests & add a couple of tests for systemd-run

12 months agoMerge pull request #27889 from poettering/no-usr-verity-detach
Lennart Poettering [Fri, 2 Jun 2023 04:24:13 +0000 (06:24 +0200)] 
Merge pull request #27889 from poettering/no-usr-verity-detach

veritysetup: make sure we don't try to detach /usr/ verity on shutdown

12 months agotest: add a couple of tests for systemd-run 27891/head
Frantisek Sumsal [Thu, 1 Jun 2023 06:47:51 +0000 (08:47 +0200)] 
test: add a couple of tests for systemd-run

12 months agosocket: avoid memory leak on incomplete SocketPort object
Frantisek Sumsal [Thu, 1 Jun 2023 20:11:01 +0000 (22:11 +0200)] 
socket: avoid memory leak on incomplete SocketPort object

==1==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 17 byte(s) in 1 object(s) allocated from:
    #0 0x7fc096c7243b in strdup (/lib64/libasan.so.8+0x7243b)
    #1 0x7fc095db3899 in bus_socket_set_transient_property ../src/core/dbus-socket.c:386
    #2 0x7fc095db5140 in bus_socket_set_property ../src/core/dbus-socket.c:460
    #3 0x7fc095dd20f1 in bus_unit_set_properties ../src/core/dbus-unit.c:2473
    #4 0x7fc095d87d53 in transient_unit_from_message ../src/core/dbus-manager.c:1025
    #5 0x7fc095d8872f in method_start_transient_unit ../src/core/dbus-manager.c:1112
    #6 0x7fc0944ddf4f in method_callbacks_run ../src/libsystemd/sd-bus/bus-objects.c:406
    #7 0x7fc0944e7854 in object_find_and_run ../src/libsystemd/sd-bus/bus-objects.c:1319
    #8 0x7fc0944e8f03 in bus_process_object ../src/libsystemd/sd-bus/bus-objects.c:1439
    #9 0x7fc09454ad78 in process_message ../src/libsystemd/sd-bus/sd-bus.c:3011
    #10 0x7fc09454b302 in process_running ../src/libsystemd/sd-bus/sd-bus.c:3053
    #11 0x7fc09454e158 in bus_process_internal ../src/libsystemd/sd-bus/sd-bus.c:3273
    #12 0x7fc09454e2f2 in sd_bus_process ../src/libsystemd/sd-bus/sd-bus.c:3300
    #13 0x7fc094551a59 in io_callback ../src/libsystemd/sd-bus/sd-bus.c:3642
    #14 0x7fc094727830 in source_dispatch ../src/libsystemd/sd-event/sd-event.c:4187
    #15 0x7fc094731009 in sd_event_dispatch ../src/libsystemd/sd-event/sd-event.c:4808
    #16 0x7fc094732124 in sd_event_run ../src/libsystemd/sd-event/sd-event.c:4869
    #17 0x7fc095f7af9f in manager_loop ../src/core/manager.c:3242
    #18 0x41cc7c in invoke_main_loop ../src/core/main.c:1937
    #19 0x4252e0 in main ../src/core/main.c:3072
    #20 0x7fc092a4a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)

SUMMARY: AddressSanitizer: 17 byte(s) leaked in 1 allocation(s).

12 months agoman: fix sd_journal_*_with_location's func argument
Hannu Lounento [Tue, 30 May 2023 10:48:20 +0000 (13:48 +0300)] 
man: fix sd_journal_*_with_location's func argument

`sd_journal_print_with_location` and similar functions behave
inconsistently compared to their documentation, which says:

    sd_journal_print_with_location(), sd_journal_printv_with_location(),
    sd_journal_send_with_location(), sd_journal_sendv_with_location(),
    and sd_journal_perror_with_location() [...] accept additional
    parameters to explicitly set the source file name, function, and
    line. Those arguments must contain valid journal entries including
    the variable name, e.g. "CODE_FILE=src/foo.c", "CODE_LINE=666",
    "CODE_FUNC=myfunc".

Calling e.g. `sd_journal_sendv_with_location` with
`CODE_FUNC=myfunction` as the value of the argument `func` results in

    "CODE_FUNC" : "CODE_FUNC=myfunction"

because `sd_journal_*_with_location` implicitly prefix the argument
`func` with `CODE_FUNC=`. For example:

    _public_ int sd_journal_sendv_with_location(
                    const char *file, const char *line,
                    const char *func,
                    const struct iovec *iov, int n) {
            [...]
            char *f;
            [...]
            niov = newa(struct iovec, n + 3);
            [...]
            ALLOCA_CODE_FUNC(f, func);
            [...]
            niov[n++] = IOVEC_MAKE_STRING(f);

            return sd_journal_sendv(niov, n);
    }

where `ALLOCA_CODE_FUNC` is:

    #define ALLOCA_CODE_FUNC(f, func)                 \
            do {                                      \
                    size_t _fl;                       \
                    const char *_func = (func);       \
                    char **_f = &(f);                 \
                    _fl = strlen(_func) + 1;          \
                    *_f = newa(char, _fl + 10);       \
                    memcpy(*_f, "CODE_FUNC=", 10);    \
                    memcpy(*_f + 10, _func, _fl);     \
            } while (false)

The arguments `file` and `line` are _not_ prefixed similarly but
expected to be prefixed already with `CODE_FILE=` and `CODE_LINE=`
respectively and sent as is like the documentation describes.

That is, the argument `func` is treated differently and behaves
inconsistently compared to the arguments `file` and `line`. The behavior
seems still intentional:

    _public_ int sd_journal_printv_with_location(int priority, const char *file, const char *line, const char *func, const char *format, va_list ap) {
            [...]
            /* func is initialized from __func__ which is not a macro, but
            * a static const char[], hence cannot easily be prefixed with
            * CODE_FUNC=, hence let's do it manually here. */
            ALLOCA_CODE_FUNC(f, func);
            [...]
    }

Thus, change the documentation to match the actual behavior.

Note: `sd_journal_{print,send}` and `sd_journal_{print,send}v` work as
expected as they only pass the function name (i.e. without `CODE_FUNC=`)
to the `func` argument of the `sd_journal_*_with_location` functions
they call. For example:

    #define sd_journal_print(priority, ...) sd_journal_print_with_location(priority, "CODE_FILE=" __FILE__, "CODE_LINE=" _SD_STRINGIFY(__LINE__), __func__, __VA_ARGS__)

12 months agodbus-util: let's take it down a notch when converting file mode to string
Frantisek Sumsal [Thu, 1 Jun 2023 18:22:20 +0000 (20:22 +0200)] 
dbus-util: let's take it down a notch when converting file mode to string

I'm definitely a fan of precision, but in this case it's a bit too much:

    $ systemd-run --unit=test --socket-property=ListenFIFO=/tmp/foo --socket-property=SocketMode=0644 true
    $ systemctl cat test.socket
    # /run/systemd/transient/test.socket
    # This is a transient unit file, created programmatically via the systemd API. Do not edit.
    [Unit]
    Description=/usr/bin/true

    [Socket]
    ListenFIFO=/tmp/foo
    SocketMode=0000000000000000000000000000000000000644

12 months agotest: make the multiple-file test more thorough
Frantisek Sumsal [Thu, 1 Jun 2023 18:02:20 +0000 (20:02 +0200)] 
test: make the multiple-file test more thorough

Let's check if we keep the old records after multiple systemd-pstore
invocations (i.e. simulate a scenario where we get multiple crashes and
multiple machine reboots).

12 months agoveritysetup: remove double escaping of data device + hash device spec 27889/head
Lennart Poettering [Thu, 1 Jun 2023 17:15:10 +0000 (19:15 +0200)] 
veritysetup: remove double escaping of data device + hash device spec

generator_write_veritysetup_service_section() already escapes the
parameters internally, doing so in the caller means double escaping,
which is a bug. Fix it.

12 months agoveritysetup: minor renaming of functions
Lennart Poettering [Thu, 1 Jun 2023 16:54:33 +0000 (18:54 +0200)] 
veritysetup: minor renaming of functions

create_device() and create_disk() so far did very similar things, but
the name didn't give a hint what the difference was.

Hence let's rename them to create_special_device() and
create_veritytab_device() to make this more understandabe, as one
creates /proc/cmdline specified roothash=/usrhash= devices, and the
other one devices for items listed in /etc/veritytab.

No code changes besides renaming.

12 months ago{crypt|verity}setup: mention volume name in some error messages
Lennart Poettering [Thu, 1 Jun 2023 13:31:25 +0000 (15:31 +0200)] 
{crypt|verity}setup: mention volume name in some error messages

12 months ago{crypt|verity}setup: replace dep on systemd-tmpfiles-setup-dev.service by modprobe...
Lennart Poettering [Thu, 1 Jun 2023 13:00:27 +0000 (15:00 +0200)] 
{crypt|verity}setup: replace dep on systemd-tmpfiles-setup-dev.service by modprobe@loop.service

Both should have the same effect: the /dev/loop-control devices should
become available. systemd-tmpfiles-setup-dev.service creates the device
node "dry" based on modalias data, while modprobe@loop.service creates
it fully, because the module backing it is loaded properly. This should
shorten the deps chain a bit, simplify things and allows us to focus on
the stuff we actually need (i.e. the loopback infra) instead of all
entrypoints anyone might possibly need (i.e. the device nodes)

12 months agoveritysetup-generator: only generate one set of deps on systemd-tmpfiles-setup-dev...
Lennart Poettering [Thu, 1 Jun 2023 12:55:26 +0000 (14:55 +0200)] 
veritysetup-generator: only generate one set of deps on systemd-tmpfiles-setup-dev.service

If both the data and the hash device are a regular file we might create
two sets of deps on s-t-s-d.s, which is of course redundant. Shorten the
code to only generate this once.

No change in behaviour.

12 months agoveritysetup-generator: imply x-initrd.attach for "usr" and "root" volumes
Lennart Poettering [Thu, 1 Jun 2023 12:50:15 +0000 (14:50 +0200)] 
veritysetup-generator: imply x-initrd.attach for "usr" and "root" volumes

Similar to the previous commit, just vor Verity rather than LUKS.

12 months agocryptsetup-generator: imply x-initrd.attach for "usr" and "root" volumes
Lennart Poettering [Thu, 1 Jun 2023 12:40:38 +0000 (14:40 +0200)] 
cryptsetup-generator: imply x-initrd.attach for "usr" and "root" volumes

Let's imply "x-initrd.attach" for "usr" and "root" volumes, so that
we do not attempt to umount them anymore during shutdown.

The names of these volumes have been mandated by the Discoverable
Partition Spec:

https://uapi-group.org/specifications/specs/discoverable_partitions_specification/#suggested-mode-of-operation

Hence it appears reasonably safe to special case these volume names.

Note that a similar logic is implemented in fstab-generator and in fact
PID 1 to treat the root mount and /usr/ mount specially too, to avoid
trying to umount it at shutdown. (This is what fstab_is_extrinsic()
checks).

This should ensure that if /usr/ or / is for some reason a LUKS medium
we won't try to detach it during runtime, which likely fails, since we
run off it.

Note this also moves an ordering dep towards umount.target under the
x-initrd.attach check, becasue that's where the crucial conflicts dep is
placed too.

12 months agounits: don't stop blockdev@.target unit at shutdown
Lennart Poettering [Thu, 1 Jun 2023 16:31:17 +0000 (18:31 +0200)] 
units: don't stop blockdev@.target unit at shutdown

We want that cryptsetup/veritysetup devices can stick around until the
very end, as well as the users of them which might depend on
blockdev@.target for the devices. Hence leave the targets around till
the very end.

Note that their runtime is managed via StopWhenUnneeded= anyway, hence
unless their are volumes that actually survive still the very end they
target units will still be stopped.

12 months agounits: set DefaultDependencies=no for veritysetup slice
Lennart Poettering [Thu, 1 Jun 2023 16:28:08 +0000 (18:28 +0200)] 
units: set DefaultDependencies=no for veritysetup slice

This mimics what we already have for cryptsetup services: the slice they
are placed in (they have their own slice since that's what we do by
default for instantiated services) shouldn't conflict with
shutdown.target, so that veritysetup services can stay around until the
very end (which is what we want for the root and usr verity volumes).

It's literally just a copy of the same unit we already have for
cryptsetup, just with an updated description string.

12 months agoveritysetup-generator: use generic veritysetup writers at one more place
Lennart Poettering [Thu, 1 Jun 2023 15:20:59 +0000 (17:20 +0200)] 
veritysetup-generator: use generic veritysetup writers at one more place

Let's use the common generator_write_veritysetup_unit_section(),
ggenerator_write_veritysetup_service_section(), generator_add_symlink()
implementation we already have at one more place.

This mostly generates the same unit, but for the first time hooks up
blockdev@dev-mapper-*.device for the device, which means things like
growfs on usr+root volumes will actually work now. (I mean, growfs
won#t, because verity devices are immutable after all, but things *like*
it that want to run between the device popping up and being mounted.)

12 months agocryptsetup: fix whitespace issue
Lennart Poettering [Thu, 1 Jun 2023 16:49:16 +0000 (18:49 +0200)] 
cryptsetup: fix whitespace issue

12 months agofstab-util: drop redundant check
Lennart Poettering [Thu, 1 Jun 2023 12:48:55 +0000 (14:48 +0200)] 
fstab-util: drop redundant check

fstab_test_option() checks this as first thing anyway, hence let's drop
the redundant check.

12 months agosd-journal: fix assignment of tail entry offset
Yu Watanabe [Tue, 16 May 2023 21:02:00 +0000 (06:02 +0900)] 
sd-journal: fix assignment of tail entry offset

Fixes a bug introduced by 206f0f397edf1144c63a158fb30f496c3e89f256.

12 months agobuild(deps): bump github/codeql-action from 2.2.9 to 2.3.5
dependabot[bot] [Thu, 1 Jun 2023 09:57:12 +0000 (09:57 +0000)] 
build(deps): bump github/codeql-action from 2.2.9 to 2.3.5

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.2.9 to 2.3.5.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/04df1262e6247151b5ac09cd2c303ac36ad3f62b...0225834cc549ee0ca93cb085b92954821a145866)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
12 months agobuild(deps): bump meson from 1.1.0 to 1.1.1 in /.github/workflows
dependabot[bot] [Thu, 1 Jun 2023 09:57:18 +0000 (09:57 +0000)] 
build(deps): bump meson from 1.1.0 to 1.1.1 in /.github/workflows

Bumps [meson](https://github.com/mesonbuild/meson) from 1.1.0 to 1.1.1.
- [Release notes](https://github.com/mesonbuild/meson/releases)
- [Commits](https://github.com/mesonbuild/meson/compare/1.1.0...1.1.1)

---
updated-dependencies:
- dependency-name: meson
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
12 months agotest: make TEST-04 stable once again
Frantisek Sumsal [Thu, 1 Jun 2023 07:07:28 +0000 (09:07 +0200)] 
test: make TEST-04 stable once again

Wait a bit if necessary for the cursor file to appear.

Follow-up fb35feae97.

12 months agoMerge pull request #27874 from keszybz/test-bus-server-shortening
Yu Watanabe [Thu, 1 Jun 2023 12:10:55 +0000 (21:10 +0900)] 
Merge pull request #27874 from keszybz/test-bus-server-shortening

Simplify the code in test-bus-server

12 months agotest-sizeof: let's be a tiny bit more careful when using glibc internal types
Lennart Poettering [Thu, 1 Jun 2023 08:46:47 +0000 (10:46 +0200)] 
test-sizeof: let's be a tiny bit more careful when using glibc internal types

One can argue that internal glibc types (i.e. those starting with __)
are not really part of the glibc API, hence let's at least ifdef them.

12 months agobuild(deps): bump redhat-plumbers-in-action/advanced-issue-labeler
dependabot[bot] [Thu, 1 Jun 2023 09:57:18 +0000 (09:57 +0000)] 
build(deps): bump redhat-plumbers-in-action/advanced-issue-labeler

Bumps [redhat-plumbers-in-action/advanced-issue-labeler](https://github.com/redhat-plumbers-in-action/advanced-issue-labeler) from 2.0.4 to 2.0.6.
- [Release notes](https://github.com/redhat-plumbers-in-action/advanced-issue-labeler/releases)
- [Commits](https://github.com/redhat-plumbers-in-action/advanced-issue-labeler/compare/25a1e41826424cdf577c71b58c852df4347f13b8...71bcf99aef4b9ea844db9a43755e8ac02c8e661e)

---
updated-dependencies:
- dependency-name: redhat-plumbers-in-action/advanced-issue-labeler
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
12 months agobuild(deps): bump actions/labeler from 4.0.3 to 4.0.4
dependabot[bot] [Thu, 1 Jun 2023 09:57:05 +0000 (09:57 +0000)] 
build(deps): bump actions/labeler from 4.0.3 to 4.0.4

Bumps [actions/labeler](https://github.com/actions/labeler) from 4.0.3 to 4.0.4.
- [Release notes](https://github.com/actions/labeler/releases)
- [Commits](https://github.com/actions/labeler/compare/ba790c862c380240c6d5e7427be5ace9a05c754b...0776a679364a9a16110aac8d0f40f5e11009e327)

---
updated-dependencies:
- dependency-name: actions/labeler
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
12 months agobuild(deps): bump redhat-plumbers-in-action/differential-shellcheck
dependabot[bot] [Thu, 1 Jun 2023 09:57:07 +0000 (09:57 +0000)] 
build(deps): bump redhat-plumbers-in-action/differential-shellcheck

Bumps [redhat-plumbers-in-action/differential-shellcheck](https://github.com/redhat-plumbers-in-action/differential-shellcheck) from 4.0.2 to 4.2.2.
- [Release notes](https://github.com/redhat-plumbers-in-action/differential-shellcheck/releases)
- [Changelog](https://github.com/redhat-plumbers-in-action/differential-shellcheck/blob/main/docs/CHANGELOG.md)
- [Commits](https://github.com/redhat-plumbers-in-action/differential-shellcheck/compare/d24099b9f39ddee81dea31eb0e135e0a623cb2b8...ac4483d8c6713bd2011037f44fe626989468af74)

---
updated-dependencies:
- dependency-name: redhat-plumbers-in-action/differential-shellcheck
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
12 months agoMerge pull request #27856 from arianvp/fix-bootctl-status
Zbigniew Jędrzejewski-Szmek [Thu, 1 Jun 2023 08:25:30 +0000 (10:25 +0200)] 
Merge pull request #27856 from arianvp/fix-bootctl-status

bootctl: Print version number of detected binaries again

12 months agotest-bus-server: simplify return value handling 27874/head
Zbigniew Jędrzejewski-Szmek [Wed, 31 May 2023 15:22:23 +0000 (17:22 +0200)] 
test-bus-server: simplify return value handling

Follow-up for f7794e423ae79325bdbf7b3637b7cb7a1a57e62e.

12 months agovarious: remove typo/unusual spelling
Zbigniew Jędrzejewski-Szmek [Wed, 31 May 2023 15:17:26 +0000 (17:17 +0200)] 
various: remove typo/unusual spelling

Wikitionary says that "noone" is known, but not preferred by a large margin.
(It's also an obsolete spelling of "noon".)

12 months agoMerge pull request #27796 from yuwata/memstream-util
Yu Watanabe [Thu, 1 Jun 2023 03:07:17 +0000 (12:07 +0900)] 
Merge pull request #27796 from yuwata/memstream-util

util: introduce memstream-util

12 months agonetworkd/dhcpserver: Save and expose the client hostname sent when requesting a DHCP...
Rene Hollander [Sat, 27 May 2023 11:33:37 +0000 (13:33 +0200)] 
networkd/dhcpserver: Save and expose the client hostname sent when requesting a DHCP lease.

DHCP clients often send their own hostname in option 12. It can be useful
to store it with the lease so it can be shown to a human to easily identify
which lease belongs to which device.

RFC: https://www.rfc-editor.org/rfc/rfc2132#section-3.14

12 months agotree-wide: use memstream-util 27796/head
Yu Watanabe [Fri, 26 May 2023 06:40:12 +0000 (15:40 +0900)] 
tree-wide: use memstream-util

12 months agoutil: introduce memstream-util
Yu Watanabe [Fri, 26 May 2023 06:22:03 +0000 (15:22 +0900)] 
util: introduce memstream-util

There is many pitfalls in using memstream.
Let's introduce a wrapper to make us safely use it.

12 months agocalendarspec: rename arguments
Yu Watanabe [Sun, 28 May 2023 14:03:26 +0000 (23:03 +0900)] 
calendarspec: rename arguments