diff --git a/LDP/howto/docbook/HOWTO-INDEX/howtoChap.sgml b/LDP/howto/docbook/HOWTO-INDEX/howtoChap.sgml index 7ca181f7..639617f2 100644 --- a/LDP/howto/docbook/HOWTO-INDEX/howtoChap.sgml +++ b/LDP/howto/docbook/HOWTO-INDEX/howtoChap.sgml @@ -2673,7 +2673,7 @@ This HOWTO has been removed for review. Module-HOWTO, Linux Loadable Kernel Module HOWTO -Updated: Jul 2005. +Updated: Mar 2006. Explains what Linux loadable kernel modules (LKMs) are, and how to use and create them. diff --git a/LDP/howto/docbook/HOWTO-INDEX/osSect.sgml b/LDP/howto/docbook/HOWTO-INDEX/osSect.sgml index 9dda23c8..85b777bb 100644 --- a/LDP/howto/docbook/HOWTO-INDEX/osSect.sgml +++ b/LDP/howto/docbook/HOWTO-INDEX/osSect.sgml @@ -517,7 +517,7 @@ Crash Dump) package. Module-HOWTO, Linux Loadable Kernel Module HOWTO -Updated: Jul 2005. +Updated: Mar 2006. Explains what Linux loadable kernel modules (LKMs) are, and how to use and create them. diff --git a/LDP/howto/docbook/HOWTO-INDEX/programmSect.sgml b/LDP/howto/docbook/HOWTO-INDEX/programmSect.sgml index c3c7d5f4..9e4942fe 100644 --- a/LDP/howto/docbook/HOWTO-INDEX/programmSect.sgml +++ b/LDP/howto/docbook/HOWTO-INDEX/programmSect.sgml @@ -335,7 +335,7 @@ point for more information. Module-HOWTO, Linux Loadable Kernel Module HOWTO -Updated: Jul 2005. +Updated: Mar 2006. Explains what Linux loadable kernel modules (LKMs) are, and how to use and create them. diff --git a/LDP/howto/docbook/Module-HOWTO.sgml b/LDP/howto/docbook/Module-HOWTO.sgml index f18227ee..fddcf628 100644 --- a/LDP/howto/docbook/Module-HOWTO.sgml +++ b/LDP/howto/docbook/Module-HOWTO.sgml @@ -17,9 +17,17 @@ -2005-07-20 +2006-03-03 + + v1.08 + 2006-03-03 + bjh + + Add copyright information. + + v1.07 2005-07-20 @@ -2269,7 +2277,7 @@ changes. -Rubini: Linux Device Drivers +Rubini et al: Linux Device Drivers The most popular book on writing device drivers is O'Reilly's @@ -2310,8 +2318,22 @@ This book is also available in print in any decent technical book store. -Improving On Use Counts +Module Use Counts + +It is essential that the kernel not try to reference the code of a +module after it has been unloaded; i.e. you must not unload a module +while it is in use. An example of in use is a device driver for which +a device special file is open. Because there is an open file +descriptor for it, a user might do a read of the device and to execute +that read, the kernel would want to call a function that is in the +device driver. You can see that there would be a problem if you +unloaded that device driver module before the read -- the kernel would +reuse the memory that used to contain the read subroutine and there's +no telling what instructions the kernel would branch to when it thinks +it's calling the read subroutine. + + In the original design, the LKM increments and decrements its use count to tell the module manager whether it is OK to unload it. For @@ -2320,7 +2342,7 @@ when someone mounts a filesystem of the type it drives, and decrement it at unmount time. -Now, there is a more flexible alternative. Your LKM can register a +Later a more flexible alternative was added. Your LKM can register a function that the module manager will call whenever it wants to know if it is OK to unload the module. If the function returns a true value, that means the LKM is busy and cannot @@ -2520,6 +2542,237 @@ count has been replaced. + + +Copyright Considerations With LKMs + + + +A perennial question about LKMs is whether the terms of GPL apply to +one, considering that the Linux kernel is distributed under GPL. For +example, is it OK to ship an LKM in binary only form? This section +covers the copyright issues surrounding LKMs, which are as interesting +as they are complex. Fair warning: we don't reach a conclusion. The +law is unsettled and there are plenty of good but conflicting +arguments. + + + +Remember that countries have varying copyright laws, so even if you +figure out the answer to a question in one country, it might be +different in another. But copyright laws are actually remarkably +similar, and this section won't go into the matter in enough detail +that it will really make a difference. + + + +Let's start at the beginning and look at what a copyright is. + + + +Primarily, a copyright is a person's right to stop other people from +copying something. It is a legal right, not a moral one. That means +it is created by law to bring about some practical effect, rather than +something that people believe people are naturally entitled to. + + + +The primary that copyright seeks to bring about is that an author gets +paid for what he created. Some people believe that is a valid goal +itself, because an author has a natural right to the value that he +creates. But historically, that isn't the real goal of copyright. +The real goal is secondary to making the author get paid for his work: +I causes the author to create in the first place. An author is more +likely to spend time and money writing if he will get paid for it. + + + +The actual operation of copyright law achieves that goal only +approximately. We've all seen cases where the law is used to transfer +wealth in ways that don't contribute to that goal at all. For +example, a music publisher denies a person permission to copy a song +that he wouldn't have paid for anyway. Legislators think of that as +collateral damage -- what copyright law does to cause things to get +written makes up for the senseless copy restrictions in other cases. + + + +But when it comes to LKMs, there is another, much more complex area of +copyright law that matters: derivative works. Copyright law gives an +author the right to stop someone from creating a derivative work. A +derivative work is not a copy of anything the +author wrote. So what is it? + + + +The definition of derivative work is elusive, but here are some +examples: When you translate a book from English into French, the +French version is a derivative work of the English work. If you write +a new chapter for a novel, your new chapter is a derivative work of +the novel. If you write a whole new book for the Harry Potter series, +with the same characters and settings, that is a derivative work of +all the Harry Potter books. If you draw a Dilbert cartoon on a +birthday card, that is a derivative work of all the Dilbert strips, +books, etc. + + + +And this brings us to LKMs, because many people believe that an LKM is +a derivative work of the Linux kernel. The Free Software Foundation +has said so. Linus Torvalds has said it is sometimes. No court of +law has ever ruled one way or the other. + + + +Now let's turn to the copyright on Linux. For the sake of discussion, +when we say "Linux," we will mean the contents of the +tarball you download from kernel.org as the regular Linux kernel. + + + +Who owns the copyright on Linux? Lots of people. Nearly everyone who +has contributed code to Linux reserved his own copyright. Some of +that work was done for hire and therefore the employing corporations +own the copyright. Linus Torvalds is the most visible copyright +owner, but he hold copyright on a very small part of Linux. + + + +How do these people prosecute their copyright? Well, nobody makes +deals with them to purchase copying rights. It wouldn't be practical. +However, they all offer a copyright license -- the same one -- to the +public. The license is documented and offered in a file in the +tarball, and is known as the General Public License (GPL). GPL is not +specific to Linux. It was developed by the Free Software Foundation +before Linux existed, and was simply chosen by Linus back when he was +the only copyright owner. And Linus doesn't put any code into the +tarball without the author offering the same license. + + + +A copyright license is permission by a copyright owner to do something +that he has a legal right to stop you from doing, such as make a copy +or a derivative work. What it means to be a public license is that it +is offered to the public, as opposed to the copyright owner offering +it to particular persons he knows about. + + + +The GPL lets you do almost anything with the code -- it's almost like +the copyright owners waiving all their copyright rights. But not +quite: there are strings attached. The license has conditions. In +order to have the permission, you have to meet the conditions. The +condition we care about here is one of two things, or both, depending +on how you read the license document (the document is ambiguous). +Either a) if you distribute a derivative work of Linux, you +have to supply source code for the whole derivative work; or b) if you +distribute a work containing Linux, you have to supply source code for +the entire work. + + + +Now we come to the real question: what sort of rights do you have to +distribute an LKM you wrote? + + + +Certainly, many people believe that you can distribute an LKM under +any terms you like, including binary-only and the owners of the Linux +copyright have nothing to say about it. You're distributing nothing +but your own code. And it's not a derivative work of anything. Many +people do distribute binary-only LKMs and believe that a principle +benefit of LKMs is the ability to do that. + + + +Others think differently: The LKM, while an original work, is a +derivative work of Linux. The Linux copyright owners have the right +to control distribution. The only permission they gave you to +distribute it is GPL, and that permission is only under the condition +that you supply source code. + + + +Let's look a little closer at the issue of whether an LKM is a +derivative work of Linux. The argument in favor goes that writing an +LKM is like writing a supplemental chapter for a novel. We know the +latter is creating a derivative work. The LKM is like the chapter +because it's specifically designed to be part of whole with the +existing Linux kernel. It has no use in any other context, and when +deployed, is tightly woven into the rest of Linux. The fact that you +typically use a bunch of Linux header files to compile it is proof +that it's just an extension of Linux (don't confuse this with another +argument -- that the #include actually means you're distributing that +header file inside your object code). And note that a kernel module +loaded at run time is essentially the same program you would +statically bind into the base kernel if you chose to go that route. +If writing a module for the Linux source tree is creating a derivative +work, the so must be writing an LKM. LKMs often have to be updated +to conform to updates the base kernel. + + + +Wasabi Systems, a company that sells kernels with freer licensing than +Linux, has published a paper that +argues in more detail that LKMs are derivative works of Linux and you +should therefore be wary of publishing binary-only LKMs for it. + + + +The argument against says that an LKM is something that interacts with +Linux, not something that is part of Linux. It likens the LKM to a +user space program, communicating with the kernel via system calls, +or an FTP client program (which would not be a derivative work of any +FTP server program). + + + +The issue also runs into one of those areas where books and computer +programs aren't analogous because a computer program does something, +whereas a book just communicates an idea to a person. Loading an LKM +might be more like plugging an attachment into your vacuum cleaner +than like inserting pages into your book. And we know that the +blueprints for a vacuum cleaner attachment are not a derivative work +of the blueprints for a vacuum cleaner. + + + +So that's as far as I can go. There appears to be a matter of degree +here and a judge will have to draw a line somewhere. + + + +But if you need to make a practical decision, consider that there have +been well-known binary LKMs (drivers for Nvidia network adapters seem +to be the most famous) for years and no one has sued for copyright +infringement. Also, Linus Torvalds, influential for reasons other than +legal, has said binary-only LKMs are OK with him. + + + +What about GPL-ONLY symbols? Kernel developers have selected some +symbols that one uses in interfacing an LKM to the base kernel as +GPL-only. These symbols have "GPL_ONLY" in their names, +making this intent obvious, order for the Linux module loader to let +your LKM use them, you must include some code in your LKM that +supposedly certifies you license your module under GPL. + + +These probably have no legal significance. If the LKM is not a +derivative work of Linux, then the kernel developers simply have no +legal way to block you from putting the GPL annotation in your code +and distributing it binary-only anyhow. If the LKM +is a derivative work of Linux, then the absence +of the GPL-only classification of the symbol is probably not enough to +give permission to use it in a binary-only LKM. The license document +does not mention them. At best, you can use GPL-only symbols as +gentleman's promise not to sue you for use of all the other symbols in +a binary-only LKM. + + + + Related Documentation @@ -7051,3 +7304,5 @@ Copyright <trademark class="copyright">2001</trademark>. </sect1> </Article> + +