Commit 918327e9 authored by Kees Cook's avatar Kees Cook
Browse files

ubsan: Remove CONFIG_UBSAN_SANITIZE_ALL



For simplicity in splitting out UBSan options into separate rules,
remove CONFIG_UBSAN_SANITIZE_ALL, effectively defaulting to "y", which
is how it is generally used anyway. (There are no ":= y" cases beyond
where a specific file is enabled when a top-level ":= n" is in effect.)

Cc: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Marco Elver <elver@google.com>
Cc: linux-doc@vger.kernel.org
Cc: linux-kbuild@vger.kernel.org
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
parent 30edbdf9
Loading
Loading
Loading
Loading
+8 −20
Original line number Diff line number Diff line
@@ -49,34 +49,22 @@ Report example
Usage
-----

To enable UBSAN configure kernel with::
To enable UBSAN, configure the kernel with::

  CONFIG_UBSAN=y

and to check the entire kernel::

        CONFIG_UBSAN_SANITIZE_ALL=y

To enable instrumentation for specific files or directories, add a line
similar to the following to the respective kernel Makefile:

- For a single file (e.g. main.o)::

    UBSAN_SANITIZE_main.o := y

- For all files in one directory::

    UBSAN_SANITIZE := y

To exclude files from being instrumented even if
``CONFIG_UBSAN_SANITIZE_ALL=y``, use::
To exclude files from being instrumented use::

  UBSAN_SANITIZE_main.o := n

and::
and to exclude all targets in one directory use::

  UBSAN_SANITIZE := n

When disabled for all targets, specific files can be enabled using::

  UBSAN_SANITIZE_main.o := y

Detection of unaligned accesses controlled through the separate option -
CONFIG_UBSAN_ALIGNMENT. It's off by default on architectures that support
unaligned accesses (CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y). One could
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ config ARM
	select ARCH_HAVE_NMI_SAFE_CMPXCHG if CPU_V7 || CPU_V7M || CPU_V6K
	select ARCH_HAS_GCOV_PROFILE_ALL
	select ARCH_KEEP_MEMBLOCK
	select ARCH_HAS_UBSAN_SANITIZE_ALL
	select ARCH_HAS_UBSAN
	select ARCH_MIGHT_HAVE_PC_PARPORT
	select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
	select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT if CPU_V7
+1 −1
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ config ARM64
	select ARCH_WANT_LD_ORPHAN_WARN
	select ARCH_WANTS_NO_INSTR
	select ARCH_WANTS_THP_SWAP if ARM64_4K_PAGES
	select ARCH_HAS_UBSAN_SANITIZE_ALL
	select ARCH_HAS_UBSAN
	select ARM_AMBA
	select ARM_ARCH_TIMER
	select ARM_GIC
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ config MIPS
	select ARCH_HAS_STRNCPY_FROM_USER
	select ARCH_HAS_STRNLEN_USER
	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
	select ARCH_HAS_UBSAN_SANITIZE_ALL
	select ARCH_HAS_UBSAN
	select ARCH_HAS_GCOV_PROFILE_ALL
	select ARCH_KEEP_MEMBLOCK
	select ARCH_USE_BUILTIN_BSWAP
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ config PARISC
	select ARCH_HAS_ELF_RANDOMIZE
	select ARCH_HAS_STRICT_KERNEL_RWX
	select ARCH_HAS_STRICT_MODULE_RWX
	select ARCH_HAS_UBSAN_SANITIZE_ALL
	select ARCH_HAS_UBSAN
	select ARCH_HAS_PTE_SPECIAL
	select ARCH_NO_SG_CHAIN
	select ARCH_SUPPORTS_HUGETLBFS if PA20
Loading