LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jan Engelhardt <jengelh@linux01.gwdg.de>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@osdl.org>,
Jon Masters <jonathan@jonmasters.org>,
Alexey Dobriyan <adobriyan@gmail.com>
Subject: Re: [m-i-t part] Ban module license tag string termination trick
Date: Thu, 1 Feb 2007 22:28:07 +0100 (MET) [thread overview]
Message-ID: <Pine.LNX.4.61.0702012225240.30766@yvahk01.tjqt.qr> (raw)
In-Reply-To: <Pine.LNX.4.61.0702012147470.1862@yvahk01.tjqt.qr>
Hello Ccs, hello list,
The m-i-t list subscription is foobared today, so no Cc. To compensate,
Jon has been Cced.
jengelh wrote:
>
>Proposed patch to prohibit loading modules that use early C string
>termination ("GPL\0 for nothing, folks!") to trick the kernel believing
>it is loading a GPL driver.
>[...]
>To work against this problem, we must store the length of the actual
>string as the compiler knows it. This will become really cumbersome if
>implemented as a new tag inside the modinfo section. Hence I chose the
>way of adding a new section called ".modlicense". The length of the new
>section's header will automatically be the string length [including
>trailing NUL]. The module loading code then just has to compare the
>section length with the string length as returned by strlen().
>[...]
>A separate patch is required for module-init-tools (m-i-t) to make the
>"modinfo" userspace utility understand the new modlicense section. I do
>not think the world will explode if someone runs an unpatched m-i-t with
>a patched kernel.
Signed-off-by: Jan Engelhardt <jengelh@gmx.de>
# modlicense-MIT.diff
Index: module-init-tools-3.2.2/modinfo.c
===================================================================
--- module-init-tools-3.2.2.orig/modinfo.c
+++ module-init-tools-3.2.2/modinfo.c
@@ -376,12 +376,22 @@ int main(int argc, char *argv[])
}
info = get_section(mod, modulesize, &infosize, ".modinfo");
- if (!info)
- continue;
- if (field)
- print_tag(field, info, infosize, filename, sep);
- else
- print_all(info, infosize, filename, sep);
+ if (info) {
+ if (field)
+ print_tag(field, info, infosize, filename, sep);
+ else
+ print_all(info, infosize, filename, sep);
+ }
+
+ info = get_section(mod, modulesize, &infosize, ".modlicense");
+ if(info != NULL && strnlen(info, infosize) + 1 == infosize) {
+ if(field != NULL && streq(field, "license"))
+ printf("%s%c", (const char *)info, sep);
+ else
+ printf("%-16s%s%c", "license:",
+ (const char *)info, sep);
+ }
+
free(filename);
}
return ret;
#<EOF>
next prev parent reply other threads:[~2007-02-01 21:29 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-28 0:41 [PATCH] Blacklist hsfmodem module Alexey Dobriyan
2006-11-01 11:21 ` Jan Engelhardt
2007-02-01 21:20 ` [PATCH] Ban module license tag string termination trick Jan Engelhardt
2007-02-01 21:28 ` Jan Engelhardt [this message]
2007-02-01 21:55 ` Randy Dunlap
2007-02-01 22:17 ` Jon Masters
2007-02-01 22:30 ` Trent Waddington
2007-02-01 23:34 ` Auke Kok
2007-02-02 8:24 ` David Schwartz
2007-02-02 10:45 ` Helge Hafting
2007-02-03 18:31 ` David Schwartz
2007-02-03 20:47 ` Jan Engelhardt
2007-02-03 22:21 ` Alan
2007-02-03 23:32 ` Jon Masters
2007-02-04 0:05 ` Alan
2007-02-04 7:56 ` David Schwartz
2007-02-07 12:18 ` Helge Hafting
2007-02-07 18:56 ` David Schwartz
2007-02-12 15:50 ` Helge Hafting
2007-02-12 16:42 ` Alan
2007-02-12 22:37 ` David Schwartz
2007-02-02 0:17 ` Tomas Carnecky
2007-02-02 0:51 ` Trent Waddington
2007-02-02 2:19 ` Valdis.Kletnieks
2007-02-02 3:12 ` Arjan van de Ven
2007-02-02 6:15 ` Jon Masters
2007-02-02 14:53 ` Paul Rolland
2007-02-02 15:11 ` Jan Engelhardt
2007-02-02 16:53 ` Randy Dunlap
2007-02-02 17:41 ` Jan Engelhardt
2007-02-02 17:49 ` Randy Dunlap
2007-02-02 19:06 ` Jan Engelhardt
2007-02-03 1:12 ` Randy Dunlap
2007-02-03 1:29 ` Jan Engelhardt
2007-02-02 18:37 ` Paul Rolland
2007-02-02 19:08 ` Jan Engelhardt
2007-02-04 8:14 ` Paul Rolland
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=Pine.LNX.4.61.0702012225240.30766@yvahk01.tjqt.qr \
--to=jengelh@linux01.gwdg.de \
--cc=adobriyan@gmail.com \
--cc=akpm@osdl.org \
--cc=jonathan@jonmasters.org \
--cc=linux-kernel@vger.kernel.org \
--subject='Re: [m-i-t part] Ban module license tag string termination trick' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).