alpine-overlay/kubezero/linux-lts/0003-kexec-add-kexec_load_disabled-boot-option.patch

37 lines
1.1 KiB
Diff

From cf29b5a58ef88adf96317c3c933a16f9c865e09a Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Thu, 14 Jul 2022 13:23:51 +0200
Subject: [PATCH 3/5] kexec: add kexec_load_disabled boot option
Make kexec_load disabled by default and add a boot option to enable it:
kexec_load_disabled=0
---
kernel/kexec_core.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index 9dc728982d79..7650ffe5631e 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -942,7 +942,16 @@ static struct kexec_load_limit load_limit_panic = {
struct kimage *kexec_image;
struct kimage *kexec_crash_image;
-static int kexec_load_disabled;
+static int kexec_load_disabled = 1;
+
+static int __init kexec_load_disabled_setup(char *str)
+{
+ unsigned long disabled;
+ if (!kstrtoul(str, 0, &disabled))
+ kexec_load_disabled = disabled ? 1 : 0;
+ return 1;
+}
+__setup("kexec_load_disabled=", kexec_load_disabled_setup);
#ifdef CONFIG_SYSCTL
static int kexec_limit_handler(struct ctl_table *table, int write,
--
2.43.0