[hsflinux] [PATCH] Blacklist binary-only modules lying about their license

Carl-Daniel Hailfinger c-d.hailfinger.kernel.2004 at gmx.net
Tue Apr 27 05:09:36 EDT 2004


Hi,

LinuxAnt offers binary only modules without any sources. To circumvent our
MODULE_LICENSE checks LinuxAnt has inserted a "\0" into their declaration:

MODULE_LICENSE("GPL\0for files in the \"GPL\" directory; for others, only
LICENSE file applies");

Since string comparisons stop at the first "\0" character, the kernel is
tricked into thinking the modules are GPL. Btw, the "GPL" directory they
are speaking about is empty.

The attached patch blacklists all modules having "Linuxant" or "Conexant"
in their author string. This may seem a bit broad, but AFAIK both
companies never have released anything under the GPL and have a strong
history of binary-only modules.


Regards,
Carl-Daniel
-- 
http://www.hailfinger.org/
-------------- next part --------------
--- linux-2.6.5/kernel/module.c~	2004-04-04 05:37:37.000000000 +0200
+++ linux-2.6.5/kernel/module.c	2004-04-27 01:24:14.000000000 +0200
@@ -34,6 +34,7 @@
 #include <linux/vermagic.h>
 #include <linux/notifier.h>
 #include <linux/stop_machine.h>
+#include <linux/string.h>
 #include <asm/uaccess.h>
 #include <asm/semaphore.h>
 #include <asm/pgalloc.h>
@@ -1112,6 +1113,14 @@
 	}
 }
 
+static inline int license_author_is_not_blacklisted(const char *author)
+{
+	/* LinuxAnt is known to ship non-GPL modules with license=="GPL"
+	   to cheat on our checks. Stop them from doing that. */
+	return !(strstr(author, "Linuxant")
+		|| strstr(author, "Conexant"));
+}
+
 static inline int license_is_gpl_compatible(const char *license)
 {
 	return (strcmp(license, "GPL") == 0
@@ -1121,12 +1130,16 @@
 		|| strcmp(license, "Dual MPL/GPL") == 0);
 }
 
-static void set_license(struct module *mod, const char *license)
+static void set_license(struct module *mod, const char *license,
+			const char *author)
 {
 	if (!license)
 		license = "unspecified";
+	if (!author)
+		author = "unspecified";
 
-	mod->license_gplok = license_is_gpl_compatible(license);
+	mod->license_gplok = license_is_gpl_compatible(license)
+				&& license_author_is_not_blacklisted(author);
 	if (!mod->license_gplok) {
 		printk(KERN_WARNING "%s: module license '%s' taints kernel.\n",
 		       mod->name, license);
@@ -1466,7 +1479,8 @@
 	module_unload_init(mod);
 
 	/* Set up license info based on the info section */
-	set_license(mod, get_modinfo(sechdrs, infoindex, "license"));
+	set_license(mod, get_modinfo(sechdrs, infoindex, "license"),
+			get_modinfo(sechdrs, infoindex, "author"));
 
 	/* Fix up syms, so that st_value is a pointer to location. */
 	err = simplify_symbols(sechdrs, symindex, strtab, versindex, pcpuindex,


More information about the hsflinux mailing list