mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-28 08:16:54 +00:00
security: enable stack protector
Enable stack-proctector-strong option for gcc emiting extra code to check buffer overflow. Enable noexecstack option for marking the object as not requiring executable stack. Tracked-On: 224003 Signed-off-by: wenshelx <wenshengx.wang@intel.com>
This commit is contained in:
parent
f86d91e1e1
commit
156d61e20f
@ -21,6 +21,26 @@ CFLAGS += -Werror
|
||||
CFLAGS += -I$(BASEDIR)/include
|
||||
CFLAGS += -I$(BASEDIR)/include/public
|
||||
|
||||
GCC_MAJOR=$(shell echo __GNUC__ | $(CC) -E -x c - | tail -n 1)
|
||||
GCC_MINOR=$(shell echo __GNUC_MINOR__ | $(CC) -E -x c - | tail -n 1)
|
||||
|
||||
#enable stack overflow check
|
||||
STACK_PROTECTOR := 1
|
||||
|
||||
ifdef STACK_PROTECTOR
|
||||
ifeq (true, $(shell [ $(GCC_MAJOR) -gt 4 ] && echo true))
|
||||
CFLAGS += -fstack-protector-strong
|
||||
else
|
||||
ifeq (true, $(shell [ $(GCC_MAJOR) -eq 4 ] && [ $(GCC_MINOR) -ge 9 ] && echo true))
|
||||
CFLAGS += -fstack-protector-strong
|
||||
else
|
||||
CFLAGS += -fstack-protector
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
LDFLAGS += -Wl,-z,noexecstack
|
||||
|
||||
LIBS = -lrt
|
||||
LIBS += -lpthread
|
||||
LIBS += -lcrypto
|
||||
|
Loading…
Reference in New Issue
Block a user