* [BUG] module-init-tools
@ 2005-09-19 10:32 Ustyugov Roman
2005-09-19 11:30 ` Coywolf Qi Hunt
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Ustyugov Roman @ 2005-09-19 10:32 UTC (permalink / raw)
To: linux-kernel
Hello!
I found a bug in module-init-tools.
'lsmod' shows a wrong module name, when module name complied with some
"define" at one of kernel header files.
For example,
File "current.c"
=======================
#include <linux/kernel.h>
#include <linux/module.h>
int init_module(void) {
return 0;
}
void cleanup_module() {
}
MODULE_LICENSE("GPL");
=======================
Makefile:
=======================
obj-m += current.o
=======================
Make this module and type commands:
insmod current.ko
lsmod
And we can see:
Module Size Used by
get_current() 1152 0 <---- Oops, must be 'current'
smbfs 61432 2
hfsplus 56708 0
nls_cp866 5120 1
nls_iso8859_1 4096 0
nls_cp437 5760 0
vfat 12800 0
fat 37916 1 vfat
nls_utf8 2048 1
.....
File <asm/current.h>:
===================
...
#define current get_current()
...
===================
Try to remove module:
romanu:/current # rmmod current
ERROR: Module current does not exist in /proc/modules
romanu:/current # rmmod -v "get_current()"
rmmod get_current(), wait=no
romanu:/current #
I can't remove module with 'rmmod current',
but can with
rmmod "get_current()"
Is it a bug?
Then, next example.
File 'init_stack.c'
=================
#include <linux/kernel.h>
#include <linux/module.h>
int init_module(void) {
return 0;
}
void cleanup_module() {
}
MODULE_LICENSE("GPL");
=================
Make and insert module 'init_stack.ko':
lsmod:
Module Size Used by
get_current() 1152 0
(init_thread_union.stack) 1152 0 <---- Oops, must be 'init_stack'
smbfs 61432 2
hfsplus 56708 0
nls_cp866 5120 1
nls_iso8859_1 4096 0
Now I can't to remove it at all ! :(:(
>From <asm/thread_info.h>
====================
...
#define init_stack (init_thread_union.stack)
...
====================
Some information about software:
OS: SuSE Pro 9.3
kernel version: 2.6.11.4-21.8-default
module-init-tools version: 3.2_pre1-7
--
WBR, Roman.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [BUG] module-init-tools
2005-09-19 10:32 [BUG] module-init-tools Ustyugov Roman
@ 2005-09-19 11:30 ` Coywolf Qi Hunt
2005-09-19 11:54 ` Ustyugov Roman
2005-09-19 13:21 ` Coywolf Qi Hunt
[not found] ` <3b8510d8050920000560aeb39e@mail.gmail.com>
2 siblings, 1 reply; 10+ messages in thread
From: Coywolf Qi Hunt @ 2005-09-19 11:30 UTC (permalink / raw)
To: Ustyugov Roman; +Cc: linux-kernel
On 9/19/05, Ustyugov Roman <dr_unique@ymg.ru> wrote:
> Hello!
>
> I found a bug in module-init-tools.
>
> 'lsmod' shows a wrong module name, when module name complied with some
> "define" at one of kernel header files.
>
> For example,
>
> File "current.c"
> =======================
> #include <linux/kernel.h>
> #include <linux/module.h>
>
> int init_module(void) {
>
> return 0;
> }
>
> void cleanup_module() {
> }
>
> MODULE_LICENSE("GPL");
> =======================
>
> Makefile:
>
> =======================
> obj-m += current.o
> =======================
>
> Make this module and type commands:
>
> insmod current.ko
> lsmod
>
> And we can see:
>
> Module Size Used by
> get_current() 1152 0 <---- Oops, must be 'current'
> smbfs 61432 2
> hfsplus 56708 0
> nls_cp866 5120 1
> nls_iso8859_1 4096 0
> nls_cp437 5760 0
> vfat 12800 0
> fat 37916 1 vfat
> nls_utf8 2048 1
> .....
>
> File <asm/current.h>:
>
> ===================
> ...
> #define current get_current()
> ...
> ===================
>
> Try to remove module:
>
> romanu:/current # rmmod current
> ERROR: Module current does not exist in /proc/modules
> romanu:/current # rmmod -v "get_current()"
> rmmod get_current(), wait=no
> romanu:/current #
>
> I can't remove module with 'rmmod current',
> but can with
> rmmod "get_current()"
>
> Is it a bug?
Yes, it's a bug. But it's a bad idea too to use well known kernel
symbols as module names.
--
Coywolf Qi Hunt
http://sosdg.org/~coywolf/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [BUG] module-init-tools
2005-09-19 11:30 ` Coywolf Qi Hunt
@ 2005-09-19 11:54 ` Ustyugov Roman
0 siblings, 0 replies; 10+ messages in thread
From: Ustyugov Roman @ 2005-09-19 11:54 UTC (permalink / raw)
To: lkml
On 9/19/05 Coywolf Qi Hunt wrote:
> Yes, it's a bug. But it's a bad idea too to use well known kernel
> symbols as module names.
Sure. Please, add to module documentation:
To make unique name of module use command:
touch `cat /dev/urandom | uuencode -m - | head -n 2 | tail -c10`.c
;-)
--
RomanU
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [BUG] module-init-tools
2005-09-19 10:32 [BUG] module-init-tools Ustyugov Roman
2005-09-19 11:30 ` Coywolf Qi Hunt
@ 2005-09-19 13:21 ` Coywolf Qi Hunt
[not found] ` <3b8510d8050920000560aeb39e@mail.gmail.com>
2 siblings, 0 replies; 10+ messages in thread
From: Coywolf Qi Hunt @ 2005-09-19 13:21 UTC (permalink / raw)
To: Ustyugov Roman; +Cc: linux-kernel, Sam Ravnborg
On 9/19/05, Ustyugov Roman <dr_unique@ymg.ru> wrote:
> Hello!
>
> I found a bug in module-init-tools.
>
> 'lsmod' shows a wrong module name, when module name complied with some
> "define" at one of kernel header files.
>
> For example,
>
> File "current.c"
> =======================
> #include <linux/kernel.h>
> #include <linux/module.h>
>
> int init_module(void) {
>
> return 0;
> }
>
> void cleanup_module() {
> }
>
> MODULE_LICENSE("GPL");
> =======================
>
> Makefile:
>
> =======================
> obj-m += current.o
> =======================
>
> Make this module and type commands:
>
> insmod current.ko
> lsmod
>
> And we can see:
>
> Module Size Used by
> get_current() 1152 0 <---- Oops, must be 'current'
> smbfs 61432 2
> hfsplus 56708 0
> nls_cp866 5120 1
> nls_iso8859_1 4096 0
> nls_cp437 5760 0
> vfat 12800 0
> fat 37916 1 vfat
> nls_utf8 2048 1
> .....
>
> File <asm/current.h>:
>
> ===================
> ...
> #define current get_current()
> ...
> ===================
>
> Try to remove module:
>
> romanu:/current # rmmod current
> ERROR: Module current does not exist in /proc/modules
> romanu:/current # rmmod -v "get_current()"
> rmmod get_current(), wait=no
> romanu:/current #
>
> I can't remove module with 'rmmod current',
> but can with
> rmmod "get_current()"
>
> Is it a bug?
>
> Then, next example.
>
> File 'init_stack.c'
> =================
> #include <linux/kernel.h>
> #include <linux/module.h>
>
> int init_module(void) {
>
> return 0;
> }
>
> void cleanup_module() {
> }
>
> MODULE_LICENSE("GPL");
> =================
>
> Make and insert module 'init_stack.ko':
>
> lsmod:
>
> Module Size Used by
> get_current() 1152 0
> (init_thread_union.stack) 1152 0 <---- Oops, must be 'init_stack'
> smbfs 61432 2
> hfsplus 56708 0
> nls_cp866 5120 1
> nls_iso8859_1 4096 0
>
> Now I can't to remove it at all ! :(:(
>
> From <asm/thread_info.h>
>
> ====================
> ...
> #define init_stack (init_thread_union.stack)
> ...
> ====================
>
> Some information about software:
>
> OS: SuSE Pro 9.3
> kernel version: 2.6.11.4-21.8-default
> module-init-tools version: 3.2_pre1-7
Actually, this is a kbuild bug, not module-init-tools' fault.
(cc Sam)
--
Coywolf Qi Hunt
http://sosdg.org/~coywolf/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [BUG] module-init-tools
[not found] ` <3b8510d805092000116c6a9c33@mail.gmail.com>
@ 2005-09-20 7:24 ` Ustyugov Roman
[not found] ` <3b8510d8050920002661c08f48@mail.gmail.com>
0 siblings, 1 reply; 10+ messages in thread
From: Ustyugov Roman @ 2005-09-20 7:24 UTC (permalink / raw)
To: thayumk, lkml
Thayumanavar Sachithanantham wrote:
> > buf_printf(b, " .name = __stringify(KBUILD_MODNAME),\n");
>
> $(modname))),-DKBUILD_MODNAME=$(subst $(comma),_,$(subst -,_,$(modname))))
>
In my case I've already had these lines at files you're specified.
But situation is unchanged. Module name is wrong :(
Any ideas?
--
RomanU
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [BUG] module-init-tools
[not found] ` <3b8510d805092000346c27270f@mail.gmail.com>
@ 2005-09-20 7:43 ` Thayumanavar Sachithanantham
2005-09-20 8:13 ` [BUG] kbuild Ustyugov Roman
0 siblings, 1 reply; 10+ messages in thread
From: Thayumanavar Sachithanantham @ 2005-09-20 7:43 UTC (permalink / raw)
To: Ustyugov Roman; +Cc: lkml
Please change the lines that you have mentioned to this:
buf_printf(b, " .name = KBUILD_MODNAME,\n");
modname_flags = $(if $(filter 1,$(words $(modname))),-D'DUM(a)=\#a'
-D'KBUILD_MODNAME=DUM($(subst $(comma),_,$(subst -,_,$(modname))))')
Let me know your results.Take care of the quotes while you change.
Thayumanavar
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [BUG] kbuild
2005-09-20 7:43 ` Thayumanavar Sachithanantham
@ 2005-09-20 8:13 ` Ustyugov Roman
2005-09-20 8:51 ` Thayumanavar Sachithanantham
0 siblings, 1 reply; 10+ messages in thread
From: Ustyugov Roman @ 2005-09-20 8:13 UTC (permalink / raw)
To: thayumk, lkml
Thayumanavar Sachithanantham wrote:
> Let me know your results.Take care of the quotes while you change.
make -C ../../../linux-2.6.11.4-21.8
O=../linux-2.6.11.4-21.8-obj/i386/default /bin/sh: -c: line 0: syntax error
near unexpected token `('
/bin/sh: -c: line 0: `set -e;
.....
What symbol must be between
-D'DUM(a)=\#a'
and
-D'KBUILD_MODNAME=DUM($(subst $(comma),_,$(subst -,_,$(modname))))')
?
I tried a space, comma and no spaces, also with quotes and without any, but
got an error above.
Here is my line:
modname_flags = $(if $(filter 1,$(words $(modname))),-D'DUM(a)=\#a'
-D'KBUILD_MODNAME=DUM($(subst $(comma),_,$(subst -,_,$(modname))))')
--
RomanU
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [BUG] kbuild
2005-09-20 8:13 ` [BUG] kbuild Ustyugov Roman
@ 2005-09-20 8:51 ` Thayumanavar Sachithanantham
2005-09-20 9:32 ` [PATCH] kbuild: using well known kernel symbols as module names Ustyugov Roman
0 siblings, 1 reply; 10+ messages in thread
From: Thayumanavar Sachithanantham @ 2005-09-20 8:51 UTC (permalink / raw)
To: Ustyugov Roman; +Cc: lkml
On 9/20/05, Ustyugov Roman <dr_unique@ymg.ru> wrote:
> Thayumanavar Sachithanantham wrote:
> > Let me know your results.Take care of the quotes while you change.
>
> make -C ../../../linux-2.6.11.4-21.8
> O=../linux-2.6.11.4-21.8-obj/i386/default /bin/sh: -c: line 0: syntax error
> near unexpected token `('
> /bin/sh: -c: line 0: `set -e;
> .....
>
> What symbol must be between
> -D'DUM(a)=\#a'
> and
> -D'KBUILD_MODNAME=DUM($(subst $(comma),_,$(subst -,_,$(modname))))')
>
> ?
>
> I tried a space, comma and no spaces, also with quotes and without any, but
> got an error above.
>
> Here is my line:
> modname_flags = $(if $(filter 1,$(words $(modname))),-D'DUM(a)=\#a'
> -D'KBUILD_MODNAME=DUM($(subst $(comma),_,$(subst -,_,$(modname))))')
>
> --
> RomanU
>
A space.
Let me know if you still get errors. Also there should be an extra
parantheses before the quote.
Thayumanavar S.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] kbuild: using well known kernel symbols as module names.
2005-09-20 8:51 ` Thayumanavar Sachithanantham
@ 2005-09-20 9:32 ` Ustyugov Roman
2005-09-20 9:32 ` Thayumanavar Sachithanantham
0 siblings, 1 reply; 10+ messages in thread
From: Ustyugov Roman @ 2005-09-20 9:32 UTC (permalink / raw)
To: thayumk, lkml
Here is a Thayumanavar's (thayumk@gmail.com) patch with small changes. I have
to use double quotes, but not single ones.
Problem was solved.
--- linux/scripts/Makefile.lib.orig 2005-03-02 10:38:09.000000000 +0300
+++ linux/scripts/Makefile.lib 2005-09-20 13:14:13.000000000 +0400
@@ -96,7 +96,7 @@ depfile = $(subst $(comma),_,$(@D)/.$(@F
# than one module. In that case KBUILD_MODNAME will be set to foo_bar,
# where foo and bar are the name of the modules.
basename_flags = -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F)))
-modname_flags = $(if $(filter 1,$(words
$(modname))),-DKBUILD_MODNAME=$(subst $(comma),_,$(subst -,_,$(modname))))
+modname_flags = $(if $(filter 1,$(words $(modname))),-D"DUM(a)=\#a"
-D"KBUILD_MODNAME=DUM($(subst $(comma),_,$(subst -,_,$(modname))))")
_c_flags = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o)
_a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
--- linux/scripts/mod/modpost.c.orig 2005-07-23 04:41:06.000000000 +0400
+++ linux/scripts/mod/modpost.c 2005-09-20 13:19:21.000000000 +0400
@@ -575,7 +575,7 @@ add_header(struct buffer *b, struct modu
buf_printf(b, "#undef unix\n"); /* We have a module called "unix" */
buf_printf(b, "struct module __this_module\n");
buf_printf(b, "__attribute__((section(\".gnu.linkonce.this_module\"))) =
{\n");
- buf_printf(b, " .name = __stringify(KBUILD_MODNAME),\n");
+ buf_printf(b, " .name = KBUILD_MODNAME,\n");
if (mod->has_init)
buf_printf(b, " .init = init_module,\n");
if (mod->has_cleanup)
--
RomanU
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] kbuild: using well known kernel symbols as module names.
2005-09-20 9:32 ` [PATCH] kbuild: using well known kernel symbols as module names Ustyugov Roman
@ 2005-09-20 9:32 ` Thayumanavar Sachithanantham
0 siblings, 0 replies; 10+ messages in thread
From: Thayumanavar Sachithanantham @ 2005-09-20 9:32 UTC (permalink / raw)
To: Ustyugov Roman; +Cc: lkml
For me it works with single quotes. Anyhow it's okay. Thanks.
Regards,
Thayumanavar S.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2005-09-20 9:32 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-19 10:32 [BUG] module-init-tools Ustyugov Roman
2005-09-19 11:30 ` Coywolf Qi Hunt
2005-09-19 11:54 ` Ustyugov Roman
2005-09-19 13:21 ` Coywolf Qi Hunt
[not found] ` <3b8510d8050920000560aeb39e@mail.gmail.com>
[not found] ` <3b8510d805092000116c6a9c33@mail.gmail.com>
2005-09-20 7:24 ` Ustyugov Roman
[not found] ` <3b8510d8050920002661c08f48@mail.gmail.com>
[not found] ` <3b8510d805092000346c27270f@mail.gmail.com>
2005-09-20 7:43 ` Thayumanavar Sachithanantham
2005-09-20 8:13 ` [BUG] kbuild Ustyugov Roman
2005-09-20 8:51 ` Thayumanavar Sachithanantham
2005-09-20 9:32 ` [PATCH] kbuild: using well known kernel symbols as module names Ustyugov Roman
2005-09-20 9:32 ` Thayumanavar Sachithanantham
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox