lkml.org 
[lkml]   [2003]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: proc_misc.c bug
David Mosberger <davidm@napali.hpl.hp.com> wrote:
>
> interrupts_open() can easily try to kmalloc() more memory than
> supported by kmalloc. E.g., with 16KB page size and NR_CPUS==64, it
> would try to allocate 147456 bytes.
>
> The workaround below is to allocate 4KB per 8 CPUs. Not really a
> solution, but the fundamental problem is that /proc/interrupts
> shouldn't use a fixed buffer size in the first place. I suppose
> another solution would be to use vmalloc() instead. It all feels like
> bandaids though.
>
> --david
>
> ===== fs/proc/proc_misc.c 1.71 vs edited =====
> --- 1.71/fs/proc/proc_misc.c Sat Mar 22 22:14:49 2003
> +++ edited/fs/proc/proc_misc.c Thu Apr 10 14:35:16 2003
> @@ -388,7 +388,7 @@
> extern int show_interrupts(struct seq_file *p, void *v);
> static int interrupts_open(struct inode *inode, struct file *file)
> {
> - unsigned size = PAGE_SIZE * (1 + NR_CPUS / 8);
> + unsigned size = 4096 * (1 + NR_CPUS / 8);

urgh, consider me thwapped.

There continue to be a lot of places where we assume that pages are 4k (eg:
sizing of the free page reserves). But few are as fatal as this one...

Thanks.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:34    [W:0.078 / U:0.400 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site