update version to 0.3-24

(cherry picked from commit 2bea4972650e38ba03b6de6af93adf654151e99b)
This commit is contained in:
zhangsong234 2021-02-08 19:16:56 +08:00 committed by openeuler-sync-bot
parent 4b5157fe54
commit 59e47fbd10
2 changed files with 57 additions and 1 deletions

View File

@ -0,0 +1,50 @@
From 5a612ba26670f44197906df518b772bf116c0efe Mon Sep 17 00:00:00 2001
From: zhangsong <zhangsong34@huawei.com>
Date: Fri, 29 Jan 2021 14:50:19 +0800
Subject: [PATCH] lxcfs-tools: build security option
Signed-off-by: zhangsong <zhangsong34@huawei.com>
---
Makefile | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index 3eb27a3..a597ff4 100644
--- a/Makefile
+++ b/Makefile
@@ -20,11 +20,15 @@ TAGS="cgo static_build"
BEP_DIR=/tmp/lxcfs-tools-build-bep
BEP_FLAGS=-tmpdir=/tmp/lxcfs-tools-build-bep
-GO_LDFLAGS="-w -buildid=IdByiSula -extldflags -static $(BEP_FLAGS) -X main.gitCommit=${COMMIT} -X main.version=${VERSION}"
+GO_LDFLAGS="-buildid=IdByiSula $(BEP_FLAGS) -extldflags=-static -extldflags=-Wl,-z,relro,-z,now -X main.gitCommit=${COMMIT} -X main.version=${VERSION}"
DEF_GOPATH=${GOPATH}
ifneq ($(GOPATH), )
CUS_GOPATH=${GOPATH}:${PWD}
-ENV = GOPATH=${CUS_GOPATH} CGO_ENABLED=1
+ENV = GOPATH=${CUS_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"
else
ENV = CGO_ENABLED=1
endif
@@ -35,12 +39,12 @@ dep:
toolkit: $(SOURCES) | $(DEPS_LINK)
@echo "Making lxcfs-tools..."
- ${ENV} go build -mod=vendor -tags ${TAGS} -ldflags ${GO_LDFLAGS} -o build/lxcfs-tools .
+ ${ENV} go build -buildmode=pie -mod=vendor -tags ${TAGS} -ldflags ${GO_LDFLAGS} -o build/lxcfs-tools .
@echo "Done!"
lxcfs-hook: $(SOURCES) | $(DEPS_LINK)
@echo "Making lxcfs-hook..."
- ${ENV} go build -mod=vendor -tags ${TAGS} -ldflags ${GO_LDFLAGS} -o build/lxcfs-hook ./hooks/lxcfs-hook
+ ${ENV} go build -buildmode=pie -mod=vendor -tags ${TAGS} -ldflags ${GO_LDFLAGS} -o build/lxcfs-hook ./hooks/lxcfs-hook
@echo "Done!"
clean:
--
1.8.3.1

View File

@ -3,13 +3,15 @@
#Basic Information
Name: lxcfs-tools
Version: 0.3
Release: 2
Release: 24
Summary: toolkit for lxcfs to remount a running isulad
License: Mulan PSL v2
URL: https://gitee.com/openeuler/lxcfs-tools
Source0: https://gitee.com/openeuler/lxcfs-tools/repository/archive/v%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-root
Patch1: 0001-lxcfs-tools-build-security-option.patch
#Dependency
BuildRequires: golang > 1.7
BuildRequires: glibc-static
@ -21,6 +23,7 @@ A toolkit for lxcfs to remount a running isulad when crashes recover
#Build sections
%prep
%setup -n %{name} -q
%patch1 -p1
%build
make
@ -90,6 +93,9 @@ rm -rfv %{buildroot}
%changelog
* Mon Feb 08 2021 zhangsong234 <zhangsong34@huawei.com> - 0.3-24
- update version to 0.3-24
* Mon Sep 07 2020 wangkang101 <873229877@qq.com> - 0.3-2
- modify url of source0