diff mbox

[kernel-hardening,v5,2/5] GCC plugin infrastructure

Message ID 20160309090115.GA6964@davidb.org (mailing list archive)
State New, archived
Headers show

Commit Message

David Brown March 9, 2016, 9:01 a.m. UTC
On Mon, Mar 07, 2016 at 12:04:27AM +0100, 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 but
>currently only the x86 architecture enables plugins.

I've tested this with both ARM and ARM64.  There are some missing
headers in the arm64 gcc, reported here:
https://bugs.linaro.org/show_bug.cgi?id=2123 (also upstream), but this
should work once that is fixed.

Feel free to fold these into your patch, or, if you prefer, I can send
out separate patches for them.

Signed-off-by: David Brown <david.brown@linaro.org>

Comments

Kees Cook March 9, 2016, 8:50 p.m. UTC | #1
On Wed, Mar 9, 2016 at 1:01 AM, David Brown <david.brown@linaro.org> wrote:
> On Mon, Mar 07, 2016 at 12:04:27AM +0100, 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 but
>> currently only the x86 architecture enables plugins.
>
>
> I've tested this with both ARM and ARM64.  There are some missing
> headers in the arm64 gcc, reported here:
> https://bugs.linaro.org/show_bug.cgi?id=2123 (also upstream), but this
> should work once that is fixed.
>
> Feel free to fold these into your patch, or, if you prefer, I can send
> out separate patches for them.

Ah-ha, great! Thanks for testing!

Emese, if you're not interested in carrying this, I can add it to my tree.

-Kees

>
> Signed-off-by: David Brown <david.brown@linaro.org>
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 4f799e5..67ee8e3 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -54,6 +54,7 @@ config ARM
>         select HAVE_FUNCTION_GRAPH_TRACER if (!THUMB2_KERNEL)
>         select HAVE_FUNCTION_TRACER if (!XIP_KERNEL)
>         select HAVE_GENERIC_DMA_COHERENT
> +       select HAVE_GCC_PLUGINS
>         select HAVE_HW_BREAKPOINT if (PERF_EVENTS && (CPU_V6 || CPU_V6K ||
> CPU_V7))
>         select HAVE_IDE if PCI || ISA || PCMCIA
>         select HAVE_IRQ_TIME_ACCOUNTING
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 8cc6228..6d6e4f8 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -70,6 +70,7 @@ config ARM64
>         select HAVE_FTRACE_MCOUNT_RECORD
>         select HAVE_FUNCTION_TRACER
>         select HAVE_FUNCTION_GRAPH_TRACER
> +       select HAVE_GCC_PLUGINS
>         select HAVE_GENERIC_DMA_COHERENT
>         select HAVE_HW_BREAKPOINT if PERF_EVENTS
>         select HAVE_IRQ_TIME_ACCOUNTING
> --
Emese Revfy March 9, 2016, 10:03 p.m. UTC | #2
On Wed, 9 Mar 2016 02:01:15 -0700
David Brown <david.brown@linaro.org> wrote:

> Feel free to fold these into your patch, or, if you prefer, I can send
> out separate patches for them.

Thanks, I'll take it.
Emese Revfy March 9, 2016, 10:07 p.m. UTC | #3
On Wed, 9 Mar 2016 12:50:26 -0800
Kees Cook <keescook@chromium.org> wrote:

> > Feel free to fold these into your patch, or, if you prefer, I can send
> > out separate patches for them.
> 
> Ah-ha, great! Thanks for testing!
> 
> Emese, if you're not interested in carrying this, I can add it to my tree.

I think it is easier if it is in my patch set.
diff mbox

Patch

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 4f799e5..67ee8e3 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -54,6 +54,7 @@  config ARM
 	select HAVE_FUNCTION_GRAPH_TRACER if (!THUMB2_KERNEL)
 	select HAVE_FUNCTION_TRACER if (!XIP_KERNEL)
 	select HAVE_GENERIC_DMA_COHERENT
+	select HAVE_GCC_PLUGINS
 	select HAVE_HW_BREAKPOINT if (PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7))
 	select HAVE_IDE if PCI || ISA || PCMCIA
 	select HAVE_IRQ_TIME_ACCOUNTING
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 8cc6228..6d6e4f8 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -70,6 +70,7 @@  config ARM64
 	select HAVE_FTRACE_MCOUNT_RECORD
 	select HAVE_FUNCTION_TRACER
 	select HAVE_FUNCTION_GRAPH_TRACER
+	select HAVE_GCC_PLUGINS
 	select HAVE_GENERIC_DMA_COHERENT
 	select HAVE_HW_BREAKPOINT if PERF_EVENTS
 	select HAVE_IRQ_TIME_ACCOUNTING