]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
sysrq: Allow magic SysRq key functions to be disabled through Kconfig
authorBen Hutchings <ben@decadent.org.uk>
Mon, 7 Oct 2013 00:05:46 +0000 (01:05 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Oct 2013 20:01:44 +0000 (13:01 -0700)
Turn the initial value of sysctl kernel.sysrq (SYSRQ_DEFAULT_ENABLE)
into a Kconfig variable.

Original version by Bastian Blank <waldi@debian.org>.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Documentation/sysrq.txt
drivers/tty/sysrq.c
include/linux/sysrq.h
kernel/sysctl.c
lib/Kconfig.debug

index 1c0471dc70fe68b32c93d151ca97461d084286f8..0e307c94809a02586d59c13ca8c56985b632cfaf 100644 (file)
@@ -11,11 +11,9 @@ regardless of whatever else it is doing, unless it is completely locked up.
 You need to say "yes" to 'Magic SysRq key (CONFIG_MAGIC_SYSRQ)' when
 configuring the kernel. When running a kernel with SysRq compiled in,
 /proc/sys/kernel/sysrq controls the functions allowed to be invoked via
-the SysRq key. By default the file contains 1 which means that every
-possible SysRq request is allowed (in older versions SysRq was disabled
-by default, and you were required to specifically enable it at run-time
-but this is not the case any more). Here is the list of possible values
-in /proc/sys/kernel/sysrq:
+the SysRq key. The default value in this file is set by the
+CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE config symbol, which itself defaults
+to 1. Here is the list of possible values in /proc/sys/kernel/sysrq:
    0 - disable sysrq completely
    1 - enable all functions of sysrq
   >1 - bitmask of allowed sysrq functions (see below for detailed function
@@ -32,8 +30,9 @@ in /proc/sys/kernel/sysrq:
 You can set the value in the file by the following command:
     echo "number" >/proc/sys/kernel/sysrq
 
-The number may be written either as decimal or as hexadecimal with the
-0x prefix.
+The number may be written here either as decimal or as hexadecimal
+with the 0x prefix. CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE must always be
+written in hexadecimal.
 
 Note that the value of /proc/sys/kernel/sysrq influences only the invocation
 via a keyboard. Invocation of any operation via /proc/sysrq-trigger is always
index 40a9fe9d3b10f0170af31c4d8845d8cc609e6bb5..ce396ecdf41268b5de64a7ac3f820438c3bdfffb 100644 (file)
@@ -51,7 +51,7 @@
 #include <asm/irq_regs.h>
 
 /* Whether we react on sysrq keys or just ignore them */
-static int __read_mostly sysrq_enabled = SYSRQ_DEFAULT_ENABLE;
+static int __read_mostly sysrq_enabled = CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE;
 static bool __read_mostly sysrq_always_enabled;
 
 unsigned short platform_sysrq_reset_seq[] __weak = { KEY_RESERVED };
index 7faf933cced7018657d2212d543530484ce17ec9..387fa7d05c982b758942f83395e328949324fc1a 100644 (file)
@@ -17,9 +17,6 @@
 #include <linux/errno.h>
 #include <linux/types.h>
 
-/* Enable/disable SYSRQ support by default (0==no, 1==yes). */
-#define SYSRQ_DEFAULT_ENABLE   1
-
 /* Possible values of bitmask for enabling sysrq functions */
 /* 0x0001 is reserved for enable everything */
 #define SYSRQ_ENABLE_LOG       0x0002
index b2f06f3c6a3ff32ec9f8f2b92bea0c4766ac6f7d..8b80f1bae21a56de33b18ce198d1df5272fbce0f 100644 (file)
@@ -190,7 +190,7 @@ static int proc_dostring_coredump(struct ctl_table *table, int write,
 
 #ifdef CONFIG_MAGIC_SYSRQ
 /* Note: sysrq code uses it's own private copy */
-static int __sysrq_enabled = SYSRQ_DEFAULT_ENABLE;
+static int __sysrq_enabled = CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE;
 
 static int sysrq_sysctl_handler(ctl_table *table, int write,
                                void __user *buffer, size_t *lenp,
index 06344d986eb9dde61f341057f431d3183301f54e..29329374ff0d5b94d22157195aae3c453dd3d0f4 100644 (file)
@@ -312,6 +312,15 @@ 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_ENABLE
+       hex "Enable magic SysRq key functions by default"
+       depends on MAGIC_SYSRQ
+       default 0x1
+       help
+         Specifies which SysRq key functions are enabled by default.
+         This may be set to 1 or 0 to enable or disable them all, or
+         to a bitmask as described in Documentation/sysrq.txt.
+
 config DEBUG_KERNEL
        bool "Kernel debugging"
        help