Re: ndiswrapper and GPL-only symbols redux

From: Pavel Roskin
Date: Wed Jan 30 2008 - 00:26:59 EST


On Wed, 2008-01-30 at 05:07 +0000, Jon Masters wrote:
> *). Add a new taint?
> *). Move it later?
>
> It's all trivial, but a policy should be established for the future.

I'd prefer a new taint. It's less likely to break. It provides more
information in the stack dumps. It makes it clear the difference
ndiswrapper and driverloader.

Here's the patch:
---

Introduce a new taint flag for ndiswrapper

Although ndiswrapper loads proprietary code, it's under GPL itself.
Introduce a different taint flag for this case, so that ndiswrapper
retains access to GPL-only symbols.

Add comments to show the difference between driverloader and
ndiswrapper.

Signed-off-by: Pavel Roskin <proski@xxxxxxx>
---

include/linux/kernel.h | 1 +
kernel/module.c | 5 ++++-
kernel/panic.c | 2 ++
3 files changed, 7 insertions(+), 1 deletions(-)


diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index a7283c9..861a6ae 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -240,6 +240,7 @@ extern enum system_states {
#define TAINT_BAD_PAGE (1<<5)
#define TAINT_USER (1<<6)
#define TAINT_DIE (1<<7)
+#define TAINT_BLOB_WRAPPER (1<<8)

extern void dump_stack(void) __cold;

diff --git a/kernel/module.c b/kernel/module.c
index f6a4e72..a64380c 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1925,8 +1925,11 @@ static struct module *load_module(void __user *umod,
/* Set up license info based on the info section */
set_license(mod, get_modinfo(sechdrs, infoindex, "license"));

+ /* GPL, but may load proprietary code */
if (strcmp(mod->name, "ndiswrapper") == 0)
- add_taint_module(mod, TAINT_PROPRIETARY_MODULE);
+ add_taint_module(mod, TAINT_BLOB_WRAPPER);
+
+ /* Wrongly claims to be under GPL */
if (strcmp(mod->name, "driverloader") == 0)
add_taint_module(mod, TAINT_PROPRIETARY_MODULE);

diff --git a/kernel/panic.c b/kernel/panic.c
index da4d6ba..b040812 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -152,6 +152,7 @@ EXPORT_SYMBOL(panic);
* 'M' - System experienced a machine check exception.
* 'B' - System has hit bad_page.
* 'U' - Userspace-defined naughtiness.
+ * 'W' - Wrapper for untrusted binary blobs has been loaded.
*
* The string is overwritten by the next call to print_taint().
*/
@@ -162,6 +163,7 @@ const char *print_tainted(void)
if (tainted) {
snprintf(buf, sizeof(buf), "Tainted: %c%c%c%c%c%c%c%c",
tainted & TAINT_PROPRIETARY_MODULE ? 'P' : 'G',
+ tainted & TAINT_BLOB_WRAPPER ? 'W' : ' ',
tainted & TAINT_FORCED_MODULE ? 'F' : ' ',
tainted & TAINT_UNSAFE_SMP ? 'S' : ' ',
tainted & TAINT_FORCED_RMMOD ? 'R' : ' ',

--
Regards,
Pavel Roskin
--
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/