From 99bf48e5f8d0ba791706c168c81adb7484fffef2 Mon Sep 17 00:00:00 2001 From: Albin Kerouanton Date: Thu, 27 Feb 2025 19:27:16 +0100 Subject: [PATCH 1/3] Makefile: set CGO_LDFLAGS=-latomic on arm/v6 Compiling with Go >= 1.22 on arm/v6 is failing with the following error message: 27.84 gcc_libinit.c:44:8: error: large atomic operation may incur significant performance penalty; the access size (4 bytes) exceeds the max lock-free size (0 bytes) [-Werror,-Watomic-alignment] For these Go versions, we need to manually link to libatomic as arm/v6 does not support atomic intrinsics and neither the CGo, nor the C toolchain automatically link to that library. Signed-off-by: Albin Kerouanton --- Makefile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Makefile b/Makefile index 9868445..036a8f0 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,17 @@ ifeq "$(shell go env GOOS)" "darwin" export CGO_CFLAGS = -mmacosx-version-min=$(MACOSX_DEPLOYMENT_TARGET) endif +ifeq "$(shell go env GOOS)/$(shell go env GOARCH)/$(shell go env GOARM)" "linux/arm/6" + # Neither the CGo compiler, nor the C toolchain automatically link to + # libatomic when the architecture doesn't support atomic intrinsics, as is + # the case for arm/v6. + # + # Here's the error we get when this is not done (see https://github.com/docker/docker-credential-helpers/pull/340#issuecomment-2437593837): + # + # gcc_libinit.c:44:8: error: large atomic operation may incur significant performance penalty; the access size (4 bytes) exceeds the max lock-free size (0 bytes) [-Werror,-Watomic-alignment] + export CGO_LDFLAGS=-latomic +endif + .PHONY: all all: cross From a5569fbfffc6d9fce7943ea53304aa3ec987a4f2 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 24 Oct 2024 21:47:36 +0200 Subject: [PATCH 2/3] update to go1.22.11 (fix CVE-2024-45341, CVE-2024-45336) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit go1.22.11 (released 2025-01-16) includes security fixes to the crypto/x509 and net/http packages, as well as bug fixes to the runtime. See the Go 1.22.11 milestone on our issue tracker for details. - https://github.com/golang/go/issues?q=milestone%3AGo1.22.11+label%3ACherryPickApproved - full diff: https://github.com/golang/go/compare/go1.22.10...go1.22.11 Hello gophers, We have just released Go versions 1.23.5 and 1.22.11, minor point releases. These minor releases include 2 security fixes following the security policy: - crypto/x509: usage of IPv6 zone IDs can bypass URI name constraints A certificate with a URI which has a IPv6 address with a zone ID may incorrectly satisfy a URI name constraint that applies to the certificate chain. Certificates containing URIs are not permitted in the web PKI, so this only affects users of private PKIs which make use of URIs. Thanks to Juho Forsén of Mattermost for reporting this issue. This is CVE-2024-45341 and Go issue https://go.dev/issue/71156. - net/http: sensitive headers incorrectly sent after cross-domain redirect The HTTP client drops sensitive headers after following a cross-domain redirect. For example, a request to a.com/ containing an Authorization header which is redirected to b.com/ will not send that header to b.com. In the event that the client received a subsequent same-domain redirect, however, the sensitive headers would be restored. For example, a chain of redirects from a.com/, to b.com/1, and finally to b.com/2 would incorrectly send the Authorization header to b.com/2. Thanks to Kyle Seely for reporting this issue. This is CVE-2024-45336 and Go issue https://go.dev/issue/70530. Signed-off-by: Sebastiaan van Stijn --- .github/workflows/build.yml | 2 +- Dockerfile | 2 +- Makefile | 6 +++++- deb/Dockerfile | 2 +- docker-bake.hcl | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ec03847..8b0da93 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ on: env: DESTDIR: ./bin - GO_VERSION: 1.21.10 + GO_VERSION: 1.22.11 jobs: validate: diff --git a/Dockerfile b/Dockerfile index 8f4db1a..d5e8beb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -ARG GO_VERSION=1.21.10 +ARG GO_VERSION=1.22.11 ARG DEBIAN_VERSION=bookworm ARG XX_VERSION=1.6.1 diff --git a/Makefile b/Makefile index 036a8f0..e413bbf 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,11 @@ COVERAGEDIR ?= ./bin/coverage # 10.11 is the minimum supported version for osxkeychain export MACOSX_DEPLOYMENT_TARGET = 10.11 ifeq "$(shell go env GOOS)" "darwin" - export CGO_CFLAGS = -mmacosx-version-min=$(MACOSX_DEPLOYMENT_TARGET) + export CGO_CFLAGS = -Wno-atomic-alignment -mmacosx-version-min=$(MACOSX_DEPLOYMENT_TARGET) +else + # prevent warnings; see https://github.com/docker/docker-credential-helpers/pull/340#issuecomment-2437593837 + # gcc_libinit.c:44:8: error: large atomic operation may incur significant performance penalty; the access size (4 bytes) exceeds the max lock-free size (0 bytes) [-Werror,-Watomic-alignment] + export CGO_CFLAGS = -Wno-atomic-alignment endif ifeq "$(shell go env GOOS)/$(shell go env GOARCH)/$(shell go env GOARM)" "linux/arm/6" diff --git a/deb/Dockerfile b/deb/Dockerfile index 5f617e0..099fd3c 100644 --- a/deb/Dockerfile +++ b/deb/Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -ARG GO_VERSION=1.21.10 +ARG GO_VERSION=1.22.11 ARG DISTRO=ubuntu ARG SUITE=focal diff --git a/docker-bake.hcl b/docker-bake.hcl index c72103a..f65783c 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -1,5 +1,5 @@ variable "GO_VERSION" { - default = "1.21.10" + default = null } # Defines the output folder From a767624e34c6e88cf597a3610b8ce8ebee0dddbf Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 27 Feb 2025 15:04:51 +0100 Subject: [PATCH 3/3] update to go1.23.6 Signed-off-by: Sebastiaan van Stijn --- .github/workflows/build.yml | 2 +- Dockerfile | 2 +- deb/Dockerfile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8b0da93..ca8b106 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ on: env: DESTDIR: ./bin - GO_VERSION: 1.22.11 + GO_VERSION: 1.23.6 jobs: validate: diff --git a/Dockerfile b/Dockerfile index d5e8beb..9b477cb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -ARG GO_VERSION=1.22.11 +ARG GO_VERSION=1.23.6 ARG DEBIAN_VERSION=bookworm ARG XX_VERSION=1.6.1 diff --git a/deb/Dockerfile b/deb/Dockerfile index 099fd3c..468d6b1 100644 --- a/deb/Dockerfile +++ b/deb/Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -ARG GO_VERSION=1.22.11 +ARG GO_VERSION=1.23.6 ARG DISTRO=ubuntu ARG SUITE=focal