From bc5f8ce0bf7fa4abfbd45d99fcf009f6c678cf68 Mon Sep 17 00:00:00 2001 From: taesubkim Date: Fri, 10 Jun 2016 09:14:36 +0900 Subject: [PATCH] Apply ASLR for executable vpnsvc-daemon and vpnsvc_test Change-Id: I0ebf0d3e7cd06d9d9ef9369576a95267af9ca17f Signed-off-by: Taesub Kim --- daemon/CMakeLists.txt | 5 +++-- test/CMakeLists.txt | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/daemon/CMakeLists.txt b/daemon/CMakeLists.txt index 6ffc7ea..6f1e4c1 100755 --- a/daemon/CMakeLists.txt +++ b/daemon/CMakeLists.txt @@ -35,12 +35,13 @@ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fPIC -Wall -fvisibility=hidden") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -I${DAEMON_DIR}") SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") +ADD_DEFINITIONS("-fPIE") ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"") ADD_DEFINITIONS("-DDATAFS=\"$ENV{DATADIR}\"") ADD_DEFINITIONS("-DSLP_DEBUG") -SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath="${LIBDIR}" -pie") +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath="${LIBDIR}"") ADD_CUSTOM_COMMAND( WORKING_DIRECTORY @@ -53,7 +54,7 @@ ADD_CUSTOM_COMMAND( COMMENT "Generating GDBus .c/.h") ADD_EXECUTABLE(${PACKAGE_NAME} ${SRCS} ${DAEMON_DIR}/generated-code.c) -TARGET_LINK_LIBRARIES(${PACKAGE_NAME} ${${PACKAGE_NAME}_LDFLAGS} -lrt -ldl) +TARGET_LINK_LIBRARIES(${PACKAGE_NAME} ${${PACKAGE_NAME}_LDFLAGS} -lrt -ldl -pie) INSTALL(TARGETS ${PACKAGE_NAME} DESTINATION bin) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f2146f8..4a2fcca 100755 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -31,11 +31,12 @@ SET(EXTRA_C_FLAGS "${EXTRA_CFLAGS} -fPIC -Wall -fvisibility=hidden") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS}") SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") +ADD_DEFINITIONS("-fPIE") ADD_DEFINITIONS("-DSLP_DEBUG") SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath="${LIBDIR}) ADD_EXECUTABLE(${PACKAGE_NAME} ${TEST_SRCS}) -TARGET_LINK_LIBRARIES(${PACKAGE_NAME} ${${PACKAGE_NAME}_LDFLAGS} "-ldl" capi-vpnsvc) +TARGET_LINK_LIBRARIES(${PACKAGE_NAME} ${${PACKAGE_NAME}_LDFLAGS} "-ldl" capi-vpnsvc -pie) INSTALL(TARGETS ${PACKAGE_NAME} DESTINATION bin/) -- 2.7.4