linux-hardening.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.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>, Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH RFC] gcc-plugins: Handle GCC version mismatch for OOT modules
Date: Fri, 5 Mar 2021 00:35:44 +0900	[thread overview]
Message-ID: <CAK7LNAR0kNJ=DLuvRzRG+-rgMfcrSOZu8Mn6JBJ5do7TzJWLcA@mail.gmail.com> (raw)
In-Reply-To: <20210304150812.rzya7ewmerwhe4m4@treble>

On Fri, Mar 5, 2021 at 12:08 AM Josh Poimboeuf <jpoimboe@redhat.com> wrote:
>
> On Thu, Mar 04, 2021 at 09:27:28PM +0900, Masahiro Yamada wrote:
> > I agree with rebuilding GCC plugins when the compiler is upgraded
> > for *in-tree* building.
> > Linus had reported it a couple of months before,
> > and I just submitted a very easy fix.
>
> Hm?  So does that mean that a GCC version change won't trigger a
> tree-wide rebuild?  So you're asserting that a GCC mismatch is ok for
> in-tree code, but not for external modules???  That seems backwards.
>
> For in-tree, why not just rebuild the entire tree?  Some kernel features
> are dependent on compiler version or capability, so not rebuilding the
> tree could introduce silent breakage.



All the kernel-space objects are rebuilt
when the compiler is upgraded.
(See commit 8b59cd81dc5e724eaea283fa6006985891c7bff4)


Linus complaint about GCC plugins not being rebuilt.
                      ^^^^^^^^^^^

https://lore.kernel.org/lkml/CAHk-=wieoN5ttOy7SnsGwZv+Fni3R6m-Ut=oxih6bbZ28G+4dw@mail.gmail.com/


That is easy to fix. I submitted a patch:
https://patchwork.kernel.org/project/linux-kbuild/patch/20210304113708.215121-1-masahiroy@kernel.org/




> For external modules, a tree-wide rebuild isn't an option so the risk is
> assumed by the user.  I posted a patch earlier [1] which prints a
> warning if the compiler major/minor version changes with an external
> module build.
>
> [1] https://lkml.kernel.org/r/20210201211322.t2rxmvnrystc2ky7@treble
>
> > Rebuilding plugins for external modules is not easy;
> > plugins are placed in the read-only directory,
> > /usr/src/linux-headers-$(uname -r)/scripts/gcc-plugins/.
> >
> > The external modules must not (cannot) update in-tree
> > build artifacts.  "Rebuild" means creating copies in a different
> > writable directory.
> > Doing that requires a lot of design changes.
>
> Ok.  So it sounds like the best/easiest option is the original patch in
> this thread:  when building an external module with a GCC mismatch, just
> disable the GCC plugin, with a warning (or an error for randstruct).

It was rejected.


If a distribution wants to enable CONFIG_GCC_PLUGINS,
it must provide GCC whose version is the same as
used for building the kernel.

If a distribution cannot manage release in that way,
do not enable CONFIG_GCC_PLUGINS in the first place.




-- 
Best Regards
Masahiro Yamada

  reply	other threads:[~2021-03-04 15:38 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 [this message]
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
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='CAK7LNAR0kNJ=DLuvRzRG+-rgMfcrSOZu8Mn6JBJ5do7TzJWLcA@mail.gmail.com' \
    --to=masahiroy@kernel.org \
    --cc=fche@redhat.com \
    --cc=jforbes@redhat.com \
    --cc=jpoimboe@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.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).