* Re: [PATCH] killswitch: add per-function short-circuit mitigation primitive [not found] <20260507070547.2268452-1-sashal@kernel.org> @ 2026-05-15 3:48 ` Paul Moore 2026-05-18 6:31 ` Song Liu 0 siblings, 1 reply; 14+ messages in thread From: Paul Moore @ 2026-05-15 3:48 UTC (permalink / raw) To: Sasha Levin Cc: corbet, akpm, skhan, linux-doc, linux-kernel, linux-kselftest, gregkh, linux-security-module On Thu, May 7, 2026 at 3:05 AM Sasha Levin <sashal@kernel.org> wrote: > > When a (security) issue goes public, fleets stay exposed until a patched kernel > is built, distributed, and rebooted into. > > For many such issues the simplest mitigation is to stop calling the buggy > function. Killswitch provides that. An admin writes: > > echo "engage af_alg_sendmsg -1" \ > > /sys/kernel/security/killswitch/control > > After this, af_alg_sendmsg() returns -EPERM on every call without > running its body. The mitigation takes effect immediately, and is dropped on > the next reboot. > > A lot of recent kernel issues sit in code paths most installs only have enabled > to support a relative minority of users: AF_ALG, ksmbd, nf_tables, vsock, ax25, > and friends. > > For most users, the cost of "this socket family stops working for the day" is > much smaller than the cost of running a known vulnerable kernel until the fix > land. > > Assisted-by: Claude:claude-opus-4-7 > Signed-off-by: Sasha Levin <sashal@kernel.org> > --- > Documentation/admin-guide/index.rst | 1 + > Documentation/admin-guide/killswitch.rst | 159 ++++ > Documentation/admin-guide/tainted-kernels.rst | 8 + > MAINTAINERS | 11 + > include/linux/killswitch.h | 19 + > include/linux/panic.h | 3 +- > init/Kconfig | 2 + > kernel/Kconfig.killswitch | 31 + > kernel/Makefile | 1 + > kernel/killswitch.c | 798 ++++++++++++++++++ > kernel/panic.c | 1 + > lib/Kconfig.debug | 13 + > lib/Makefile | 1 + > lib/test_killswitch.c | 85 ++ > tools/testing/selftests/Makefile | 1 + > tools/testing/selftests/killswitch/.gitignore | 1 + > tools/testing/selftests/killswitch/Makefile | 8 + > .../selftests/killswitch/cve_31431_test.c | 162 ++++ > .../selftests/killswitch/killswitch_test.sh | 147 ++++ > 19 files changed, 1451 insertions(+), 1 deletion(-) > create mode 100644 Documentation/admin-guide/killswitch.rst > create mode 100644 include/linux/killswitch.h > create mode 100644 kernel/Kconfig.killswitch > create mode 100644 kernel/killswitch.c > create mode 100644 lib/test_killswitch.c > create mode 100644 tools/testing/selftests/killswitch/.gitignore > create mode 100644 tools/testing/selftests/killswitch/Makefile > create mode 100644 tools/testing/selftests/killswitch/cve_31431_test.c > create mode 100755 tools/testing/selftests/killswitch/killswitch_test.sh If we made Lockdown an LSM, we should probably also make killswitch an LSM. For the LSM crowd who might be seeing this for the first time, the original thread can be found on lore via the link below: https://lore.kernel.org/all/20260507070547.2268452-1-sashal@kernel.org -- paul-moore.com ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] killswitch: add per-function short-circuit mitigation primitive 2026-05-15 3:48 ` [PATCH] killswitch: add per-function short-circuit mitigation primitive Paul Moore @ 2026-05-18 6:31 ` Song Liu 2026-05-18 21:29 ` Paul Moore 0 siblings, 1 reply; 14+ messages in thread From: Song Liu @ 2026-05-18 6:31 UTC (permalink / raw) To: Paul Moore Cc: Sasha Levin, corbet, akpm, skhan, linux-doc, linux-kernel, linux-kselftest, gregkh, linux-security-module On Thu, May 14, 2026 at 8:48 PM Paul Moore <paul@paul-moore.com> wrote: > > On Thu, May 7, 2026 at 3:05 AM Sasha Levin <sashal@kernel.org> wrote: > > > > When a (security) issue goes public, fleets stay exposed until a patched kernel > > is built, distributed, and rebooted into. > > > > For many such issues the simplest mitigation is to stop calling the buggy > > function. Killswitch provides that. An admin writes: > > > > echo "engage af_alg_sendmsg -1" \ > > > /sys/kernel/security/killswitch/control > > > > After this, af_alg_sendmsg() returns -EPERM on every call without > > running its body. The mitigation takes effect immediately, and is dropped on > > the next reboot. > > > > A lot of recent kernel issues sit in code paths most installs only have enabled > > to support a relative minority of users: AF_ALG, ksmbd, nf_tables, vsock, ax25, > > and friends. > > > > For most users, the cost of "this socket family stops working for the day" is > > much smaller than the cost of running a known vulnerable kernel until the fix > > land. > > > > Assisted-by: Claude:claude-opus-4-7 > > Signed-off-by: Sasha Levin <sashal@kernel.org> > > --- > > Documentation/admin-guide/index.rst | 1 + > > Documentation/admin-guide/killswitch.rst | 159 ++++ > > Documentation/admin-guide/tainted-kernels.rst | 8 + > > MAINTAINERS | 11 + > > include/linux/killswitch.h | 19 + > > include/linux/panic.h | 3 +- > > init/Kconfig | 2 + > > kernel/Kconfig.killswitch | 31 + > > kernel/Makefile | 1 + > > kernel/killswitch.c | 798 ++++++++++++++++++ > > kernel/panic.c | 1 + > > lib/Kconfig.debug | 13 + > > lib/Makefile | 1 + > > lib/test_killswitch.c | 85 ++ > > tools/testing/selftests/Makefile | 1 + > > tools/testing/selftests/killswitch/.gitignore | 1 + > > tools/testing/selftests/killswitch/Makefile | 8 + > > .../selftests/killswitch/cve_31431_test.c | 162 ++++ > > .../selftests/killswitch/killswitch_test.sh | 147 ++++ > > 19 files changed, 1451 insertions(+), 1 deletion(-) > > create mode 100644 Documentation/admin-guide/killswitch.rst > > create mode 100644 include/linux/killswitch.h > > create mode 100644 kernel/Kconfig.killswitch > > create mode 100644 kernel/killswitch.c > > create mode 100644 lib/test_killswitch.c > > create mode 100644 tools/testing/selftests/killswitch/.gitignore > > create mode 100644 tools/testing/selftests/killswitch/Makefile > > create mode 100644 tools/testing/selftests/killswitch/cve_31431_test.c > > create mode 100755 tools/testing/selftests/killswitch/killswitch_test.sh > > If we made Lockdown an LSM, we should probably also make killswitch an LSM. I don't think killswitch can stack with other LSMs. In fact, killswitch can be used to bypass other LSMs, for example: echo engage security_file_open 0 > /sys/kernel/security/killswitch/control will bypass all hooks on security_file_open. Thanks, Song > For the LSM crowd who might be seeing this for the first time, the > original thread can be found on lore via the link below: > https://lore.kernel.org/all/20260507070547.2268452-1-sashal@kernel.org > > -- > paul-moore.com > ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] killswitch: add per-function short-circuit mitigation primitive 2026-05-18 6:31 ` Song Liu @ 2026-05-18 21:29 ` Paul Moore 2026-05-18 23:22 ` Song Liu 2026-05-19 0:31 ` Sasha Levin 0 siblings, 2 replies; 14+ messages in thread From: Paul Moore @ 2026-05-18 21:29 UTC (permalink / raw) To: Song Liu Cc: Sasha Levin, corbet, akpm, skhan, linux-doc, linux-kernel, linux-kselftest, gregkh, linux-security-module On Mon, May 18, 2026 at 2:31 AM Song Liu <song@kernel.org> wrote: > On Thu, May 14, 2026 at 8:48 PM Paul Moore <paul@paul-moore.com> wrote: > > On Thu, May 7, 2026 at 3:05 AM Sasha Levin <sashal@kernel.org> wrote: > > > > > > When a (security) issue goes public, fleets stay exposed until a patched kernel > > > is built, distributed, and rebooted into. > > > > > > For many such issues the simplest mitigation is to stop calling the buggy > > > function. Killswitch provides that. An admin writes: > > > > > > echo "engage af_alg_sendmsg -1" \ > > > > /sys/kernel/security/killswitch/control > > > > > > After this, af_alg_sendmsg() returns -EPERM on every call without > > > running its body. The mitigation takes effect immediately, and is dropped on > > > the next reboot. > > > > > > A lot of recent kernel issues sit in code paths most installs only have enabled > > > to support a relative minority of users: AF_ALG, ksmbd, nf_tables, vsock, ax25, > > > and friends. > > > > > > For most users, the cost of "this socket family stops working for the day" is > > > much smaller than the cost of running a known vulnerable kernel until the fix > > > land. > > > > > > Assisted-by: Claude:claude-opus-4-7 > > > Signed-off-by: Sasha Levin <sashal@kernel.org> > > > --- > > > Documentation/admin-guide/index.rst | 1 + > > > Documentation/admin-guide/killswitch.rst | 159 ++++ > > > Documentation/admin-guide/tainted-kernels.rst | 8 + > > > MAINTAINERS | 11 + > > > include/linux/killswitch.h | 19 + > > > include/linux/panic.h | 3 +- > > > init/Kconfig | 2 + > > > kernel/Kconfig.killswitch | 31 + > > > kernel/Makefile | 1 + > > > kernel/killswitch.c | 798 ++++++++++++++++++ > > > kernel/panic.c | 1 + > > > lib/Kconfig.debug | 13 + > > > lib/Makefile | 1 + > > > lib/test_killswitch.c | 85 ++ > > > tools/testing/selftests/Makefile | 1 + > > > tools/testing/selftests/killswitch/.gitignore | 1 + > > > tools/testing/selftests/killswitch/Makefile | 8 + > > > .../selftests/killswitch/cve_31431_test.c | 162 ++++ > > > .../selftests/killswitch/killswitch_test.sh | 147 ++++ > > > 19 files changed, 1451 insertions(+), 1 deletion(-) > > > create mode 100644 Documentation/admin-guide/killswitch.rst > > > create mode 100644 include/linux/killswitch.h > > > create mode 100644 kernel/Kconfig.killswitch > > > create mode 100644 kernel/killswitch.c > > > create mode 100644 lib/test_killswitch.c > > > create mode 100644 tools/testing/selftests/killswitch/.gitignore > > > create mode 100644 tools/testing/selftests/killswitch/Makefile > > > create mode 100644 tools/testing/selftests/killswitch/cve_31431_test.c > > > create mode 100755 tools/testing/selftests/killswitch/killswitch_test.sh > > > > If we made Lockdown an LSM, we should probably also make killswitch an LSM. > > I don't think killswitch can stack with other LSMs. In fact, killswitch > can be used to bypass other LSMs, for example: > > echo engage security_file_open 0 > /sys/kernel/security/killswitch/control > > will bypass all hooks on security_file_open. From my perspective there are two different issues here: should killswitch be a LSM, and should killswitch leverage kprobes to be able to "kill" security related symbols. After all, are we okay with killswitch killing capable() and friends? In my opinion, making killswitch an LSM is more of a procedural item that deals with how we view a capability like killswitch. I personally view killswitch as somewhat similar to Lockdown, which is why I made the suggestion. The use of kprobes, while an interesting idea, presents problems as allowing any kernel symbol to be killed introduces the potential for security regressions. As a reminder, some LSMs, as well as other kernel subsystems, have mechanisms in place to restrict root and/or enforce one-way configuration locks; while many people equate "root" with full control, in many cases today that is not strictly correct. Yes, kprobes have been around for some time, this is not a new problem, but killswitch makes it far more convenient and accessible to do dangerous things with kprobes. If killswitch makes it past the RFC stage without any significant changes to its kill mechanism, we may need to start considering more liberal usage of NOKPROBE_SYMBOL() which I think would be an unfortunate casualty. -- paul-moore.com ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] killswitch: add per-function short-circuit mitigation primitive 2026-05-18 21:29 ` Paul Moore @ 2026-05-18 23:22 ` Song Liu 2026-05-18 23:57 ` Paul Moore 2026-05-19 0:31 ` Sasha Levin 1 sibling, 1 reply; 14+ messages in thread From: Song Liu @ 2026-05-18 23:22 UTC (permalink / raw) To: Paul Moore Cc: Sasha Levin, corbet, akpm, skhan, linux-doc, linux-kernel, linux-kselftest, gregkh, linux-security-module On Mon, May 18, 2026 at 2:29 PM Paul Moore <paul@paul-moore.com> wrote: [...] > In my opinion, making killswitch an LSM is more of a procedural item > that deals with how we view a capability like killswitch. I > personally view killswitch as somewhat similar to Lockdown, which is > why I made the suggestion. > > The use of kprobes, while an interesting idea, presents problems as > allowing any kernel symbol to be killed introduces the potential for > security regressions. As a reminder, some LSMs, as well as other > kernel subsystems, have mechanisms in place to restrict root and/or > enforce one-way configuration locks; while many people equate "root" > with full control, in many cases today that is not strictly correct. > > Yes, kprobes have been around for some time, this is not a new > problem, but killswitch makes it far more convenient and accessible to > do dangerous things with kprobes. If killswitch makes it past the RFC > stage without any significant changes to its kill mechanism, we may > need to start considering more liberal usage of NOKPROBE_SYMBOL() > which I think would be an unfortunate casualty. I don't think we can use NOKPROBE_SYMBOL(). There are functions that we don't want to killswitch, but still want to trace. Thanks, Song ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] killswitch: add per-function short-circuit mitigation primitive 2026-05-18 23:22 ` Song Liu @ 2026-05-18 23:57 ` Paul Moore 2026-05-19 0:01 ` Song Liu 2026-05-19 0:21 ` Sasha Levin 0 siblings, 2 replies; 14+ messages in thread From: Paul Moore @ 2026-05-18 23:57 UTC (permalink / raw) To: Song Liu Cc: Sasha Levin, corbet, akpm, skhan, linux-doc, linux-kernel, linux-kselftest, gregkh, linux-security-module On Mon, May 18, 2026 at 7:23 PM Song Liu <song@kernel.org> wrote: > On Mon, May 18, 2026 at 2:29 PM Paul Moore <paul@paul-moore.com> wrote: > [...] > > In my opinion, making killswitch an LSM is more of a procedural item > > that deals with how we view a capability like killswitch. I > > personally view killswitch as somewhat similar to Lockdown, which is > > why I made the suggestion. > > > > The use of kprobes, while an interesting idea, presents problems as > > allowing any kernel symbol to be killed introduces the potential for > > security regressions. As a reminder, some LSMs, as well as other > > kernel subsystems, have mechanisms in place to restrict root and/or > > enforce one-way configuration locks; while many people equate "root" > > with full control, in many cases today that is not strictly correct. > > > > Yes, kprobes have been around for some time, this is not a new > > problem, but killswitch makes it far more convenient and accessible to > > do dangerous things with kprobes. If killswitch makes it past the RFC > > stage without any significant changes to its kill mechanism, we may > > need to start considering more liberal usage of NOKPROBE_SYMBOL() > > which I think would be an unfortunate casualty. > > I don't think we can use NOKPROBE_SYMBOL(). There are functions > that we don't want to killswitch, but still want to trace. That was exactly my point, but we need to figure something out so killswitch doesn't make it easier to cause a regression. -- paul-moore.com ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] killswitch: add per-function short-circuit mitigation primitive 2026-05-18 23:57 ` Paul Moore @ 2026-05-19 0:01 ` Song Liu 2026-05-19 2:55 ` Paul Moore 2026-05-19 0:21 ` Sasha Levin 1 sibling, 1 reply; 14+ messages in thread From: Song Liu @ 2026-05-19 0:01 UTC (permalink / raw) To: Paul Moore Cc: Sasha Levin, corbet, akpm, skhan, linux-doc, linux-kernel, linux-kselftest, gregkh, linux-security-module On Mon, May 18, 2026 at 4:57 PM Paul Moore <paul@paul-moore.com> wrote: > > On Mon, May 18, 2026 at 7:23 PM Song Liu <song@kernel.org> wrote: > > On Mon, May 18, 2026 at 2:29 PM Paul Moore <paul@paul-moore.com> wrote: > > [...] > > > In my opinion, making killswitch an LSM is more of a procedural item > > > that deals with how we view a capability like killswitch. I > > > personally view killswitch as somewhat similar to Lockdown, which is > > > why I made the suggestion. > > > > > > The use of kprobes, while an interesting idea, presents problems as > > > allowing any kernel symbol to be killed introduces the potential for > > > security regressions. As a reminder, some LSMs, as well as other > > > kernel subsystems, have mechanisms in place to restrict root and/or > > > enforce one-way configuration locks; while many people equate "root" > > > with full control, in many cases today that is not strictly correct. > > > > > > Yes, kprobes have been around for some time, this is not a new > > > problem, but killswitch makes it far more convenient and accessible to > > > do dangerous things with kprobes. If killswitch makes it past the RFC > > > stage without any significant changes to its kill mechanism, we may > > > need to start considering more liberal usage of NOKPROBE_SYMBOL() > > > which I think would be an unfortunate casualty. > > > > I don't think we can use NOKPROBE_SYMBOL(). There are functions > > that we don't want to killswitch, but still want to trace. > > That was exactly my point, but we need to figure something out so > killswitch doesn't make it easier to cause a regression. killswitch is making it easier to fix a CVE. It can surely make it easier to cause a regression. AFAICT, the only protection here is "it is only for root". Thanks, Song ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] killswitch: add per-function short-circuit mitigation primitive 2026-05-19 0:01 ` Song Liu @ 2026-05-19 2:55 ` Paul Moore 0 siblings, 0 replies; 14+ messages in thread From: Paul Moore @ 2026-05-19 2:55 UTC (permalink / raw) To: Song Liu Cc: Sasha Levin, corbet, akpm, skhan, linux-doc, linux-kernel, linux-kselftest, gregkh, linux-security-module On Mon, May 18, 2026 at 8:01 PM Song Liu <song@kernel.org> wrote: > On Mon, May 18, 2026 at 4:57 PM Paul Moore <paul@paul-moore.com> wrote: > > On Mon, May 18, 2026 at 7:23 PM Song Liu <song@kernel.org> wrote: > > > On Mon, May 18, 2026 at 2:29 PM Paul Moore <paul@paul-moore.com> wrote: > > > [...] > > > > In my opinion, making killswitch an LSM is more of a procedural item > > > > that deals with how we view a capability like killswitch. I > > > > personally view killswitch as somewhat similar to Lockdown, which is > > > > why I made the suggestion. > > > > > > > > The use of kprobes, while an interesting idea, presents problems as > > > > allowing any kernel symbol to be killed introduces the potential for > > > > security regressions. As a reminder, some LSMs, as well as other > > > > kernel subsystems, have mechanisms in place to restrict root and/or > > > > enforce one-way configuration locks; while many people equate "root" > > > > with full control, in many cases today that is not strictly correct. > > > > > > > > Yes, kprobes have been around for some time, this is not a new > > > > problem, but killswitch makes it far more convenient and accessible to > > > > do dangerous things with kprobes. If killswitch makes it past the RFC > > > > stage without any significant changes to its kill mechanism, we may > > > > need to start considering more liberal usage of NOKPROBE_SYMBOL() > > > > which I think would be an unfortunate casualty. > > > > > > I don't think we can use NOKPROBE_SYMBOL(). There are functions > > > that we don't want to killswitch, but still want to trace. > > > > That was exactly my point, but we need to figure something out so > > killswitch doesn't make it easier to cause a regression. > > killswitch is making it easier to fix a CVE. It can surely make it easier > to cause a regression. AFAICT, the only protection here is "it is only > for root". As I mentioned earlier, several LSMs have the ability to restrict root beyond what is possible with traditional Linux accesscontrols. For example, with SELinux one could deny root a specific privilege while also blocking changes to the SELinux policy; the root user would not be able to restore that privilege without rebooting the system. On a killswitch enabled system the ability to restrict root is lost as root would be able to kill the enforcement of those access controls. Presumably one could have the LSM block access to killswitch in this particular case, but that defeats the purpose doesn't it? The audit subsystem also has a somewhat similar one-way configuration lock, which when set does not allow even root to unlock it, a reboot is required. By a bit of luck with regards to how the code is written*, it may not be vulnerable to a killswitch regression but I do wonder if there are other similar things in the kernel which would have the same type of problem. * This is probably the first time I think I've ever considered myself lucky with respect to the audit code implementation. -- paul-moore.com ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] killswitch: add per-function short-circuit mitigation primitive 2026-05-18 23:57 ` Paul Moore 2026-05-19 0:01 ` Song Liu @ 2026-05-19 0:21 ` Sasha Levin 1 sibling, 0 replies; 14+ messages in thread From: Sasha Levin @ 2026-05-19 0:21 UTC (permalink / raw) To: Paul Moore Cc: Song Liu, corbet, akpm, skhan, linux-doc, linux-kernel, linux-kselftest, gregkh, linux-security-module On Mon, May 18, 2026 at 07:57:37PM -0400, Paul Moore wrote: >On Mon, May 18, 2026 at 7:23 PM Song Liu <song@kernel.org> wrote: >> On Mon, May 18, 2026 at 2:29 PM Paul Moore <paul@paul-moore.com> wrote: >> [...] >> > In my opinion, making killswitch an LSM is more of a procedural item >> > that deals with how we view a capability like killswitch. I >> > personally view killswitch as somewhat similar to Lockdown, which is >> > why I made the suggestion. >> > >> > The use of kprobes, while an interesting idea, presents problems as >> > allowing any kernel symbol to be killed introduces the potential for >> > security regressions. As a reminder, some LSMs, as well as other >> > kernel subsystems, have mechanisms in place to restrict root and/or >> > enforce one-way configuration locks; while many people equate "root" >> > with full control, in many cases today that is not strictly correct. >> > >> > Yes, kprobes have been around for some time, this is not a new >> > problem, but killswitch makes it far more convenient and accessible to >> > do dangerous things with kprobes. If killswitch makes it past the RFC >> > stage without any significant changes to its kill mechanism, we may >> > need to start considering more liberal usage of NOKPROBE_SYMBOL() >> > which I think would be an unfortunate casualty. >> >> I don't think we can use NOKPROBE_SYMBOL(). There are functions >> that we don't want to killswitch, but still want to trace. > >That was exactly my point, but we need to figure something out so >killswitch doesn't make it easier to cause a regression. At this point it sounds like you're trying to stop root from shooting itself in the foot, which we always avoided doing. killswitch doesn't add any new functionality in that regard: rood can always load a module, write to /dev/mem, etc which would allow it to do the same thing. It's just a more convenient way to do it. -- Thanks, Sasha ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] killswitch: add per-function short-circuit mitigation primitive 2026-05-18 21:29 ` Paul Moore 2026-05-18 23:22 ` Song Liu @ 2026-05-19 0:31 ` Sasha Levin 2026-05-19 3:08 ` Paul Moore 2026-05-19 5:29 ` Song Liu 1 sibling, 2 replies; 14+ messages in thread From: Sasha Levin @ 2026-05-19 0:31 UTC (permalink / raw) To: Paul Moore Cc: Song Liu, corbet, akpm, skhan, linux-doc, linux-kernel, linux-kselftest, gregkh, linux-security-module On Mon, May 18, 2026 at 05:29:32PM -0400, Paul Moore wrote: >From my perspective there are two different issues here: should >killswitch be a LSM, and should killswitch leverage kprobes to be able >to "kill" security related symbols. After all, are we okay with >killswitch killing capable() and friends? killswitch doesn't do it on it's own. It may be instructed by root to do that, at which point that is root's problem. >In my opinion, making killswitch an LSM is more of a procedural item >that deals with how we view a capability like killswitch. I >personally view killswitch as somewhat similar to Lockdown, which is >why I made the suggestion. Maybe I'm not all that familiar with LSMs, but we would need to be able to stop "random" code paths from executing, and I don't think we can create LSM hooks at that granularity, no? >The use of kprobes, while an interesting idea, presents problems as >allowing any kernel symbol to be killed introduces the potential for >security regressions. As a reminder, some LSMs, as well as other >kernel subsystems, have mechanisms in place to restrict root and/or >enforce one-way configuration locks; while many people equate "root" >with full control, in many cases today that is not strictly correct. killswitch "complies" with lockdown. Is there a different scenario which we should be blocking? >Yes, kprobes have been around for some time, this is not a new >problem, but killswitch makes it far more convenient and accessible to >do dangerous things with kprobes. If killswitch makes it past the RFC >stage without any significant changes to its kill mechanism, we may >need to start considering more liberal usage of NOKPROBE_SYMBOL() >which I think would be an unfortunate casualty. Why? If I don't really mind the security impact, I want to be able to have a killswitch-like interface on my systems. If an attacker is in my systems, killswitch is the least of my concerns I think. If you are security concious, just don't enable CONFIG_KILLSWITCH? -- Thanks, Sasha ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] killswitch: add per-function short-circuit mitigation primitive 2026-05-19 0:31 ` Sasha Levin @ 2026-05-19 3:08 ` Paul Moore 2026-05-19 20:00 ` Sasha Levin 2026-05-19 5:29 ` Song Liu 1 sibling, 1 reply; 14+ messages in thread From: Paul Moore @ 2026-05-19 3:08 UTC (permalink / raw) To: Sasha Levin Cc: Song Liu, corbet, akpm, skhan, linux-doc, linux-kernel, linux-kselftest, gregkh, linux-security-module On Mon, May 18, 2026 at 8:31 PM Sasha Levin <sashal@kernel.org> wrote: > On Mon, May 18, 2026 at 05:29:32PM -0400, Paul Moore wrote: > >From my perspective there are two different issues here: should > >killswitch be a LSM, and should killswitch leverage kprobes to be able > >to "kill" security related symbols. After all, are we okay with > >killswitch killing capable() and friends? > > killswitch doesn't do it on it's own. It may be instructed by root to do that, > at which point that is root's problem. As I mentioned previously, there are cases where we can restrict root's privileges today, but a functional killswitch would allow that restriction to be bypassed. My last email to Song has an example with SELinux. > >In my opinion, making killswitch an LSM is more of a procedural item > >that deals with how we view a capability like killswitch. I > >personally view killswitch as somewhat similar to Lockdown, which is > >why I made the suggestion. > > Maybe I'm not all that familiar with LSMs, but we would need to be able to stop > "random" code paths from executing, and I don't think we can create LSM hooks > at that granularity, no? I don't see any LSM hooks in this revision of killswitch, and as long as it is based on a kprobes I can't imagine it would ever use any. As I mentioned above, my killswitch-as-a-LSM comment is primarily about killswitch filling a role very similar to Lockdown. > >The use of kprobes, while an interesting idea, presents problems as > >allowing any kernel symbol to be killed introduces the potential for > >security regressions. As a reminder, some LSMs, as well as other > >kernel subsystems, have mechanisms in place to restrict root and/or > >enforce one-way configuration locks; while many people equate "root" > >with full control, in many cases today that is not strictly correct. > > killswitch "complies" with lockdown. Is there a different scenario which we > should be blocking? See the SELinux example I mentioned in my email to Song. > >Yes, kprobes have been around for some time, this is not a new > >problem, but killswitch makes it far more convenient and accessible to > >do dangerous things with kprobes. If killswitch makes it past the RFC > >stage without any significant changes to its kill mechanism, we may > >need to start considering more liberal usage of NOKPROBE_SYMBOL() > >which I think would be an unfortunate casualty. > > Why? If I don't really mind the security impact, I want to be able to have a > killswitch-like interface on my systems. If an attacker is in my systems, > killswitch is the least of my concerns I think. > > If you are security concious, just don't enable CONFIG_KILLSWITCH? Isn't the whole point of killswitch to have it enabled everywhere because you never know when you might want/need it? -- paul-moore.com ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] killswitch: add per-function short-circuit mitigation primitive 2026-05-19 3:08 ` Paul Moore @ 2026-05-19 20:00 ` Sasha Levin 2026-05-19 20:50 ` Paul Moore 0 siblings, 1 reply; 14+ messages in thread From: Sasha Levin @ 2026-05-19 20:00 UTC (permalink / raw) To: Paul Moore Cc: Song Liu, corbet, akpm, skhan, linux-doc, linux-kernel, linux-kselftest, gregkh, linux-security-module On Mon, May 18, 2026 at 11:08:38PM -0400, Paul Moore wrote: >On Mon, May 18, 2026 at 8:31 PM Sasha Levin <sashal@kernel.org> wrote: >> On Mon, May 18, 2026 at 05:29:32PM -0400, Paul Moore wrote: >> >From my perspective there are two different issues here: should >> >killswitch be a LSM, and should killswitch leverage kprobes to be able >> >to "kill" security related symbols. After all, are we okay with >> >killswitch killing capable() and friends? >> >> killswitch doesn't do it on it's own. It may be instructed by root to do that, >> at which point that is root's problem. > >As I mentioned previously, there are cases where we can restrict >root's privileges today, but a functional killswitch would allow that >restriction to be bypassed. My last email to Song has an example with >SELinux. This would be handled by just disabling killswitch in those scenarios like how we do with lockdown, no? >> >In my opinion, making killswitch an LSM is more of a procedural item >> >that deals with how we view a capability like killswitch. I >> >personally view killswitch as somewhat similar to Lockdown, which is >> >why I made the suggestion. >> >> Maybe I'm not all that familiar with LSMs, but we would need to be able to stop >> "random" code paths from executing, and I don't think we can create LSM hooks >> at that granularity, no? > >I don't see any LSM hooks in this revision of killswitch, and as long >as it is based on a kprobes I can't imagine it would ever use any. As >I mentioned above, my killswitch-as-a-LSM comment is primarily about >killswitch filling a role very similar to Lockdown. My question was more about how to structure killswitch as an LSM. I want to be able to poke at pretty much any function in the kernel, rather than restrict access to a known list of functions. >> >The use of kprobes, while an interesting idea, presents problems as >> >allowing any kernel symbol to be killed introduces the potential for >> >security regressions. As a reminder, some LSMs, as well as other >> >kernel subsystems, have mechanisms in place to restrict root and/or >> >enforce one-way configuration locks; while many people equate "root" >> >with full control, in many cases today that is not strictly correct. >> >> killswitch "complies" with lockdown. Is there a different scenario which we >> should be blocking? > >See the SELinux example I mentioned in my email to Song. > >> >Yes, kprobes have been around for some time, this is not a new >> >problem, but killswitch makes it far more convenient and accessible to >> >do dangerous things with kprobes. If killswitch makes it past the RFC >> >stage without any significant changes to its kill mechanism, we may >> >need to start considering more liberal usage of NOKPROBE_SYMBOL() >> >which I think would be an unfortunate casualty. >> >> Why? If I don't really mind the security impact, I want to be able to have a >> killswitch-like interface on my systems. If an attacker is in my systems, >> killswitch is the least of my concerns I think. >> >> If you are security concious, just don't enable CONFIG_KILLSWITCH? > >Isn't the whole point of killswitch to have it enabled everywhere >because you never know when you might want/need it? Right. We have different usecases. If you want selinux/lockdown/etc and a really crippled root, that should be an option. If you choose to allow something like killswitch, it should be an option too. -- Thanks, Sasha ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] killswitch: add per-function short-circuit mitigation primitive 2026-05-19 20:00 ` Sasha Levin @ 2026-05-19 20:50 ` Paul Moore 0 siblings, 0 replies; 14+ messages in thread From: Paul Moore @ 2026-05-19 20:50 UTC (permalink / raw) To: Sasha Levin Cc: Song Liu, corbet, akpm, skhan, linux-doc, linux-kernel, linux-kselftest, gregkh, linux-security-module On Tue, May 19, 2026 at 4:00 PM Sasha Levin <sashal@kernel.org> wrote: > On Mon, May 18, 2026 at 11:08:38PM -0400, Paul Moore wrote: > >On Mon, May 18, 2026 at 8:31 PM Sasha Levin <sashal@kernel.org> wrote: > >> On Mon, May 18, 2026 at 05:29:32PM -0400, Paul Moore wrote: > >> >From my perspective there are two different issues here: should > >> >killswitch be a LSM, and should killswitch leverage kprobes to be able > >> >to "kill" security related symbols. After all, are we okay with > >> >killswitch killing capable() and friends? > >> > >> killswitch doesn't do it on it's own. It may be instructed by root to do that, > >> at which point that is root's problem. > > > >As I mentioned previously, there are cases where we can restrict > >root's privileges today, but a functional killswitch would allow that > >restriction to be bypassed. My last email to Song has an example with > >SELinux. > > This would be handled by just disabling killswitch in those scenarios like how > we do with lockdown, no? One could presumably deny access to killswitch, but that pushes the burden of choice onto the users/admins. Yes, that is the easy way to solve thorny use case conflicts like this, but it would be nice if we could do better for those who have to deal with this in the wild. > >> >In my opinion, making killswitch an LSM is more of a procedural item > >> >that deals with how we view a capability like killswitch. I > >> >personally view killswitch as somewhat similar to Lockdown, which is > >> >why I made the suggestion. > >> > >> Maybe I'm not all that familiar with LSMs, but we would need to be able to stop > >> "random" code paths from executing, and I don't think we can create LSM hooks > >> at that granularity, no? > > > >I don't see any LSM hooks in this revision of killswitch, and as long > >as it is based on a kprobes I can't imagine it would ever use any. As > >I mentioned above, my killswitch-as-a-LSM comment is primarily about > >killswitch filling a role very similar to Lockdown. > > My question was more about how to structure killswitch as an LSM. I want to be > able to poke at pretty much any function in the kernel, rather than restrict > access to a known list of functions. Well, like I said in my last reply to you, I can't imagine a kprobes based killswitch would need to worry about the LSM hooks. Structuring killswitch as an LSM would be mostly a few lines of code to register it as an LSM and that's about it. Benefits would be minor, and likely a matter of opinion, it's mostly about how we view something like killswitch in the kernel. If we view it as a security mechanism similar to lockdown, then it makes sense as a LSM, if we view this as a completely different thing then it can be whatever it wants to be. -- paul-moore.com ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] killswitch: add per-function short-circuit mitigation primitive 2026-05-19 0:31 ` Sasha Levin 2026-05-19 3:08 ` Paul Moore @ 2026-05-19 5:29 ` Song Liu 2026-05-19 20:33 ` Paul Moore 1 sibling, 1 reply; 14+ messages in thread From: Song Liu @ 2026-05-19 5:29 UTC (permalink / raw) To: Sasha Levin Cc: Paul Moore, corbet, akpm, skhan, linux-doc, linux-kernel, linux-kselftest, gregkh, linux-security-module On Mon, May 18, 2026 at 5:31 PM Sasha Levin <sashal@kernel.org> wrote: > > On Mon, May 18, 2026 at 05:29:32PM -0400, Paul Moore wrote: > >From my perspective there are two different issues here: should > >killswitch be a LSM, and should killswitch leverage kprobes to be able > >to "kill" security related symbols. After all, are we okay with > >killswitch killing capable() and friends? > > killswitch doesn't do it on it's own. It may be instructed by root to do that, > at which point that is root's problem. > > >In my opinion, making killswitch an LSM is more of a procedural item > >that deals with how we view a capability like killswitch. I > >personally view killswitch as somewhat similar to Lockdown, which is > >why I made the suggestion. > > Maybe I'm not all that familiar with LSMs, but we would need to be able to stop > "random" code paths from executing, and I don't think we can create LSM hooks > at that granularity, no? There are much fewer LSM hooks than ftrace-able (killswitch-able) functions. In this sense, killswitch is more granular. However, LSM hooks allow LSM policies to make different decisions for different arguments. In this sense, LSM hooks are more granular than killswitch, as killswitch can only set a fixed return value for each engaged function. With current LSM solutions, we can mitigate issues like Copy Fail without breaking other features of the system. In [1], Cloudflare shared how they mitigate Copy Fail with BPF LSM. Thanks, Song [1] https://blog.cloudflare.com/copy-fail-linux-vulnerability-mitigation/ ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] killswitch: add per-function short-circuit mitigation primitive 2026-05-19 5:29 ` Song Liu @ 2026-05-19 20:33 ` Paul Moore 0 siblings, 0 replies; 14+ messages in thread From: Paul Moore @ 2026-05-19 20:33 UTC (permalink / raw) To: Song Liu Cc: Sasha Levin, corbet, akpm, skhan, linux-doc, linux-kernel, linux-kselftest, gregkh, linux-security-module On Tue, May 19, 2026 at 1:29 AM Song Liu <song@kernel.org> wrote: > On Mon, May 18, 2026 at 5:31 PM Sasha Levin <sashal@kernel.org> wrote: > > > > On Mon, May 18, 2026 at 05:29:32PM -0400, Paul Moore wrote: > > >From my perspective there are two different issues here: should > > >killswitch be a LSM, and should killswitch leverage kprobes to be able > > >to "kill" security related symbols. After all, are we okay with > > >killswitch killing capable() and friends? > > > > killswitch doesn't do it on it's own. It may be instructed by root to do that, > > at which point that is root's problem. > > > > >In my opinion, making killswitch an LSM is more of a procedural item > > >that deals with how we view a capability like killswitch. I > > >personally view killswitch as somewhat similar to Lockdown, which is > > >why I made the suggestion. > > > > Maybe I'm not all that familiar with LSMs, but we would need to be able to stop > > "random" code paths from executing, and I don't think we can create LSM hooks > > at that granularity, no? > > There are much fewer LSM hooks than ftrace-able (killswitch-able) > functions. In this sense, killswitch is more granular. I don't know if I would say it is necessarily more granular as its ability to filter access is limited to a breakpoint set on a symbol, but killswitch definitely has a larger quantity of control points. > However, LSM > hooks allow LSM policies to make different decisions for different > arguments. In this sense, LSM hooks are more granular than > killswitch, as killswitch can only set a fixed return value for each > engaged function. Yes, I think we agree here. > With current LSM solutions, we can mitigate issues like Copy Fail > without breaking other features of the system. In [1], Cloudflare > shared how they mitigate Copy Fail with BPF LSM. ... and Android has been shown to not be vulnerable in the first place due to their use of SELinux and a well crafted SELinux policy. -- paul-moore.com ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2026-05-19 20:50 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260507070547.2268452-1-sashal@kernel.org>
2026-05-15 3:48 ` [PATCH] killswitch: add per-function short-circuit mitigation primitive Paul Moore
2026-05-18 6:31 ` Song Liu
2026-05-18 21:29 ` Paul Moore
2026-05-18 23:22 ` Song Liu
2026-05-18 23:57 ` Paul Moore
2026-05-19 0:01 ` Song Liu
2026-05-19 2:55 ` Paul Moore
2026-05-19 0:21 ` Sasha Levin
2026-05-19 0:31 ` Sasha Levin
2026-05-19 3:08 ` Paul Moore
2026-05-19 20:00 ` Sasha Levin
2026-05-19 20:50 ` Paul Moore
2026-05-19 5:29 ` Song Liu
2026-05-19 20:33 ` Paul Moore
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox