kernel-hardening.lists.openwall.com archive mirror
 help / color / mirror / Atom feed
* [kernel-hardening] [PATCH] Add support for complex gcc plugins that don't fit in a single file
@ 2016-06-26 15:38 Emese Revfy
  2016-07-06 18:56 ` [kernel-hardening] " Kees Cook
  0 siblings, 1 reply; 2+ messages in thread
From: Emese Revfy @ 2016-06-26 15:38 UTC (permalink / raw)
  To: keescook; +Cc: mmarek, linux-kbuild, kernel-hardening, pageexec


Reported-by: PaX Team <pageexec@freemail.hu>
Signed-off-by: Emese Revfy <re.emese@gmail.com>
---
 scripts/Makefile.gcc-plugins | 3 ++-
 scripts/gcc-plugins/Makefile | 9 ++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/scripts/Makefile.gcc-plugins b/scripts/Makefile.gcc-plugins
index 61fc4bb..1f922df 100644
--- a/scripts/Makefile.gcc-plugins
+++ b/scripts/Makefile.gcc-plugins
@@ -27,7 +27,7 @@ ifdef CONFIG_GCC_PLUGINS
 
   GCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y))
 
-  export PLUGINCC GCC_PLUGINS_CFLAGS GCC_PLUGIN SANCOV_PLUGIN DISABLE_LATENT_ENTROPY_PLUGIN
+  export PLUGINCC GCC_PLUGINS_CFLAGS GCC_PLUGIN GCC_PLUGIN_SUBDIR SANCOV_PLUGIN DISABLE_LATENT_ENTROPY_PLUGIN
 
   ifneq ($(PLUGINCC),)
     # SANCOV_PLUGIN can be only in CFLAGS_KCOV because avoid duplication.
@@ -36,6 +36,7 @@ ifdef CONFIG_GCC_PLUGINS
 
   KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
   GCC_PLUGIN := $(gcc-plugin-y)
+  GCC_PLUGIN_SUBDIR := $(gcc-plugin-subdir-y)
 endif
 
 # If plugins aren't supported, abort the build before hard-to-read compiler
diff --git a/scripts/gcc-plugins/Makefile b/scripts/gcc-plugins/Makefile
index 898449d..94fa139 100644
--- a/scripts/gcc-plugins/Makefile
+++ b/scripts/gcc-plugins/Makefile
@@ -12,14 +12,17 @@ else
   export HOST_EXTRACXXFLAGS
 endif
 
-export GCCPLUGINS_DIR HOSTLIBS
-
 ifneq ($(CFLAGS_KCOV), $(SANCOV_PLUGIN))
   GCC_PLUGIN := $(filter-out $(SANCOV_PLUGIN), $(GCC_PLUGIN))
 endif
 
-$(HOSTLIBS)-y := $(GCC_PLUGIN)
+export HOSTLIBS
+
+$(HOSTLIBS)-y := $(foreach p,$(GCC_PLUGIN),$(if $(findstring /,$(p)),,$(p)))
 always := $($(HOSTLIBS)-y)
 $(foreach p,$($(HOSTLIBS)-y:%.so=%),$(eval $(p)-objs := $(p).o))
 
+subdir-y := $(GCC_PLUGIN_SUBDIR)
+subdir-  += $(GCC_PLUGIN_SUBDIR)
+
 clean-files += *.so
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [kernel-hardening] Re: [PATCH] Add support for complex gcc plugins that don't fit in a single file
  2016-06-26 15:38 [kernel-hardening] [PATCH] Add support for complex gcc plugins that don't fit in a single file Emese Revfy
@ 2016-07-06 18:56 ` Kees Cook
  0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2016-07-06 18:56 UTC (permalink / raw)
  To: Emese Revfy; +Cc: Michal Marek, linux-kbuild, kernel-hardening, PaX Team

On Sun, Jun 26, 2016 at 11:38 AM, Emese Revfy <re.emese@gmail.com> wrote:
>
> Reported-by: PaX Team <pageexec@freemail.hu>
> Signed-off-by: Emese Revfy <re.emese@gmail.com>

I've added a commit message body to this and applied it to my tree
(though nothing uses it yet...)

-Kees

> ---
>  scripts/Makefile.gcc-plugins | 3 ++-
>  scripts/gcc-plugins/Makefile | 9 ++++++---
>  2 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/Makefile.gcc-plugins b/scripts/Makefile.gcc-plugins
> index 61fc4bb..1f922df 100644
> --- a/scripts/Makefile.gcc-plugins
> +++ b/scripts/Makefile.gcc-plugins
> @@ -27,7 +27,7 @@ ifdef CONFIG_GCC_PLUGINS
>
>    GCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y))
>
> -  export PLUGINCC GCC_PLUGINS_CFLAGS GCC_PLUGIN SANCOV_PLUGIN DISABLE_LATENT_ENTROPY_PLUGIN
> +  export PLUGINCC GCC_PLUGINS_CFLAGS GCC_PLUGIN GCC_PLUGIN_SUBDIR SANCOV_PLUGIN DISABLE_LATENT_ENTROPY_PLUGIN
>
>    ifneq ($(PLUGINCC),)
>      # SANCOV_PLUGIN can be only in CFLAGS_KCOV because avoid duplication.
> @@ -36,6 +36,7 @@ ifdef CONFIG_GCC_PLUGINS
>
>    KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
>    GCC_PLUGIN := $(gcc-plugin-y)
> +  GCC_PLUGIN_SUBDIR := $(gcc-plugin-subdir-y)
>  endif
>
>  # If plugins aren't supported, abort the build before hard-to-read compiler
> diff --git a/scripts/gcc-plugins/Makefile b/scripts/gcc-plugins/Makefile
> index 898449d..94fa139 100644
> --- a/scripts/gcc-plugins/Makefile
> +++ b/scripts/gcc-plugins/Makefile
> @@ -12,14 +12,17 @@ else
>    export HOST_EXTRACXXFLAGS
>  endif
>
> -export GCCPLUGINS_DIR HOSTLIBS
> -
>  ifneq ($(CFLAGS_KCOV), $(SANCOV_PLUGIN))
>    GCC_PLUGIN := $(filter-out $(SANCOV_PLUGIN), $(GCC_PLUGIN))
>  endif
>
> -$(HOSTLIBS)-y := $(GCC_PLUGIN)
> +export HOSTLIBS
> +
> +$(HOSTLIBS)-y := $(foreach p,$(GCC_PLUGIN),$(if $(findstring /,$(p)),,$(p)))
>  always := $($(HOSTLIBS)-y)
>  $(foreach p,$($(HOSTLIBS)-y:%.so=%),$(eval $(p)-objs := $(p).o))
>
> +subdir-y := $(GCC_PLUGIN_SUBDIR)
> +subdir-  += $(GCC_PLUGIN_SUBDIR)
> +
>  clean-files += *.so
> --
> 2.8.1



-- 
Kees Cook
Chrome OS & Brillo Security

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-07-06 18:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-26 15:38 [kernel-hardening] [PATCH] Add support for complex gcc plugins that don't fit in a single file Emese Revfy
2016-07-06 18:56 ` [kernel-hardening] " Kees Cook

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).