Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

# SPDX-License-Identifier: GPL-2.0-only
config CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL
	bool

config CONFIG_UBSAN
	bool "Undefined behaviour sanity checker"
	help
	  This option enables undefined behaviour sanity checker
	  Compile-time instrumentation is used to detect various undefined
	  behaviours in runtime. Various types of checks may be enabled
	  via boot parameter ubsan_handle
	  (see: Documentation/dev-tools/ubsan.rst).

config CONFIG_UBSAN_SANITIZE_ALL
	bool "Enable instrumentation for the entire kernel"
	depends on CONFIG_UBSAN
	depends on CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL

	# We build with -Wno-maybe-uninitilzed, but we still want to
	# use -Wmaybe-uninitilized in allmodconfig builds.
	# So dependsy bellow used to disable this option in allmodconfig
	depends on !CONFIG_COMPILE_TEST
	default y
	help
	  This option activates instrumentation for the entire kernel.
	  If you don't enable this option, you have to explicitly specify
	  UBSAN_SANITIZE := y for the files/directories you want to check for UB.
	  Enabling this option will get kernel image size increased
	  significantly.

config CONFIG_UBSAN_NO_ALIGNMENT
	bool "Disable checking of pointers alignment"
	depends on CONFIG_UBSAN
	default y if CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
	help
	  This option disables the check of unaligned memory accesses.
	  This option should be used when building allmodconfig.
	  Disabling this option on architectures that support unaligned
	  accesses may produce a lot of false positives.

config CONFIG_UBSAN_ALIGNMENT
	def_bool !CONFIG_UBSAN_NO_ALIGNMENT

config CONFIG_TEST_UBSAN
	tristate "Module for testing for undefined behavior detection"
	depends on m && CONFIG_UBSAN
	help
	  This is a test module for CONFIG_UBSAN.
	  It triggers various undefined behavior, and detect it.