All of lore.kernel.org
 help / color / mirror / Atom feed
* [kernel-hardening] Proposal for kernel self protection features
@ 2015-11-06 22:55 Emese Revfy
  2015-11-06 23:30 ` [kernel-hardening] " Kees Cook
  2016-01-19 18:11 ` Kees Cook
  0 siblings, 2 replies; 45+ messages in thread
From: Emese Revfy @ 2015-11-06 22:55 UTC (permalink / raw)
  To: kernel-hardening; +Cc: pageexec, spender, keescook, gregkh

Hi,

My name is Emese Revfy, the author of the size_overflow, initify gcc plugin
and the original creator of the constify gcc plugin in grsecurity/PaX.

I'm very happy about this Kernel Self Protection Project and
I'd like to take part in it. I can do the following tasks:
 * gcc plugin infrastructure
 * size_overflow: Briefly about the plugin, it recomputes expressions
    that are marked by a size_overflow attribute or which are in the hash table
    with double integer precision. The recomputed expression is checked against
    TYPE_MIN/TYPE_MAX in the end and during some casts.
    It needs three hash tables:
    * size_overflow_hash: This hash table stores functions, function pointers,
       structure fields and variable declarations for the size_overflow
       duplication. It must be regenerated for every kernel version.
    * disable_size_overflow_hash: We ignore (don't instrument) the functions
       in this hash table.
    * size_overflow_hash_aux: For out-of-tree modules.
    The non-public version of the plugin also supports LTO so when the kernel
    will support LTO then hash tables will no longer be needed.
    There are three kinds of false positives that are caused by:
       * the developers: some code uses integer overflow for no reason.
          These can be fixed in the source code.
       * the developers intentionally: usually in the net part of the
          kernel (counters etc.). We use an gcc attribute (intentional_overflow)
          to ignore these functions.
       * gcc intentional overflow: gcc computes some expressions by overflow
          when it optimizes. Sadly it is doing this in the front end where
          there is no plugin support. Most of these false positives I handle
          from the plugin or sometimes I patch the kernel source code.
          There are some unsolved issues.
    You can read more about the plugin:
    https://forums.grsecurity.net/viewtopic.php?f=7&t=3043
    This is a complex plugin and it has false positives but it also found
    a lot of bugs (overflows, underflows and trunctions) and
    thanks to the data flow duplication it has a small performance impact only.
    I know that I will have to adapt it to be suitable for vanilla.
 * constify: This plugin constifies all structure types which contain only
    function pointers or are explicitly marked for constification.
    If some code wants to modify a read-only object it will cause
    a compile error.
    There are two gcc attributes:
       * no_const: if we don't want constification
       * do_const: if we want to constify a structure type which has a
          non-function pointer field
 * latent_entropy: This plugin generates some entropy from program state
    throughout the uptime of the kernel. It has small performance loss.
    The plugin uses an attribute which can be
    on a function (to extract entropy beyond init functions) or on a
    variable (to initialize it with a random number generated at compile time)
 * structleak: This plugin forcibly initializes certain local variables
    based on the __user attribute that could otherwise leak kernel stack
    to userland if they aren't properly initialized by later code.
    It has small performance loss.
 * colorize: This plugin is just for fun, it isn't a security related plugin.
    If the gcc version doesn't support colors (before gcc-4.9) then
    it colorizes the compiler output.
 * initify: This plugin isn't security related either.
    It moves string constants (__func__ and function string arguments
    marked by the nocapture attribute) only referenced in
    __init/__exit functions to __initconst/__exitconst sections.
    It reduces memory usage (many kB), I think it may be important for
    embedded systems.

I think the first plugin can be a simpler plugin e.g., constify or latent_entry.
Please let me know if you want one, more or all of them.

--
Emese

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

end of thread, other threads:[~2016-01-19 23:08 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-06 22:55 [kernel-hardening] Proposal for kernel self protection features Emese Revfy
2015-11-06 23:30 ` [kernel-hardening] " Kees Cook
2015-11-07  0:25   ` Josh Triplett
2015-11-07  2:46     ` Greg KH
2015-11-07  4:16       ` Kees Cook
2015-11-07  5:42         ` Josh Triplett
2015-11-07 22:07           ` Emese Revfy
2015-11-08  8:21             ` Josh Triplett
2015-11-08 11:28               ` Emese Revfy
2015-11-08  9:27           ` Alyssa Milburn
2015-11-08 14:09             ` PaX Team
2015-11-07 21:58       ` Emese Revfy
2015-11-08  9:58         ` David Sterba
2015-11-08 17:15         ` Greg KH
2015-11-07 12:41     ` Ard Biesheuvel
2015-11-08 10:09       ` Mathias Krause
2015-11-07 21:42     ` Emese Revfy
2015-11-08  8:37       ` Josh Triplett
2015-11-07 21:34   ` Emese Revfy
2015-11-08  6:40     ` Kees Cook
2015-11-11 13:32     ` Paolo Bonzini
2015-11-12 12:22       ` PaX Team
2015-11-12 12:36         ` Paolo Bonzini
2015-11-13  2:08           ` Emese Revfy
2015-11-08 13:13   ` PaX Team
2015-11-09 18:07     ` Laura Abbott
2015-11-09 18:28       ` Jason Cooper
2015-11-09 18:33         ` Jason Cooper
2015-11-09 18:57         ` Valdis.Kletnieks
2015-11-09 19:02           ` Jason Cooper
2015-11-09 19:11             ` Theodore Tso
2015-11-09 20:06               ` Josh Triplett
2015-11-09 21:07                 ` Jason Cooper
2015-11-09 21:09               ` Jason Cooper
2015-11-09 21:13                 ` Matthew Garrett
2015-11-10 10:42                   ` Yves-Alexis Perez
2015-11-10 10:47                     ` Marcus Meissner
2015-11-10 11:24                       ` Yves-Alexis Perez
2015-11-09 18:32       ` Theodore Tso
2015-11-11  3:41       ` PaX Team
2015-11-09 21:52     ` Kees Cook
2015-11-09 23:09       ` PaX Team
2016-01-19 18:11 ` Kees Cook
2016-01-19 21:20   ` Emese Revfy
2016-01-19 23:08     ` Kees Cook

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.