Module licence and EXPORT_SYMBOL_GPL
RFC PATCH 1/1 Module licence and EXPORT_SYMBOL_GPL
Currently, EXPORT_SYMBOL_GPL and EXPORT_SYMBOL are the same, and MODULE_LICENCE is a noop. This patch implements EXPORT_SYMBOL_GPL and enforces it, using module licences.
Linus, your options:
1) Drop the patch and leave well enough alone.
2) Just keep the module licence taint check.
3) Say OK to the whole thing (once I've tested it against latest bk).
Thanks!
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
Name: MODULE_LICENSE support for modules
Author: Rusty Russell
Status: Untested
D: This implements EXPORT_SYMBOL_GPL and MODULE_LICENSE properly (so
D: restrictions are enforced).
arch/i386/vmlinux.lds.S +4 -0
@@ -30,6 +30,10 @@ SECTIONS __start___ksymtab = .; /* Kernel symbol table */ __ksymtab : { *(__ksymtab) } __stop___ksymtab = .; + . = ALIGN(64); + __start___gpl_ksymtab = .; /* Kernel symbol table (GPL only) */ + __gpl_ksymtab : { *(__gpl_ksymtab) } + __stop___gpl_ksymtab = .; __start___kallsyms = .; /* All kernel symbols */ __kallsyms : { *(__kallsyms) }
include/linux/module.h +43 -2
87 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 +57 -13
148 lines not on this page · raw message
Quoted 5 lines · Rusty Russell
Linus, your options:
1) Drop the patch and leave well enough alone.
2) Just keep the module licence taint check.
3) Say OK to the whole thing (once I've tested it against latest bk).
Hmm.. Can you make the "module_is_gpl()" thing a load-time check, and instead of carrying the license string along at run-time, you just carry the "I'm GPL-ok'd" bit along.
Linus
In message <[email protected]> you wri te:
Quoted 11 lines · Rusty Russell
Quoted 5 lines
Linus, your options:
1) Drop the patch and leave well enough alone.
2) Just keep the module licence taint check.
3) Say OK to the whole thing (once I've tested it against latest bk).Hmm.. Can you make the "
module_is_gpl()" thing a load-time check, and instead of carrying the license string along at run-time, you just carry the "I'm GPL-ok'd" bit along.
Just call it ".init.license" instead of ".license" and you're done:
it's never used at runtime (well, setting the mod->license field to NULL after init to make sure noone abuses it might make sense).
I'll test it now...
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.