kernel-hardening.lists.openwall.com archive mirror
 help / color / mirror / Atom feed
* [kernel-hardening] [PATCH 0/3] Introduce GCC plugin infrastructure
@ 2016-02-07 21:27 Emese Revfy
  2016-02-07 21:28 ` [kernel-hardening] [PATCH 1/3] " Emese Revfy
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Emese Revfy @ 2016-02-07 21:27 UTC (permalink / raw)
  To: linux-kbuild; +Cc: pageexec, spender, kernel-hardening, mmarek, keescook

This patch set introduce the GCC plugin infrastructure with examples for testing
and documentation.

GCC plugins are loadable modules that provide extra features to the compiler.
They are useful for runtime instrumentation and static analysis.

The infrastructure supports all gcc versions from 4.5 to 6.0, building
out-of-tree modules and building in a separate directory. Cross-compilation
is supported too but currently only the x86 architecture enables plugins.

This infrastructure was ported from grsecurity/PaX. It is a CII project
supported by the Linux Foundation.

Emese Revfy (3):
 GCC plugin infrastructure
 Add Cyclomatic complexity plugin
 Documentations of the GCC plugin infrastructre

---
 Documentation/dontdiff             |   1 +
 Documentation/example_gcc_plugin.c | 103 +++++
 Documentation/gcc-plugins.txt      |  76 ++++
 Makefile                           |  70 +++-
 arch/Kconfig                       |  26 ++
 arch/x86/Kconfig                   |   1 +
 init/Makefile                      |   3 +
 scripts/Makefile.build             |   2 +-
 scripts/Makefile.clean             |   3 +-
 scripts/Makefile.host              |  69 +++-
 scripts/gcc-plugin.sh              |  51 +++
 scripts/link-vmlinux.sh            |   2 +-
 scripts/package/builddeb           |   1 +
 tools/gcc/Makefile                 |  19 +
 tools/gcc/cyc_complexity_plugin.c  | 120 ++++++
 tools/gcc/gcc-common.h             | 794 +++++++++++++++++++++++++++++++++++++
 16 files changed, 1326 insertions(+), 15 deletions(-)

^ permalink raw reply	[flat|nested] 13+ messages in thread
* [kernel-hardening] Re: [PATCH 1/3] GCC plugin infrastructure
@ 2016-02-09  4:20 Kees Cook
  0 siblings, 0 replies; 13+ messages in thread
From: Kees Cook @ 2016-02-09  4:20 UTC (permalink / raw)
  To: Emese Revfy
  Cc: Michal Marek, linux-kbuild, PaX Team, Brad Spengler,
	kernel-hardening@lists.openwall.com

On Mon, Feb 8, 2016 at 1:31 PM, Emese Revfy <re.emese@gmail.com> wrote:
> On Mon, 8 Feb 2016 21:28:13 +0100
> Michal Marek <mmarek@suse.com> wrote:
>
>> Dne 7.2.2016 v 22:28 Emese Revfy napsal(a):
>> > 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.
>> >
>> > The directory of the gcc plugins is tools/gcc. 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
>> > tools/gcc/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 changelog is missing an explanation as to why this needs to be part
>> of the kernel build system. To me it looks like building the kernel with
>> a modified build system and non-default compiler flags, which can be
>> achieved by doing make CC=my-gcc-wrapper or somesuch. But I'd love to be
>> corrected.
>
> These compiler options compile the gcc plugins not the kernel. The new gcc option
> used for building the kernel is the -fplugin option.

Since these plugins will be used as part of kernel builds and
controlled with CONFIG settings in the future, we want to make sure
they're part of the kernel tree itself. The end goal is gaining the
security benefits of the constify and size_overflow plugins, but that
requires the plugin infrastructure itself first. For example, I would
ultimately expect to see constify on by default after some initial
testing.

-Kees

-- 
Kees Cook
Chrome OS & Brillo Security

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

end of thread, other threads:[~2016-02-09 19:14 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-07 21:27 [kernel-hardening] [PATCH 0/3] Introduce GCC plugin infrastructure Emese Revfy
2016-02-07 21:28 ` [kernel-hardening] [PATCH 1/3] " Emese Revfy
2016-02-08 20:28   ` [kernel-hardening] " Michal Marek
2016-02-08 21:31     ` Emese Revfy
2016-02-07 21:31 ` [kernel-hardening] [PATCH 2/3] Add Cyclomatic complexity GCC plugin Emese Revfy
2016-02-07 23:05   ` [kernel-hardening] " Rasmus Villemoes
2016-02-08 21:20     ` Emese Revfy
2016-02-09  4:23   ` Kees Cook
2016-02-09 18:55     ` Emese Revfy
2016-02-07 21:32 ` [kernel-hardening] [PATCH 3/3] Documentation for the GCC plugin infrastructure Emese Revfy
2016-02-09  4:27   ` [kernel-hardening] " Kees Cook
2016-02-09 19:14     ` Emese Revfy
  -- strict thread matches above, loose matches on Subject: below --
2016-02-09  4:20 [kernel-hardening] Re: [PATCH 1/3] " 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).