public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] mii module broken under new scheme
@ 2002-11-19 18:14 Petr Vandrovec
  2002-11-19 18:42 ` Jeff Garzik
  2002-11-19 19:46 ` David Woodhouse
  0 siblings, 2 replies; 16+ messages in thread
From: Petr Vandrovec @ 2002-11-19 18:14 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-kernel, rusty, arashi

On 19 Nov 02 at 12:51, Jeff Garzik wrote:
> Matt Reppert wrote:
> 
> > drivers/net/mii.c doesn't export module init/cleanup functions. That 
> > means it
> > can't be loaded under the new module scheme. This patch adds do-nothing
> > functions for it, which allows it to load. (8139too depends on mii, so
> > without this I don't have network.)
> 
> ahhh!   I was wondering what was up, but since I was busy with other 
> things I just compiled it into the kernel and continued on my way.
> 
> That's a bug in the new module loader.

Rusty told me that it is intentional. Add

no_module_init;

at the end of module. He even sent patch which fixes dozen of such
modules (15 I had on my system...) to Linus, but it get somehow lost.

Only question is whether we want to have it this way or no. And if
yes, whether we do not want to move no_module_init from linux/init.h to 
linux/module.h: all of affected modules were already including
module.h to get MODULE_LICENSE() & other, but almost none of them
included init.h.
                                        Petr Vandrovec
                                        vandrove@vc.cvut.cz
                                        

^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: [PATCH] mii module broken under new scheme
@ 2002-11-19 22:23 Rusty Russell
  0 siblings, 0 replies; 16+ messages in thread
From: Rusty Russell @ 2002-11-19 22:23 UTC (permalink / raw)
  To: Petr Vandrovec; +Cc: linux-kernel, rusty, arashi, Linus Torvalds

Linus, this is a better fix, until the module post-link patch goes in
(rth and I are working on it, Kai likes the idea for other reasons).

Once again, fix up my assumptions so we err on the side of not
breaking anything.

Untested (on plane home and low on battery), but trivial.

Hope this helps,
Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5-bk/kernel/module.c working-2.5-bk-modname/kernel/module.c
--- linux-2.5-bk/kernel/module.c	2002-11-20 05:58:00.000000000 +1100
+++ working-2.5-bk-modname/kernel/module.c	2002-11-20 09:18:04.000000000 +1100
@@ -895,12 +895,6 @@ static struct module *load_module(void *
 #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 +911,17 @@ static struct module *load_module(void *
 		err = -EFAULT;
 		goto free_mod;
 	}
-	strncpy(mod->name, (char *)hdr + sechdrs[modnameindex].sh_offset,
-		sizeof(mod->name)-1);
+
+	if (modnameindex)
+		strncpy(mod->name,
+			(char *)hdr + sechdrs[modnameindex].sh_offset,
+			sizeof(mod->name)-1);
+	else {
+		/* FIXME: With module post-link phase, always insert
+                   .modname section. --RR */
+		static unsigned int num_unknown;
+		sprintf(mod->name, "unknown%u", num_unknown++);
+	}
 
 	if (find_module(mod->name)) {
 		err = -EEXIST;

^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: [PATCH] mii module broken under new scheme
@ 2002-11-19 18:21 Petr Vandrovec
  2002-11-19 18:44 ` Jeff Garzik
  2002-11-19 21:49 ` Rusty Russell
  0 siblings, 2 replies; 16+ messages in thread
From: Petr Vandrovec @ 2002-11-19 18:21 UTC (permalink / raw)
  To: Matt Reppert; +Cc: linux-kernel, rusty, jgarzik

On 19 Nov 02 at 12:15, Matt Reppert wrote:
> On Tue, 19 Nov 2002 12:51:44 -0500
> Jeff Garzik <jgarzik@pobox.com> wrote:
> 
> > Matt Reppert wrote:
> > 
> > > drivers/net/mii.c doesn't export module init/cleanup functions. That 
> > > means it
> > > can't be loaded under the new module scheme. This patch adds do-nothing
> > > functions for it, which allows it to load. (8139too depends on mii, so
> > > without this I don't have network.)
> > 
> > ahhh!   I was wondering what was up, but since I was busy with other 
> > things I just compiled it into the kernel and continued on my way.
> > 
> > That's a bug in the new module loader.
> 
> Not so sure I agree ... recompiled the kernel with debugging output in
> module.c and when I try to insert mii.o without above patch it complains
> "Module has no name!" and returns -ENOEXEC from the syscall. I think
> naming mii.o would be a good idea. This may not be the best way to do
> it, but it works. (Granted, I'm not terribly familiar with all the
> modules code changes yet, but ... ) Having anonymous output in lsmod
> would be somewhat confusing :) ("Well, whatever it is, 8139too needs
> it, don't touch it!")

I think that retrieving module name from module's binary is wrong: I
need to have dummy.o (network driver) insmodded two times to get my
test environment up. 

I do not think that it is correct that I must add multiple device support 
to the dummy due to new module loader, and creating two dummy.o,
with different .modulename sections, also does not look like reasonable
solution to me.
                                            Best regards,
                                                Petr Vandrovec
                                                vandrove@vc.cvut.cz


^ permalink raw reply	[flat|nested] 16+ messages in thread
* [PATCH] mii module broken under new scheme
@ 2002-11-19 17:50 Matt Reppert
  2002-11-19 17:51 ` Jeff Garzik
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Matt Reppert @ 2002-11-19 17:50 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-kernel, trivial

drivers/net/mii.c doesn't export module init/cleanup functions. That means it
can't be loaded under the new module scheme. This patch adds do-nothing
functions for it, which allows it to load. (8139too depends on mii, so
without this I don't have network.)

Matt

--- drivers/net/mii.c~no	2002-11-19 11:41:20.000000000 -0600
+++ drivers/net/mii.c	2002-11-19 11:39:06.000000000 -0600
@@ -348,3 +348,19 @@
 EXPORT_SYMBOL(mii_check_media);
 EXPORT_SYMBOL(generic_mii_ioctl);
 
+static void __init mii_init_module (void)
+{
+#ifdef MODULE
+	printk (KERN_INFO "mii" "\n");
+#endif
+
+	return 0;
+}
+
+
+static void __exit mii_cleanup_module (void)
+{
+}
+
+module_init(mii_init_module);
+module_exit(mii_cleanup_module);

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2002-12-02  5:25 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-19 18:14 [PATCH] mii module broken under new scheme Petr Vandrovec
2002-11-19 18:42 ` Jeff Garzik
2002-11-19 19:46 ` David Woodhouse
  -- strict thread matches above, loose matches on Subject: below --
2002-11-19 22:23 Rusty Russell
2002-11-19 18:21 Petr Vandrovec
2002-11-19 18:44 ` Jeff Garzik
2002-11-19 22:07   ` Rusty Russell
2002-11-19 21:49 ` Rusty Russell
2002-11-19 17:50 Matt Reppert
2002-11-19 17:51 ` Jeff Garzik
2002-11-19 18:15   ` Matt Reppert
2002-11-19 21:38   ` Rusty Russell
2002-11-19 18:37 ` Jeff Garzik
2002-11-21 21:34   ` Bill Davidsen
2002-11-19 19:29 ` Alan Cox
2002-12-02  4:51 ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox