|
Zbigniew Jędrzejewski-Szmek |
f69edd |
From 254338a838354d9d3e43efa14190ca1203ef3afe Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
Date: Wed, 3 Jul 2024 17:05:31 +0200
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
Subject: [PATCH 3/3] meson: add option to build systemd-executor "statically"
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
The new link-executor-shared option is similar to the existing
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
link-udev-shared: when set to false, we link to the static versions of our
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
internal libraries.
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
The resulting exuctor binary is fairly large, about as large as libsystemd-core
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
(14 MB without lto, 8 with lto).
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
This is intended as a workaround for the fuckup with the pinned executor
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
binary:
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
when an upgrade is performed, the package manager will install new version of
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
the libraries and new version of the code, and some time later reexecute the
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
managers. This creates a window when the pinned executor binary will fail to
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
execute. There are two factors which make the issue easier to hit:
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
- when the distribution uses a finely-grained shared-lib-tag. E.g. Fedora
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
uses version-release as the tag, which means that the issue occurs on
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
every package upgrade. This is the right thing to do, because the
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
ABI of our internal libraries is not stable at all, so replacing the
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
library from a different version in place creates a window where our
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
programs may crash or misbehave.
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
- when the distribution doesn't immediately reexec all the managers after
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
upgrade. In early versions of systemd, we used to hammer the machine during
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
upgrade, doing daemon-reexecs repeatedly. This works, but is ugly and
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
wasteful. Doing the reexecs while the upgrade is in progres also creates a
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
window where a mix of old and new configs or both is loaded. Users are
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
particularly annoyed by those reloads if there is some issue in the
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
configuration causing us to emit warnings on every reexec. Doing the
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
reexecs once after the new configuration and libraries have been put
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
in place is nicer.
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
The pinning of the executor binary breaks upgrades and in particular
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
it penalizes the distributions which make use of the features which
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
were previously added to avoid bugs and inefficiency during upgrades.
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
When the executor is linked statically, there is a smaller chance that it'll
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
fail to load libraries. The issue can still occur because other libraries, not
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
our own, are linked dynamically.
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
(cherry picked from commit d59cae6cebd0fc25a16a020bd28e5303901f1b19)
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
meson_options.txt | 2 ++
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
src/core/meson.build | 16 ++++++++++++----
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
2 files changed, 14 insertions(+), 4 deletions(-)
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
diff --git a/meson_options.txt b/meson_options.txt
|
|
Zbigniew Jędrzejewski-Szmek |
f69edd |
index 667340ca59..909e2d53e8 100644
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
--- a/meson_options.txt
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
+++ b/meson_options.txt
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
@@ -21,6 +21,8 @@ option('rootprefix', type : 'string', deprecated: true,
|
|
Zbigniew Jędrzejewski-Szmek |
f69edd |
description : 'This option is deprecated and will be removed in a future release')
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
option('link-udev-shared', type : 'boolean',
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
description : 'link systemd-udevd and its helpers to libsystemd-shared.so')
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
+option('link-executor-shared', type : 'boolean',
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
+ description : 'link systemd-executor to libsystemd-shared.so and libsystemd-core.so')
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
option('link-systemctl-shared', type: 'boolean',
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
description : 'link systemctl against libsystemd-shared.so')
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
option('link-networkd-shared', type: 'boolean',
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
diff --git a/src/core/meson.build b/src/core/meson.build
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
index 1ef31cc529..dbeb752977 100644
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
--- a/src/core/meson.build
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
+++ b/src/core/meson.build
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
@@ -156,6 +156,17 @@ systemd_executor_sources = files(
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
'exec-invoke.c',
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
)
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
+executor_libs = get_option('link-executor-shared') ? \
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
+ [
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
+ libcore,
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
+ libshared,
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
+ ] : [
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
+ libcore_static,
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
+ libshared_static,
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
+ libbasic_static,
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
+ libsystemd_static,
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
+ ]
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
executables += [
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
libexec_template + {
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
'name' : 'systemd',
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
@@ -173,10 +184,7 @@ executables += [
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
'public' : true,
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
'sources' : systemd_executor_sources,
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
'include_directories' : core_includes,
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
- 'link_with' : [
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
- libcore,
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
- libshared,
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
- ],
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
+ 'link_with' : executor_libs,
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
'dependencies' : [
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
libapparmor,
|
|
Zbigniew Jędrzejewski-Szmek |
38b885 |
libpam,
|