From: Lennart Poettering Date: Wed, 30 Mar 2022 08:46:16 +0000 (+0200) Subject: pid1: check for kernels older than baseline X-Git-Tag: v251-rc2~234 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40efaaed42fa8119704f55040c0eb564887e03be;p=thirdparty%2Fsystemd.git pid1: check for kernels older than baseline Let's make this detectable explicitly. --- diff --git a/src/basic/def.h b/src/basic/def.h index ffd462c456f..54a82c7c49a 100644 --- a/src/basic/def.h +++ b/src/basic/def.h @@ -73,3 +73,5 @@ #define VARLINK_ADDR_PATH_MANAGED_OOM_SYSTEM "/run/systemd/io.system.ManagedOOM" /* Path where systemd-oomd listens for varlink connections from user managers to report changes in ManagedOOM settings. */ #define VARLINK_ADDR_PATH_MANAGED_OOM_USER "/run/systemd/oom/io.system.ManagedOOM" + +#define KERNEL_BASELINE_VERSION "3.15" diff --git a/src/core/main.c b/src/core/main.c index f39c7b0e378..6567cdfb280 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #if HAVE_SECCOMP #include @@ -2009,6 +2010,7 @@ static void log_execution_mode(bool *ret_first_boot) { assert(ret_first_boot); if (arg_system) { + struct utsname uts; int v; log_info("systemd " GIT_VERSION " running in %ssystem mode (%s)", @@ -2046,6 +2048,14 @@ static void log_execution_mode(bool *ret_first_boot) { log_debug("Detected initialized system, this is not the first boot."); } } + + assert(uname(&uts) >= 0); + + if (strverscmp_improved(uts.release, KERNEL_BASELINE_VERSION) < 0) + log_warning("Warning! Reported kernel version %s is older than systemd's required baseline kernel version %s. " + "Your mileage may vary.", uts.release, KERNEL_BASELINE_VERSION); + else + log_debug("Kernel version %s, our baseline is %s", uts.release, KERNEL_BASELINE_VERSION); } else { if (DEBUG_LOGGING) { _cleanup_free_ char *t = NULL; diff --git a/src/core/manager.c b/src/core/manager.c index 4493103298e..768977dc3a7 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -4351,6 +4352,7 @@ int manager_dispatch_user_lookup_fd(sd_event_source *source, int fd, uint32_t re char *manager_taint_string(Manager *m) { _cleanup_free_ char *destination = NULL, *overflowuid = NULL, *overflowgid = NULL; + struct utsname uts; char *buf, *e; int r; @@ -4367,7 +4369,8 @@ char *manager_taint_string(Manager *m) { "local-hwclock:" "var-run-bad:" "overflowuid-not-65534:" - "overflowgid-not-65534:")); + "overflowgid-not-65534:" + "old-kernel:")); if (!buf) return NULL; @@ -4398,6 +4401,10 @@ char *manager_taint_string(Manager *m) { if (r >= 0 && !streq(overflowgid, "65534")) e = stpcpy(e, "overflowgid-not-65534:"); + assert_se(uname(&uts) >= 0); + if (strverscmp_improved(uts.release, KERNEL_BASELINE_VERSION) < 0) + e = stpcpy(e, "old-kernel:"); + /* remove the last ':' */ if (e != buf) e[-1] = 0;