[PATCH] [2.6.2-rc3] Fix module.c pointer arithmetics
From: Carl-Daniel Hailfinger (c-d.hailfinger.kernel.2004_at_gmx.net)
Date: 01/31/04
- Previous message: Arnd Bergmann: "Re: [klibc] Re: long long on 32-bit machines"
- Next in thread: Rusty Russell: "Re: [PATCH] [2.6.2-rc3] Fix module.c pointer arithmetics"
- Reply: Rusty Russell: "Re: [PATCH] [2.6.2-rc3] Fix module.c pointer arithmetics"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 31 Jan 2004 13:52:48 +0100 To: Linus Torvalds <torvalds@osdl.org>
Linus,
Rusty,
while studying the module code closely, I found a problem in
kernel/module.c:153ff.
for (i = 0; __start___ksymtab+i < __stop___ksymtab; i++)
In combination with __start___ksymtab[i].name this will go eight times too
far. Proposed fix is attached.
Please apply before 2.6.2. If you think this makes the code too slow, I
can offer an alternative which will even speed up the current code.
Thanks,
Carl-Daniel
===== kernel/module.c 1.99 vs edited =====
--- 1.99/kernel/module.c Wed Jan 21 02:50:58 2004
+++ edited/kernel/module.c Sat Jan 31 13:50:47 2004
@@ -150,14 +150,14 @@
/* Core kernel first. */
*owner = NULL;
- for (i = 0; __start___ksymtab+i < __stop___ksymtab; i++) {
+ for (i = 0; __start___ksymtab+i*sizeof(struct kernel_symbol) < __stop___ksymtab; i++) {
if (strcmp(__start___ksymtab[i].name, name) == 0) {
*crc = symversion(__start___kcrctab, i);
return __start___ksymtab[i].value;
}
}
if (gplok) {
- for (i = 0; __start___ksymtab_gpl+i<__stop___ksymtab_gpl; i++)
+ for (i = 0; __start___ksymtab_gpl+i*sizeof(struct kernel_symbol) < __stop___ksymtab_gpl; i++)
if (strcmp(__start___ksymtab_gpl[i].name, name) == 0) {
*crc = symversion(__start___kcrctab_gpl, i);
return __start___ksymtab_gpl[i].value;
@@ -1308,7 +1308,7 @@
unsigned int i;
if (!mod) {
- for (i = 0; __start___ksymtab+i < __stop___ksymtab; i++)
+ for (i = 0; __start___ksymtab+i*sizeof(struct kernel_symbol) < __stop___ksymtab; i++)
if (strcmp(__start___ksymtab[i].name, name) == 0)
return 1;
return 0;
-
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/
- Previous message: Arnd Bergmann: "Re: [klibc] Re: long long on 32-bit machines"
- Next in thread: Rusty Russell: "Re: [PATCH] [2.6.2-rc3] Fix module.c pointer arithmetics"
- Reply: Rusty Russell: "Re: [PATCH] [2.6.2-rc3] Fix module.c pointer arithmetics"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
- Re: [PATCH] airo driver: fix races, oops, etc..
... On Thu, 7 Aug 2003, Jeff Garzik wrote: ... >> I've been studying
the problem for a while and I've implemented a solution ... This version should be applied to
the latest patches I sent ... send the line "unsubscribe linux-kernel" in ...
(Linux-Kernel) - Re: Linux v2.6.12-rc6
... Proposed fix: ... Jean Delvare - ... 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/
... (Linux-Kernel) - Re: [BUG/PATCH/RFC] Oops while completing async USB via usbdevio
... > Sorry, I've been busy, mostly with the annual netfilter developer ...
What about the following proposed fix: ... send the line "unsubscribe linux-kernel"
in ... (Linux-Kernel) - Re: [PATCH]: Brown paper bag in fs/file.c?
... but I think the patch is correct regardless. ... Studying fs/file.c
a bit more, there seems to be several of these ... send the line "unsubscribe linux-kernel"
in ... (Linux-Kernel) - Re: [bootfix] pass used_node_mask by reference in 2.6.10-mm1
... This proposed fix passes it by reference. ... This proposed fix is an
actual fix according to my own testing. ... my quad em64 boots and runs normally. ...
send the line "unsubscribe linux-kernel" in ... (Linux-Kernel)