endchoice
+ config PKG_SANITIZER_ADDRESS
+ bool "Enable Address Sanitizer"
+ depends on USE_GLIBC
+ select PACKAGE_libasan
+ select USE_SANITIZER_ADDRESS
+ help
+ This will build all user space applications with the Address Sanitizer enabled
+
+ config PKG_SANITIZER_UNDEFINED_BEHAVIOR
+ bool "Enable undefined behavior Sanitizer"
+ depends on USE_GLIBC
+ select PACKAGE_libubsan
+ select USE_SANITIZER_UNDEFINED_BEHAVIOR
+ help
+ This will build all user space applications with the undefined behavior Sanitizer enabled
+
+ config USE_SANITIZER_ADDRESS
+ bool
+
+ config USE_SANITIZER_UNDEFINED_BEHAVIOR
+ bool
+
endmenu
PKG_SSP ?= 1
PKG_FORTIFY_SOURCE ?= 1
PKG_RELRO ?= 1
+PKG_SANITIZER_ADDRESS ?= 1
+PKG_SANITIZER_UNDEFINED_BEHAVIOR ?= 1
ifdef CONFIG_PKG_CHECK_FORMAT_SECURITY
ifeq ($(strip $(PKG_CHECK_FORMAT_SECURITY)),1)
TARGET_LDFLAGS += -znow -zrelro
endif
endif
+ifdef CONFIG_PKG_SANITIZER_ADDRESS
+ ifeq ($(strip $(PKG_SANITIZER_ADDRESS)),1)
+ TARGET_CFLAGS += -fsanitize=address
+ TARGET_LDFLAGS += -fsanitize=address
+ endif
+endif
+ifdef CONFIG_PKG_SANITIZER_UNDEFINED_BEHAVIOR
+ ifeq ($(strip $(PKG_SANITIZER_UNDEFINED_BEHAVIOR)),1)
+ TARGET_CFLAGS += -fsanitize=undefined
+ TARGET_LDFLAGS += -fsanitize=undefined
+ endif
+endif
# See /LICENSE for more information.
#
-PKG_DEFAULT_DEPENDS = +libc +USE_GLIBC:librt +USE_GLIBC:libpthread
+PKG_DEFAULT_DEPENDS = +libc +USE_GLIBC:librt +USE_GLIBC:libpthread +USE_SANITIZER_ADDRESS:libasan +USE_SANITIZER_UNDEFINED_BEHAVIOR:libubsan
ifneq ($(PKG_NAME),toolchain)
PKG_FIXUP_DEPENDS = $(if $(filter kmod-%,$(1)),$(2),$(PKG_DEFAULT_DEPENDS) $(filter-out $(PKG_DEFAULT_DEPENDS),$(2)))
HOST_BUILD_PREFIX:=$(TOOLCHAIN_DIR)
BUILD_DIR_HOST:=$(BUILD_DIR_TOOLCHAIN)
+PKG_SANITIZER_ADDRESS:=0
+PKG_SANITIZER_UNDEFINED_BEHAVIOR:=0
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/hardening.mk
PKG_ASLR_PIE:=0
PKG_SSP:=0
+PKG_SANITIZER_ADDRESS:=0
+PKG_SANITIZER_UNDEFINED_BEHAVIOR:=0
PKG_FLAGS:=nonshared
PKG_LICENSE:=GPL-3.0-with-GCC-exception
PKG_FLAGS:=hold essential nonshared
+PKG_SANITIZER_ADDRESS:=0
+PKG_SANITIZER_UNDEFINED_BEHAVIOR:=0
include $(INCLUDE_DIR)/package.mk
PKG_BUILD_PARALLEL:=1
PKG_ASLR_PIE_REGULAR:=1
+PKG_SANITIZER_ADDRESS:=0
+PKG_SANITIZER_UNDEFINED_BEHAVIOR:=0
PKG_USE_MIPS16:=0
PKG_FIXUP:=autoreconf
PKG_FLAGS:=nonshared
PKG_BUILD_DEPENDS:=BUSYBOX_CONFIG_PAM:libpam
PKG_BUILD_PARALLEL:=1
PKG_CHECK_FORMAT_SECURITY:=0
+PKG_SANITIZER_ADDRESS:=0
+PKG_SANITIZER_UNDEFINED_BEHAVIOR:=0
#Busybox use it's own PIE config flag and LDFLAGS are used with ld, not gcc.
PKG_ASLR_PIE:=0