Skip to content

Commit 749556e

Browse files
tianhuaswenlingz
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 5530fc8 commit 749556e

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
@@ -18,6 +18,7 @@ BASEDIR := $(shell pwd)
1818
HV_OBJDIR ?= $(CURDIR)/build
1919
HV_FILE := acrn
2020
SUB_MAKEFILES := $(wildcard */Makefile)
21+
RELEASE ?= 0
2122

2223
LIB_DEBUG = $(HV_OBJDIR)/debug/libdebug.a
2324
LIB_RELEASE = $(HV_OBJDIR)/release/librelease.a
@@ -95,6 +96,10 @@ else
9596
LDFLAGS += -static
9697
endif
9798

99+
ifeq ($(RELEASE),y)
100+
LDFLAGS += -s
101+
endif
102+
98103
ARCH_CFLAGS += -gdwarf-2
99104
ARCH_ASFLAGS += -gdwarf-2 -DASSEMBLER=1
100105
ARCH_ARFLAGS +=

tools/acrn-manager/Makefile

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

4242
ifeq ($(RELEASE),0)
4343
MANAGER_CFLAGS += -g -DMNGR_DEBUG
44+
else
45+
MANAGER_LDFLAGS += -s
4446
endif
4547

4648
MANAGER_LDFLAGS := -Wl,-z,noexecstack

0 commit comments

Comments
 (0)