aboutsummaryrefslogtreecommitdiffstats
path: root/driver
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2006-02-08 17:02:07 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2006-02-08 17:02:07 -0800
commitbedc80c69c9409d72a395239098fa5c8c314004d (patch)
tree08903891df2c756f98ec172d6167413c5e5a7c60 /driver
parent2fdb5c74ee3f0b5b737f365fbf17e3c0ff6dea10 (diff)
downloadpatches-bedc80c69c9409d72a395239098fa5c8c314004d.tar.gz
added export_symbol_gpl_future stuff
Diffstat (limited to 'driver')
-rw-r--r--driver/clean-up-module.c-symbol-searching-logic.patch125
-rw-r--r--driver/export_symbol_gpl_future-rcu.patch26
-rw-r--r--driver/export_symbol_gpl_future-usb.patch64
-rw-r--r--driver/export_symbol_gpl_future.patch169
4 files changed, 384 insertions, 0 deletions
diff --git a/driver/clean-up-module.c-symbol-searching-logic.patch b/driver/clean-up-module.c-symbol-searching-logic.patch
new file mode 100644
index 0000000000000..02fc8819e75aa
--- /dev/null
+++ b/driver/clean-up-module.c-symbol-searching-logic.patch
@@ -0,0 +1,125 @@
+From sam@ravnborg.org Wed Feb 8 14:53:48 2006
+Date: Wed, 8 Feb 2006 21:16:45 +0100
+From: Sam Ravnborg <sam@ravnborg.org>
+To: Greg KH <gregkh@suse.de>
+Subject: Clean up module.c symbol searching logic
+Message-ID: <20060208201645.GA9497@mars.ravnborg.org>
+Content-Disposition: inline
+
+From: Sam Ravnborg <sam@ravnborg.org>
+
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ kernel/module.c | 73 +++++++++++++++++++++++++++++++-------------------------
+ 1 file changed, 41 insertions(+), 32 deletions(-)
+
+--- gregkh-2.6.orig/kernel/module.c
++++ gregkh-2.6/kernel/module.c
+@@ -135,6 +135,18 @@ extern const unsigned long __start___kcr
+ #define symversion(base, idx) ((base) ? ((base) + (idx)) : NULL)
+ #endif
+
++/* lookup symbol in given range of kernel_symbols */
++static const struct kernel_symbol *lookup_symbol(const char *name,
++ const struct kernel_symbol *start,
++ const struct kernel_symbol *stop)
++{
++ const struct kernel_symbol *ks = start;
++ for (; ks < stop; ks++)
++ if (strcmp(ks->name, name) == 0)
++ return ks;
++ return NULL;
++}
++
+ /* Find a symbol, return value, crc and module which owns it */
+ static unsigned long __find_symbol(const char *name,
+ struct module **owner,
+@@ -142,39 +154,41 @@ static unsigned long __find_symbol(const
+ int gplok)
+ {
+ struct module *mod;
+- unsigned int i;
++ const struct kernel_symbol *ks;
+
+ /* Core kernel first. */
+ *owner = NULL;
+- for (i = 0; __start___ksymtab+i < __stop___ksymtab; i++) {
+- if (strcmp(__start___ksymtab[i].name, name) == 0) {
+- *crc = symversion(__start___kcrctab, i);
+- return __start___ksymtab[i].value;
+- }
++ ks = lookup_symbol(name, __start___ksymtab, __stop___ksymtab);
++ if (ks) {
++ *crc = symversion(__start___kcrctab, (ks - __start___ksymtab));
++ return ks->value;
+ }
+ if (gplok) {
+- for (i = 0; __start___ksymtab_gpl+i<__stop___ksymtab_gpl; i++)
+- if (strcmp(__start___ksymtab_gpl[i].name, name) == 0) {
+- *crc = symversion(__start___kcrctab_gpl, i);
+- return __start___ksymtab_gpl[i].value;
+- }
++ ks = lookup_symbol(name, __start___ksymtab_gpl,
++ __stop___ksymtab_gpl);
++ if (ks) {
++ *crc = symversion(__start___kcrctab_gpl,
++ (ks - __start___ksymtab_gpl));
++ return ks->value;
++ }
+ }
+
+ /* Now try modules. */
+ list_for_each_entry(mod, &modules, list) {
+ *owner = mod;
+- for (i = 0; i < mod->num_syms; i++)
+- if (strcmp(mod->syms[i].name, name) == 0) {
+- *crc = symversion(mod->crcs, i);
+- return mod->syms[i].value;
+- }
++ ks = lookup_symbol(name, mod->syms, mod->syms + mod->num_syms);
++ if (ks) {
++ *crc = symversion(mod->crcs, (ks - mod->syms));
++ return ks->value;
++ }
+
+ if (gplok) {
+- for (i = 0; i < mod->num_gpl_syms; i++) {
+- if (strcmp(mod->gpl_syms[i].name, name) == 0) {
+- *crc = symversion(mod->gpl_crcs, i);
+- return mod->gpl_syms[i].value;
+- }
++ ks = lookup_symbol(name, mod->gpl_syms,
++ mod->gpl_syms + mod->num_gpl_syms);
++ if (ks) {
++ *crc = symversion(mod->gpl_crcs,
++ (ks - mod->gpl_syms));
++ return ks->value;
+ }
+ }
+ }
+@@ -1444,18 +1458,13 @@ static void setup_modinfo(struct module
+ #ifdef CONFIG_KALLSYMS
+ int is_exported(const char *name, const struct module *mod)
+ {
+- unsigned int i;
+-
+- if (!mod) {
+- for (i = 0; __start___ksymtab+i < __stop___ksymtab; i++)
+- if (strcmp(__start___ksymtab[i].name, name) == 0)
+- return 1;
+- return 0;
+- }
+- for (i = 0; i < mod->num_syms; i++)
+- if (strcmp(mod->syms[i].name, name) == 0)
++ if (!mod && lookup_symbol(name, __start___ksymtab, __stop___ksymtab))
++ return 1;
++ else
++ if (lookup_symbol(name, mod->syms, mod->syms + mod->num_syms))
+ return 1;
+- return 0;
++ else
++ return 0;
+ }
+
+ /* As per nm */
diff --git a/driver/export_symbol_gpl_future-rcu.patch b/driver/export_symbol_gpl_future-rcu.patch
new file mode 100644
index 0000000000000..b85c300f3b11a
--- /dev/null
+++ b/driver/export_symbol_gpl_future-rcu.patch
@@ -0,0 +1,26 @@
+From: Greg Kroah-Hartman <gregkh@suse.de>
+Subject: [PATCH] add EXPORT_SYMBOL_GPL_FUTURE() to RCU subsystem
+
+As the RCU symbols are going to be changed to GPL in the near future,
+lets warn users that this is going to happen.
+
+Cc: Paul McKenney <paulmck@us.ibm.com>
+Acked-by: Dipankar Sarma <dipankar@in.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ kernel/rcupdate.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- gregkh-2.6.orig/kernel/rcupdate.c
++++ gregkh-2.6/kernel/rcupdate.c
+@@ -569,7 +569,7 @@ void synchronize_kernel(void)
+
+ module_param(maxbatch, int, 0);
+ EXPORT_SYMBOL_GPL(rcu_batches_completed);
+-EXPORT_SYMBOL(call_rcu); /* WARNING: GPL-only in April 2006. */
+-EXPORT_SYMBOL(call_rcu_bh); /* WARNING: GPL-only in April 2006. */
++EXPORT_SYMBOL_GPL_FUTURE(call_rcu); /* WARNING: GPL-only in April 2006. */
++EXPORT_SYMBOL_GPL_FUTURE(call_rcu_bh); /* WARNING: GPL-only in April 2006. */
+ EXPORT_SYMBOL_GPL(synchronize_rcu);
+-EXPORT_SYMBOL(synchronize_kernel); /* WARNING: GPL-only in April 2006. */
++EXPORT_SYMBOL_GPL_FUTURE(synchronize_kernel); /* WARNING: GPL-only in April 2006. */
diff --git a/driver/export_symbol_gpl_future-usb.patch b/driver/export_symbol_gpl_future-usb.patch
new file mode 100644
index 0000000000000..b87cb2b7cd889
--- /dev/null
+++ b/driver/export_symbol_gpl_future-usb.patch
@@ -0,0 +1,64 @@
+From: Greg Kroah-Hartman <gregkh@suse.de>
+Subject: [PATCH] add EXPORT_SYMBOL_GPL_FUTURE() to USB subsystem
+
+The USB core symbols will be converted to GPL-only in a few years. Mark
+this as such and update the documentation explaining why, and provide a
+pointer for developers to receive help if they need it.
+
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ Documentation/feature-removal-schedule.txt | 19 +++++++++++++++++++
+ drivers/usb/core/driver.c | 6 +++---
+ 2 files changed, 22 insertions(+), 3 deletions(-)
+
+--- gregkh-2.6.orig/drivers/usb/core/driver.c
++++ gregkh-2.6/drivers/usb/core/driver.c
+@@ -378,7 +378,7 @@ const struct usb_device_id *usb_match_id
+
+ return NULL;
+ }
+-EXPORT_SYMBOL(usb_match_id);
++EXPORT_SYMBOL_GPL_FUTURE(usb_match_id);
+
+ int usb_device_match(struct device *dev, struct device_driver *drv)
+ {
+@@ -446,7 +446,7 @@ int usb_register_driver(struct usb_drive
+
+ return retval;
+ }
+-EXPORT_SYMBOL(usb_register_driver);
++EXPORT_SYMBOL_GPL_FUTURE(usb_register_driver);
+
+ /**
+ * usb_deregister - unregister a USB driver
+@@ -469,4 +469,4 @@ void usb_deregister(struct usb_driver *d
+
+ usbfs_update_special();
+ }
+-EXPORT_SYMBOL(usb_deregister);
++EXPORT_SYMBOL_GPL_FUTURE(usb_deregister);
+--- gregkh-2.6.orig/Documentation/feature-removal-schedule.txt
++++ gregkh-2.6/Documentation/feature-removal-schedule.txt
+@@ -171,3 +171,22 @@ Why: The ISA interface is faster and sho
+ probing is also known to cause trouble in at least one case (see
+ bug #5889.)
+ Who: Jean Delvare <khali@linux-fr.org>
++
++---------------------------
++
++What: USB driver API moves to EXPORT_SYMBOL_GPL
++When: Febuary 2008
++Files: include/linux/usb.h, drivers/usb/core/driver.c
++Why: The USB subsystem has changed a lot over time, and it has been
++ possible to create userspace USB drivers using usbfs/libusb/gadgetfs
++ that operate as fast as the USB bus allows. Because of this, the USB
++ subsystem will not be allowing closed source kernel drivers to
++ register with it, after this grace period is over. If anyone needs
++ any help in converting their closed source drivers over to use the
++ userspace filesystems, please contact the
++ linux-usb-devel@lists.sourceforge.net mailing list, and the developers
++ there will be glad to help you out.
++Who: Greg Kroah-Hartman <gregkh@suse.de>
++
++---------------------------
++
diff --git a/driver/export_symbol_gpl_future.patch b/driver/export_symbol_gpl_future.patch
new file mode 100644
index 0000000000000..939a5f36b64c0
--- /dev/null
+++ b/driver/export_symbol_gpl_future.patch
@@ -0,0 +1,169 @@
+From: Greg Kroah-Hartman <gregkh@suse.de>
+Subject: [PATCH] add EXPORT_SYMBOL_GPL_FUTURE()
+
+This patch adds the ability to mark symbols that will be changed in the
+future, so that non-GPL usage of them is flagged by the kernel and
+printed out to the system log.
+
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ include/asm-generic/vmlinux.lds.h | 14 ++++++++++
+ include/linux/module.h | 8 ++++++
+ kernel/module.c | 49 ++++++++++++++++++++++++++++++++++++--
+ 3 files changed, 69 insertions(+), 2 deletions(-)
+
+--- gregkh-2.6.orig/include/asm-generic/vmlinux.lds.h
++++ gregkh-2.6/include/asm-generic/vmlinux.lds.h
+@@ -58,6 +58,13 @@
+ VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \
+ } \
+ \
++ /* Kernel symbol table: GPL-future-only symbols */ \
++ __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \
++ VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \
++ *(__ksymtab_gpl_future) \
++ VMLINUX_SYMBOL(__stop___ksymtab_gpl_future) = .; \
++ } \
++ \
+ /* Kernel symbol table: Normal symbols */ \
+ __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \
+ VMLINUX_SYMBOL(__start___kcrctab) = .; \
+@@ -72,6 +79,13 @@
+ VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \
+ } \
+ \
++ /* Kernel symbol table: GPL-future-only symbols */ \
++ __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \
++ VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .; \
++ *(__kcrctab_gpl_future) \
++ VMLINUX_SYMBOL(__stop___kcrctab_gpl_future) = .; \
++ } \
++ \
+ /* Kernel symbol table: strings */ \
+ __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
+ *(__ksymtab_strings) \
+--- gregkh-2.6.orig/include/linux/module.h
++++ gregkh-2.6/include/linux/module.h
+@@ -198,6 +198,9 @@ void *__symbol_get_gpl(const char *symbo
+ #define EXPORT_SYMBOL_GPL(sym) \
+ __EXPORT_SYMBOL(sym, "_gpl")
+
++#define EXPORT_SYMBOL_GPL_FUTURE(sym) \
++ __EXPORT_SYMBOL(sym, "_gpl_future")
++
+ #endif
+
+ struct module_ref
+@@ -255,6 +258,11 @@ struct module
+ unsigned int num_gpl_syms;
+ const unsigned long *gpl_crcs;
+
++ /* symbols that will be GPL-only in the near future. */
++ const struct kernel_symbol *gpl_future_syms;
++ unsigned int num_gpl_future_syms;
++ const unsigned long *gpl_future_crcs;
++
+ /* Exception table */
+ unsigned int num_exentries;
+ const struct exception_table_entry *extable;
+--- gregkh-2.6.orig/kernel/module.c
++++ gregkh-2.6/kernel/module.c
+@@ -126,8 +126,11 @@ extern const struct kernel_symbol __star
+ extern const struct kernel_symbol __stop___ksymtab[];
+ extern const struct kernel_symbol __start___ksymtab_gpl[];
+ extern const struct kernel_symbol __stop___ksymtab_gpl[];
++extern const struct kernel_symbol __start___ksymtab_gpl_future[];
++extern const struct kernel_symbol __stop___ksymtab_gpl_future[];
+ extern const unsigned long __start___kcrctab[];
+ extern const unsigned long __start___kcrctab_gpl[];
++extern const unsigned long __start___kcrctab_gpl_future[];
+
+ #ifndef CONFIG_MODVERSIONS
+ #define symversion(base, idx) NULL
+@@ -172,6 +175,22 @@ static unsigned long __find_symbol(const
+ return ks->value;
+ }
+ }
++ ks = lookup_symbol(name, __start___ksymtab_gpl_future,
++ __stop___ksymtab_gpl_future);
++ if (ks) {
++ if (!gplok) {
++ printk(KERN_WARNING "Symbol %s is being used "
++ "by a non-GPL module, which will not "
++ "be allowed in the future\n", name);
++ printk(KERN_WARNING "Please see the file, "
++ "Documentation/feature-removal-schedule.txt, "
++ "in the kernel source tree, for more "
++ "details.\n");
++ }
++ *crc = symversion(__start___kcrctab_gpl_future,
++ (ks - __start_ksymtab_gpl_future));
++ return ks->value;
++ }
+
+ /* Now try modules. */
+ list_for_each_entry(mod, &modules, list) {
+@@ -191,6 +210,23 @@ static unsigned long __find_symbol(const
+ return ks->value;
+ }
+ }
++ ks = lookup_symbol(name, mod->gpl_future_syms,
++ (mod->gpl_future_syms +
++ mod->num_gpl_future_syms));
++ if (ks) {
++ if (!gplok) {
++ printk(KERN_WARNING "Symbol %s is being used "
++ "by a non-GPL module, which will not "
++ "be allowed in the future\n", name);
++ printk(KERN_WARNING "Please see the file, "
++ "Documentation/feature-removal-schedule.txt, "
++ "in the kernel source tree, for more "
++ "details.\n");
++ }
++ *crc = symversion(mod->gpl_future_crcs,
++ (ks - mod->gpl_future_syms));
++ return ks->value;
++ }
+ }
+ DEBUGP("Failed to find symbol %s\n", name);
+ return 0;
+@@ -1546,7 +1582,8 @@ static struct module *load_module(void _
+ char *secstrings, *args, *modmagic, *strtab = NULL;
+ unsigned int i, symindex = 0, strindex = 0, setupindex, exindex,
+ exportindex, modindex, obsparmindex, infoindex, gplindex,
+- crcindex, gplcrcindex, versindex, pcpuindex;
++ crcindex, gplcrcindex, versindex, pcpuindex, gplfutureindex,
++ gplfuturecrcindex;
+ long arglen;
+ struct module *mod;
+ long err = 0;
+@@ -1627,8 +1664,10 @@ static struct module *load_module(void _
+ /* Optional sections */
+ exportindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab");
+ gplindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_gpl");
++ gplfutureindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_gpl_future");
+ crcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab");
+ gplcrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_gpl");
++ gplfuturecrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_gpl_future");
+ setupindex = find_sec(hdr, sechdrs, secstrings, "__param");
+ exindex = find_sec(hdr, sechdrs, secstrings, "__ex_table");
+ obsparmindex = find_sec(hdr, sechdrs, secstrings, "__obsparm");
+@@ -1784,10 +1823,16 @@ static struct module *load_module(void _
+ mod->gpl_syms = (void *)sechdrs[gplindex].sh_addr;
+ if (gplcrcindex)
+ mod->gpl_crcs = (void *)sechdrs[gplcrcindex].sh_addr;
++ mod->num_gpl_future_syms = sechdrs[gplfutureindex].sh_size /
++ sizeof(*mod->gpl_future_syms);
++ mod->gpl_future_syms = (void *)sechdrs[gplfutureindex].sh_addr;
++ if (gplfuturecrcindex)
++ mod->gpl_future_crcs = (void *)sechdrs[gplfuturecrcindex].sh_addr;
+
+ #ifdef CONFIG_MODVERSIONS
+ if ((mod->num_syms && !crcindex) ||
+- (mod->num_gpl_syms && !gplcrcindex)) {
++ (mod->num_gpl_syms && !gplcrcindex) ||
++ (mod->num_gpl_future_syms && !gplfuturecrcindex)) {
+ printk(KERN_WARNING "%s: No versions for exported symbols."
+ " Tainting kernel.\n", mod->name);
+ add_taint(TAINT_FORCED_MODULE);