Skip to contentSkip to conversation

sysrq: Allow access to sensitive keys to be restricted by default

PATCH In review Ben Hutchings 3 participants 3 messages Sep 30, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sysrq: Allow access to sensitive keys to be restricted by default

From: Bastian Blank <[email protected]>

Add a Kconfig variable to set the initial value of the Magic SysRq mask (sysctl: kernel.sysrq).

---
This has been in Debian for a while, but should probably be signed-off by Bastian as well.

Debian sets this to 0x01b6, which excludes.

8 - enable debugging dumps of processes etc.
64 - enable signalling of processes (term, kill, oom-kill)

Ben.

include/linux/sysrq.h +1 -1
@@ -18,7 +18,7 @@
 #include <linux/types.h>
 
 /* Enable/disable SYSRQ support by default (0==no, 1==yes). */
-#define SYSRQ_DEFAULT_ENABLE	1
+#define SYSRQ_DEFAULT_ENABLE	CONFIG_MAGIC_SYSRQ_DEFAULT_MASK
 
 /* Possible values of bitmask for enabling sysrq functions */
 /* 0x0001 is reserved for enable everything */
lib/Kconfig.debug +8 -0
@@ -312,6 +312,14 @@ config MAGIC_SYSRQ
 	  keys are documented in <file:Documentation/sysrq.txt>. Don't say Y
 	  unless you really know what this hack does.
 
+config MAGIC_SYSRQ_DEFAULT_MASK
+	hex "Default mask for Magic SysRq keys on the console"
+	depends on MAGIC_SYSRQ
+	default 1
+	help
+	  Specifies the default mask for the allowed SysRq keys.  This can be
+	  used to disable several sensitive keys by default.
+
 config DEBUG_KERNEL
 	bool "Kernel debugging"
 	help
Signature · 3 lines
Ben Hutchings
Life is like a sewer:
what you get out of it depends on what you put into it.
#1 lore raw
Quoted 16 lines · Ben Hutchings

From: Bastian Blank <[email protected]>

Add a Kconfig variable to set the initial value of the Magic SysRq mask (sysctl: kernel.sysrq).

---
This has been in Debian for a while, but should probably be signed-off by Bastian as well.

Debian sets this to 0x01b6, which excludes.

8 - enable debugging dumps of processes etc.
64 - enable signalling of processes (term, kill, oom-kill)
...

lib/Kconfig.debug config MAGIC_SYSRQ · line 321

Quoted 7 lines
lib/Kconfig.debug +7 -0
+config MAGIC_SYSRQ_DEFAULT_MASK
+	hex "Default mask for Magic SysRq keys on the console"
+	depends on MAGIC_SYSRQ
+	default 1
+	help
+	  Specifies the default mask for the allowed SysRq keys.  This can be
+	  used to disable several sensitive keys by default.

Might be nice to have the mask values duplicated here to save having to go grepping through code ?

Dave

#2 lore raw
Quoted 17 lines · Dave Jones
Quoted 16 lines · Ben Hutchings

From: Bastian Blank <[email protected]>

Add a Kconfig variable to set the initial value of the Magic SysRq mask (sysctl: kernel.sysrq).

---
This has been in Debian for a while, but should probably be signed-off by Bastian as well.

Debian sets this to 0x01b6, which excludes.

8 - enable debugging dumps of processes etc.
64 - enable signalling of processes (term, kill, oom-kill)
...

Quoted 10 lines

lib/Kconfig.debug config MAGIC_SYSRQ · line 321

Quoted 7 lines
lib/Kconfig.debug +7 -0
+config MAGIC_SYSRQ_DEFAULT_MASK
+	hex "Default mask for Magic SysRq keys on the console"
+	depends on MAGIC_SYSRQ
+	default 1
+	help
+	  Specifies the default mask for the allowed SysRq keys.  This can be
+	  used to disable several sensitive keys by default.

Might be nice to have the mask values duplicated here to save having to go grepping through code ?

Yeah, a hit would be good. Like what '1' does as default would be a nice start :)

thanks,

greg k-h