Skip to contentSkip to conversation

MODULE_LICENSE and EXPORT_SYMBOL_GPL support

PATCH New Rusty Russell 1 participant 1 message Jan 5, 2003 Module support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MODULE_LICENSE and EXPORT_SYMBOL_GPL support

Re-xmit: Linus, please apply.

Now simply a flag, and the license text itself is in a .init section, so will be discarded for most archs.

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
diff -urNp --exclude TAGS -X /home/rusty/current-dontdiff --minimal linux-2.5-bk/include/linux/kernel.h working-2.5-bk-module-license/include/linux/kernel.h
@@ -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
diff -urNp --exclude TAGS -X /home/rusty/current-dontdiff --minimal linux-2.5-bk/kernel/extable.c working-2.5-bk-module-license/kernel/extable.c
@@ -24,6 +24,8 @@ extern const struct exception_table_entr
 extern 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
diff -urNp --exclude TAGS -X /home/rusty/current-dontdiff --minimal linux-2.5-bk/kernel/panic.c working-2.5-bk-module-license/kernel/panic.c
@@ -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' : ' ');
 	}