--- 1.17/include/linux/init.h Sat Nov 9 04:08:33 2002 +++ edited/include/linux/init.h Wed Nov 20 10:48:28 2002 @@ -125,14 +125,6 @@ */ #define module_exit(x) __exitcall(x); -/** - * no_module_init - code needs no initialization. - * - * The equivalent of declaring an empty init function which returns 0. - * Every module must have exactly one module_init() or no_module_init - * invocation. */ -#define no_module_init - #else /* MODULE */ /* Don't use these in modules, but some people do... */ @@ -144,10 +136,6 @@ #define device_initcall(fn) module_init(fn) #define late_initcall(fn) module_init(fn) -/* Each module knows its own name. */ -#define __DEFINE_MODULE_NAME \ - char __module_name[] __attribute__((section(".modulename"))) = \ - __stringify(KBUILD_MODNAME) /* These macros create a dummy inline: gcc 2.9x does not count alias as usage, hence the `unused function' warning when __init functions @@ -155,14 +143,11 @@ both to kill the warning and check the type of the init/cleanup function. */ -/* Each module must use one module_init(), or one no_module_init */ +/* Each module must use no more than one module_init() */ #define module_init(initfn) \ - __DEFINE_MODULE_NAME; \ static inline initcall_t __inittest(void) \ { return initfn; } \ int __initfn(void) __attribute__((alias(#initfn))); - -#define no_module_init __DEFINE_MODULE_NAME /* This is only required if you want to be unloadable. */ #define module_exit(exitfn) \ ===== include/linux/module.h 1.25 vs edited ===== --- 1.25/include/linux/module.h Tue Nov 19 04:51:14 2002 +++ edited/include/linux/module.h Wed Nov 20 10:08:30 2002 @@ -297,8 +297,6 @@ /* Used as "int init_module(void) { ... }". Get funky to insert modname. */ #define init_module(voidarg) \ __initfn(void); \ - char __module_name[] __attribute__((section(".modulename"))) = \ - __stringify(KBUILD_MODNAME); \ int __initfn(void) #define cleanup_module(voidarg) __exitfn(void) #endif ===== kernel/module.c 1.25 vs edited ===== --- 1.25/kernel/module.c Tue Nov 19 04:51:14 2002 +++ edited/kernel/module.c Wed Nov 20 10:54:47 2002 @@ -800,15 +800,15 @@ } /* Allocate and load the module */ -static struct module *load_module(void *umod, +static struct module *load_module(const char *modname, + void *umod, unsigned long len, const char *uargs) { Elf_Ehdr *hdr; Elf_Shdr *sechdrs; char *secstrings; - unsigned int i, symindex, exportindex, strindex, setupindex, exindex, - modnameindex; + unsigned int i, symindex, exportindex, strindex, setupindex, exindex; long arglen; unsigned long common_length; struct sizes sizes, used; @@ -816,8 +816,8 @@ long err = 0; void *ptr = NULL; /* Stops spurious gcc uninitialized warning */ - DEBUGP("load_module: umod=%p, len=%lu, uargs=%p\n", - umod, len, uargs); + DEBUGP("load_module: modname=%p, umod=%p, len=%lu, uargs=%p\n", + modname, umod, len, uargs); if (len < sizeof(*hdr)) return ERR_PTR(-ENOEXEC); @@ -849,7 +849,7 @@ exportindex = setupindex = 0; /* And these should exist, but gcc whinges if we don't init them */ - symindex = strindex = exindex = modnameindex = 0; + symindex = strindex = exindex = 0; /* Find where important sections are */ for (i = 1; i < hdr->e_shnum; i++) { @@ -857,11 +857,6 @@ /* Internal symbols */ DEBUGP("Symbol table in section %u\n", i); symindex = i; - } else if (strcmp(secstrings+sechdrs[i].sh_name, ".modulename") - == 0) { - /* This module's name */ - DEBUGP("Module name in section %u\n", i); - modnameindex = i; } else if (strcmp(secstrings+sechdrs[i].sh_name, "__ksymtab") == 0) { /* Exported symbols. */ @@ -895,12 +890,6 @@ #endif } - if (!modnameindex) { - DEBUGP("Module has no name!\n"); - err = -ENOEXEC; - goto free_hdr; - } - /* Now allocate space for the module proper, and copy name and args. */ err = strlen_user(uargs); if (err < 0) @@ -917,8 +906,9 @@ err = -EFAULT; goto free_mod; } - strncpy(mod->name, (char *)hdr + sechdrs[modnameindex].sh_offset, - sizeof(mod->name)-1); + strncpy_from_user(mod->name, modname, sizeof(mod->name)-1); + /* strncpy doesn't NUL-terminate when it runs out of space */ + mod->name[sizeof(mod->name)-1] = 0; if (find_module(mod->name)) { err = -EEXIST; @@ -1058,7 +1048,8 @@ /* This is where the real work happens */ asmlinkage long -sys_init_module(void *umod, +sys_init_module(const char *modname, + void *umod, unsigned long len, const char *uargs) { @@ -1074,7 +1065,7 @@ return -EINTR; /* Do all the hard work */ - mod = load_module(umod, len, uargs); + mod = load_module(modname, umod, len, uargs); if (IS_ERR(mod)) { up(&module_mutex); return PTR_ERR(mod); ===== lib/zlib_deflate/deflate_syms.c 1.2 vs edited ===== --- 1.2/lib/zlib_deflate/deflate_syms.c Sat Nov 9 04:08:33 2002 +++ edited/lib/zlib_deflate/deflate_syms.c Wed Nov 20 10:45:43 2002 @@ -19,5 +19,3 @@ EXPORT_SYMBOL(zlib_deflateCopy); EXPORT_SYMBOL(zlib_deflateParams); MODULE_LICENSE("GPL"); - -no_module_init; ===== lib/zlib_inflate/inflate_syms.c 1.3 vs edited ===== --- 1.3/lib/zlib_inflate/inflate_syms.c Sat Nov 9 04:08:33 2002 +++ edited/lib/zlib_inflate/inflate_syms.c Wed Nov 20 10:51:40 2002 @@ -20,5 +20,3 @@ EXPORT_SYMBOL(zlib_inflateSyncPoint); EXPORT_SYMBOL(zlib_inflateIncomp); MODULE_LICENSE("GPL"); - -no_module_init;