Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 01e76903 authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds
Browse files

kasan: show gcc version requirements in Kconfig and Documentation



The documentation shows a need for gcc > 4.9.2, but it's really >=.  The
Kconfig entries don't show require versions so add them.  Correct a
latter/later typo too.  Also mention that gcc 5 required to catch out of
bounds accesses to global and stack variables.

Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarAndrey Ryabinin <a.ryabinin@samsung.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 09789e5d
Loading
Loading
Loading
Loading
+5 −3
Original line number Original line Diff line number Diff line
@@ -9,7 +9,9 @@ a fast and comprehensive solution for finding use-after-free and out-of-bounds
bugs.
bugs.


KASan uses compile-time instrumentation for checking every memory access,
KASan uses compile-time instrumentation for checking every memory access,
therefore you will need a certain version of GCC > 4.9.2
therefore you will need a gcc version of 4.9.2 or later. KASan could detect out
of bounds accesses to stack or global variables, but only if gcc 5.0 or later was
used to built the kernel.


Currently KASan is supported only for x86_64 architecture and requires that the
Currently KASan is supported only for x86_64 architecture and requires that the
kernel be built with the SLUB allocator.
kernel be built with the SLUB allocator.
@@ -23,8 +25,8 @@ To enable KASAN configure kernel with:


and choose between CONFIG_KASAN_OUTLINE and CONFIG_KASAN_INLINE. Outline/inline
and choose between CONFIG_KASAN_OUTLINE and CONFIG_KASAN_INLINE. Outline/inline
is compiler instrumentation types. The former produces smaller binary the
is compiler instrumentation types. The former produces smaller binary the
latter is 1.1 - 2 times faster. Inline instrumentation requires GCC 5.0 or
latter is 1.1 - 2 times faster. Inline instrumentation requires a gcc version
latter.
of 5.0 or later.


Currently KASAN works only with the SLUB memory allocator.
Currently KASAN works only with the SLUB memory allocator.
For better bug detection and nicer report, enable CONFIG_STACKTRACE and put
For better bug detection and nicer report, enable CONFIG_STACKTRACE and put
+6 −2
Original line number Original line Diff line number Diff line
@@ -10,8 +10,11 @@ config KASAN
	help
	help
	  Enables kernel address sanitizer - runtime memory debugger,
	  Enables kernel address sanitizer - runtime memory debugger,
	  designed to find out-of-bounds accesses and use-after-free bugs.
	  designed to find out-of-bounds accesses and use-after-free bugs.
	  This is strictly debugging feature. It consumes about 1/8
	  This is strictly a debugging feature and it requires a gcc version
	  of available memory and brings about ~x3 performance slowdown.
	  of 4.9.2 or later. Detection of out of bounds accesses to stack or
	  global variables requires gcc 5.0 or later.
	  This feature consumes about 1/8 of available memory and brings about
	  ~x3 performance slowdown.
	  For better error detection enable CONFIG_STACKTRACE,
	  For better error detection enable CONFIG_STACKTRACE,
	  and add slub_debug=U to boot cmdline.
	  and add slub_debug=U to boot cmdline.


@@ -40,6 +43,7 @@ config KASAN_INLINE
	  memory accesses. This is faster than outline (in some workloads
	  memory accesses. This is faster than outline (in some workloads
	  it gives about x2 boost over outline instrumentation), but
	  it gives about x2 boost over outline instrumentation), but
	  make kernel's .text size much bigger.
	  make kernel's .text size much bigger.
	  This requires a gcc version of 5.0 or later.


endchoice
endchoice