---1463793166-1065553756-939782648=:488
Content-Type: text/PLAIN; CHARSET=us-ascii
Content-ID: <Pine.LNX.4.10.9910122148011.488@okaysus.ed.vnet>
About 10 months ago, I hit Alt-PrintScrn-l two times too many, due to
poor memory, and I decided that my kernel would probably be better
without this (considering that according to the documentation, it's
guarenteed to kill the system), and so I patched my code.
Up until now, I've procrastinated on submitting this trivial patch due
to wanting to make absolutely sure it works; it's been tried on four x86
machines so far, but they don't make heavy use of Magic SysRq. No
problems found so far. Basically, my patch turns it into a synonym for
Alt-PrintScrn-i, although I've been tempted to disable it entirely, so
that noone would get in the habit of using the other option. (If people
provide me feedback, I may do the other method.) I've not patched it to
change documentation other than Configure.help, due to it being an
option.
Kernel 2.3.21 is the first I've tried that needs a different patch,
although I've not kept up, so I'm sure there are a bunch in the 2.3.x
series (2.2.13-pre14 worked fine), so I've made a second patch.
Due to Pine's "helpful" use of base64 for text attachments, I'm also
including both patches in the text portion, but the attachments should
work fine for people who can handle it.
Ed Grimm
---cut here--- safesysrq.patch (2.2.0-2.2.13-pre14)
diff -ru linux/Documentation/Configure.help edpre5/Documentation/Configure.help
--- linux/Documentation/Configure.help Thu Jan 7 14:05:16 1999
+++ edpre5/Documentation/Configure.help Fri Jan 8 11:55:33 1999
@@ -9286,6 +9286,14 @@
keys are documented in Documentation/sysrq.txt. Don't say Y unless
you really know what this hack does.
+Safe Magic System Request Key support
+CONFIG_SAFE_MAGIC_SYSRQ
+ If you say Y here, alt-SysRq-l will behave the same as alt-SysRq-i,
+ leaving you with a (barely) usable system. This can be helpful to
+ those who don't use sysrq very often, and don't want to accidentally
+ completely cripple their system, when they were just trying to get rid
+ of a runaway process or something.
+
ISDN subsystem
CONFIG_ISDN
ISDN ("Integrated Services Digital Networks", called RNIS in France)
diff -ru linux/arch/i386/config.in edpre5/arch/i386/config.in
--- linux/arch/i386/config.in Thu Jan 7 14:05:17 1999
+++ edpre5/arch/i386/config.in Fri Jan 8 11:48:04 1999
@@ -186,5 +186,8 @@
#bool 'Debug kmalloc/kfree' CONFIG_DEBUG_MALLOC
bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
+if [ "$CONFIG_MAGIC_SYSRQ" != "n" ]; then
+ bool 'Disable SysRq l key' CONFIG_SAFE_MAGIC_SYSRQ
+fi
endmenu
diff -ru linux/drivers/char/sysrq.c edpre5/drivers/char/sysrq.c
--- linux/drivers/char/sysrq.c Wed Nov 25 20:25:17 1998
+++ edpre5/drivers/char/sysrq.c Fri Jan 8 11:50:37 1999
@@ -41,8 +41,10 @@
for_each_task(p) {
if (p->pid && p->mm != &init_mm) { /* Not swapper nor kernel thread */
+#ifndef CONFIG_SAFE_MAGIC_SYSRQ
if (p->pid == 1 && even_init) /* Ugly hack to kill init */
p->pid = 0x8000;
+#endif
force_sig(sig, p);
}
}
---cut here--- safesysrq.patch (2.2.0-2.2.13-pre14)
---cut here--- safesysrq.patch (2.3.21)
--- linux-2.3.21/Documentation/Configure.help Sat Oct 9 20:51:41 1999
+++ linux-2.3.21.safesysrq/Documentation/Configure.help Tue Oct 12 19:58:08 1999
@@ -10774,8 +10774,16 @@
by pressing various keys while holding SysRq (Alt+PrintScreen). The
keys are documented in Documentation/sysrq.txt. Don't say Y unless
you really know what this hack does.
+Safe Magic System Request Key support
+CONFIG_SAFE_MAGIC_SYSRQ
+ If you say Y here, alt-SysRq-l will behave the same as alt-SysRq-i,
+ leaving you with a (barely) usable system. This can be helpful to
+ those who don't use sysrq very often, and don't want to accidentally
+ completely cripple their system, when they were just trying to get rid
+ of a runaway process or something.
+
ISDN subsystem
CONFIG_ISDN
ISDN ("Integrated Services Digital Networks", called RNIS in France)
is a special type of fully digital telephone service; it's mostly
--- linux-2.3.21/arch/i386/config.in Mon Oct 11 12:37:44 1999
+++ linux-2.3.21.safesysrq/arch/i386/config.in Tue Oct 12 19:58:08 1999
@@ -201,6 +201,9 @@
comment 'Kernel hacking'
#bool 'Debug kmalloc/kfree' CONFIG_DEBUG_MALLOC
bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
+if [ "$CONFIG_MAGIC_SYSRQ" != "n" ]; then
+ bool 'Disable SysRq l key' CONFIG_SAFE_MAGIC_SYSRQ
+fi
endmenu
--- linux-2.3.21/drivers/char/sysrq.c Tue Jul 20 01:08:41 1999
+++ linux-2.3.21.safesysrq/drivers/char/sysrq.c Tue Oct 12 20:01:07 1999
@@ -42,10 +42,12 @@
struct task_struct *p;
for_each_task(p) {
if (p->mm) { /* Not swapper nor kernel thread */
+#ifndef CONFIG_SAFE_MAGIC_SYSRQ
if (p->pid == 1 && even_init) /* Ugly hack to kill init */
p->pid = 0x8000;
+#endif
force_sig(sig, p);
}
}
}
---cut here--- safesysrq.patch (2.3.21)
---1463793166-1065553756-939782648=:488
Content-Type: text/PLAIN; CHARSET=us-ascii; NAME="safesysrq.patch"
Content-Transfer-Encoding: base64
Content-ID: <Pine.LNX.4.10.9910122144080.488@okaysus.ed.vnet>
Content-Description:
Content-Disposition: ATTACHMENT; FILENAME="safesysrq.patch"
ZGlmZiAtcnUgbGludXgvRG9jdW1lbnRhdGlvbi9Db25maWd1cmUuaGVscCBl
ZHByZTUvRG9jdW1lbnRhdGlvbi9Db25maWd1cmUuaGVscA0KLS0tIGxpbnV4
L0RvY3VtZW50YXRpb24vQ29uZmlndXJlLmhlbHAJVGh1IEphbiAgNyAxNDow
NToxNiAxOTk5DQorKysgZWRwcmU1L0RvY3VtZW50YXRpb24vQ29uZmlndXJl
LmhlbHAJRnJpIEphbiAgOCAxMTo1NTozMyAxOTk5DQpAQCAtOTI4Niw2ICs5
Mjg2LDE0IEBADQogICBrZXlzIGFyZSBkb2N1bWVudGVkIGluIERvY3VtZW50
YXRpb24vc3lzcnEudHh0LiBEb24ndCBzYXkgWSB1bmxlc3MNCiAgIHlvdSBy
ZWFsbHkga25vdyB3aGF0IHRoaXMgaGFjayBkb2VzLg0KIA0KK1NhZmUgTWFn
aWMgU3lzdGVtIFJlcXVlc3QgS2V5IHN1cHBvcnQNCitDT05GSUdfU0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ZW4NCisgIGJvb2wgJ0Rpc2FibGUgU3lzUnEg
bCBrZXknIENPTkZJR19TQUZFX01BR0lDX1NZU1JRDQorZmkNCiBlbmRtZW51
DQogDQpkaWZmIC1ydSBsaW51eC9kcml2ZXJzL2NoYXIvc3lzcnEuYyBlZHBy
ZTUvZHJpdmVycy9jaGFyL3N5c3JxLmMNCi0tLSBsaW51eC9kcml2ZXJzL2No
YXIvc3lzcnEuYwlXZWQgTm92IDI1IDIwOjI1OjE3IDE5OTgNCisrKyBlZHBy
ZTUvZHJpdmVycy9jaGFyL3N5c3JxLmMJRnJpIEphbiAgOCAxMTo1MDozNyAx
OTk5DQpAQCAtNDEsOCArNDEsMTAgQEANCiANCiAJZm9yX2VhY2hfdGFzayhw
KSB7DQogCQlpZiAocC0+cGlkICYmIHAtPm1tICE9ICZpbml0X21tKSB7CSAg
ICAvKiBOb3Qgc3dhcHBlciBub3Iga2VybmVsIHRocmVhZCAqLw0KKyNpZm5k
ZWYgQ09ORklHX1NBRkVfTUFHSUNfU1lTUlENCiAJCQlpZiAocC0+cGlkID09
IDEgJiYgZXZlbl9pbml0KQkgICAgLyogVWdseSBoYWNrIHRvIGtpbGwgaW5p
dCAqLw0KIAkJCQlwLT5waWQgPSAweDgwMDA7DQorI2VuZGlmDQogCQkJZm9y
Y2Vfc2lnKHNpZywgcCk7DQogCQl9DQogCX0NCg==
---1463793166-1065553756-939782648=:488
Content-Type: text/PLAIN; CHARSET=us-ascii; NAME="safesysrq-2.3.21.patch"
Content-Transfer-Encoding: base64
Content-ID: <Pine.LNX.4.10.9910122144081.488@okaysus.ed.vnet>
Content-Description:
Content-Disposition: ATTACHMENT; FILENAME="safesysrq-2.3.21.patch"
LS0tIGxpbnV4LTIuMy4yMS9Eb2N1bWVudGF0aW9uL0NvbmZpZ3VyZS5oZWxw
CVNhdCBPY3QgIDkgMjA6NTE6NDEgMTk5OQ0KKysrIGxpbnV4LTIuMy4yMS5z
YWZlc3lzcnEvRG9jdW1lbnRhdGl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bl9pbml0KQkgICAgLyogVWdseSBoYWNrIHRvIGtpbGwgaW5pdCAqLw0K
IAkJCQlwLT5waWQgPSAweDgwMDA7DQorI2VuZGlmDQogCQkJZm9yY2Vfc2ln
KHNpZywgcCk7DQogCQl9DQogCX0NCiB9DQo=
---1463793166-1065553756-939782648=:488--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/