* Patch 2.4 kernel / allow to read more than 2048 (1821) Symbols from /boot/System.map
@ 2006-09-18 5:23 Jurzitza, Dieter
2006-09-18 5:35 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Jurzitza, Dieter @ 2006-09-18 5:23 UTC (permalink / raw)
To: linux-kernel, sparclinux; +Cc: Willy Tarreau
Problem:
The 2.4 kernel series uses sys32_get_kernel_syms(struct kernel_sym32 *table) for reading the kernel symbols (on sparc64). The size of struct kernel_sym is 64 byte on "normal" arches, but 72 byte on sparc64.
The memory for the table holding all the structs is currently kmalloc'd, giving a limitation of 2048*sizeof(struct kernel_sym) for "normal" and 1820*sizeof(struct kernel_sym) for "sparc64" arches, the latter being caused by different sizes of unsigned longs and the need for alingnment bytes. This causes an "error reading System.map" message for no reason.
Solution (significantly helped by Dave Miller):
replace kmalloc() by vmalloc() to circumvent the size limit of 2^17 for kmalloc.
Other arches:
ppc64 defines value in struct kernel_sym as u32 in contrast to sparc, so we have the 2048 units limit here, but this would profit from using vmalloc(), too, since the limitation to 2048 is neither helpful nor neccessary. I lack sufficient understanding of the details to predict the impact on other arches. This patch refers to sparc64 but someone with deeper insight might want to look into this for other arches, too.
Signed off by: Dieter Jurzitza <DJurzitza@HarmanBecker.com>
--- linux/arch/sparc64/kernel/sys_sparc32.c 2006-08-11 06:18:20.000000000 +
+++ linux/arch/sparc64/kernel/sys_sparc32.c 2006-08-25 12:37:42.000000000 +
@@ -3730,7 +3730,7 @@
len = sys_get_kernel_syms(NULL);
if (!table) return len;
- tbl = kmalloc (len * sizeof (struct kernel_sym), GFP_KERNEL);
+ tbl = vmalloc (len * sizeof (struct kernel_sym));
if (!tbl) return -ENOMEM;
old_fs = get_fs();
set_fs (KERNEL_DS);
@@ -3741,7 +3741,7 @@
copy_to_user (table->name, tbl[i].name, 60))
break;
}
- kfree (tbl);
+ vfree (tbl);
return i;
}
--
________________________________________________
HARMAN BECKER AUTOMOTIVE SYSTEMS
Dr.-Ing. Dieter Jurzitza
Manager Hardware Systems
System Development
Industriegebiet Ittersbach
Becker-Göring Str. 16
D-76307 Karlsbad / Germany
Phone: +49 (0)7248 71-1577
Fax: +49 (0)7248 71-1216
eMail: DJurzitza@harmanbecker.com
Internet: http://www.becker.de
*******************************************
Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den Absender und loeschen Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the contents in this e-mail is strictly forbidden.
*******************************************
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Patch 2.4 kernel / allow to read more than 2048 (1821) Symbols from /boot/System.map
2006-09-18 5:23 Patch 2.4 kernel / allow to read more than 2048 (1821) Symbols from /boot/System.map Jurzitza, Dieter
@ 2006-09-18 5:35 ` David Miller
2006-09-19 18:26 ` Willy Tarreau
0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2006-09-18 5:35 UTC (permalink / raw)
To: DJurzitza; +Cc: linux-kernel, sparclinux, w
From: "Jurzitza, Dieter" <DJurzitza@harmanbecker.com>
Date: Mon, 18 Sep 2006 07:23:58 +0200
> The 2.4 kernel series uses sys32_get_kernel_syms(struct kernel_sym32
> *table) for reading the kernel symbols (on sparc64). The size of
> struct kernel_sym is 64 byte on "normal" arches, but 72 byte on
> sparc64.
Jurzita, you do not need to post this patch multiple times.
I was simply on vacation for 2 weeks right after your first
posting so I had no chance to review the patch.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Patch 2.4 kernel / allow to read more than 2048 (1821) Symbols from /boot/System.map
2006-09-18 5:35 ` David Miller
@ 2006-09-19 18:26 ` Willy Tarreau
2006-09-21 22:56 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Willy Tarreau @ 2006-09-19 18:26 UTC (permalink / raw)
To: David Miller; +Cc: DJurzitza, linux-kernel, sparclinux
Hi David,
On Sun, Sep 17, 2006 at 10:35:12PM -0700, David Miller wrote:
> From: "Jurzitza, Dieter" <DJurzitza@harmanbecker.com>
> Date: Mon, 18 Sep 2006 07:23:58 +0200
>
> > The 2.4 kernel series uses sys32_get_kernel_syms(struct kernel_sym32
> > *table) for reading the kernel symbols (on sparc64). The size of
> > struct kernel_sym is 64 byte on "normal" arches, but 72 byte on
> > sparc64.
>
> Jurzita, you do not need to post this patch multiple times.
> I was simply on vacation for 2 weeks right after your first
> posting so I had no chance to review the patch.
BTW, did you finally review it (no emergency at all on my side) ?
Regards,
Willy
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Patch 2.4 kernel / allow to read more than 2048 (1821) Symbols from /boot/System.map
2006-09-19 18:26 ` Willy Tarreau
@ 2006-09-21 22:56 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2006-09-21 22:56 UTC (permalink / raw)
To: w; +Cc: DJurzitza, linux-kernel, sparclinux
From: Willy Tarreau <w@1wt.eu>
Date: Tue, 19 Sep 2006 20:26:38 +0200
> On Sun, Sep 17, 2006 at 10:35:12PM -0700, David Miller wrote:
> > From: "Jurzitza, Dieter" <DJurzitza@harmanbecker.com>
> > Date: Mon, 18 Sep 2006 07:23:58 +0200
> >
> > > The 2.4 kernel series uses sys32_get_kernel_syms(struct kernel_sym32
> > > *table) for reading the kernel symbols (on sparc64). The size of
> > > struct kernel_sym is 64 byte on "normal" arches, but 72 byte on
> > > sparc64.
> >
> > Jurzita, you do not need to post this patch multiple times.
> > I was simply on vacation for 2 weeks right after your first
> > posting so I had no chance to review the patch.
>
> BTW, did you finally review it (no emergency at all on my side) ?
There are two problems:
1) If this goes in, similar fixes for sys_ia32.c, mips64, et al.
should go in at the same time.
2) I dislike this fix because it means that users can lock down
a significant amount of non-swappable kernel memory. There are
no privilege checks in the get_kernel_syms() system call, so
anyone can invoke it. Imagine a fork bomb invoking this, and it
could also potentially eat up nearly all of the vmalloc() space.
It may be, in the end, simply better to have a
"compat_sys_get_kernel_syms" written that can be called
so a temporary kernel copy is not needed.
I'm not offering to implement this :-) But it does seem to be the
only reasonable solution.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-09-21 22:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-18 5:23 Patch 2.4 kernel / allow to read more than 2048 (1821) Symbols from /boot/System.map Jurzitza, Dieter
2006-09-18 5:35 ` David Miller
2006-09-19 18:26 ` Willy Tarreau
2006-09-21 22:56 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox