Skip to contentSkip to conversation

kexec: add sysctl to disable kexec

PATCH Superseded Kees Cook 4 participants 15 messages Dec 10, 2013 – Dec 12, 2013

Subsystems (5)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH v2 1/1 kexec: add sysctl to disable kexec

For general-purpose (i.e. distro) kernel builds it makes sense to build with CONFIG_KEXEC to allow end users to choose what kind of things they want to do with kexec. However, in the face of trying to lock down a system with such a kernel, there needs to be a way to disable kexec (much like module loading can be disabled). Without this, it is too easy for the root user to modify kernel memory even when CONFIG_STRICT_DEVMEM and modules_disabled are set.

---
v2:
- updated sysctl documentation; akpm

---
 Documentation/sysctl/kernel.txt |   13 ++++++++++++-
 include/linux/kexec.h           |    1 +
 kernel/kexec.c                  |    3 ++-
 kernel/sysctl.c                 |   13 +++++++++++++
 4 files changed, 28 insertions(+), 2 deletions(-)
Documentation/sysctl/kernel.txt +12 -1
index 26b7ee491df8..ca153f958a30 100644
@@ -33,6 +33,7 @@ show up in /proc/sys/kernel:
 - domainname
 - hostname
 - hotplug
+- kexec_disabled
 - kptr_restrict
 - kstack_depth_to_print       [ X86 only ]
 - l2cr                        [ PPC only ]
@@ -287,6 +288,16 @@ Default value is "/sbin/hotplug".
 
 ==============================================================
 
+kexec_disabled:
+
+A toggle indicating if the kexec_load syscall has been disabled. This
+value defaults to 0 (false: kexec_load enabled), but can be set to 1
+(true: kexec_load disabled). Once true, kexec can no longer be used, and
+the toggle cannot be set back to false. Generally used together with the
+"modules_disabled" sysctl.
+
+==============================================================
+
 kptr_restrict:
 
 This toggle indicates whether restrictions are placed on
@@ -331,7 +342,7 @@ A toggle value indicating if modules are allowed to be loaded
 in an otherwise modular kernel.  This toggle defaults to off
 (0), but can be set true (1).  Once true, modules can be
 neither loaded nor unloaded, and the toggle cannot be set back
-to false.
+to false.  Generally used with the "kexec_disabled" toggle.
 
 ==============================================================
 
include/linux/kexec.h +1 -0
index d78d28a733b1..a1503ed4dde5 100644
@@ -170,6 +170,7 @@ unsigned long paddr_vmcoreinfo_note(void);
 
 extern struct kimage *kexec_image;
 extern struct kimage *kexec_crash_image;
+extern int kexec_disabled;
 
 #ifndef kexec_flush_icache_page
 #define kexec_flush_icache_page(page)
kernel/kexec.c +2 -1
index 490afc03627e..9d44ed203ee7 100644
@@ -929,6 +929,7 @@ static int kimage_load_segment(struct kimage *image,
  */
 struct kimage *kexec_image;
 struct kimage *kexec_crash_image;
+int kexec_disabled;
 
 static DEFINE_MUTEX(kexec_mutex);
 
@@ -939,7 +940,7 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
 	int result;
 
 	/* We only trust the superuser with rebooting the system. */
-	if (!capable(CAP_SYS_BOOT))
+	if (!capable(CAP_SYS_BOOT) || kexec_disabled)
 		return -EPERM;
 
 	/*
kernel/sysctl.c +13 -0
index 34a604726d0b..07869ce3642d 100644
@@ -62,6 +62,7 @@
 #include <linux/capability.h>
 #include <linux/binfmts.h>
 #include <linux/sched/sysctl.h>
+#include <linux/kexec.h>
 
 #include <asm/uaccess.h>
 #include <asm/processor.h>
@@ -614,6 +615,18 @@ static struct ctl_table kern_table[] = {
 		.proc_handler	= proc_dointvec,
 	},
 #endif
+#ifdef CONFIG_KEXEC
+	{
+		.procname	= "kexec_disabled",
+		.data		= &kexec_disabled,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		/* only handle a transition from default "0" to "1" */
+		.proc_handler	= proc_dointvec_minmax,
+		.extra1		= &one,
+		.extra2		= &one,
+	},
+#endif
 #ifdef CONFIG_MODULES
 	{
 		.procname	= "modprobe",
Signature · 11 lines
1.7.9.5


-- 
Kees Cook
Chrome OS Security

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#1 lore raw
Quoted 9 lines · Kees Cook

For general-purpose (i.e. distro) kernel builds it makes sense to build with CONFIG_KEXEC to allow end users to choose what kind of things they want to do with kexec. However, in the face of trying to lock down a system with such a kernel, there needs to be a way to disable kexec (much like module loading can be disabled). Without this, it is too easy for the root user to modify kernel memory even when CONFIG_STRICT_DEVMEM and modules_disabled are set.

So the logic is to load a crashkernel and then lock down the machine before services, networking etc. are enabled?

-hpa

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

author
#2 lore raw
Quoted 8 lines · H. Peter Anvin
Quoted 7 lines · Kees Cook

For general-purpose (i.e. distro) kernel builds it makes sense to build with CONFIG_KEXEC to allow end users to choose what kind of things they want to do with kexec. However, in the face of trying to lock down a system with such a kernel, there needs to be a way to disable kexec (much like module loading can be disabled). Without this, it is too easy for the root user to modify kernel memory even when CONFIG_STRICT_DEVMEM and modules_disabled are set.

Quoted 5 lines
Quoted 2 lines

So the logic is to load a crashkernel and then lock down the machine before services, networking etc. are enabled?

Right, or to just turn it off at boot time if kexec will not be used at all.

-Kees

Signature · 2 lines
Kees Cook
Chrome OS Security
#3 lore raw
Quoted 9 lines · Kees Cook
Quoted 8 lines · H. Peter Anvin
Quoted 7 lines · Kees Cook

For general-purpose (i.e. distro) kernel builds it makes sense to build with CONFIG_KEXEC to allow end users to choose what kind of things they want to do with kexec. However, in the face of trying to lock down a system with such a kernel, there needs to be a way to disable kexec (much like module loading can be disabled). Without this, it is too easy for the root user to modify kernel memory even when CONFIG_STRICT_DEVMEM and modules_disabled are set.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

So the logic is to load a crashkernel and then lock down the machine before services, networking etc. are enabled?

Right, or to just turn it off at boot time if kexec will not be used at all.

kdump kernel is loaded with the help of kdump service. Different distro's might have different dependencies for that serivce. But recently in fedora we wait network to come up before starting that service. (So that nfs targets can be mounted and checked for valid dump destinations).

IOW, crash kernel is loaded quite late in the game (quite a few services have run and possibly networking is up too). To me, practically one will disable kdump also if you change state of this knob early.

Thanks
Vivek

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#4 lore raw
Quoted 18 lines · Vivek Goyal
Quoted 9 lines · Kees Cook
Quoted 8 lines · H. Peter Anvin
Quoted 7 lines · Kees Cook

For general-purpose (i.e. distro) kernel builds it makes sense to build with CONFIG_KEXEC to allow end users to choose what kind of things they want to do with kexec. However, in the face of trying to lock down a system with such a kernel, there needs to be a way to disable kexec (much like module loading can be disabled). Without this, it is too easy for the root user to modify kernel memory even when CONFIG_STRICT_DEVMEM and modules_disabled are set.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

So the logic is to load a crashkernel and then lock down the machine before services, networking etc. are enabled?

Right, or to just turn it off at boot time if kexec will not be used at all.

Quoted 8 lines

kdump kernel is loaded with the help of kdump service. Different distro's might have different dependencies for that serivce. But recently in fedora we wait network to come up before starting that service. (So that nfs targets can be mounted and checked for valid dump destinations).

IOW, crash kernel is loaded quite late in the game (quite a few services have run and possibly networking is up too). To me, practically one will disable kdump also if you change state of this knob early.

Of course it also removes the possibility of re-loading crash kernel after doing some changes to /etc/kdump.conf (like dump destination or kernel command line).

I am wondering if it is sufficient to disable kexec jump back functionality only while retaining kexec and kdump. That seems to be easiest way to change kernel's data structures.

Thanks
Vivek

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#5 lore raw
In reply to Vivek Goyal

Of course it isn't.

Quoted 41 lines · Vivek Goyal
Quoted 3 lines · Kees Cook
Quoted 2 lines · H. Peter Anvin
Quoted 1 line · Kees Cook

For general-purpose (i.e. distro) kernel builds it makes sense to

build with

Quoted 1 line
Quoted 1 line
Quoted 1 line

CONFIG_KEXEC to allow end users to choose what kind of things they

want to do

Quoted 1 line
Quoted 1 line
Quoted 1 line

with kexec. However, in the face of trying to lock down a system

with such

Quoted 1 line
Quoted 1 line
Quoted 1 line

a kernel, there needs to be a way to disable kexec (much like

module loading

Quoted 1 line
Quoted 1 line
Quoted 1 line

can be disabled). Without this, it is too easy for the root user

to modify

Quoted 1 line
Quoted 1 line
Quoted 1 line

kernel memory even when CONFIG_STRICT_DEVMEM and modules_disabled

are set.

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

So the logic is to load a crashkernel and then lock down the

machine

Quoted 3 lines
Quoted 1 line

before services, networking etc. are enabled?

Right, or to just turn it off at boot time if kexec will not be used

at all.

kdump kernel is loaded with the help of kdump service. Different distro's
might have different dependencies for that serivce. But recently in fedora
we wait network to come up before starting that service. (So that nfs targets can be mounted and checked for valid dump destinations).

IOW, crash kernel is loaded quite late in the game (quite a few services
have run and possibly networking is up too). To me, practically one will
disable kdump also if you change state of this knob early.

Thanks
Vivek

Signature · 6 lines
Sent from my mobile phone.  Please pardon brevity and lack of formatting.

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#6 lore raw
Quoted 1 line · H. Peter Anvin

Of course it isn't.

I am not sure what are you trying to say. This is too brief.

Thanks
Vivek

Quoted 35 lines
Quoted 33 lines · Vivek Goyal
Quoted 3 lines · Kees Cook
Quoted 2 lines · H. Peter Anvin
Quoted 1 line · Kees Cook

For general-purpose (i.e. distro) kernel builds it makes sense to

build with

Quoted 1 line
Quoted 1 line
Quoted 1 line

CONFIG_KEXEC to allow end users to choose what kind of things they

want to do

Quoted 1 line
Quoted 1 line
Quoted 1 line

with kexec. However, in the face of trying to lock down a system

with such

Quoted 1 line
Quoted 1 line
Quoted 1 line

a kernel, there needs to be a way to disable kexec (much like

module loading

Quoted 1 line
Quoted 1 line
Quoted 1 line

can be disabled). Without this, it is too easy for the root user

to modify

Quoted 1 line
Quoted 1 line
Quoted 1 line

kernel memory even when CONFIG_STRICT_DEVMEM and modules_disabled

are set.

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

So the logic is to load a crashkernel and then lock down the

machine

Quoted 3 lines
Quoted 1 line

before services, networking etc. are enabled?

Right, or to just turn it off at boot time if kexec will not be used

at all.

kdump kernel is loaded with the help of kdump service. Different distro's
might have different dependencies for that serivce. But recently in fedora
we wait network to come up before starting that service. (So that nfs targets can be mounted and checked for valid dump destinations).

Quoted 11 lines
Quoted 8 lines

IOW, crash kernel is loaded quite late in the game (quite a few services
have run and possibly networking is up too). To me, practically one will
disable kdump also if you change state of this knob early.

Thanks
Vivek

Signature · 1 line
Sent from my mobile phone.  Please pardon brevity and lack of formatting.

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#7 lore raw
Quoted 8 lines · Vivek Goyal
Quoted 1 line · H. Peter Anvin

Of course it isn't.

I am not sure what are you trying to say. This is too brief.

Thanks
Vivek

Of course it is not sufficient. Once you can get arbitrary code into kernel space (CPL 0) you can do anything, and "disabling jump back" is just a speed bump.

-hpa

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#8 lore raw
Quoted 6 lines · H. Peter Anvin
Quoted 5 lines · Vivek Goyal
Quoted 1 line · H. Peter Anvin

Of course it isn't.

I am not sure what are you trying to say. This is too brief.

Quoted 7 lines
Quoted 3 lines

Thanks
Vivek

Of course it is not sufficient. Once you can get arbitrary code into kernel space (CPL 0) you can do anything, and "disabling jump back" is just a speed bump.

Agreed that disabling jump back is only a speed bump.

Kees, so how would be use this knob?

- If I put it in some init script, then root will permission to modify and remove it.

- Can one specify sysctl parameters on command line? If yes, then one can disable this using kernel command line and in that case kdump will be disabled too.

Thanks
Vivek

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

author
#9 lore raw
Quoted 15 lines · Vivek Goyal
Quoted 6 lines · H. Peter Anvin
Quoted 5 lines · Vivek Goyal
Quoted 1 line · H. Peter Anvin

Of course it isn't.

I am not sure what are you trying to say. This is too brief.

Quoted 7 lines
Quoted 3 lines

Thanks
Vivek

Of course it is not sufficient. Once you can get arbitrary code into kernel space (CPL 0) you can do anything, and "disabling jump back" is just a speed bump.

Quoted 6 lines

Agreed that disabling jump back is only a speed bump.

Kees, so how would be use this knob?

- If I put it in some init script, then root will permission to modify and remove it.

Correct. Same applies to changing the kernel itself, yes. However, all those options require a reboot, and unexpected system reboots should signal a significant problem to a system owner. :) This is a big step better than a silent kernel root kit getting installed.

Quoted 3 lines

- Can one specify sysctl parameters on command line? If yes, then one can disable this using kernel command line and in that case kdump will be disabled too.

If they can be set on the command line, I'd like to know about it. That would let me flip the bit even earlier, since I don't use kexec at all (and don't need to wait until boot up is done).

-Kees

Signature · 2 lines
Kees Cook
Chrome OS Security
#10 lore raw
In reply to Kees Cook
Quoted 7 lines · Kees Cook

For general-purpose (i.e. distro) kernel builds it makes sense to build with CONFIG_KEXEC to allow end users to choose what kind of things they want to do with kexec. However, in the face of trying to lock down a system with such a kernel, there needs to be a way to disable kexec (much like module loading can be disabled). Without this, it is too easy for the root user to modify kernel memory even when CONFIG_STRICT_DEVMEM and modules_disabled are set.

So let me get this straight. You object to what happens in sys_reboot so you patch sys_kexec_load?

You give someone the privilege to boot whatever they want and yet you don't want to support them booting whatever they want?

I'm sorry my brain is hurting trying to understand the logic of this patch.

Eric

author
#11 lore raw
Quoted 10 lines · Eric W. Biederman
Quoted 7 lines · Kees Cook

For general-purpose (i.e. distro) kernel builds it makes sense to build with CONFIG_KEXEC to allow end users to choose what kind of things they want to do with kexec. However, in the face of trying to lock down a system with such a kernel, there needs to be a way to disable kexec (much like module loading can be disabled). Without this, it is too easy for the root user to modify kernel memory even when CONFIG_STRICT_DEVMEM and modules_disabled are set.

Quoted 2 lines

So let me get this straight. You object to what happens in sys_reboot so you patch sys_kexec_load?

Yes; it's the entry point for loading the image used for crashes and LINUX_REBOOT_CMD_KEXEC.

Quoted 5 lines

You give someone the privilege to boot whatever they want and yet you don't want to support them booting whatever they want?

I'm sorry my brain is hurting trying to understand the logic of this patch.

I'm not trying to claim this fixes all attack vectors from a root user. That is exceedingly hard. :) However, kexec gives the root user a trivial (and undetectable) way to modify the running kernel. Providing an option to block sys_kexec_load for systems that will never use it (or will use it once at startup) is valuable in several situations. There's no reason to make an attacker's job easier, and this doesn't get in any one else's way.

-Kees

Signature · 2 lines
Kees Cook
Chrome OS Security
#12 lore raw
Quoted 24 lines · Kees Cook
Quoted 10 lines · Eric W. Biederman
Quoted 7 lines · Kees Cook

For general-purpose (i.e. distro) kernel builds it makes sense to build with CONFIG_KEXEC to allow end users to choose what kind of things they want to do with kexec. However, in the face of trying to lock down a system with such a kernel, there needs to be a way to disable kexec (much like module loading can be disabled). Without this, it is too easy for the root user to modify kernel memory even when CONFIG_STRICT_DEVMEM and modules_disabled are set.

Quoted 2 lines

So let me get this straight. You object to what happens in sys_reboot so you patch sys_kexec_load?

Yes; it's the entry point for loading the image used for crashes and LINUX_REBOOT_CMD_KEXEC.

Quoted 5 lines

You give someone the privilege to boot whatever they want and yet you don't want to support them booting whatever they want?

I'm sorry my brain is hurting trying to understand the logic of this patch.

Quoted 7 lines

I'm not trying to claim this fixes all attack vectors from a root user. That is exceedingly hard. :) However, kexec gives the root user a trivial (and undetectable) way to modify the running kernel. Providing an option to block sys_kexec_load for systems that will never use it (or will use it once at startup) is valuable in several situations. There's no reason to make an attacker's job easier, and this doesn't get in any one else's way.

I am simply trying to point out your patch is incomplete and silly as presented.

LINUX_REBOOT_CMD_KEXEC should be disabled if you are calling the sysctl kexec_disable. If you want to it to be kexec_load_disable please call it that. A kexec_load_disable is a different thing than a kexec_disable.

A kexec_disable would block both sys_kexec_load and sys_reboot(LINUX_REBOOT_CMD_KEXEC) and would remove any staged kexec images. Allowing you to stop considering kexec past that point from a security analysis perspective. That is what it sounds like you want.

What I am asking for is an problem description and an implementation that are in sync, and a problem description that people can look at and say was this a complete implementation.

Right now I can not tell what was intended so I can not truly tell if the patch is correct. Code with that property does not serve anyone any good, especially as the kernel evolves.

So please decide if you want kexec_disable or kexec_load_disable, or if you want something a little more nuanced.

Right now I think a full and complete kexec_disable makes sense. I probably won't use it but I think it makes sense. Your patch implementiong kexec_load_disable seems to be a half solution that tries to please everyone and does not serve anyone well. So I don't see the point.

Eric

author
#13 lore raw
Quoted 55 lines · Eric W. Biederman
Quoted 24 lines · Kees Cook
Quoted 10 lines · Eric W. Biederman
Quoted 7 lines · Kees Cook

For general-purpose (i.e. distro) kernel builds it makes sense to build with CONFIG_KEXEC to allow end users to choose what kind of things they want to do with kexec. However, in the face of trying to lock down a system with such a kernel, there needs to be a way to disable kexec (much like module loading can be disabled). Without this, it is too easy for the root user to modify kernel memory even when CONFIG_STRICT_DEVMEM and modules_disabled are set.

Quoted 2 lines

So let me get this straight. You object to what happens in sys_reboot so you patch sys_kexec_load?

Yes; it's the entry point for loading the image used for crashes and LINUX_REBOOT_CMD_KEXEC.

Quoted 5 lines

You give someone the privilege to boot whatever they want and yet you don't want to support them booting whatever they want?

I'm sorry my brain is hurting trying to understand the logic of this patch.

Quoted 7 lines

I'm not trying to claim this fixes all attack vectors from a root user. That is exceedingly hard. :) However, kexec gives the root user a trivial (and undetectable) way to modify the running kernel. Providing an option to block sys_kexec_load for systems that will never use it (or will use it once at startup) is valuable in several situations. There's no reason to make an attacker's job easier, and this doesn't get in any one else's way.

I am simply trying to point out your patch is incomplete and silly as presented.

LINUX_REBOOT_CMD_KEXEC should be disabled if you are calling the sysctl kexec_disable. If you want to it to be kexec_load_disable please call it that. A kexec_load_disable is a different thing than a kexec_disable.

A kexec_disable would block both sys_kexec_load and sys_reboot(LINUX_REBOOT_CMD_KEXEC) and would remove any staged kexec images. Allowing you to stop considering kexec past that point from a security analysis perspective. That is what it sounds like you want.

What I am asking for is an problem description and an implementation that are in sync, and a problem description that people can look at and say was this a complete implementation.

Right now I can not tell what was intended so I can not truly tell if the patch is correct. Code with that property does not serve anyone any good, especially as the kernel evolves.

Quoted 8 lines

So please decide if you want kexec_disable or kexec_load_disable, or if you want something a little more nuanced.

Right now I think a full and complete kexec_disable makes sense. I probably won't use it but I think it makes sense. Your patch implementiong kexec_load_disable seems to be a half solution that tries to please everyone and does not serve anyone well. So I don't see the point.

Sure, it seems reasonable to clarify it's purpose. I would like block _changes_ to the kexec image. In the case of systems not using kexec, this freezes it to "no kexec image", for those with a crash kernel, it freezes it to just that image, and makes sure it can't change until reboot. Blocking LINUX_REBOOT_CMD_KEXEC doesn't make sense in the latter sense, so it seems like changing the sysctl to "kexec_load_disable" is the sensible direction. I can send a v3 that changes the name and clarifies the purpose and potential uses.

-Kees

Signature · 2 lines
Kees Cook
Chrome OS Security
#14 lore raw
Quoted 66 lines · Kees Cook
Quoted 55 lines · Eric W. Biederman
Quoted 24 lines · Kees Cook
Quoted 10 lines · Eric W. Biederman
Quoted 7 lines · Kees Cook

For general-purpose (i.e. distro) kernel builds it makes sense to build with CONFIG_KEXEC to allow end users to choose what kind of things they want to do with kexec. However, in the face of trying to lock down a system with such a kernel, there needs to be a way to disable kexec (much like module loading can be disabled). Without this, it is too easy for the root user to modify kernel memory even when CONFIG_STRICT_DEVMEM and modules_disabled are set.

Quoted 2 lines

So let me get this straight. You object to what happens in sys_reboot so you patch sys_kexec_load?

Yes; it's the entry point for loading the image used for crashes and LINUX_REBOOT_CMD_KEXEC.

Quoted 5 lines

You give someone the privilege to boot whatever they want and yet you don't want to support them booting whatever they want?

I'm sorry my brain is hurting trying to understand the logic of this patch.

Quoted 7 lines

I'm not trying to claim this fixes all attack vectors from a root user. That is exceedingly hard. :) However, kexec gives the root user a trivial (and undetectable) way to modify the running kernel. Providing an option to block sys_kexec_load for systems that will never use it (or will use it once at startup) is valuable in several situations. There's no reason to make an attacker's job easier, and this doesn't get in any one else's way.

I am simply trying to point out your patch is incomplete and silly as presented.

LINUX_REBOOT_CMD_KEXEC should be disabled if you are calling the sysctl kexec_disable. If you want to it to be kexec_load_disable please call it that. A kexec_load_disable is a different thing than a kexec_disable.

A kexec_disable would block both sys_kexec_load and sys_reboot(LINUX_REBOOT_CMD_KEXEC) and would remove any staged kexec images. Allowing you to stop considering kexec past that point from a security analysis perspective. That is what it sounds like you want.

What I am asking for is an problem description and an implementation that are in sync, and a problem description that people can look at and say was this a complete implementation.

Right now I can not tell what was intended so I can not truly tell if the patch is correct. Code with that property does not serve anyone any good, especially as the kernel evolves.

Quoted 8 lines

So please decide if you want kexec_disable or kexec_load_disable, or if you want something a little more nuanced.

Right now I think a full and complete kexec_disable makes sense. I probably won't use it but I think it makes sense. Your patch implementiong kexec_load_disable seems to be a half solution that tries to please everyone and does not serve anyone well. So I don't see the point.

Quoted 8 lines

Sure, it seems reasonable to clarify it's purpose. I would like block _changes_ to the kexec image. In the case of systems not using kexec, this freezes it to "no kexec image", for those with a crash kernel, it freezes it to just that image, and makes sure it can't change until reboot. Blocking LINUX_REBOOT_CMD_KEXEC doesn't make sense in the latter sense, so it seems like changing the sysctl to "kexec_load_disable" is the sensible direction. I can send a v3 that changes the name and clarifies the purpose and potential uses.

The name change is definitely needed.

My concern from the conversation. Is there anyone we actually expect to use the functionality of loading an image and then disabling kexec_load?

Quoted 1 line

From the earlier discussion it appeared that no one could actually

figure out how to practically use the functionality of loading a kexec on panic image and then disabling kexec. Not to mention the weirdness caused by cpu/memory hotplug which trigger a need to reload the kexec on panic kernel.

If there is not a clear use case for limiting ourselves to just the loaded kexec images my preference would be to make it a big hammer that disabled kexec_load and LINUX_REBOOT_CMD_KEXEC, as that is easier to reason about.

Eric