diff --git a/0002-syscontainer-tools-build-security-option.patch b/0002-syscontainer-tools-build-security-option.patch new file mode 100644 index 0000000..525f093 --- /dev/null +++ b/0002-syscontainer-tools-build-security-option.patch @@ -0,0 +1,48 @@ +From 49975380c5a6ffeceffe0e002a9a63171145053e Mon Sep 17 00:00:00 2001 +From: zhangsong +Date: Fri, 29 Jan 2021 11:31:06 +0800 +Subject: [PATCH] syscontainer-tools: build security option + +Signed-off-by: zhangsong +--- + Makefile | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/Makefile b/Makefile +index 4b3af7d..b7c45b2 100644 +--- a/Makefile ++++ b/Makefile +@@ -20,8 +20,13 @@ VERSION := $(shell cat ./VERSION) + BEP_DIR=/tmp/syscontainer-tools-build-bep + BEP_FLAGS=-tmpdir=/tmp/syscontainer-tools-build-bep + +-GO_LDFLAGS="-w -buildid=IdByiSula -extldflags -static $(BEP_FLAGS) -X main.gitCommit=${COMMIT} -X main.version=${VERSION}" +-ENV = GOPATH=${GOPATH} CGO_ENABLED=1 ++GO_LDFLAGS="-buildid=IdByiSula $(BEP_FLAGS) -extldflags=-static -extldflags=-Wl,-z,relro,-z,now -X main.gitCommit=${COMMIT} -X main.version=${VERSION}" ++ ++ENV = GOPATH=${GOPATH} \ ++ CGO_ENABLED=1 \ ++ CGO_CFLAGS="-fstack-protector-strong -fPIE" \ ++ CGO_LDFLAGS_ALLOW='-Wl,-z,relro,-z,now' \ ++ CGO_LDFLAGS="-Wl,-z,relro,-z,now -Wl,-z,noexecstack" + + ## PLEASE be noticed that the vendor dir can only work with golang > 1.6 !! + +@@ -34,12 +39,12 @@ init: + + syscontainer-tools: $(SOURCES) | $(DEPS_LINK) + @echo "Making syscontainer-tools..." +- ${ENV} go build -mod=vendor -tags ${TAGS} -ldflags ${GO_LDFLAGS} -o build/syscontainer-tools . ++ ${ENV} go build -buildmode=pie -mod=vendor -tags ${TAGS} -ldflags ${GO_LDFLAGS} -o build/syscontainer-tools . + @echo "Done!" + + syscontainer-hooks: $(SOURCES) | $(DEPS_LINK) + @echo "Making syscontainer-hooks..." +- ${ENV} go build -mod=vendor -tags ${TAGS} -ldflags ${GO_LDFLAGS} -o build/syscontainer-hooks ./hooks/syscontainer-hooks ++ ${ENV} go build -buildmode=pie -mod=vendor -tags ${TAGS} -ldflags ${GO_LDFLAGS} -o build/syscontainer-hooks ./hooks/syscontainer-hooks + @echo "Done!" + + localtest: +-- +1.8.3.1 + diff --git a/syscontainer-tools.spec b/syscontainer-tools.spec index ee12a7e..0972b8d 100644 --- a/syscontainer-tools.spec +++ b/syscontainer-tools.spec @@ -4,14 +4,15 @@ #Basic Information Name: syscontainer-tools Version: 0.9 -Release: 3 +Release: 47 Summary: syscontainer tools for IT, work with iSulad License: Mulan PSL v2 URL: https://gitee.com/openeuler/syscontainer-tools Source0: https://gitee.com/openeuler/syscontainer-tools/repository/archive/v%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-root -Patch0001: 0001-fix-failed-build-with-golang-1.15.5.patch +Patch1: 0001-fix-failed-build-with-golang-1.15.5.patch +Patch2: 0002-syscontainer-tools-build-security-option.patch #Dependency BuildRequires: glibc-static @@ -110,6 +111,9 @@ chmod 0640 ${HOOK_SPEC}/hookspec.json rm -rfv %{buildroot} %changelog +* Mon Feb 08 2021 zhangsong234 - 0.9-47 +- update version to 0.9-47 + * Wed Dec 23 2020 wangkang101<873229877@qq.com> - 0.9-3 - fix failed build with golang 1.15.5