public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jesper Juhl <jju@dif.dk>
To: linux-kernel@vger.kernel.org
Cc: marcelo@conectiva.com.br
Subject: [PATCH] console_loglevel broken on ia64 (and possibly other archs)
Date: Fri, 21 Dec 2001 23:52:32 +0100	[thread overview]
Message-ID: <3C23BD30.F8C3B2E1@dif.dk> (raw)

[-- Attachment #1: Type: text/plain, Size: 781 bytes --]


This patch fixes the console_loglevel variable(s) so that code that
assumes the variables occupy continuous storage does not break (and
overwrite other data).

Without this patch this will break on ia64 :

echo 6 4 1 7 > /proc/sys/kernel/printk

with this patch everything works as expected on ia64 and ia32 and as far
as I can tell it should have no ill effects on other archs.

The patch has been tested by Keith Owens who agrees that the patch works
and fixes the bug. And I've been told that David Mosberger has included
this patch in his ia64 add on patch. 
So I hope that it could go into 2.4.18-pre when that starts but I'm
posting it to the list in case someone else wants to comment on it.

The patch applies cleanly to 2.4.17-final


Best regards,
Jesper Juhl
jju@dif.dk

[-- Attachment #2: 2.4.17-console_loglevel-1.patch --]
[-- Type: text/plain, Size: 2682 bytes --]

diff -ur linux-2.4.17-rc1-orig/arch/i386/mm/fault.c linux-2.4.17-rc1/arch/i386/mm/fault.c
--- linux-2.4.17-rc1-orig/arch/i386/mm/fault.c	Wed Oct 10 00:13:03 2001
+++ linux-2.4.17-rc1/arch/i386/mm/fault.c	Mon Dec 17 20:05:41 2001
@@ -27,8 +27,6 @@
 
 extern void die(const char *,struct pt_regs *,long);
 
-extern int console_loglevel;
-
 /*
  * Ugly, ugly, but the goto's result in better assembly..
  */
diff -ur linux-2.4.17-rc1-orig/arch/parisc/kernel/traps.c linux-2.4.17-rc1/arch/parisc/kernel/traps.c
--- linux-2.4.17-rc1-orig/arch/parisc/kernel/traps.c	Sun Sep 30 21:26:08 2001
+++ linux-2.4.17-rc1/arch/parisc/kernel/traps.c	Mon Dec 17 20:05:41 2001
@@ -43,7 +43,6 @@
 
 static inline void console_verbose(void)
 {
-	extern int console_loglevel;
 	console_loglevel = 15;
 }
 
diff -ur linux-2.4.17-rc1-orig/include/linux/kernel.h linux-2.4.17-rc1/include/linux/kernel.h
--- linux-2.4.17-rc1-orig/include/linux/kernel.h	Fri Dec 14 00:08:23 2001
+++ linux-2.4.17-rc1/include/linux/kernel.h	Mon Dec 17 20:05:41 2001
@@ -36,6 +36,13 @@
 #define	KERN_INFO	"<6>"	/* informational			*/
 #define	KERN_DEBUG	"<7>"	/* debug-level messages			*/
 
+extern int console_printk[];
+
+#define console_loglevel (console_printk[0])
+#define default_message_loglevel (console_printk[1])
+#define minimum_console_loglevel (console_printk[2])
+#define default_console_loglevel (console_printk[3])
+
 # define NORET_TYPE    /**/
 # define ATTRIB_NORET  __attribute__((noreturn))
 # define NORET_AND     noreturn,
@@ -81,8 +88,6 @@
 
 asmlinkage int printk(const char * fmt, ...)
 	__attribute__ ((format (printf, 1, 2)));
-
-extern int console_loglevel;
 
 static inline void console_silent(void)
 {
diff -ur linux-2.4.17-rc1-orig/kernel/printk.c linux-2.4.17-rc1/kernel/printk.c
--- linux-2.4.17-rc1-orig/kernel/printk.c	Fri Dec 14 00:04:53 2001
+++ linux-2.4.17-rc1/kernel/printk.c	Mon Dec 17 20:05:41 2001
@@ -16,6 +16,7 @@
  *	01Mar01 Andrew Morton <andrewm@uow.edu.au>
  */
 
+#include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/tty.h>
 #include <linux/tty_driver.h>
@@ -51,11 +52,12 @@
 
 DECLARE_WAIT_QUEUE_HEAD(log_wait);
 
-/* Keep together for sysctl support */
-int console_loglevel = DEFAULT_CONSOLE_LOGLEVEL;
-int default_message_loglevel = DEFAULT_MESSAGE_LOGLEVEL;
-int minimum_console_loglevel = MINIMUM_CONSOLE_LOGLEVEL;
-int default_console_loglevel = DEFAULT_CONSOLE_LOGLEVEL;
+int console_printk[4] = {
+	DEFAULT_CONSOLE_LOGLEVEL,	/* console_loglevel */
+	DEFAULT_MESSAGE_LOGLEVEL,	/* default_message_loglevel */
+	MINIMUM_CONSOLE_LOGLEVEL,	/* minimum_console_loglevel */
+	DEFAULT_CONSOLE_LOGLEVEL,	/* default_console_loglevel */
+};
 
 int oops_in_progress;
 

             reply	other threads:[~2001-12-21 22:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-21 22:52 Jesper Juhl [this message]
2001-12-24 22:35 ` [PATCH] console_loglevel broken on ia64 (and possibly other archs) Pavel Machek
2001-12-25 10:20   ` Keith Owens
2001-12-25 11:41   ` Kai Henningsen
2001-12-29 15:02   ` Jesper Juhl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3C23BD30.F8C3B2E1@dif.dk \
    --to=jju@dif.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox