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 <[EMAIL PROTECTED]>

# 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>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to