[PATCH] Initialize sysctl to 1 to fix /proc/sys/kernel/sysrq value
From: Simon Glass
Date: Thu Jan 06 2011 - 19:44:25 EST
sysreq has previously (before commit 97f5f0cd) been initialized to 1,
thus enabling it on startup and making this value visible to user
space via /proc/sys/kernel/sysrq.
Commit 97f5f0cd split the __sysrq_enabled into two variables, one in
kernel/sysctl.c and the other in drivers/char/sysrq.c. The second is
initialised to 1 but the first is not, and I can find no mechanism in
the code to do so.
The upshot of this problem is that sysrq will read as 0 and appear to
be disabled as far as user space thinks, even though in fact it will
be enabled on boot. This problem goes away as soon as anyone writes
the sysrq file, and in particular when sysctl.conf contains the sysrq
line, so it may not be obvious.
This simple fix just initialises the variable on the sysctl.c side.
Signed-off-by: Simon Glass <sjg@xxxxxxxxxxxx>
kernel/sysctl.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 3a45c22..4b2f758 100644
@@ -171,7 +171,8 @@ static int proc_taint(struct ctl_table *table, int write,
-static int __sysrq_enabled; /* Note: sysrq code ises it's own private copy */
+/* Note: sysrq code in drivers/char/sysrq.c uses its own private copy */
+static int __sysrq_enabled = 1;
static int sysrq_sysctl_handler(ctl_table *table, int write,
void __user *buffer, size_t *lenp,
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/