1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00
Commit Graph

65148 Commits

Author SHA1 Message Date
Frantisek Sumsal
d5ab23aa54 test: a couple of assorted cleanups
- sort binaries
- send stdout/stderr of the autorelabel service to console as well
2023-06-05 23:30:01 +02:00
Frantisek Sumsal
fa5dee77c0 test: load the SELinux module outside of the VM
Turns out we can, apart from just building the module, "shove" it into
the SELinux database in a chroot as well. This brings quite significant
time savings, as the SELinux db rebuild takes 2 - 5 minutes in a VM
without acceleration (and takes currently ~half of the runtime of the test
in the C8S job).
2023-06-05 22:52:38 +02:00
Frantisek Sumsal
8c0ace5739 test: add a reasoning why we don't use the SELinux-provided units 2023-06-05 22:52:38 +02:00
jonathanmetzman
56595a3730
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.
2023-06-05 07:37:34 +02:00
Gaël PORTAY
150231d25d 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 4dfaa528d4.

As the comment tells, the function futimens_opath() introduced by the
commit f25bff5eaf 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().
2023-06-05 14:21:43 +09:00
Yu Watanabe
c507c81ee7
Merge pull request #27907 from mrc0mmand/quick-test-tweaks
test: a couple of tweaks for recent CI fails
2023-06-04 05:22:53 +09:00
Frantisek Sumsal
e5ea38db28
Merge pull request #27908 from weblate/weblate-systemd-master
Translations update from Fedora Weblate
2023-06-03 17:54:46 +02:00
김인수
966e021025 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
2023-06-03 17:48:02 +02:00
Asier Sarasua Garmendia
6fce42e15d 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
2023-06-03 17:48:02 +02:00
Lennart Poettering
798e811733 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.
2023-06-03 16:48:00 +01:00
Frantisek Sumsal
d99e099fb4 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.
2023-06-03 16:30:46 +02:00
Frantisek Sumsal
686da1c095 test: ignore missing coverage in TEST-82-SOFTREBOOT
As we temporarily mount rootfs read-only there.
2023-06-03 16:30:46 +02:00
Adrian Vovk
0470f91983 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
2023-06-03 09:13:27 +02:00
Luca Boccassi
58a5a2362c
Merge pull request #27904 from DaanDeMeyer/lsm
mkosi: Enable more options
2023-06-02 23:57:21 +01:00
Luca Boccassi
e1aacab7d5
Merge pull request #27903 from mrc0mmand/test-followups
test: a couple of systemd-{coredump,pstore,run} followups
2023-06-02 23:56:58 +01:00
Lennart Poettering
4d824ac0d3
Merge pull request #27435 from poettering/renew-reboot
pid1: add a new method of rebooting: userspace only under the name "soft-reboot"
2023-06-02 23:27:45 +02:00
Lennart Poettering
2e04ba9de9
Merge pull request #27896 from poettering/umount-detach-rework
shutdown: refactoring + tone down log message a bit
2023-06-02 21:47:09 +02:00
Lennart Poettering
db41880d34
Merge pull request #27902 from poettering/round-up
add ROUND_UP() macro for rounding integer up to next multiple of some value
2023-06-02 21:46:50 +02:00
Lennart Poettering
5596fd8ff7 update TODO 2023-06-02 18:43:11 +02:00
Lennart Poettering
093d545658 test: add integration test for soft reboots incl. fdstore passing 2023-06-02 18:43:11 +02:00
Lennart Poettering
8af66251a1 test: disable SoftReboot() in dfuzzer test for now
As requested:

https://github.com/systemd/systemd/pull/27435#issuecomment-1527810336
2023-06-02 18:43:11 +02:00
Lennart Poettering
4de665812a man: document the soft reboot operation 2023-06-02 18:43:10 +02:00
Lennart Poettering
ba1af88c3c 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.
2023-06-02 18:43:10 +02:00
Lennart Poettering
d585065624 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.
2023-06-02 18:43:10 +02:00
Lennart Poettering
f717d7a40a 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.
2023-06-02 18:43:10 +02:00
Lennart Poettering
f9ad896ee2 mount-util: add fd_make_mount_point() helper 2023-06-02 18:43:10 +02:00
Daan De Meyer
cc532533b8 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.
2023-06-02 17:25:23 +02:00
Frantisek Sumsal
50fb26d237 test: probe a couple more paths in systemd-run 2023-06-02 16:59:58 +02:00
Lennart Poettering
1795252caa 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.
2023-06-02 16:49:39 +02:00
Lennart Poettering
2932161bf6 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.
2023-06-02 16:49:39 +02:00
Lennart Poettering
7c764d4599 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 268d1244e8) 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.
2023-06-02 16:49:39 +02:00
Lennart Poettering
34f21ff610 systemctl: add "systemctl soft-reboot" command 2023-06-02 16:49:38 +02:00
Lennart Poettering
9edf5af57b logind: add support for 'soft-reboot' reboots 2023-06-02 16:49:38 +02:00
Lennart Poettering
13ffc60749 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)
2023-06-02 16:49:38 +02:00
Lennart Poettering
4dcaab9c89 tree-wide: port various pieces of code over to ROUND_UP()
There's probably more than we can convert to this.
2023-06-02 16:43:39 +02:00
Lennart Poettering
beda8529b9 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.
2023-06-02 16:41:36 +02:00
Frantisek Sumsal
878ec7942f 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.
2023-06-02 16:25:06 +02:00
Daan De Meyer
8f9a307fec
Merge pull request #27849 from DaanDeMeyer/sign-pcr
mkosi: Sign expected PCRs
2023-06-02 16:16:41 +02:00
Lennart Poettering
9dd2da5b72 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".
2023-06-02 15:56:06 +02:00
Lennart Poettering
9959797dbf 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.
2023-06-02 15:56:06 +02:00
Lennart Poettering
2067a7ec7f detach-md: similar to the DM case, also don't try to detach MD device backing /usr/ 2023-06-02 15:56:06 +02:00
Lennart Poettering
31d346206c 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
2023-06-02 15:56:06 +02:00
Lennart Poettering
f5fcacdf2c detach-loopback: also decouple from umount.h
Let's introduce LoopbackDevice as replacement for MountPoint, with just
the fields we actually need.
2023-06-02 15:56:06 +02:00
Lennart Poettering
6514a6fd82 detach-md: also decouple structures from umount.h 2023-06-02 15:56:06 +02:00
Lennart Poettering
015937f901 detach-dm: decouple from umount.[ch]
Let's also define our own little structure here with just the fields we
need.
2023-06-02 15:56:06 +02:00
Lennart Poettering
a0fb20672d 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.
2023-06-02 15:56:06 +02:00
Lennart Poettering
82a1d6d096 umount: split out swap detachment code too 2023-06-02 15:56:06 +02:00
Lennart Poettering
2e2c472b1c umount: split out loopback detach code
Like the similar commits, no actual code changes, just splitting up
large C files.
2023-06-02 15:56:06 +02:00
Lennart Poettering
b44411c702 umount: similar as previous commit, split out DM detaching 2023-06-02 15:56:06 +02:00
Lennart Poettering
49427110a0 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.
2023-06-02 15:56:06 +02:00