public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Carl-Daniel Hailfinger <c-d.hailfinger.kernel.2004@gmx.net>,
	Andrew Morton <akpm@osdl.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Blacklist binary-only modules lying about their license
Date: Tue, 27 Apr 2004 16:04:06 +1000	[thread overview]
Message-ID: <1083045844.2150.105.camel@bach> (raw)
In-Reply-To: <Pine.LNX.4.58.0404262116510.19703@ppc970.osdl.org>

On Tue, 2004-04-27 at 14:31, Linus Torvalds wrote:
> Anyway, I suspect that rather than blacklist bad people, I'd much prefer
> to have the module tags be done as counted strings instead. It should be
> easy enough to do by just having the macro prepend a "sizeof(xxxx)"  
> thing or something.
> 
> Hmm. At least with -sdt=c99 it should be trivial, with something like
> 
> 	#define __MODULE_INFO(tag, name, info)		\
> 	static struct { int len; const char value[] }	\
> 	__module_cat(name,__LINE__) __attribute_used__	\
> 	__attribute__((section(".modinfo"),unused)) =	\
> 		{ sizeof(__stringify(tag) "=" info),	\
> 		__stringify(tag) "=" info }
> 
> doing the job.

Cute, but breaks the "modinfo" tool unfortunately.  I'd prefer not to do
that.  Since they want to circumvent this, almost anything we want to do
is a waste of time.

Rusty.

Name: Stop most obvious abuse of MODULE_LICENSE
Status: Tested on 2.6.6-rc2-bk4

Arms race forces bloat upon module users.

diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .31262-linux-2.6.6-rc2-bk4/include/linux/module.h .31262-linux-2.6.6-rc2-bk4.updated/include/linux/module.h
--- .31262-linux-2.6.6-rc2-bk4/include/linux/module.h	2004-04-22 08:03:55.000000000 +1000
+++ .31262-linux-2.6.6-rc2-bk4.updated/include/linux/module.h	2004-04-27 15:52:19.000000000 +1000
@@ -16,6 +16,9 @@
 #include <linux/kmod.h>
 #include <linux/elf.h>
 #include <linux/stringify.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/compiler.h>
 #include <asm/local.h>
 
 #include <asm/module.h>
@@ -61,7 +64,14 @@ void sort_main_extable(void);
 #ifdef MODULE
 #define ___module_cat(a,b) __mod_ ## a ## b
 #define __module_cat(a,b) ___module_cat(a,b)
+/* Some sick fucks embeded NULs in MODULE_LICENSE to circumvent checks. */
+#define __MODULE_INFO_CHECK(info)					  \
+	static void __init __attribute_used__				  \
+	__module_cat(__mc_,__LINE__)(void) {				  \
+		BUILD_BUG_ON(__builtin_strlen(info) + 1 != sizeof(info)); \
+	}
 #define __MODULE_INFO(tag, name, info)					  \
+__MODULE_INFO_CHECK(info);						  \
 static const char __module_cat(name,__LINE__)[]				  \
   __attribute_used__							  \
   __attribute__((section(".modinfo"),unused)) = __stringify(tag) "=" info


-- 
Anyone who quotes me in their signature is an idiot -- Rusty Russell


  reply	other threads:[~2004-04-27  6:05 UTC|newest]

Thread overview: 197+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-27  2:09 [PATCH] Blacklist binary-only modules lying about their license Carl-Daniel Hailfinger
2004-04-27  3:13 ` Gilles May
2004-04-27  4:42   ` Zwane Mwaikambo
2004-04-27  9:58     ` Carl-Daniel Hailfinger
2004-04-27  4:31 ` Linus Torvalds
2004-04-27  6:04   ` Rusty Russell [this message]
2004-04-27  9:21     ` Jan-Benedict Glaw
2004-04-27 10:37       ` Carl-Daniel Hailfinger
2004-04-27 12:59         ` Paulo Marques
2004-04-27 13:12           ` [PATCH] Blacklist binary-only modules lying about their license (-> possible GPL violation :) Jan-Benedict Glaw
2004-04-27 14:10             ` Tim Connors
2004-04-27 17:05           ` [PATCH] Blacklist binary-only modules lying about their license Juergen E. Fischer
2004-04-27 18:58           ` Pavel Machek
2004-04-28 22:55             ` Timothy Miller
     [not found]           ` <fa.f05evul.1qmg8gd@ifi.uio.no>
2004-04-27 21:17             ` Junio C Hamano
2004-04-27 21:33               ` Valdis.Kletnieks
2004-04-28 23:24           ` Rik van Riel
2004-04-27 18:52   ` Pavel Machek
2004-04-27  5:26 ` Willy Tarreau
2004-04-27  7:03   ` Grzegorz Piotr Jaskiewicz
2004-04-29 18:40 ` [hsflinux] " Giuliano Colla
2004-04-29 19:08   ` viro
2004-04-29 19:29     ` Måns Rullgård
2004-04-29 20:24   ` Timothy Miller
2004-04-29 21:32     ` Marc Boucher
2004-04-29 22:12       ` Timothy Miller
2004-04-29 22:20         ` Marc Boucher
2004-04-29 23:01           ` Timothy Miller
2004-04-30  6:01             ` Matthias Schniedermeyer
2004-04-30  9:33               ` Symbios and BIOS (was: Re: [PATCH] Blacklist binary-only modules lying about their license) Geert Uytterhoeven
2004-04-30 11:07                 ` Matthias Schniedermeyer
2004-05-06 15:06       ` [PATCH] Blacklist binary-only modules lying about their license Pavel Machek
2004-04-29 21:10   ` [hsflinux] " Linus Torvalds
2004-04-29 21:44     ` viro
2004-04-30 13:37     ` Giuliano Colla
2004-04-30 14:14       ` Arthur Perry
2004-04-30 18:14         ` Giuliano Colla
2004-04-30 15:55       ` Carl-Daniel Hailfinger
2004-04-30 19:27         ` Giuliano Colla
2004-04-30 20:29           ` Timothy Miller
2004-05-02  8:40           ` Geert Uytterhoeven
2004-05-02 22:26             ` Giuliano Colla
2004-05-03  1:21               ` David Lang
2004-05-04 17:27                 ` Timothy Miller
  -- strict thread matches above, loose matches on Subject: below --
2004-04-27 13:43 Albert Cahalan
2004-04-27 16:18 ` Jon
2004-04-27 16:58   ` Marc Boucher
2004-04-27 17:25     ` Adam Jaskiewicz
2004-04-27 17:33       ` Marc Boucher
2004-04-27 17:46         ` Chris Friesen
2004-04-27 17:53           ` Grzegorz Kulewski
2004-04-27 18:10             ` Chris Friesen
2004-04-27 20:37               ` Timothy Miller
2004-04-27 20:44                 ` Grzegorz Kulewski
2004-04-27 18:54             ` Valdis.Kletnieks
2004-04-27 19:03               ` Jorge Bernal (Koke)
2004-04-27 19:16                 ` Grzegorz Kulewski
2004-04-27 19:41                   ` Jorge Bernal (Koke)
2004-04-27 20:18                     ` Valdis.Kletnieks
2004-04-28 11:23               ` Helge Hafting
2004-04-27 18:10           ` Marc Boucher
2004-04-27 18:30             ` Chris Friesen
2004-04-27 20:40               ` Timothy Miller
2004-04-28  0:08               ` Carl-Daniel Hailfinger
2004-04-27 19:54         ` Tigran Aivazian
2004-04-28 11:28         ` Helge Hafting
2004-04-27 23:12     ` Rusty Russell
2004-04-28  0:02       ` Marc Boucher
2004-04-28  0:25         ` David Gibson
2004-04-28  1:14           ` Marc Boucher
2004-04-28  3:23             ` Horst von Brand
2004-04-28  6:04               ` Marc Boucher
2004-04-28 17:05                 ` Horst von Brand
2004-04-28 17:37             ` Timothy Miller
2004-04-28 19:31               ` Marc Boucher
2004-04-28 19:46                 ` Timothy Miller
2004-04-29  0:02                 ` Rik van Riel
2004-04-29  0:40                   ` Nick Piggin
2004-04-29  2:20                     ` Kenneth Aafløy
2004-04-29  2:31                   ` Marc Boucher
2004-04-29  2:36                     ` Ian Stirling
2004-04-29  2:38                       ` Rik van Riel
2004-04-29  2:47                         ` Ian Stirling
2004-04-29  2:47                       ` Kenneth Aafløy
2004-04-29 22:47                         ` Denis Vlasenko
2004-04-30 15:57                     ` Paulo Marques
2004-04-29 15:15                   ` Timothy Miller
2004-04-29 15:14                     ` Rik van Riel
2004-04-29 21:00                       ` Paul Wagland
2004-04-29 21:36                         ` Timothy Miller
2004-04-29 21:45                           ` viro
2004-04-29 21:47                           ` Jorge Bernal (Koke)
2004-04-29 22:24                             ` Marc Boucher
2004-04-29 22:32                               ` Tim Hockin
2004-04-29 22:49                                 ` Marc Boucher
2004-04-29 22:40                               ` viro
2004-04-29 23:55                               ` Sean Estabrooks
2004-04-30  2:15                                 ` Marc Boucher
2004-04-30  4:18                                   ` Bartlomiej Zolnierkiewicz
2004-04-30  4:32                                     ` Peter Williams
2004-04-30 14:49                                       ` Bartlomiej Zolnierkiewicz
2004-04-30 16:10                                       ` Timothy Miller
2004-04-30 20:01                                         ` Jesse Pollard
2004-04-30  4:43                                   ` Sean Estabrooks
2004-04-30  5:44                                     ` Marc Boucher
2004-04-30  6:13                                       ` Sean Estabrooks
2004-04-30  8:04                                       ` Jeff Garzik
2004-04-30  8:48                                         ` Jan-Benedict Glaw
2004-04-30 15:06                                         ` Tigran Aivazian
2004-04-30 15:43                                           ` Chris Friesen
2004-04-30 16:10                                             ` Marc Boucher
2004-04-30 16:30                                               ` Chris Friesen
2004-05-10  6:25                                                 ` Rogier Wolff
2004-05-10  7:08                                                   ` Måns Rullgård
2004-04-30 16:31                                               ` Gilles May
2004-04-30 16:50                                                 ` Marc Boucher
2004-04-30 17:44                                                   ` Michael Poole
2004-04-30 18:46                                                     ` Marc Boucher
2004-04-30 19:17                                                       ` Timothy Miller
2004-04-30 18:26                                                   ` Timothy Miller
2004-04-30 18:52                                                     ` Marc Boucher
2004-04-30 18:22                                               ` Timothy Miller
2004-04-30 18:01                                           ` Timothy Miller
2004-04-30  8:47                                       ` Jan-Benedict Glaw
2004-04-30  9:31                                   ` Geert Uytterhoeven
2004-04-30 15:57                                 ` Timothy Miller
2004-04-30 17:14                                   ` Marc Boucher
2004-04-30 17:46                                     ` Sean Estabrooks
2004-04-30 18:27                                       ` Timothy Miller
2004-04-30 11:49                           ` Helge Hafting
2004-04-30 16:20                             ` Timothy Miller
2004-04-30 21:03                               ` Gene Heskett
2004-04-30  9:16                     ` Geert Uytterhoeven
2004-04-28 23:43             ` Rik van Riel
2004-04-28  1:57         ` Rusty Russell
2004-04-28  3:28           ` Marc Boucher
2004-04-28 11:47             ` Helge Hafting
2004-04-28 16:15               ` Marc Boucher
2004-04-28 19:32                 ` Timothy Miller
2004-04-28 19:41                   ` Marc Boucher
2004-04-29 22:41                 ` Denis Vlasenko
2004-04-29 23:03                   ` Timothy Miller
2004-04-30 13:06                 ` Helge Hafting
2004-04-28 14:03             ` Tom Sightler
2004-04-28 16:40               ` Marc Boucher
2004-04-28 22:08                 ` Stephen Hemminger
2004-04-28 23:00                   ` Timothy Miller
2004-04-28 23:54                 ` Rik van Riel
2004-04-27 23:17     ` Carl-Daniel Hailfinger
2004-04-28  2:10     ` Horst von Brand
2004-04-27 19:03 Steve Lee
2004-04-27 19:37 ` Tigran Aivazian
2004-04-27 21:34 Robert M. Stockmann
2004-05-01  9:15 ` Tomas Szepe
2004-04-27 22:17 Nick Warne
     [not found] <878ygh147m.fsf@sanosuke.troilus.org>
2004-04-27 22:59 ` Robert M. Stockmann
2004-04-27 23:05   ` Tim Hockin
2004-04-27 23:30     ` Robert M. Stockmann
2004-04-27 23:41       ` Tim Hockin
2004-04-27 23:59         ` Robert M. Stockmann
2004-05-01  9:19           ` Tomas Szepe
     [not found] <20040428000952.GA19522@hockin.org>
2004-04-28  0:18 ` Robert M. Stockmann
     [not found] <20040428003034.GA20811@hockin.org>
2004-04-28  0:56 ` Robert M. Stockmann
     [not found] <20040428011348.GA22754@hockin.org>
2004-04-28  1:33 ` Robert M. Stockmann
2004-04-28 18:56 Keith D Burgess Jr
2004-04-28 23:45 ` Tim Connors
2004-04-30 22:48 ` David Woodhouse
2004-04-29 14:55 Rick Zeman
2004-04-30 17:47 Keith D Burgess Jr
2004-04-30 18:39 ` Timothy Miller
2004-04-30 19:37 ` Richard B. Johnson
2004-04-30 20:37 ` Horst von Brand
     [not found] <009701c42edf$25e47390$ca41cb3f@amer.cisco.com>
2004-04-30 19:19 ` Linus Torvalds
2004-04-30 19:37   ` Hua Zhong
2004-04-30 20:11   ` Marc Boucher
2004-04-30 20:26     ` Linus Torvalds
2004-04-30 20:39       ` Marc Boucher
2004-04-30 20:44         ` Linus Torvalds
2004-04-30 20:53           ` Marc Boucher
2004-04-30 21:05             ` Linus Torvalds
2004-04-30 21:10             ` Timothy Miller
2004-04-30 20:46         ` Sean Estabrooks
2004-04-30 20:34     ` Stefan Smietanowski
2004-05-01  0:40     ` Jorge Bernal
2004-05-01  5:07     ` Martin J. Bligh
2004-05-01 19:12       ` Marc Boucher
2004-05-01 19:27         ` Davide Libenzi
2004-05-01 19:32         ` Zwane Mwaikambo
2004-05-01 19:33         ` Sean Estabrooks
2004-05-01 22:14           ` Randy.Dunlap
2004-05-01 19:47         ` Nicolas Pitre
2004-05-01 20:47         ` Martin J. Bligh
2004-05-01 20:58           ` Marc Boucher
2004-05-03  0:04         ` Horst von Brand
     [not found] ` <40929F5B.9090603@techsource.com>
2004-04-30 18:58   ` Hua Zhong
2004-04-30 20:14   ` Bartlomiej Zolnierkiewicz
2004-04-30 20:02 Keith D Burgess Jr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1083045844.2150.105.camel@bach \
    --to=rusty@rustcorp.com.au \
    --cc=akpm@osdl.org \
    --cc=c-d.hailfinger.kernel.2004@gmx.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox