1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-14 23:24:38 +03:00

pid1: check for kernels older than baseline

Let's make this detectable explicitly.
This commit is contained in:
Lennart Poettering 2022-03-30 10:46:16 +02:00 committed by Luca Boccassi
parent 58270534bf
commit 40efaaed42
3 changed files with 20 additions and 1 deletions

View File

@ -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"

View File

@ -6,6 +6,7 @@
#include <linux/oom.h>
#include <sys/mount.h>
#include <sys/prctl.h>
#include <sys/utsname.h>
#include <unistd.h>
#if HAVE_SECCOMP
#include <seccomp.h>
@ -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;

View File

@ -8,6 +8,7 @@
#include <sys/ioctl.h>
#include <sys/reboot.h>
#include <sys/timerfd.h>
#include <sys/utsname.h>
#include <sys/wait.h>
#include <unistd.h>
@ -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;