Skip to contentSkip to conversation

Fix unix module

PATCH In review Rusty Russell 2 participants 3 messages Apr 18, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix unix module

Linus, please apply. I should never have accepted that damn "make modpost create the struct module" patch during the stable series: this is at least the third fix which had to go on top of it...

Name: Fix name of unix domain sockets module
Status: Tested on 2.6.6-rc1-bk2

# lsmod
Module                  Size  Used by
1                      26060  6 
#

The compiler #define's unix to 1: we use -DKBUILD_MODNAME=unix. We used to #undef unix at the top of af_unix.c, but now the name is inserted by modpost, that doesn't help.

#undef unix in modpost.c's generated C file.

net/unix/af_unix.c +0 -2
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.6.6-rc1-bk2/net/unix/af_unix.c working-2.6.6-rc1-bk2-usermodehelper-thread/net/unix/af_unix.c
@@ -82,8 +82,6 @@
  *		  with BSD names.
  */
 
-#undef unix	/* KBUILD_MODNAME */
-
 #include <linux/module.h>
 #include <linux/config.h>
 #include <linux/kernel.h>
scripts/modpost.c +1 -0
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.6.6-rc1-bk2/scripts/modpost.c working-2.6.6-rc1-bk2-usermodehelper-thread/scripts/modpost.c
@@ -487,6 +487,7 @@ add_header(struct buffer *b)
 	buf_printf(b, "\n");
 	buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n");
 	buf_printf(b, "\n");
+	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");
Signature · 1 line
Anyone who quotes me in their signature is an idiot -- Rusty Russell
#1 lore raw
Quoted 3 lines · Rusty Russell

The compiler #define's unix to 1: we use -DKBUILD_MODNAME=unix. We used to #undef unix at the top of af_unix.c, but now the name is inserted by modpost, that doesn't help.

Do we depend on this preprocessor symbol anywhere? If not, adding -Uunix to the global CFLAGS would prevent future "accidents".

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
#2 lore raw
Quoted 7 lines · Russell King
Quoted 3 lines · Rusty Russell

The compiler #define's unix to 1: we use -DKBUILD_MODNAME=unix. We used to #undef unix at the top of af_unix.c, but now the name is inserted by modpost, that doesn't help.

Do we depend on this preprocessor symbol anywhere? If not, adding -Uunix to the global CFLAGS would prevent future "accidents".

I don't really mind which way it's done, but this was the direct translation of the previous fix, so required less testing.

Hopefully noone will ever call their module "linux", "i386" or "__OPTIMIZE__" 8)

Cheers,
Rusty.

Signature · 1 line
Anyone who quotes me in their signature is an idiot -- Rusty Russell