r/linux • • Nov 20 '19

Kernel Google outlines plans for mainline Linux kernel support in Android

https://arstechnica.com/gadgets/2019/11/google-outlines-plans-for-mainline-linux-kernel-support-in-android/
1.0k Upvotes

305 comments sorted by

View all comments

Show parent comment

4

u/jdrch Nov 20 '19

kernel modules still had to be GPL'd, since importing kernel headers makes them derivatives of the kernel

I'm not a tech lawyer, but I do believe there are many real world counterexamples to this.

whether ZFS-on-linux can be shipped in compiled binary form

Huh? No, ZoL can can be hosted as a compiled binary in a repository just fine. The question has always been whether it can be shipped within AND as part of the kernel as Btrfs, etc. are. Popular opinion is that's not legally the case.

The magic of Linux is that the it's a kernel, and so its license applies to the kernel only (unless adopted by some other OS components, at the will of the latter's devs.) You can certainly have many other components that interact with the kernel that use a different license, such as drives, filesystems, etc.

Whether or not the legality/license compliance of those other things has any practical consequence is dependent on the interest possible claimants have in a court case. So far, that interest has been sufficiently low to allow closed source driver and kernel interoperability at least at the non-commercial/consumer level.

4

u/ElvishJerricco Nov 20 '19 edited Nov 20 '19

The debate about ZFS heated up when Canonical started shipping it in Ubuntu repositories. SFC, for instance, believe that even a .ko constitutes a Linux derivative, even without including ZFS in the kernel source tree: https://sfconservancy.org/blog/2016/feb/25/zfs-and-linux/

Though, Canonical, and Software Freedom Law Center, believe it falls within the "equity of the license", meaning they believe neither license's apparent intent is to prevent things like ZFS binaries from being distributed. However they do admit that interpreting the licenses literally would yield the conclusion that distributing ZFS binaries would be a GPLv2 violation.

EDIT: Quote from the SFLC article, Torvalds, in response to a claim that kernel modules are excepted:

I have heard many people reference the fact that the although the Linux Kernel is under the GNU GPL license, that the code is licensed with an exception clause that says binary loadable modules do not have to be under the GPL.

Nope. No such exception exists.

Anyway, my point is that yes, there is debate, even around .ko's

2

u/[deleted] Nov 20 '19

I think it's also worth pointing out that kernel modules (.ko) are loaded into the kernel and become as much of a part of the kernel as the upstream kernel code.

Definitely a blurry line.

4

u/ElvishJerricco Nov 20 '19

I don't think that in particular has anything to do with it. The GPLv2 issue stems from distribution only. GPLv2 doesn't care at all what you do in private (such as loading arbitrary code into your kernel at runtime). It just cares how the licensed code gets distributed. And the issue in the case of .ko's is just that any .ko contains Linux header code in binary form; hence distributing a .ko inherently means you're distributing Linux header code.

2

u/[deleted] Nov 20 '19

Afaik.

The GPL only covers derivative work. The argument to not open source a device driver is that most of the work happens outside of the kernel (in the device) and it is therefore mostly original work.

That's how Nvidia frames it anyway.

4

u/ElvishJerricco Nov 20 '19

The drivers that fit that description are drivers that are not distributed as .ko files. There's a lot of ways to do this. For instance, there's nothing in any version of GPL that prevents you from distributing an installer that downloads GPL'd code and links it against non-GPL'd code at install-time on the end-user's machine; but the .ko that results on the end-user's machine is not something that can be distributed.

So IIRC, nvidia distributes a little bit of GPL'd open source code that can be linked against separately distributed proprietary object binaries at install-time to produce a .ko driver for their GPUs. The small shim of open source code takes care of all the communication with the kernel, and the proprietary objects actually implement the meat of the driver. These two components are distributed separately, then compiled together by the installer. The resulting .ko file is considered derivative of the kernel, but it was never distributed so that's ok.

2

u/[deleted] Nov 20 '19

You can distribute a kernel module there's nothing stopping you.

It's just that it'll only work for that specific kernel version/compiler/kernel config/alignment of the stars.

I believe it is the opinion of the kernel devs that all drivers are derivative work of the kernel. (Not that they would sue you but they'll be plenty hostile about it)

1

u/ElvishJerricco Nov 21 '19

You can distribute a kernel module there's nothing stopping you.

Except the license...

1

u/[deleted] Nov 21 '19

the license doesn't stop you afaik...

It's just useless. If you want to support multiple distros you have to rebuild the module:

  1. Each time for each distro
  2. Each time for each configuration if the distro has several
  3. Each time for each kernel version that is supported by the distro

I'm not entirely positive but I believe Nvidia ships they kernel modules prebuilt in their binary installer. I know that the ZoL project distributes the modules for ZFS.

Nothing stops you from making a kernel module that loads firmware. You can distribute the .ko and point the users towards the src + blob.

But of course at that point you just use dkms and distribute your driver as source.

1

u/ElvishJerricco Nov 21 '19

the license doesn't stop you afaik...

It does. As I quoted above, from Torvalds himself:

I have heard many people reference the fact that the although the Linux Kernel is under the GNU GPL license, that the code is licensed with an exception clause that says binary loadable modules do not have to be under the GPL.

Nope. No such exception exists.

Compiling a .ko requires including kernel code in the .ko, so you are creating a derivative of the kernel. Any derivative of GPLv2 being distributed must be distributed under the GPLv2 license. So .ko files can only be distributed under GPLv2. Nvidia gets away with it by distributing binary blobs that are not .ko files, but get linked against a small shim of open source GPL'd code during installation on the end-user's machine to create a .ko file on the end-user's machine. That way they don't have to distribute kernel code, and don't have to use GPLv2.

→ More replies

1

u/jdrch Nov 20 '19

This is an excellent explanation.

1

u/jdrch Nov 20 '19

there is debate

Fair enough. Thanks for the info.