1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-11 09:18:07 +03:00
Commit Graph

65416 Commits

Author SHA1 Message Date
Lennart Poettering
af4e8e86ec 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.
2023-06-05 12:18:21 +02:00
Stefan Roesch
85614c6e2f 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.
2023-06-05 11:22:43 +02:00
Yu Watanabe
308b189511 chase: fix triggering assertion 2023-06-05 10:22:47 +02:00
Yu Watanabe
3991f35fbd chase: handle root path more carefully in chase_and_open()
chase_and_open() may be called with relative root path.
2023-06-05 15:50:46 +09:00
Yu Watanabe
c0dff4205b test: move intro() near DEFINE_TEST_MAIN_WITH_INTRO() 2023-06-05 14:49:54 +09:00
Yu Watanabe
d7aef22724 test: add more test cases about path_startswith() 2023-06-05 14:49:54 +09: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
Yu Watanabe
d1e96f2f6c test-kernel-install: add tests for --entry-token= 2023-06-05 14:23:54 +09:00
Yu Watanabe
1fd90ed3ed kernel-install: introduce --entry-token= option
For consistency with bootctl.
2023-06-05 14:23:54 +09:00
Yu Watanabe
88e94af2ab test-kernel-install: add tests for --make-entry-directory= 2023-06-05 14:23:54 +09:00
Yu Watanabe
b79621aa99 kernel-install: introduce --make-entry-directory= option
For consistency with bootctl. However, unlike the same option for
bootctl, defaults to 'auto' for backward compatibility.
2023-06-05 14:23:54 +09:00
Yu Watanabe
4cff5e92a9 kernel-install: add --esp-path= and --boot-path= options
Then, kernel-install takes one more step for compatibility with bootctl.
2023-06-05 14:23:54 +09:00
Yu Watanabe
1fd2af1ab8 kernel-install: also parse KERNEL_INSTALL_LAYOUT from /etc/machine-info
For consistency with bootctl.
2023-06-05 14:23:54 +09:00
Yu Watanabe
f7665b7f6c kernel-install: make inspect command optionally take kernel image
If the kernel image is provided, then we can inspect the kernel image
and may determine the layout based on the kernel image type.
2023-06-05 14:23:54 +09:00
Yu Watanabe
42551ea7e9 kernel-install: rewrite in C
This is mostly a one-to-one translation of kernel-install.sh, except for
the followings:
- BOOT_ROOT is searched with find_{esp,xbootldr}_and_warn().
- entry token is searched with boot_entry_token_ensure().
- inspect command verboses more information, e.g. found plugins,
  environment variables explicitly passed to plugins, arguments passed
  to plugins.
- paths specified in $KERNEL_INSTALL_PLUGINS must be absolute.
- LC_COLLATE is set to C.UTF-8 (or any specified on build time).

By writing kernel-install C, we can share the code used by bootctl or
so, and can introduce --root and/or --image options later.
2023-06-05 14:23:54 +09: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
1bf3dd4153 udev: downgrade log level about style issues
And add --no-style switch that make style issues not critical.
2023-06-05 11:37:26 +09:00
Yu Watanabe
2ef0959fbe test: drop unnecessary copy of expected output 2023-06-05 11:21:28 +09:00
Yu Watanabe
4134614fc0 udev-rules: terminate log messages with period 2023-06-05 11:21:28 +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