Initial address sanitization support

This commit is contained in:
Hugo Melder 2024-11-08 18:47:28 +01:00
parent c6a561d713
commit 3618354637

View file

@ -769,6 +769,22 @@ ifeq ($(GNUSTEP_TARGET_OS), windows)
endif
endif
# Sanitization must be enabled explicitly and shall _not_ be used in production,
# as it may leak sensitive info or result in privilege escalation due to unchecked
# use of variables (https://www.openwall.com/lists/oss-security/2016/02/17/9).
ifeq ($(asan), yes)
ADDITIONAL_FLAGS += -fsanitize=address
# We use the clang or gcc to drive the linking process. The driver will
# add the required runtime libraries for address sanitizer.
INTERNAL_LDFLAGS += -fsanitize=address
# Not omitting the frame pointer results in more readable stack traces
ifneq ($(filter -fno-omit-frame-pointer, $(ADDTIONAL_FLAGS)), -fno-omit-frame-pointer)
ADDITIONAL_FLAGS += -fno-omit-frame-pointer
endif
endif
ifeq ($(warn), no)
ADDITIONAL_FLAGS += -UGSWARN
else