66 lines
2.0 KiB
Diff
66 lines
2.0 KiB
Diff
From 728d921b36f07833470a284a55cbfea4baaab268 Mon Sep 17 00:00:00 2001
|
|
From: mzzhou <1362843687@qq.com>
|
|
Date: Mon, 10 Jul 2023 21:28:10 +0800
|
|
Subject: [PATCH] add secure compile marco
|
|
|
|
---
|
|
configure.ac | 20 ++++++++++++++++++++
|
|
src/lxc/Makefile.am | 6 +++++-
|
|
2 files changed, 25 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index 2180586..e66bdf1 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -837,10 +837,30 @@ if test "x$adapt_isulad" = "xyes"; then
|
|
AC_DEFINE([HAVE_ISULAD], 1, [adapt to iSulad])
|
|
AC_MSG_RESULT([yes])
|
|
|
|
+ AC_MSG_CHECKING([Whether enable secure compile])
|
|
+ AC_ARG_ENABLE([secure-compile],
|
|
+ [AC_HELP_STRING([--enable-secure-compile], [enable secure compile [default=no]])],
|
|
+ [secure_compile=$enableval], [secure_compile=yes])
|
|
+ AM_CONDITIONAL([HAVE_SECURE_COMPILE], [test "x$secure_compile" = "xyes"])
|
|
+ AC_DEFINE([HAVE_SECURE_COMPILE], 1, [enable secure compile])
|
|
+ AC_MSG_RESULT([yes])
|
|
+
|
|
# Check yajl
|
|
PKG_CHECK_MODULES([YAJL], [yajl >= 2],[],[AC_MSG_ERROR([You must install yajl >= 2])])
|
|
else
|
|
AC_MSG_RESULT([no])
|
|
+
|
|
+ AC_MSG_CHECKING([Whether enable secure compile])
|
|
+ AC_ARG_ENABLE([secure-compile],
|
|
+ [AC_HELP_STRING([--enable-secure-compile], [enable secure compile [default=no]])],
|
|
+ [secure_compile=$enableval], [secure_compile=yes])
|
|
+ AM_CONDITIONAL([HAVE_SECURE_COMPILE], [test "x$secure_compile" = "xyes"])
|
|
+ if test "x$secure_compile" = "xyes"; then
|
|
+ AC_DEFINE([HAVE_SECURE_COMPILE], 1, [enable secure compile])
|
|
+ AC_MSG_RESULT([yes])
|
|
+ else
|
|
+ AC_MSG_RESULT([no])
|
|
+ fi
|
|
fi
|
|
|
|
# Files requiring some variable expansion
|
|
diff --git a/src/lxc/Makefile.am b/src/lxc/Makefile.am
|
|
index 61a229f..c1d20f6 100644
|
|
--- a/src/lxc/Makefile.am
|
|
+++ b/src/lxc/Makefile.am
|
|
@@ -292,7 +292,11 @@ liblxc_la_LDFLAGS = -pthread \
|
|
-version-info @LXC_ABI_MAJOR@
|
|
|
|
if HAVE_ISULAD
|
|
-liblxc_la_LDFLAGS += @YAJL_LIBS@ -Wl,-z,relro \
|
|
+liblxc_la_LDFLAGS += @YAJL_LIBS@
|
|
+endif
|
|
+
|
|
+if HAVE_SECURE_COMPILE
|
|
+liblxc_la_LDFLAGS += -Wl,-z,relro \
|
|
-Wl,-z,now \
|
|
-Wl,-z,noexecstack
|
|
endif
|
|
--
|
|
2.41.0.windows.2
|
|
|