lkml.org 
[lkml]   [1998]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH]: Runtime enable/disable magic sysrq against 2.1.107pre1.
Hi,
For all those who said that having magic sysrq enabled on a system was
a security hole:
This patch will add /proc/sys/debug/sysrq_enable. If you:
echo "0">/proc/sys/debug/sysrq_enable
then sysrq won't work. If you:
echo "1">/proc/sys/debug/sysrq_enable
then sysrq will work. "1" is the default setting. Comments? This is
my very first kernel hack, so be gentle :)
-Myrdraal
--
Linux jackalz 2.1.107 #72 Thu Jun 25 01:15:22 EDT 1998 i486
2:11am up 38 min, 15 users, load average: 0.01, 0.01, 0.00
diff -ur linpatch/drivers/char/sysrq.c linux/drivers/char/sysrq.c
--- linpatch/drivers/char/sysrq.c Thu Jun 25 01:10:11 1998
+++ linux/drivers/char/sysrq.c Thu Jun 25 00:58:35 1998
@@ -27,6 +27,8 @@
#include <linux/apm_bios.h>
#endif

+int sysctl_sysrq_enable = 1;
+
extern void wakeup_bdflush(int);
extern void reset_vc(unsigned int);
extern int console_loglevel;
@@ -57,7 +59,7 @@
{
int orig_log_level = console_loglevel;

- if (!key)
+ if (!key || !sysctl_sysrq_enable)
return;

console_loglevel = 7;
diff -ur linpatch/include/linux/sysctl.h linux/include/linux/sysctl.h
--- linpatch/include/linux/sysctl.h Thu Jun 25 01:09:30 1998
+++ linux/include/linux/sysctl.h Thu Jun 25 01:03:07 1998
@@ -369,6 +369,9 @@
};

/* CTL_DEBUG names: */
+enum {
+ DEBUG_SYSRQ_ENABLE = 1,
+};

/* CTL_DEV names: */
enum {
diff -ur linpatch/kernel/sysctl.c linux/kernel/sysctl.c
--- linpatch/kernel/sysctl.c Thu Jun 25 01:10:37 1998
+++ linux/kernel/sysctl.c Thu Jun 25 01:29:02 1998
@@ -41,6 +41,9 @@
extern int bdf_prm[], bdflush_min[], bdflush_max[];
extern char binfmt_java_interpreter[], binfmt_java_appletviewer[];
extern int sysctl_overcommit_memory;
+#ifdef CONFIG_MAGIC_SYSRQ
+extern int sysctl_sysrq_enable;
+#endif
#ifdef CONFIG_KMOD
extern char modprobe_path[];
#endif
@@ -236,6 +239,10 @@
};

static ctl_table debug_table[] = {
+#ifdef CONFIG_MAGIC_SYSRQ
+ {DEBUG_SYSRQ_ENABLE, "sysrq_enable", &sysctl_sysrq_enable, sizeof(int),
+ 0644, NULL, &proc_dointvec},
+#endif
{0}
};
\
 
 \ /
  Last update: 2005-03-22 13:43    [W:0.069 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site