CONFIG_MODVERSIONS bug

Michael Elizabeth Chastain (mec@shout.net)
Mon, 29 Dec 1997 23:25:47 -0600


Hello kernel hackers,

I think I've found a long-standing bug with CONFIG_MODVERSIONS.

Take a look at this paragraph from kernel/ksyms.c, 2.1.76:

#ifdef MODVERSIONS
const struct module_symbol __export_Using_Versions
__attribute__((section("__ksymtab"))) = {
1 /* Version version */, "Using_Versions"
};
#endif

The problem is that MODVERSIONS is defined only when compiling *modules*.
It's not defined when compiling kernel/ksyms.c because kernel/ksyms.c
is part of the resident kernel.

This construction has been in the kernel for a long time. It's also
in 2.1.76, 2.1.50, 2.1.32, 2.1.16, 2.0.33, and 2.0. Back in the 2.0.XX
kernels, Rules.make said -DMODVERSIONS for $(LX_OBJS) and $(OX_OBJS).
But it doesn't any more. And it probably shouldn't. The right fix
is probably to change MODVERSIONS above to CONFIG_MODVERSIONS.

I have no patch for this one because I've got enough patches in progress
already.

How I found this: I was chasing some other potential bugs in insmod
2.1.71 when I noticed that new_get_kernel_symbols returned 0. Then I
checked /proc/ksyms, and there was no "Using_Versions" there.

Michael Chastain
<mailto:mec@shout.net>
"love without fear"