linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Michal Marek <michal.lkml@markovi.net>,
	linux-hardening@vger.kernel.org,
	Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Justin Forbes <jforbes@redhat.com>,
	Ondrej Mosnacek <omosnace@redhat.com>,
	Frank Eigler <fche@redhat.com>
Subject: Re: [PATCH RFC] gcc-plugins: Handle GCC version mismatch for OOT modules
Date: Wed, 3 Mar 2021 13:52:53 -0800	[thread overview]
Message-ID: <202103031334.8D898CA@keescook> (raw)
In-Reply-To: <CAHk-=whA6zru0BaNm4uu5KyZe+aQpRScOnmc9hdOpO3W+xN9Xw@mail.gmail.com>

On Wed, Mar 03, 2021 at 11:57:33AM -0800, Linus Torvalds wrote:
> End result: gcc plugins are pure garbage, and you should shun them. If

I think that's pretty harsh, but okay, opinions are opinions. As Josh
says, people are interested in them for not-uncommon real-world uses:

- stackleak has data-lifetime wiping coverage that -ftrivial-auto-var-init=zero
  for either Clang or GCC doesn't cover. There are no plans to provide
  such coverage under Clang yet. It's arguable that stackleak's benefits
  are smaller than it's maintenance burden compared to having
  -ftrivial-auto-var-init=zero, but we can have that conversation when
  we get there. :)

- structleak is likely to vanish as soon as GCC supports
  -ftrivial-auto-var-init=zero. Clang's implementation is done and in
  use by every Clang-built kernel I know of.

- latent_entropy is likely less useful since the jitter entropy was added,
  but I've not seen anyone analyze it. No "upstream" GCC nor Clang support
  is planned.

- arm32 per-task stack protector canary meaningfully reduces the risk of
  stack content exposures vs stack frame overwrites, but neither GCC
  nor Clang seem interested in implementing this "correctly" (as done
  for arm64 on GCC -- Clang doesn't have this for arm64 yet). I want this
  fixed for arm64 on Clang, and maybe arm32 can be done at the same time.

- randstruct is likely not used for distro kernels, but very much for
  end users where security has a giant priority over performance.
  There's no "upstream" GCC plan for this, and the Clang support has
  stalled.

> you really believe you need compiler plugins, you should look at
> clang.

This is currently true only in 1 case (structleak), and only a few
"traditional" distros are building the kernel with Clang right now. I
don't disagree: doing this via LLVM IR would be much easier, but the
implementations for the other above features don't exist yet. I expect
this to change over time (I expect Clang's randstruct and GCC's
-ftrivial-auto-var-init=zero to likely be the next two things to
appear), but it's not the case right now.

-- 
Kees Cook

  parent reply	other threads:[~2021-03-04  0:13 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25 20:42 [PATCH RFC] gcc-plugins: Handle GCC version mismatch for OOT modules Josh Poimboeuf
2021-01-25 21:16 ` Masahiro Yamada
2021-01-25 21:27   ` Josh Poimboeuf
2021-01-25 21:44     ` Masahiro Yamada
2021-01-25 22:07       ` Josh Poimboeuf
2021-01-26  8:13         ` Greg KH
2021-01-26 12:44           ` Justin Forbes
2021-01-26 13:51             ` Greg KH
2021-01-26 14:51               ` Josh Poimboeuf
2021-01-26 15:00                 ` Greg KH
2021-01-26 15:15                 ` Peter Zijlstra
2021-01-26 15:46                   ` Josh Poimboeuf
2021-01-26 16:05                     ` Peter Zijlstra
2021-01-26 16:15                       ` Justin Forbes
2021-01-26 16:19                         ` Josh Poimboeuf
2021-01-26 17:06                           ` Greg KH
2021-01-26 17:47                             ` Justin Forbes
2021-01-26 16:22                       ` David Laight
2021-01-27 18:03             ` Christoph Hellwig
2021-01-26  8:12     ` Greg KH
2021-01-25 22:03 ` Kees Cook
2021-01-25 22:19   ` Josh Poimboeuf
2021-01-26 17:56     ` Kees Cook
2021-01-26 18:43       ` Josh Poimboeuf
2021-01-26 22:59         ` Kees Cook
2021-01-26 23:32           ` Josh Poimboeuf
2021-01-26  1:53   ` Masahiro Yamada
2021-01-26 12:16     ` David Laight
2021-01-27 18:02 ` Christoph Hellwig
2021-01-27 18:38   ` Josh Poimboeuf
2021-01-27 18:43     ` Christoph Hellwig
2021-01-27 18:51       ` Josh Poimboeuf
2021-01-27 22:09         ` David Laight
2021-01-28 14:29         ` Christoph Hellwig
2021-01-28 15:45           ` Josh Poimboeuf
2021-03-02 23:26 ` Josh Poimboeuf
2021-03-03 18:49   ` Masahiro Yamada
2021-03-03 19:15     ` Josh Poimboeuf
2021-03-03 19:25       ` Linus Torvalds
2021-03-03 19:38         ` Josh Poimboeuf
2021-03-03 19:57           ` Linus Torvalds
2021-03-03 20:24             ` Josh Poimboeuf
2021-03-03 20:31               ` Josh Poimboeuf
2021-03-03 20:56               ` Linus Torvalds
2021-03-03 21:45                 ` Josh Poimboeuf
2021-03-04 12:27                   ` Masahiro Yamada
2021-03-04 15:08                     ` Josh Poimboeuf
2021-03-04 15:35                       ` Masahiro Yamada
2021-03-04 19:12                         ` Linus Torvalds
2021-03-05  2:41                           ` Josh Poimboeuf
2021-03-05  2:49                             ` Linus Torvalds
2021-03-05 16:03                             ` Masahiro Yamada
2021-03-05 19:18                               ` Josh Poimboeuf
2021-03-08  9:39                                 ` David Laight
2021-03-05 15:31                           ` Masahiro Yamada
2021-03-03 21:52             ` Kees Cook [this message]
2021-03-04 12:26       ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202103031334.8D898CA@keescook \
    --to=keescook@chromium.org \
    --cc=fche@redhat.com \
    --cc=jforbes@redhat.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=omosnace@redhat.com \
    --cc=peterz@infradead.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).