Re: [PATCH] Blacklist hsfmodem module

From: Jan Engelhardt
Date: Wed Nov 01 2006 - 06:23:20 EST



>It seems, hcfpcimodem-1.10full.tar.gz from
>http://www.linuxant.com/drivers/hcf/full/downloads.php
>also uses GPL\0 trick.
>
>Patch is obviously not tested (and I'm not sure name is right, got it from
>Ubuntu forums and tarball filename),
>
>Does someone know internal contact so we can weed out all names and
>blacklist them in bulk?


Could not we introduce some compile-time magic that makes sure no extra
NULs are present? Like...

Consider
MODULE_LICENSE("GPL\0foobar");
generating an extra symbol
static const __rodata int __module_license_length = sizeof("GPL\0foobar");

And in the module loader, check:
if(strcmp(__module_license, "GPL") == 0 &&
__module_license_length == sizeof("GPL"))
{
allow;
}

That should weed out all those pesky GPL-override attempts, without needing to
blacklist every single module. After all, HSF (or whoever else is blacklisted)
could just change their module's name from hsfmodem.ko to hsf_modem.ko, for
example.

linux/license.h could look like this:

<<<
#ifndef __LICENSE_H
#define __LICENSE_H

#define strcmpexact(given, required, length) \
(strcmp((given), (required)) == 0 && (length) == sizeof(required))

static inline int license_is_gpl_compatible(const char *license, int len)
{
return strcmpexact(license, "GPL", len) ||
strcmpexact(license, "GPL v2", len) ||
strcmpexact(license, "GPL and additional rights", len) ||
strcmpexact(license, "Dual BSD/GPL", len) ||
strcmpexact(license, "Dual MIT/GPL", len) ||
strcmpexact(license, "Dual MPL/GPL", len);
}

#undef strcmpexact

#endif
>>>


-`J'
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/