Module licence and EXPORT_SYMBOL_GPL
Quoted 1 line
In message <[email protected]> you w
ri
Quoted 4 lines
te:
Just call it ".init.license" instead of ".license" and you're done:
it's never used at runtime (well, setting themod->licensefield to NULL after init to make sure noone abuses it might make sense).
OK, made it a flag, too (thanks rth).
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
Name: MODULE_LICENSE support for modules
Author: Rusty Russell
Status: Tested in 2.5.54
D: This implements EXPORT_SYMBOL_GPL and MODULE_LICENSE properly (so
D: restrictions are enforced). Also fixes "proprietory" spelling.
include/linux/kernel.h +1 -1
@@ -105,7 +105,7 @@ extern int oops_in_progress; /* If set,extern int tainted;extern const char *print_tainted (void ); -#define TAINT_PROPRIETORY_MODULE (1<<0) +#define TAINT_PROPRIETARY_MODULE (1<<0)#define TAINT_FORCED_MODULE (1<<1)#define TAINT_UNSAFE_SMP (1<<2)#define TAINT_FORCED_RMMOD (1<<3)
include/linux/module.h +46 -3
95 lines not on this page · raw message
kernel/extable.c +9 -0
@@ -24,6 +24,8 @@ extern const struct exception_table_entrextern const struct exception_table_entry __stop___ex_table[];extern const struct kernel_symbol __start___ksymtab[];extern const struct kernel_symbol __stop___ksymtab[]; +extern const struct kernel_symbol __start___gpl_ksymtab[]; +extern const struct kernel_symbol __stop___gpl_ksymtab[];/* Protects extables and symbol tables */ spinlock_t modlist_lock =SPIN_LOCK_UNLOCKED ;
@@ -34,13 +36,20 @@ LIST_HEAD(symbols);static struct exception_table kernel_extable;static struct kernel_symbol_group kernel_symbols; +static struct kernel_symbol_group kernel_gpl_symbols;void __init extable_init (void ) {/* Add kernel symbols to symbol table */ kernel_symbols.num_syms = (__stop___ksymtab - __start___ksymtab); kernel_symbols.syms = __start___ksymtab; + kernel_symbols.gplonly =0 ;list_add (&kernel_symbols.list, &symbols); + kernel_gpl_symbols.num_syms = (__stop___gpl_ksymtab + - __start___gpl_ksymtab); + kernel_gpl_symbols.syms = __start___gpl_ksymtab; + kernel_gpl_symbols.gplonly =1 ; +list_add (&kernel_gpl_symbols.list, &symbols);/* Add kernel exception table to exception tables */ kernel_extable.num_entries = (__stop___ex_table -__start___ex_table);
kernel/module.c +59 -13
149 lines not on this page · raw message
kernel/panic.c +2 -2
@@ -103,7 +103,7 @@ NORET_TYPE void panic(const char * fmt,/** * print_tainted - return a string to represent the kernel taint state. * -* 'P' - Proprietory module has been loaded. +* 'P' - Proprietary module has been loaded. * 'F' - Module has been forcibly loaded. * 'S' - SMP with CPUs not designed for SMP. *
@@ -115,7 +115,7 @@ const char *print_tainted()static char buf[20 ];if (tainted) {snprintf (buf,sizeof (buf),"Tainted: %c%c%c" , - tainted &TAINT_PROPRIETORY_MODULE ?'P' :'G' , + tainted &TAINT_PROPRIETARY_MODULE ?'P' :'G' , tainted &TAINT_FORCED_MODULE ?'F' :' ' , tainted &TAINT_UNSAFE_SMP ?'S' :' ' ); }