Re: no version magic, tainting kernel.

From: Mark Fasheh (mark.fasheh@oracle.com)
Date: Thu Jan 23 2003 - 14:35:40 EST


Can't the stuff in init/vermagic.c be moved into a header file? Maybe
vermagic.h? Most of the code can be cut 'n pasted right out of vermagic.c
and the bit that defines "const char vermagic[]..." could be placed inside a
macro which modules would then stick in the bottom of one of their c files.
This is what I'm getting at (warning I haven't checked this code or even
tried to clean it up):

in vermagic.h:
#include <linux/version.h>
#include <linux/module.h>

/* Simply sanity version stamp for modules. */
#ifdef CONFIG_SMP
#define MODULE_VERMAGIC_SMP "SMP "
#else
#define MODULE_VERMAGIC_SMP ""
#endif
#ifdef CONFIG_PREEMPT
#define MODULE_VERMAGIC_PREEMPT "preempt "
#else
#define MODULE_VERMAGIC_PREEMPT ""
#endif
#ifndef MODULE_ARCH_VERMAGIC
#define MODULE_ARCH_VERMAGIC ""
#endif

#define KERNEL_VERSIONMAGIC const char vermagic[] \
__attribute__((section("__vermagic"))) = \
       UTS_RELEASE " " \
       MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT MODULE_ARCH_VERMAGIC \
       "gcc-" __stringify(__GNUC__) "." __stringify(__GNUC_MINOR__)

in my_external_module.c, and init/vermagic.c I'd just do:
#include <linux/vermagic.h>
KERNEL_VERSIONMAGIC();

and be done with it.

Modules that ship with the kernel wouldn't have to change a thing (and still
be linked against vermagic.c, and it'd only add two lines of code to
everyones externally shipped modules. I don't really think that this would be
"doing too much" for those whose modules are included in Linus's kernel, and
it wouldn't require people to keep entire source tree's around to compile a
module or two...
Am I totally missing something here or wouldn't this solve our problem?
Someone please correct me if I'm wrong :)
        --Mark

On Thu, Jan 23, 2003 at 07:22:36PM +0100, Sam Ravnborg wrote:
> As it is today the only sane way is to have the full kernel src available.
> It should be possible to minimize that - but I do not feel tempted to
> do so.
>
> We want to do too much to rely on whatever makefile people write for
> their module.
>
> Sam
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

--
Mark Fasheh
Software Developer, Oracle Corp
mark.fasheh@oracle.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Jan 23 2003 - 22:00:32 EST