Skip to content

Commit 796ac55

Browse files
tianhuasacrnsi
authored andcommitted
hv: fix symbols not stripped from release binaries
In release environment, binary files must be stripped in order to remove debugging code sections and symbol information that aid attackers in the process of disassembly and reverse engineering. Use '-s' linking option to remove symbol table and relocation information from release binaries. Tracked-On: #3427 Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com> Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
1 parent 63e258b commit 796ac55

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

devicemodel/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@ endif
5151

5252
ifeq ($(RELEASE),0)
5353
CFLAGS += -DDM_DEBUG
54+
else
55+
LDFLAGS += -s
5456
endif
5557

58+
5659
LDFLAGS += -Wl,-z,noexecstack
5760
LDFLAGS += -Wl,-z,relro,-z,now
5861
LDFLAGS += -pie

hypervisor/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ HV_OBJDIR ?= $(CURDIR)/build
1919
HV_MODDIR ?= $(HV_OBJDIR)/modules
2020
HV_FILE := acrn
2121
SUB_MAKEFILES := $(wildcard */Makefile)
22+
RELEASE ?= 0
2223

2324
LIB_MOD = $(HV_MODDIR)/lib_mod.a
2425
BOOT_MOD = $(HV_MODDIR)/boot_mod.a
@@ -108,6 +109,10 @@ else
108109
LDFLAGS += -static
109110
endif
110111

112+
ifeq ($(RELEASE),y)
113+
LDFLAGS += -s
114+
endif
115+
111116
ARCH_CFLAGS += -gdwarf-2
112117
ARCH_ASFLAGS += -gdwarf-2 -DASSEMBLER=1
113118
ARCH_ARFLAGS +=

tools/acrn-manager/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ endif
4949

5050
ifeq ($(RELEASE),0)
5151
MANAGER_CFLAGS += -g -DMNGR_DEBUG
52+
else
53+
MANAGER_LDFLAGS += -s
5254
endif
5355

5456
MANAGER_LDFLAGS := -Wl,-z,noexecstack

0 commit comments

Comments
 (0)