podman: Fix host contamination
PATCH 1/3 podman: Fix host contamination
From: Andrei Gherzan <[email protected]>
The project's internal Makefile uses BUILDFLAGS variable to pass arguments to go build while Yocto/OE defines it as GOBUILDFLAGS. Add a patch to align this and avoid using host headers in which case, a musl build will fail similarly to:
| [...]ld: /tmp/go-link-3172010154/000015.o: in function `vfprintf': | /usr/include/x86_64-linux-gnu/bits/stdio2.h:130: undefined reference to `__vfprintf_chk' | [...]ld: /tmp/go-link-3172010154/000016.o: in function `fprintf': | /usr/include/x86_64-linux-gnu/bits/stdio2.h:100: undefined reference to `__fprintf_chk' | collect2: error: ld returned 1 exit status
--- ...01-Rename-BUILDFLAGS-to-GOBUILDFLAGS.patch | 125 ++++++++++++++++++ recipes-containers/podman/podman_git.bb | 1 + 2 files changed, 126 insertions(+) create mode 100644 recipes-containers/podman/podman/0001-Rename-BUILDFLAGS-to-GOBUILDFLAGS.patch
recipes-containers/podman/podman/0001-Rename-BUILDFLAGS-to-GOBUILDFLAGS.patch new file +125 -0
@@ -0,0 +1,125 @@ +From 3e18f3a4db638a3df48f49aa0a539f8bb048afc9 Mon Sep 17 00:00:00 2001 +From: Andrei Gherzan <[email protected]> +Date: Tue, 5 Jul 2022 11:51:56 +0200 +Subject: [PATCH] Rename BUILDFLAGS to GOBUILDFLAGS + +Yocto uses GOBUILDFLAGS to pass the right build flags while the Makefile +uses BUILDFLAGS. Align them accordingly. + +See go.bbclass for more information. + +Upstream-Status: Inappropriate [OE specific] +Signed-off-by: Andrei Gherzan <[email protected]> +--- + Makefile | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +diff --git a/Makefile b/Makefile +index cb230d8e9..538b28d41 100644 +--- a/Makefile ++++ b/Makefile +@@ -69,7 +69,7 @@ PRE_COMMIT = $(shell command -v bin/venv/bin/pre-commit ~/.local/bin/pre-commit + # triggered. + SOURCES = $(shell find . -path './.*' -prune -o \( \( -name '*.go' -o -name '*.c' \) -a ! -name '*_test.go' \) -print) + +-BUILDFLAGS := -mod=vendor $(BUILDFLAGS) ++GOBUILDFLAGS := -mod=vendor $(GOBUILDFLAGS) + + BUILDTAGS_CROSS ?= containers_image_openpgp exclude_graphdriver_btrfs exclude_graphdriver_devicemapper exclude_graphdriver_overlay + CONTAINER_RUNTIME := $(shell command -v podman 2> /dev/null || echo docker) +@@ -264,11 +264,11 @@ gofmt: ## Verify the source code gofmt + + .PHONY: test/checkseccomp/checkseccomp + test/checkseccomp/checkseccomp: .gopathok $(wildcard test/checkseccomp/*.go) +- $(GOCMD) build $(BUILDFLAGS) $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' -tags "$(BUILDTAGS)" -o $@ ./test/checkseccomp ++ $(GOCMD) build $(GOBUILDFLAGS) $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' -tags "$(BUILDTAGS)" -o $@ ./test/checkseccomp + + .PHONY: test/testvol/testvol + test/testvol/testvol: .gopathok $(wildcard test/testvol/*.go) +- $(GOCMD) build $(BUILDFLAGS) $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' -o $@ ./test/testvol ++ $(GOCMD) build $(GOBUILDFLAGS) $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' -o $@ ./test/testvol + + .PHONY: volume-plugin-test-image + volume-plugin-test-img: +@@ -276,7 +276,7 @@ volume-plugin-test-img: + + .PHONY: test/goecho/goecho + test/goecho/goecho: .gopathok $(wildcard test/goecho/*.go) +- $(GOCMD) build $(BUILDFLAGS) $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' -o $@ ./test/goecho ++ $(GOCMD) build $(GOBUILDFLAGS) $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' -o $@ ./test/goecho + + test/version/version: .gopathok version/version.go + $(GO) build -o $@ ./test/version/ +@@ -318,7 +318,7 @@ ifeq (,$(findstring systemd,$(BUILDTAGS))) + distro for journald support." + endif + $(GOCMD) build \ +- $(BUILDFLAGS) \ ++ $(GOBUILDFLAGS) \ + $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' \ + -tags "$(BUILDTAGS)" \ + -o $@ ./cmd/podman +@@ -329,14 +329,14 @@ $(SRCBINDIR): + + $(SRCBINDIR)/podman$(BINSFX): $(SRCBINDIR) .gopathok $(SOURCES) go.mod go.sum + $(GOCMD) build \ +- $(BUILDFLAGS) \ ++ $(GOBUILDFLAGS) \ + $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' \ + -tags "${REMOTETAGS}" \ + -o $@ ./cmd/podman + + $(SRCBINDIR)/podman-remote-static: $(SRCBINDIR) .gopathok $(SOURCES) go.mod go.sum + $(GOCMD) build \ +- $(BUILDFLAGS) \ ++ $(GOBUILDFLAGS) \ + $(GO_LDFLAGS) '$(LDFLAGS_PODMAN_STATIC)' \ + -tags "${REMOTETAGS}" \ + -o $@ ./cmd/podman +@@ -371,7 +371,7 @@ podman-winpath: .gopathok $(SOURCES) go.mod go.sum + CGO_ENABLED=0 \ + GOOS=windows \ + $(GO) build \ +- $(BUILDFLAGS) \ ++ $(GOBUILDFLAGS) \ + -ldflags -H=windowsgui \ + -o bin/windows/winpath.exe \ + ./cmd/winpath +@@ -390,14 +390,14 @@ podman-mac-helper: ## Build podman-mac-helper for macOS + GOOS=darwin \ + GOARCH=$(GOARCH) \ + $(GO) build \ +- $(BUILDFLAGS) \ ++ $(GOBUILDFLAGS) \ + -o bin/darwin/podman-mac-helper \ + ./cmd/podman-mac-helper + + bin/rootlessport: .gopathok $(SOURCES) go.mod go.sum + CGO_ENABLED=$(CGO_ENABLED) \ + $(GO) build \ +- $(BUILDFLAGS) \ ++ $(GOBUILDFLAGS) \ + -o $@ ./cmd/rootlessport + + .PHONY: rootlessport +@@ -420,7 +420,7 @@ bin/podman.cross.%: .gopathok + GOARCH="$${TARGET##*.}"; \ + CGO_ENABLED=0 \ + $(GO) build \ +- $(BUILDFLAGS) \ ++ $(GOBUILDFLAGS) \ + $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' \ + -tags '$(BUILDTAGS_CROSS)' \ + -o "$@" ./cmd/podman +@@ -864,7 +864,7 @@ install.tools: .install.goimports .install.gitvalidation .install.md2man .instal + .PHONY: .install.ginkgo + .install.ginkgo: .gopathok + if [ ! -x "$(GOBIN)/ginkgo" ]; then \ +- $(GO) install $(BUILDFLAGS) ./vendor/github.com/onsi/ginkgo/ginkgo ; \ ++ $(GO) install $(GOBUILDFLAGS) ./vendor/github.com/onsi/ginkgo/ginkgo ; \ + fi + + .PHONY: .install.gitvalidation +-- +2.25.1 +
recipes-containers/podman/podman_git.bb +1 -0
@@ -20,6 +20,7 @@ DEPENDS = " \ SRCREV = "717edd7b844dcd66468f5d991991d87e9fc14c12" SRC_URI = " \ git://github.com/containers/libpod.git;branch=v4.0;protocol=https \ + file://0001-Rename-BUILDFLAGS-to-GOBUILDFLAGS.patch;patchdir=src/import \ " LICENSE = "Apache-2.0"
Signature · 1 line
2.25.1
PATCH 2/3 oci-image-tools: Add Upstream-Status to patch 0001
From: Andrei Gherzan <[email protected]>
--- .../0001-tool-respect-GO-and-GOBUILDFLAGS-when-building.patch | 1 + 1 file changed, 1 insertion(+)
recipes-containers/oci-image-tools/files/0001-tool-respect-GO-and-GOBUILDFLAGS-when-building.patch +1 -0
@@ -8,6 +8,7 @@ build flags from our environemnt. Otherwise, we'll use the host settings for each and end up with a binary that cannot be run on the target. +Upstream-Status: Inappropriate [OE specific] Signed-off-by: Bruce Ashfield <[email protected]> --- Makefile | 2 +-
Signature · 1 line
2.25.1
PATCH 3/3 runc: Add Upstream-Status to patch 0001
In reply to Andrei GherzanFrom: Andrei Gherzan <[email protected]>
--- ...01-Makefile-respect-GOBUILDFLAGS-for-runc-and-remove-re.patch | 1 + 1 file changed, 1 insertion(+)
recipes-containers/runc/files/0001-Makefile-respect-GOBUILDFLAGS-for-runc-and-remove-re.patch +1 -0
@@ -4,6 +4,7 @@ Date: Tue, 24 Aug 2021 11:38:23 -0400 Subject: [PATCH] Makefile: respect GOBUILDFLAGS for runc and remove recvtty from static +Upstream-Status: Inappropriate [OE specific] Signed-off-by: Chen Qi <[email protected]> [bva: refreshed for release 1.0.2] Signed-off-by: Bruce Ashfield <[email protected]>
Signature · 1 line
2.25.1
Bruce Ashfield
Appliedmerged to kirkstone.
Bruce
In message: [meta-virtualization][kirkstone][PATCH 1/3] podman: Fix host contamination
Quoted 176 lines · on 05/07/2022 Andrei Gherzan wrote:
From: Andrei Gherzan <[email protected]>
The project's internal
Makefileuses BUILDFLAGS variable to pass arguments togo buildwhile Yocto/OE defines it as GOBUILDFLAGS. Add a patch to align this and avoid using host headers in which case, a musl build will fail similarly to:| [...]ld: /tmp/go-link-3172010154/000015.o: in function `vfprintf': | /usr/include/x86_64-linux-gnu/bits/stdio2.h:130: undefined reference to `__vfprintf_chk' | [...]ld: /tmp/go-link-3172010154/000016.o: in function `fprintf': | /usr/include/x86_64-linux-gnu/bits/stdio2.h:100: undefined reference to `__fprintf_chk' | collect2: error: ld returned 1 exit statusSigned-off-by Andrei Gherzan <[email protected]>--- ...01-Rename-BUILDFLAGS-to-GOBUILDFLAGS.patch | 125 ++++++++++++++++++ recipes-containers/podman/podman_git.bb | 1 + 2 files changed, 126 insertions(+) create mode 100644 recipes-containers/podman/podman/0001-Rename-BUILDFLAGS-to-GOBUILDFLAGS.patchrecipes-containers/podman/podman/0001-Rename-BUILDFLAGS-to-GOBUILDFLAGS.patch new file +125
-0@@ -0,0 +1,125 @@ +From 3e18f3a4db638a3df48f49aa0a539f8bb048afc9 Mon Sep 17 00:00:00 2001 +From: Andrei Gherzan <[email protected]> +Date: Tue, 5 Jul 2022 11:51:56 +0200 +Subject: [PATCH] Rename BUILDFLAGS to GOBUILDFLAGS + +Yocto uses GOBUILDFLAGS to pass the right build flags while the Makefile +uses BUILDFLAGS. Align them accordingly. + +See go.bbclass for more information. + +Upstream-Status: Inappropriate [OE specific] +Signed-off-by: Andrei Gherzan <[email protected]> +--- + Makefile | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +diff --git a/Makefile b/Makefile +index cb230d8e9..538b28d41 100644 +--- a/Makefile ++++ b/Makefile +@@ -69,7 +69,7 @@ PRE_COMMIT = $(shell command -v bin/venv/bin/pre-commit ~/.local/bin/pre-commit + # triggered. + SOURCES = $(shell find . -path './.*' -prune -o \( \( -name '*.go' -o -name '*.c' \) -a ! -name '*_test.go' \) -print) + +-BUILDFLAGS := -mod=vendor $(BUILDFLAGS) ++GOBUILDFLAGS := -mod=vendor $(GOBUILDFLAGS) + + BUILDTAGS_CROSS ?= containers_image_openpgp exclude_graphdriver_btrfs exclude_graphdriver_devicemapper exclude_graphdriver_overlay + CONTAINER_RUNTIME := $(shell command -v podman 2> /dev/null || echo docker) +@@ -264,11 +264,11 @@ gofmt: ## Verify the source code gofmt + + .PHONY: test/checkseccomp/checkseccomp + test/checkseccomp/checkseccomp: .gopathok $(wildcard test/checkseccomp/*.go) +- $(GOCMD) build $(BUILDFLAGS) $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' -tags "$(BUILDTAGS)" -o $@ ./test/checkseccomp ++ $(GOCMD) build $(GOBUILDFLAGS) $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' -tags "$(BUILDTAGS)" -o $@ ./test/checkseccomp + + .PHONY: test/testvol/testvol + test/testvol/testvol: .gopathok $(wildcard test/testvol/*.go) +- $(GOCMD) build $(BUILDFLAGS) $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' -o $@ ./test/testvol ++ $(GOCMD) build $(GOBUILDFLAGS) $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' -o $@ ./test/testvol + + .PHONY: volume-plugin-test-image + volume-plugin-test-img: +@@ -276,7 +276,7 @@ volume-plugin-test-img: + + .PHONY: test/goecho/goecho + test/goecho/goecho: .gopathok $(wildcard test/goecho/*.go) +- $(GOCMD) build $(BUILDFLAGS) $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' -o $@ ./test/goecho ++ $(GOCMD) build $(GOBUILDFLAGS) $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' -o $@ ./test/goecho + + test/version/version: .gopathok version/version.go + $(GO) build -o $@ ./test/version/ +@@ -318,7 +318,7 @@ ifeq (,$(findstring systemd,$(BUILDTAGS))) + distro for journald support." + endif + $(GOCMD) build \ +- $(BUILDFLAGS) \ ++ $(GOBUILDFLAGS) \ + $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' \ + -tags "$(BUILDTAGS)" \ + -o $@ ./cmd/podman +@@ -329,14 +329,14 @@ $(SRCBINDIR): + + $(SRCBINDIR)/podman$(BINSFX): $(SRCBINDIR) .gopathok $(SOURCES) go.mod go.sum + $(GOCMD) build \ +- $(BUILDFLAGS) \ ++ $(GOBUILDFLAGS) \ + $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' \ + -tags "${REMOTETAGS}" \ + -o $@ ./cmd/podman + + $(SRCBINDIR)/podman-remote-static: $(SRCBINDIR) .gopathok $(SOURCES) go.mod go.sum + $(GOCMD) build \ +- $(BUILDFLAGS) \ ++ $(GOBUILDFLAGS) \ + $(GO_LDFLAGS) '$(LDFLAGS_PODMAN_STATIC)' \ + -tags "${REMOTETAGS}" \ + -o $@ ./cmd/podman +@@ -371,7 +371,7 @@ podman-winpath: .gopathok $(SOURCES) go.mod go.sum + CGO_ENABLED=0 \ + GOOS=windows \ + $(GO) build \ +- $(BUILDFLAGS) \ ++ $(GOBUILDFLAGS) \ + -ldflags -H=windowsgui \ + -o bin/windows/winpath.exe \ + ./cmd/winpath +@@ -390,14 +390,14 @@ podman-mac-helper: ## Build podman-mac-helper for macOS + GOOS=darwin \ + GOARCH=$(GOARCH) \ + $(GO) build \ +- $(BUILDFLAGS) \ ++ $(GOBUILDFLAGS) \ + -o bin/darwin/podman-mac-helper \ + ./cmd/podman-mac-helper + + bin/rootlessport: .gopathok $(SOURCES) go.mod go.sum + CGO_ENABLED=$(CGO_ENABLED) \ + $(GO) build \ +- $(BUILDFLAGS) \ ++ $(GOBUILDFLAGS) \ + -o $@ ./cmd/rootlessport + + .PHONY: rootlessport +@@ -420,7 +420,7 @@ bin/podman.cross.%: .gopathok + GOARCH="$${TARGET##*.}"; \ + CGO_ENABLED=0 \ + $(GO) build \ +- $(BUILDFLAGS) \ ++ $(GOBUILDFLAGS) \ + $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' \ + -tags '$(BUILDTAGS_CROSS)' \ + -o "$@" ./cmd/podman +@@ -864,7 +864,7 @@ install.tools: .install.goimports .install.gitvalidation .install.md2man .instal + .PHONY: .install.ginkgo + .install.ginkgo: .gopathok + if [ ! -x "$(GOBIN)/ginkgo" ]; then \ +- $(GO) install $(BUILDFLAGS) ./vendor/github.com/onsi/ginkgo/ginkgo ; \ ++ $(GO) install $(GOBUILDFLAGS) ./vendor/github.com/onsi/ginkgo/ginkgo ; \ + fi + + .PHONY: .install.gitvalidation +-- +2.25.1 +recipes-containers/podman/podman_git.bb +1
-0@@ -20,6 +20,7 @@ DEPENDS = " \ SRCREV = "717edd7b844dcd66468f5d991991d87e9fc14c12" SRC_URI = " \ git://github.com/containers/libpod.git;branch=v4.0;protocol=https \ + file://0001-Rename-BUILDFLAGS-to-GOBUILDFLAGS.patch;patchdir=src/import \ " LICENSE = "Apache-2.0"Signature · 11 lines
2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#7404): https://lists.yoctoproject.org/g/meta-virtualization/message/7404 Mute This Topic: https://lists.yoctoproject.org/mt/92181869/1050810 Group Owner: [email protected] Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-