linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/3] Introduce the latent_entropy gcc plugin
@ 2016-05-23 22:14 Emese Revfy
  2016-05-23 22:15 ` [PATCH v1 1/3] Add " Emese Revfy
                   ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Emese Revfy @ 2016-05-23 22:14 UTC (permalink / raw)
  To: kernel-hardening
  Cc: pageexec, spender, mmarek, keescook, linux-kernel,
	yamada.masahiro, linux-kbuild, tytso, akpm, linux-mm, axboe,
	viro, paulmck, mingo, tglx, bart.vanassche, davem

I would like to introduce the latent_entropy gcc plugin. This plugin mitigates
the problem of the kernel having too little entropy during and after boot
for generating crypto keys.

This plugin mixes random values into the latent_entropy global variable
in functions marked by the __latent_entropy attribute.
The value of this global variable is added to the kernel entropy pool
to increase the entropy.

It is a CII project supported by the Linux Foundation.

The latent_entropy plugin was ported from grsecurity/PaX originally written by
the PaX Team. You can find more about the plugin here:
https://grsecurity.net/pipermail/grsecurity/2012-July/001093.html

The plugin supports all gcc version from 4.5 to 6.0.

I do some changes above the PaX version. The important one is mixing
the stack pointer into the global variable too.
You can find more about the changes here:
https://github.com/ephox-gcc-plugins/latent_entropy

This patch set is based on the "Introduce GCC plugin infrastructure" patch set (v9).

Emese Revfy (3):
 Add the latent_entropy gcc plugin
 Mark functions with the latent_entropy attribute
 Add the extra_latent_entropy kernel parameter

---
 Documentation/kernel-parameters.txt         |   5 +
 arch/Kconfig                                |  22 ++
 arch/powerpc/kernel/Makefile                |   8 +-
 block/blk-softirq.c                         |   2 +-
 drivers/char/random.c                       |   6 +-
 fs/namespace.c                              |   2 +-
 include/linux/compiler-gcc.h                |   5 +
 include/linux/compiler.h                    |   4 +
 include/linux/fdtable.h                     |   2 +-
 include/linux/genhd.h                       |   2 +-
 include/linux/init.h                        |  10 +-
 include/linux/random.h                      |  12 +-
 init/main.c                                 |   1 +
 kernel/fork.c                               |   5 +-
 kernel/rcu/tiny.c                           |   2 +-
 kernel/rcu/tree.c                           |   2 +-
 kernel/sched/fair.c                         |   2 +-
 kernel/softirq.c                            |   4 +-
 kernel/time/timer.c                         |   2 +-
 lib/irq_poll.c                              |   2 +-
 lib/random32.c                              |   2 +-
 mm/page_alloc.c                             |  28 ++
 net/core/dev.c                              |   4 +-
 scripts/Makefile.gcc-plugins                |  10 +-
 scripts/gcc-plugins/Makefile                |   1 +
 scripts/gcc-plugins/latent_entropy_plugin.c | 446 ++++++++++++++++++++++++++++
 26 files changed, 562 insertions(+), 29 deletions(-)

^ permalink raw reply	[flat|nested] 20+ messages in thread
* Re: [PATCH v1 1/3] Add the latent_entropy gcc plugin
@ 2016-05-29 17:59 Hector Martin
  2016-05-30  2:16 ` Kees Cook
  0 siblings, 1 reply; 20+ messages in thread
From: Hector Martin @ 2016-05-29 17:59 UTC (permalink / raw)
  To: re.emese; +Cc: kernel-hardening, LKML, keescook, spender, pageexec

On Mon, May 23, 2016 at 3:15 PM, Emese Revfy <re.emese@gmail.com> wrote:
> +/*
> + * Copyright 2012-2016 by the PaX Team <pageexec@freemail.hu>
> + * Copyright 2016 by Emese Revfy <re.emese@gmail.com>
> + * Licensed under the GPL v2
> + *
> + * Note: the choice of the license means that the compilation process is
> + *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
> + *       but for the kernel it doesn't matter since it doesn't link against
> + *       any of the gcc libraries
> + *
> + * gcc plugin to help generate a little bit of entropy from program state,
> + * used throughout the uptime of the kernel

The "Note" seems misleading. Since this is a GCC plugin, and directly
uses GCC's internal interfaces, doesn't that make it a derived work of
GCC, and thus, require that it be licensed under GPLv3 instead of GPLv2
(which is incompatible)?

AFAIK this is how the GPLv3 works in this context, and the GCC exception
doesn't change that because it only applies to libgcc and friends (and
does not weaken the default effects of the GPL over the rest of GCC). My
understanding is that the whole "eligible compilation" licensing hack
was designed to hinder non-linking proprietary compilation passes that
operate over data files containing an internal GCC representation, but
plain old loaded plugins still need to be GPLv3 regardless of whether
you link the end result to libgcc or not.

(Also, don't some arches link against libgcc, further complicating this?
Trying to use this compiler plugin with those arches would wind up with
non-redistributable kernels, this time due to the exception.)

-- 
Hector Martin (marcan@marcan.st)
Public Key: https://marcan.st/marcan.asc

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2016-05-31 17:25 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-23 22:14 [PATCH v1 0/3] Introduce the latent_entropy gcc plugin Emese Revfy
2016-05-23 22:15 ` [PATCH v1 1/3] Add " Emese Revfy
2016-05-24 17:32   ` Kees Cook
2016-05-24 21:23     ` Emese Revfy
2016-05-24 23:40     ` PaX Team
2016-05-25  2:55       ` Kees Cook
2016-05-30 22:39         ` Emese Revfy
2016-05-23 22:16 ` [PATCH v1 2/3] Mark functions with the latent_entropy attribute Emese Revfy
2016-05-24 17:16   ` Kees Cook
2016-05-24 20:45     ` Emese Revfy
2016-05-24 20:55       ` Kees Cook
2016-05-23 22:17 ` [PATCH v1 3/3] Add the extra_latent_entropy kernel parameter Emese Revfy
2016-05-24 17:09   ` Kees Cook
2016-05-24 20:29     ` Emese Revfy
2016-05-29 17:59 [PATCH v1 1/3] Add the latent_entropy gcc plugin Hector Martin
2016-05-30  2:16 ` Kees Cook
2016-05-30  3:46   ` Hector Martin "marcan"
2016-05-30 15:40     ` Kees Cook
2016-05-30 20:24       ` Hector Martin "marcan"
2016-05-31 17:25         ` Kees Cook

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).