All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
To: kernel-hardening@lists.openwall.com, linux-kbuild@vger.kernel.org
Cc: pageexec@freemail.hu, spender@grsecurity.net, mmarek@suse.com,
	keescook@chromium.org, linux@rasmusvillemoes.dk,
	fengguang.wu@intel.com, dvyukov@google.com,
	linux-kernel@vger.kernel.org, david.brown@linaro.org,
	yamada.masahiro@socionext.com,
	linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Daniel Axtens <dja@axtens.net>
Subject: Re: [kernel-hardening] [PATCH v8 2/4] GCC plugin infrastructure
Date: Wed, 18 May 2016 18:51:10 +1000	[thread overview]
Message-ID: <573C2CFE.8060305@au1.ibm.com> (raw)
In-Reply-To: <20160513015725.30223ee16a2a3860b4392b90@gmail.com>

On 13/05/16 09:57, Emese Revfy wrote:
> This patch allows to build the whole kernel with GCC plugins. It was ported from
> grsecurity/PaX. The infrastructure supports building out-of-tree modules and
> building in a separate directory. Cross-compilation is supported too.
> Currently the x86, arm, arm64 and uml architectures enable plugins.
>
> The directory of the gcc plugins is scripts/gcc-plugins. You can use a file or a directory
> there. The plugins compile with these options:
>   * -fno-rtti: gcc is compiled with this option so the plugins must use it too
>   * -fno-exceptions: this is inherited from gcc too
>   * -fasynchronous-unwind-tables: this is inherited from gcc too
>   * -ggdb: it is useful for debugging a plugin (better backtrace on internal
>      errors)
>   * -Wno-narrowing: to suppress warnings from gcc headers (ipa-utils.h)
>   * -Wno-unused-variable: to suppress warnings from gcc headers (gcc_version
>      variable, plugin-version.h)
>
> The infrastructure introduces a new Makefile target called gcc-plugins. It
> supports all gcc versions from 4.5 to 6.0. The scripts/gcc-plugin.sh script
> chooses the proper host compiler (gcc-4.7 can be built by either gcc or g++).
> This script also checks the availability of the included headers in
> scripts/gcc-plugins/gcc-common.h.
>
> The gcc-common.h header contains frequently included headers for GCC plugins
> and it has a compatibility layer for the supported gcc versions.
>
> The gcc-generate-*-pass.h headers automatically generate the registration
> structures for GIMPLE, SIMPLE_IPA, IPA and RTL passes.
>
> Note that 'make clean' keeps the *.so files (only the distclean or mrproper
> targets clean all) because they are needed for out-of-tree modules.
>
> The arm and arm64 architectures were tested by David Brown <david.brown@linaro.org>.
>
> Signed-off-by: Emese Revfy <re.emese@gmail.com>

I've done some basic sanity testing on powerpc with the cyclomatic 
complexity plugin (with LE native + cross-compilers) and it seems to 
work with the patch below.

Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index a18a0dc..0cfed5b 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -97,6 +97,7 @@ config PPC
         select HAVE_DYNAMIC_FTRACE_WITH_REGS if MPROFILE_KERNEL
         select HAVE_FUNCTION_TRACER
         select HAVE_FUNCTION_GRAPH_TRACER
+       select HAVE_GCC_PLUGINS
         select SYSCTL_EXCEPTION_TRACE
         select ARCH_WANT_OPTIONAL_GPIOLIB
         select VIRT_TO_BUS if !PPC64

-- 
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan@au1.ibm.com  IBM Australia Limited

  parent reply	other threads:[~2016-05-18  8:54 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-12 23:54 [PATCH v8 0/4] Introduce GCC plugin infrastructure Emese Revfy
2016-05-12 23:54 ` [kernel-hardening] " Emese Revfy
2016-05-12 23:56 ` [PATCH v8 1/4] Shared library support Emese Revfy
2016-05-12 23:56   ` [kernel-hardening] " Emese Revfy
2016-05-12 23:57 ` [PATCH v8 2/4] GCC plugin infrastructure Emese Revfy
2016-05-12 23:57   ` [kernel-hardening] " Emese Revfy
2016-05-17 14:28   ` Michal Marek
2016-05-17 14:28     ` [kernel-hardening] " Michal Marek
2016-05-18 10:56     ` Emese Revfy
2016-05-18 10:56       ` [kernel-hardening] " Emese Revfy
2016-05-18  8:51   ` Andrew Donnellan [this message]
2016-05-18 10:33     ` [kernel-hardening] " Emese Revfy
2016-05-18 21:14       ` Andrew Donnellan
2016-05-19  6:22       ` Michael Ellerman
2016-05-19  6:30         ` Andrew Donnellan
2016-05-19  8:24         ` PaX Team
2016-05-19  8:24           ` PaX Team
2016-05-20  6:22           ` Andrew Donnellan
2016-05-20 10:10           ` Michael Ellerman
2016-05-20 10:10             ` Michael Ellerman
2016-05-12 23:58 ` [PATCH v8 3/4] Add Cyclomatic complexity GCC plugin Emese Revfy
2016-05-12 23:58   ` [kernel-hardening] " Emese Revfy
2016-05-18  8:25   ` Andrew Donnellan
2016-05-18 10:53     ` Emese Revfy
2016-05-12 23:59 ` [PATCH v8 4/4] Add sancov plugin Emese Revfy
2016-05-12 23:59   ` [kernel-hardening] " Emese Revfy

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=573C2CFE.8060305@au1.ibm.com \
    --to=andrew.donnellan@au1.ibm.com \
    --cc=david.brown@linaro.org \
    --cc=dja@axtens.net \
    --cc=dvyukov@google.com \
    --cc=fengguang.wu@intel.com \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mmarek@suse.com \
    --cc=mpe@ellerman.id.au \
    --cc=pageexec@freemail.hu \
    --cc=spender@grsecurity.net \
    --cc=yamada.masahiro@socionext.com \
    /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 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.