* [PATCH] Wanted: a limit on kernel log buffer size
@ 2003-04-08 4:42 Chuck Ebbert
2003-04-08 4:52 ` Randy.Dunlap
0 siblings, 1 reply; 3+ messages in thread
From: Chuck Ebbert @ 2003-04-08 4:42 UTC (permalink / raw)
To: Randy Dunlap; +Cc: linux-kernel, Roman Zippel
Randy Dunlap wrote:
>Here's a [modified] patch that limits kernel log buffer size
>to 1 MB max and 4 KB min.
That's even better.
Maybe the kernel config system could just use multi-choice,
something like this?
( ) 8K
( ) 16K
( ) 32K
( ) 64K
( ) 128K
( ) 256K
A subset of your larger range should be enough, and this
would be less prone to user error.
--
Chuck
<insert witty statement here>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Wanted: a limit on kernel log buffer size
2003-04-08 4:42 [PATCH] Wanted: a limit on kernel log buffer size Chuck Ebbert
@ 2003-04-08 4:52 ` Randy.Dunlap
0 siblings, 0 replies; 3+ messages in thread
From: Randy.Dunlap @ 2003-04-08 4:52 UTC (permalink / raw)
To: 76306.1226; +Cc: rddunlap, linux-kernel, zippel
> Randy Dunlap wrote:
>
>
>>Here's a [modified] patch that limits kernel log buffer size
>>to 1 MB max and 4 KB min.
>
>
> That's even better.
>
> Maybe the kernel config system could just use multi-choice,
> something like this?
>
> ( ) 8K
> ( ) 16K
> ( ) 32K
> ( ) 64K
> ( ) 128K
> ( ) 256K
>
> A subset of your larger range should be enough, and this
> would be less prone to user error.
Yes, that could be done. In fact, the current LOG BUFFER size
selection started out that way IIRC, but some people said things
like, "why have limits" and "make it more general," so I did,
I guess now we have an answer to "why have limits." :(
If more people keep having problems with it, we should change it.
~Randy
^ permalink raw reply [flat|nested] 3+ messages in thread
* Wanted: a limit on kernel log buffer size
@ 2003-04-07 1:34 Chuck Ebbert
2003-04-07 2:49 ` Randy.Dunlap
0 siblings, 1 reply; 3+ messages in thread
From: Chuck Ebbert @ 2003-04-07 1:34 UTC (permalink / raw)
To: linux-kernel
Some people (who will mercifully go unnamed) just will _not_
read the documentation, and set the kernel log buffer shift
to 31 on a 256MB machine. This attempt to allocate 2GB of memory
for the buffer results in an unbootable kernel.
Suggestions?
--
Chuck
I am not a number!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Wanted: a limit on kernel log buffer size
2003-04-07 1:34 Chuck Ebbert
@ 2003-04-07 2:49 ` Randy.Dunlap
2003-04-07 3:35 ` Randy.Dunlap
0 siblings, 1 reply; 3+ messages in thread
From: Randy.Dunlap @ 2003-04-07 2:49 UTC (permalink / raw)
To: 76306.1226; +Cc: linux-kernel
> Some people (who will mercifully go unnamed) just will _not_
> read the documentation, and set the kernel log buffer shift
> to 31 on a 256MB machine. This attempt to allocate 2GB of memory
> for the buffer results in an unbootable kernel.
>
> Suggestions?
This is a multi-part answer. Say, 5 parts.
a. If someone won't read the help text, how can we help them?
b. If we make a 2 GB log buffer size a compile-time error, will
they read that?
c. If we make it a compile-time warning, will they read that?
d. What limit(s) do you suggest? I can try to add some limits.
e. This kind of config limiting should be done in the config system IMO.
I've asked Roman for that capability....
~Randy
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Wanted: a limit on kernel log buffer size
2003-04-07 2:49 ` Randy.Dunlap
@ 2003-04-07 3:35 ` Randy.Dunlap
2003-04-07 23:17 ` [PATCH] " Randy.Dunlap
0 siblings, 1 reply; 3+ messages in thread
From: Randy.Dunlap @ 2003-04-07 3:35 UTC (permalink / raw)
To: rddunlap; +Cc: 76306.1226, linux-kernel
>> Some people (who will mercifully go unnamed) just will _not_
>> read the documentation, and set the kernel log buffer shift
>> to 31 on a 256MB machine. This attempt to allocate 2GB of memory for the
>> buffer results in an unbootable kernel.
>>
>> Suggestions?
>
> This is a multi-part answer. Say, 5 parts.
>
> a. If someone won't read the help text, how can we help them?
>
> b. If we make a 2 GB log buffer size a compile-time error, will
> they read that?
>
> c. If we make it a compile-time warning, will they read that?
>
> d. What limit(s) do you suggest? I can try to add some limits.
>
> e. This kind of config limiting should be done in the config system IMO.
> I've asked Roman for that capability....
Here's a patch that limits kernel log buffer size to 1 MB max.
Comments?
I'm inserting it here via cut-and-paste, so it might not be all clean.
Patch is to 2.5.66-PV (plain vanilla).
patch_name: logbuf-limit.patch
patch_version: 2003-04-06.20:28:43
author: Randy.Dunlap <rddunlap@osdl.org>
description: limit kernel log buffer size to 1 MB
product: Linux
product_versions: 2.5.66
diffstat: =
kernel/printk.c | 3 +++
1 files changed, 3 insertions(+)
diff -Naur ./kernel/printk.c%LBLIM ./kernel/printk.c
--- ./kernel/printk.c%LBLIM 2003-04-06 20:27:28.000000000 -0700
+++ ./kernel/printk.c 2003-04-06 20:27:53.000000000 -0700
@@ -34,6 +34,9 @@
#define LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT)
#define LOG_BUF_MASK (LOG_BUF_LEN-1)
+#if (CONFIG_LOG_BUF_SHIFT > 20)
+#error CONFIG_LOG_BUF_SHIFT is ridiculously large (more than 1 MB).
+#endif
/* printk's without a loglevel use this.. */
#define DEFAULT_MESSAGE_LOGLEVEL 4 /* KERN_WARNING */
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] Wanted: a limit on kernel log buffer size
2003-04-07 3:35 ` Randy.Dunlap
@ 2003-04-07 23:17 ` Randy.Dunlap
0 siblings, 0 replies; 3+ messages in thread
From: Randy.Dunlap @ 2003-04-07 23:17 UTC (permalink / raw)
To: lkml; +Cc: 76306.1226
On Sun, 6 Apr 2003 20:35:59 -0700 (PDT) "Randy.Dunlap" <rddunlap@osdl.org> wrote:
| >> Some people (who will mercifully go unnamed) just will _not_
| >> read the documentation, and set the kernel log buffer shift
| >> to 31 on a 256MB machine. This attempt to allocate 2GB of memory for the
| >> buffer results in an unbootable kernel.
| >>
| >> Suggestions?
| >
| > This is a multi-part answer. Say, 5 parts.
| >
| > a. If someone won't read the help text, how can we help them?
| >
| > b. If we make a 2 GB log buffer size a compile-time error, will
| > they read that?
| >
| > c. If we make it a compile-time warning, will they read that?
| >
| > d. What limit(s) do you suggest? I can try to add some limits.
| >
| > e. This kind of config limiting should be done in the config system IMO.
| > I've asked Roman for that capability....
Here's a [modified] patch that limits kernel log buffer size to 1 MB max
and 4 KB min.
To me, ideally the config system would allow limits to be specified,
and then advanced users could edit .config to get around those limits.
By putting limits checking in kernel source files, there is no way
around them other than by editing the source files.
I've made this patch because there are some cases where it shouldn't be
possible to shoot oneself in the foot IMO -- at least not using the
config system...it's OK to do that when editing .config.
--
~Randy
patch_name: logbuf_limits.patch
patch_version: 2003-04-07.15:54:36
author: Randy.Dunlap <rddunlap@osdl.org>
description: enforce kernel log buffer limits (min and max);
product: Linux
product_versions: 2.5.67
changelog: add min and max kernel log buffer limits checking;
URL: http://www.osdl.org/archive/rddunlap/patches/logbuf_limits.patch
diffstat: =
kernel/printk.c | 6 ++++++
1 files changed, 6 insertions(+)
diff -Naur ./kernel/printk.c%LBLIM ./kernel/printk.c
--- ./kernel/printk.c%LBLIM Mon Apr 7 11:12:38 2003
+++ ./kernel/printk.c Mon Apr 7 14:44:16 2003
@@ -34,6 +34,12 @@
#define LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT)
#define LOG_BUF_MASK (LOG_BUF_LEN-1)
+#if (LOG_BUF_LEN > (1024 * 1024))
+#error CONFIG_LOG_BUF_SHIFT is ridiculously large (more than 20 [1 MB]).
+#endif
+#if (LOG_BUF_LEN < (4 * 1024))
+#error CONFIG_LOG_BUF_SHIFT is ridiculously small (less than 12 [4 KB]).
+#endif
/* printk's without a loglevel use this.. */
#define DEFAULT_MESSAGE_LOGLEVEL 4 /* KERN_WARNING */
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-04-08 4:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-08 4:42 [PATCH] Wanted: a limit on kernel log buffer size Chuck Ebbert
2003-04-08 4:52 ` Randy.Dunlap
-- strict thread matches above, loose matches on Subject: below --
2003-04-07 1:34 Chuck Ebbert
2003-04-07 2:49 ` Randy.Dunlap
2003-04-07 3:35 ` Randy.Dunlap
2003-04-07 23:17 ` [PATCH] " Randy.Dunlap
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®