Skip to content

Commit

Permalink
wire up -fsanitize=local-init
Browse files Browse the repository at this point in the history
  • Loading branch information
thestinger committed Feb 14, 2018
1 parent db20436 commit d00d115
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,9 @@ endif
KBUILD_CFLAGS += $(stackp-flag)

ifeq ($(cc-name),clang)
ifdef CONFIG_LOCAL_SANITIZE
KBUILD_CFLAGS += -fsanitize=local-sanitize
endif
ifneq ($(CROSS_COMPILE),)
CLANG_TARGET := --target=$(notdir $(CROSS_COMPILE:%-=%))
GCC_TOOLCHAIN := $(realpath $(dir $(shell which $(LD)))/..)
Expand Down
6 changes: 6 additions & 0 deletions init/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,12 @@ config CC_OPTIMIZE_FOR_SIZE

endchoice

config LOCAL_SANITIZE
bool "Zero uninitialized locals"
help
Zero-fill uninitialized local variables, other than variable-length
arrays. Requires compiler support.

config SYSCTL
bool

Expand Down

0 comments on commit d00d115

Please sign in to comment.