All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Marek <mmarek@suse.com>
To: Emese Revfy <re.emese@gmail.com>
Cc: linux-kbuild@vger.kernel.org, pageexec@freemail.hu,
	spender@grsecurity.net, kernel-hardening@lists.openwall.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
Subject: [kernel-hardening] Re: [PATCH v8 2/4] GCC plugin infrastructure
Date: Tue, 17 May 2016 16:28:05 +0200	[thread overview]
Message-ID: <573B2A75.9030603@suse.com> (raw)
In-Reply-To: <20160513015725.30223ee16a2a3860b4392b90@gmail.com>

Dne 13.5.2016 v 01:57 Emese Revfy napsal(a):
> --- /dev/null
> +++ b/scripts/Makefile.gcc-plugins
> @@ -0,0 +1,21 @@
> +ifdef CONFIG_GCC_PLUGINS
> +  __PLUGINCC := $(call cc-ifversion, -ge, 0408, $(HOSTCXX), $(HOSTCC))
> +  PLUGINCC := $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-plugin.sh "$(__PLUGINCC)" "$(HOSTCXX)" "$(CC)")
> +
> +  GCC_PLUGINS_CFLAGS := $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y))
> +
> +  ifeq ($(PLUGINCC),)
> +    ifneq ($(GCC_PLUGINS_CFLAGS),)
> +      ifeq ($(call cc-ifversion, -ge, 0405, y), y)
> +        PLUGINCC := $(shell $(CO, NFIG_SHELL) -x $(srctree)/scripts/gcc-plugin.sh "$(__PLUGINCC)" "$(HOSTCXX)" "$(CC)")
> +        $(error error, your gcc installation does not support plugins, perhaps the necessary headers are missing?)
> +      else
> +        $(error error, your gcc version does not support plugins, you should upgrade it to gcc 4.5 at least)
> +      endif
> +    endif
> +  endif
> +
> +  KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
> +  GCC_PLUGIN := $(gcc-plugin-y)
> +
> +endif

Hi Emese,

sorry for the late feedback. A problem I ran into now is that if you
have a compiler that is either too old or built with plugin support
disabled, scripts/Makefile.gcc-plugins errors out immediately. This is
going to be an issue with allmodconfig/allyesconfig test builds. A
solution would either be to make the respective options depend on
!COMPILE_TEST, or turn the errors into warnings and do nothing if the
compiler lacks plugin support. We are handling CONFIG_CC_STACKPROTECTOR
on x86 this way already.

Michal

WARNING: multiple messages have this Message-ID (diff)
From: Michal Marek <mmarek@suse.com>
To: Emese Revfy <re.emese@gmail.com>
Cc: linux-kbuild@vger.kernel.org, pageexec@freemail.hu,
	spender@grsecurity.net, kernel-hardening@lists.openwall.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
Subject: Re: [PATCH v8 2/4] GCC plugin infrastructure
Date: Tue, 17 May 2016 16:28:05 +0200	[thread overview]
Message-ID: <573B2A75.9030603@suse.com> (raw)
In-Reply-To: <20160513015725.30223ee16a2a3860b4392b90@gmail.com>

Dne 13.5.2016 v 01:57 Emese Revfy napsal(a):
> --- /dev/null
> +++ b/scripts/Makefile.gcc-plugins
> @@ -0,0 +1,21 @@
> +ifdef CONFIG_GCC_PLUGINS
> +  __PLUGINCC := $(call cc-ifversion, -ge, 0408, $(HOSTCXX), $(HOSTCC))
> +  PLUGINCC := $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-plugin.sh "$(__PLUGINCC)" "$(HOSTCXX)" "$(CC)")
> +
> +  GCC_PLUGINS_CFLAGS := $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y))
> +
> +  ifeq ($(PLUGINCC),)
> +    ifneq ($(GCC_PLUGINS_CFLAGS),)
> +      ifeq ($(call cc-ifversion, -ge, 0405, y), y)
> +        PLUGINCC := $(shell $(CO, NFIG_SHELL) -x $(srctree)/scripts/gcc-plugin.sh "$(__PLUGINCC)" "$(HOSTCXX)" "$(CC)")
> +        $(error error, your gcc installation does not support plugins, perhaps the necessary headers are missing?)
> +      else
> +        $(error error, your gcc version does not support plugins, you should upgrade it to gcc 4.5 at least)
> +      endif
> +    endif
> +  endif
> +
> +  KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
> +  GCC_PLUGIN := $(gcc-plugin-y)
> +
> +endif

Hi Emese,

sorry for the late feedback. A problem I ran into now is that if you
have a compiler that is either too old or built with plugin support
disabled, scripts/Makefile.gcc-plugins errors out immediately. This is
going to be an issue with allmodconfig/allyesconfig test builds. A
solution would either be to make the respective options depend on
!COMPILE_TEST, or turn the errors into warnings and do nothing if the
compiler lacks plugin support. We are handling CONFIG_CC_STACKPROTECTOR
on x86 this way already.

Michal

  reply	other threads:[~2016-05-17 14:28 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-12 23:54 [kernel-hardening] [PATCH v8 0/4] Introduce GCC plugin infrastructure Emese Revfy
2016-05-12 23:54 ` Emese Revfy
2016-05-12 23:56 ` [kernel-hardening] [PATCH v8 1/4] Shared library support Emese Revfy
2016-05-12 23:56   ` Emese Revfy
2016-05-12 23:57 ` [kernel-hardening] [PATCH v8 2/4] GCC plugin infrastructure Emese Revfy
2016-05-12 23:57   ` Emese Revfy
2016-05-17 14:28   ` Michal Marek [this message]
2016-05-17 14:28     ` Michal Marek
2016-05-18 10:56     ` [kernel-hardening] " Emese Revfy
2016-05-18 10:56       ` Emese Revfy
2016-05-18  8:51   ` [kernel-hardening] " Andrew Donnellan
2016-05-18 10:33     ` 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-12 23:58 ` [kernel-hardening] [PATCH v8 3/4] Add Cyclomatic complexity GCC plugin Emese Revfy
2016-05-12 23:58   ` Emese Revfy
2016-05-18  8:25   ` [kernel-hardening] " Andrew Donnellan
2016-05-18 10:53     ` Emese Revfy
2016-05-12 23:59 ` [kernel-hardening] [PATCH v8 4/4] Add sancov plugin Emese Revfy
2016-05-12 23:59   ` 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=573B2A75.9030603@suse.com \
    --to=mmarek@suse.com \
    --cc=david.brown@linaro.org \
    --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=pageexec@freemail.hu \
    --cc=re.emese@gmail.com \
    --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.