Skip to content

Commit 265499c

Browse files
wws666jren1
authored andcommitted
security: fortify source and format string check
"-O2 -D_FORTIFY_SOURCE=2": GCC C-Compiler can analyze the source code to be compiled and detect certain insecure sections, that might create a security problem. The compiler will replace the insecure function calls with special hardened code that will perform extra runtime checks while the process is executed. "-Wformat -Wformat-security": It warns about calls to "printf" and "scanf" functions where the format string is not a string literal and there are no format arguments, as in "printf (foo);". This may be a security hole if the format string came from untrusted input and contains %n. Tracked-On: 224003 Signed-off-by: wenshelx <wenshengx.wang@intel.com>
1 parent 0dc93a5 commit 265499c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

hypervisor/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ CFLAGS += -fshort-wchar -ffreestanding
2828
CFLAGS += -m64
2929
CFLAGS += -mno-red-zone
3030
CFLAGS += -static -nostdinc -nostdlib -fno-common
31+
CFLAGS += -O2 -D_FORTIFY_SOURCE=2
32+
CFLAGS += -Wformat -Wformat-security
3133

3234
ifdef STACK_PROTECTOR
3335
ifeq (true, $(shell [ $(GCC_MAJOR) -gt 4 ] && echo true))

0 commit comments

Comments
 (0)