All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
To: linuxppc-dev@lists.ozlabs.org,
	kernel-hardening@lists.openwall.com, keescook@chromium.org,
	re.emese@gmail.com
Cc: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org,
	pageexec@freemail.hu, spender@grsecurity.net, mmarek@suse.com
Subject: [PATCH 3/3] powerpc: enable support for GCC plugins
Date: Tue,  6 Dec 2016 17:28:00 +1100	[thread overview]
Message-ID: <20161206062800.21800-3-andrew.donnellan@au1.ibm.com> (raw)
In-Reply-To: <20161206062800.21800-1-andrew.donnellan@au1.ibm.com>

Enable support for GCC plugins on powerpc.

Add an additional version check in gcc-plugins-check to advise users to
upgrade to gcc 5.2+ on powerpc to avoid issues with header files (gcc <=
4.6) or missing copies of rs6000-cpus.def (4.8 to 5.1 on 64-bit targets).

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

---

Open to bikeshedding on the gcc version check.

Compile tested with all plugins enabled on gcc 4.6-6.2,
x86->ppc{32,64,64le} and 4.8-6.2 ppc64le->ppc{32,64,64le}. Thanks to
Chris Smart for help with this.

I think it's best to take this through powerpc#next with an ACK from
Kees/Emese?
---
 arch/powerpc/Kconfig         | 1 +
 scripts/Makefile.gcc-plugins | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 65fba4c..6efbc08 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -92,6 +92,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 VIRT_TO_BUS if !PPC64
 	select HAVE_IDE
diff --git a/scripts/Makefile.gcc-plugins b/scripts/Makefile.gcc-plugins
index 26c67b7..9835a75 100644
--- a/scripts/Makefile.gcc-plugins
+++ b/scripts/Makefile.gcc-plugins
@@ -47,6 +47,14 @@ gcc-plugins-check: FORCE
 ifdef CONFIG_GCC_PLUGINS
   ifeq ($(PLUGINCC),)
     ifneq ($(GCC_PLUGINS_CFLAGS),)
+      # Various gccs between 4.5 and 5.1 have bugs on powerpc due to missing
+      # header files. gcc <= 4.6 doesn't work at all, gccs from 4.8 to 5.1 have
+      # issues with 64-bit targets.
+      ifeq ($(ARCH),powerpc)
+        ifeq ($(call cc-ifversion, -le, 0501, y), y)
+	  @echo "Cannot use CONFIG_GCC_PLUGINS: plugin support on gcc <= 5.1 is buggy on powerpc, please upgrade to gcc 5.2 or newer" >&2 && exit 1
+        endif
+      endif
       ifeq ($(call cc-ifversion, -ge, 0405, y), y)
 	$(Q)$(srctree)/scripts/gcc-plugin.sh --show-error "$(__PLUGINCC)" "$(HOSTCXX)" "$(CC)" || true
 	@echo "Cannot use CONFIG_GCC_PLUGINS: your gcc installation does not support plugins, perhaps the necessary headers are missing?" >&2 && exit 1
-- 
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan@au1.ibm.com  IBM Australia Limited

WARNING: multiple messages have this Message-ID (diff)
From: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
To: linuxppc-dev@lists.ozlabs.org,
	kernel-hardening@lists.openwall.com, keescook@chromium.org,
	re.emese@gmail.com
Cc: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org,
	pageexec@freemail.hu, spender@grsecurity.net, mmarek@suse.com
Subject: [kernel-hardening] [PATCH 3/3] powerpc: enable support for GCC plugins
Date: Tue,  6 Dec 2016 17:28:00 +1100	[thread overview]
Message-ID: <20161206062800.21800-3-andrew.donnellan@au1.ibm.com> (raw)
In-Reply-To: <20161206062800.21800-1-andrew.donnellan@au1.ibm.com>

Enable support for GCC plugins on powerpc.

Add an additional version check in gcc-plugins-check to advise users to
upgrade to gcc 5.2+ on powerpc to avoid issues with header files (gcc <=
4.6) or missing copies of rs6000-cpus.def (4.8 to 5.1 on 64-bit targets).

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

---

Open to bikeshedding on the gcc version check.

Compile tested with all plugins enabled on gcc 4.6-6.2,
x86->ppc{32,64,64le} and 4.8-6.2 ppc64le->ppc{32,64,64le}. Thanks to
Chris Smart for help with this.

I think it's best to take this through powerpc#next with an ACK from
Kees/Emese?
---
 arch/powerpc/Kconfig         | 1 +
 scripts/Makefile.gcc-plugins | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 65fba4c..6efbc08 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -92,6 +92,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 VIRT_TO_BUS if !PPC64
 	select HAVE_IDE
diff --git a/scripts/Makefile.gcc-plugins b/scripts/Makefile.gcc-plugins
index 26c67b7..9835a75 100644
--- a/scripts/Makefile.gcc-plugins
+++ b/scripts/Makefile.gcc-plugins
@@ -47,6 +47,14 @@ gcc-plugins-check: FORCE
 ifdef CONFIG_GCC_PLUGINS
   ifeq ($(PLUGINCC),)
     ifneq ($(GCC_PLUGINS_CFLAGS),)
+      # Various gccs between 4.5 and 5.1 have bugs on powerpc due to missing
+      # header files. gcc <= 4.6 doesn't work at all, gccs from 4.8 to 5.1 have
+      # issues with 64-bit targets.
+      ifeq ($(ARCH),powerpc)
+        ifeq ($(call cc-ifversion, -le, 0501, y), y)
+	  @echo "Cannot use CONFIG_GCC_PLUGINS: plugin support on gcc <= 5.1 is buggy on powerpc, please upgrade to gcc 5.2 or newer" >&2 && exit 1
+        endif
+      endif
       ifeq ($(call cc-ifversion, -ge, 0405, y), y)
 	$(Q)$(srctree)/scripts/gcc-plugin.sh --show-error "$(__PLUGINCC)" "$(HOSTCXX)" "$(CC)" || true
 	@echo "Cannot use CONFIG_GCC_PLUGINS: your gcc installation does not support plugins, perhaps the necessary headers are missing?" >&2 && exit 1
-- 
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan@au1.ibm.com  IBM Australia Limited

  parent reply	other threads:[~2016-12-06  6:28 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-06  6:27 [PATCH 1/3] gcc-plugins: fix definition of DISABLE_LATENT_ENTROPY_PLUGIN Andrew Donnellan
2016-12-06  6:27 ` [kernel-hardening] " Andrew Donnellan
2016-12-06  6:27 ` [PATCH 2/3] powerpc: correctly disable latent entropy GCC plugin on prom_init.o Andrew Donnellan
2016-12-06  6:27   ` [kernel-hardening] " Andrew Donnellan
2016-12-06  6:28 ` Andrew Donnellan [this message]
2016-12-06  6:28   ` [kernel-hardening] [PATCH 3/3] powerpc: enable support for GCC plugins Andrew Donnellan
2016-12-06 20:40   ` Kees Cook
2016-12-06 20:40     ` [kernel-hardening] " Kees Cook
2016-12-06 20:40     ` Kees Cook
2016-12-07  1:05     ` [kernel-hardening] " Andrew Donnellan
2016-12-06 21:25   ` Emese Revfy
2016-12-06 21:25     ` [kernel-hardening] " Emese Revfy
2016-12-07  5:49     ` Andrew Donnellan
2016-12-07  5:49       ` [kernel-hardening] " Andrew Donnellan
2016-12-07  5:45   ` Andrew Donnellan
2016-12-07  5:45     ` [kernel-hardening] " Andrew Donnellan
2016-12-08 14:42   ` PaX Team
2016-12-08 14:42     ` [kernel-hardening] " PaX Team
2016-12-08 14:42     ` PaX Team
2016-12-08 18:06     ` Kees Cook
2016-12-08 18:06       ` [kernel-hardening] " Kees Cook
2016-12-08 18:06       ` Kees Cook
2016-12-09  2:48       ` Andrew Donnellan
2016-12-09  2:48         ` [kernel-hardening] " Andrew Donnellan
2016-12-09  2:48         ` Andrew Donnellan
2016-12-09 10:59         ` PaX Team
2016-12-09 10:59           ` [kernel-hardening] " PaX Team
2016-12-09 10:59           ` PaX Team
2016-12-09 10:59           ` PaX Team
2017-01-27  5:52           ` Andrew Donnellan
2017-01-27  5:52             ` [kernel-hardening] " Andrew Donnellan
2017-01-27  5:52             ` Andrew Donnellan
2017-01-27  5:55             ` Andrew Donnellan
2017-01-27  5:55               ` [kernel-hardening] " Andrew Donnellan
2017-01-27  5:55               ` Andrew Donnellan
2017-02-06 20:37 ` [1/3] gcc-plugins: fix definition of DISABLE_LATENT_ENTROPY_PLUGIN Michael Ellerman
2017-02-06 20:37   ` [kernel-hardening] " Michael Ellerman

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=20161206062800.21800-3-andrew.donnellan@au1.ibm.com \
    --to=andrew.donnellan@au1.ibm.com \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mmarek@suse.com \
    --cc=pageexec@freemail.hu \
    --cc=re.emese@gmail.com \
    --cc=spender@grsecurity.net \
    /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.