172 Commits
Author SHA1 Message Date
Christian Stewart 43d1323196 package/go: security bump to version 1.26.1
Building Go 1.26 and later requires Go 1.24.6 or later for bootstrap.

To support this we use Go version 1.25.8 as the version for
go-bootstrap-stage5 and have the build for Go 1.26.1 depend on
go-bootstrap-stage5.

Go version 1.25.8 is the latest Go version we can build using
go-bootstrap-stage4.

The package build for go-bootstrap-stage5 is effectively identical to
go-bootstrap-stage4 with only the Go version and stage number changed.

Go 1.28 is expected to require a minor release of Go 1.26 for bootstrap.

Fixes the following security vulnerabilities:

- CVE-2026-25679: net/url: reject IPv6 literal not at start of host
- CVE-2026-27142: html/template: URLs in meta attribute actions not escaped
- CVE-2026-27137: crypto/x509: incorrect enforcement of email constraints
- CVE-2026-27138: crypto/x509: panic in name constraint checking: certificates
- CVE-2026-27139: os: FileInfo can escape from a Root

For full release notes, see:
https://go.dev/doc/devel/release#go1.26.0

Signed-off-by: Christian Stewart <christian@aperture.us>
Signed-off-by: Julien Olivain <ju.o@free.fr>
2026-03-12 19:42:12 +01:00
Peter Korsgaard f56dc6b122 package/go: security bump to version 1.25.7
Fixes the following vulnerabilities:

CVE-2025-61732: cmd/cgo: remove user-content from doc strings in cgo ASTs

A discrepancy between how Go and C/C++ comments were parsed allowed for code
smuggling into the resulting cgo binary.

To prevent this behavior, the cgo compiler will no longer parse
user-provided doc comments.

CVE-2025-68121: crypto/tls: unexpected session resumption when using
Config.GetConfigForClient

Config.GetConfigForClient is documented to use the original Config's session
ticket keys unless explicitly overridden.  This can cause unexpected
behavior if the returned Config modifies authentication parameters, like
ClientCAs: a connection initially established with the parent (or a sibling)
Config can be resumed, bypassing the modified authentication requirements.

If ClientAuth is VerifyClientCertIfGiven or RequireAndVerifyClientCert (on
the server) or InsecureSkipVerify is false (on the client), crypto/tls now
checks that the root of the previously-verified chain is still in
ClientCAs/RootCAs when resuming a connection.

Go 1.26 Release Candidate 2, Go 1.25.6, and Go 1.24.12 had fixed a similar
issue related to session ticket keys being implicitly shared by
Config.Clone.  Since this fix is broader, the Config.Clone behavior change
has been reverted.

Note that VerifyPeerCertificate still behaves as documented: it does not
apply to resumed connections.  Applications that use
Config.GetConfigForClient or Config.Clone and do not wish to blindly resume
connections established with the original Config must use VerifyConnection
instead (or SetSessionTicketKeys or SessionTicketsDisabled).

For more details, see the announcement:
https://groups.google.com/g/golang-announce/c/K09ubi9FQFk

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
2026-02-10 13:22:18 +01:00
Peter Korsgaard 22137df16b package/go: security bump to version 1.25.6
Fixes the following vulnerabilities:

- CVE-2025-61728: archive/zip: denial of service when parsing arbitrary ZIP
  archives

  archive/zip used a super-linear file name indexing algorithm that is
  invoked the first time a file in an archive is opened.  This can lead to a
  denial of service when consuming a maliciously constructed ZIP archive.

- CVE-2025-61726: net/http: memory exhaustion in Request.ParseForm

  When parsing a URL-encoded form net/http may allocate an unexpected amount
  of memory when provided a large number of key-value pairs.  This can
  result in a denial of service due to memory exhaustion.

- CVE-2025-68121: crypto/tls: Config.Clone copies automatically generated
  session ticket keys, session resumption does not account for the
  expiration of full certificate chain

  The Config.Clone methods allows cloning a Config which has already been
  passed to a TLS function, allowing it to be mutated and reused.

  If Config.SessionTicketKey has not been set, and
  Config.SetSessionTicketKeys has not been called, crypto/tls will generate
  random session ticket keys and automatically rotate them.  Config.Clone
  would copy these automatically generated keys into the returned Config,
  meaning that the two Configs would share session ticket keys, allowing
  sessions created using one Config could be used to resume sessions with
  the other Config.  This can allow clients to resume sessions even though
  the Config may be configured such that they should not be able to do so.

- CVE-2025-61731: cmd/go: unexpected code execution when invoking toolchain

  The Go toolchain supports multiple VCS which are used retrieving modules
  and embedding build information into binaries.

  On systems with Mercurial installed (hg) downloading modules (e.g.  via go
  get or go mod download) from non-standard sources (e.g.  custom domains)
  can cause unexpected code execution due to how external VCS commands are
  constructed.

  On systems with Git installed, downloading and building modules with
  malicious version strings could allow an attacker to write to arbitrary
  files on the system the user has access to.  This can only be triggered by
  explicitly providing the malicious version strings to the toolchain, and
  does not affect usage of @latest or bare module paths.

  The toolchain now uses safer VCS options to prevent misinterpretation of
  untrusted inputs.  In addition, the toolchain now disallows module version
  strings prefixed with a "-" or "/" character.

- CVE-2025-61730: crypto/tls: handshake messages may be processed at the
  incorrect encryption level

  During the TLS 1.3 handshake if multiple messages are sent in records that
  span encryption level boundaries (for instance the Client Hello and
  Encrypted Extensions messages), the subsequent messages may be processed
  before the encryption level changes.  This can cause some minor
  information disclosure if a network-local attacker can inject messages
  during the handshake.

For details, see the announcement:
https://groups.google.com/g/golang-announce/c/Vd2tYVM8eUc

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
2026-01-27 21:55:00 +01:00
Bernd Kuhls eed28fd448 package/go: security bump to version 1.25.5
Release notes:
https://go.dev/doc/devel/release#go1.25.5
https://groups.google.com/g/golang-announce/c/8FJoBkPddm4
Fixes CVE-2025-61727 & CVE-2025-61729.

https://go.dev/doc/devel/release#go1.25.4
https://groups.google.com/g/golang-announce/c/tVVHm9gnwl8

Updated _SITE because previous URL returns 403.

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
Signed-off-by: Julien Olivain <ju.o@free.fr>
2025-12-05 19:23:44 +01:00
Peter Korsgaard c55714aeb9 package/go: security bump to version 1.25.3
For relase notes, see:
https://go.dev/doc/devel/release#go1.25.0

go1.25.2 (released 2025-10-07) includes security fixes to the archive/tar,
crypto/tls, crypto/x509, encoding/asn1, encoding/pem, net/http, net/mail,
net/textproto, and net/url packages, as well as bug fixes to the compiler,
the runtime, and the context, debug/pe, net/http, os, and sync/atomic
packages. See release announce:
https://groups.google.com/g/golang-announce/c/4Emdl2iQ_bI

go1.25.3 (released 2025-10-13) includes fixes to the crypto/x509 package.
See release announce:
https://groups.google.com/g/golang-announce/c/YEyj6FUNbik

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
[Julien: add links to release notes and announces]
Signed-off-by: Julien Olivain <ju.o@free.fr>
2025-10-19 23:47:32 +02:00
James Hilliard ecf12c186f package/go: bump to version 1.25.1
For relase notes, see:
https://go.dev/doc/devel/release#go1.25.0

Building Go 1.24 and later requires Go 1.22.6 or later for bootstrap.

To support this we use our previous Go version 1.23.12 as the version
for go-bootstrap-stage4 and have the build for Go 1.25.1 depend on
go-bootstrap-stage4.

Go version 1.23.12 is the latest go version we can build using
go-bootstrap-stage3.

The package build for go-bootstrap-stage4 if effectively identical to
go-bootstrap-stage3 with only the Go version and stage number changed.

Note: go version 1.25.1 release note mention a security fix
which is for CVE-2025-47910. This commit is not marked as security
bump, because the issue was introduced in version 1.25.0 which
was not included in Buildroot. See:
https://pkg.go.dev/vuln/GO-2025-3955

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Tested-by: Christian Stewart <christian@aperture.us>
[Julien: add link to release notes and
  comment about CVE in commit log.
]
Signed-off-by: Julien Olivain <ju.o@free.fr>
2025-09-25 22:33:40 +02:00
Thomas Perale 1869b4065c package/go: fix CPE id
This patch fixes the CPE ID for both go-bin and go-src packages.

The go-src package did had a CPE ID because GO_SRC_CPE_ID_VENDOR is
defined but the generated CPE ID would be the following:

cpe:2.3:a:golang:go-src:*:*:*:*:*:*:*:*

The CPE product go-src doesn't match to anything and should be 'go'
instead.

For go-bin no CPE_ID variable were defined so no CPE ID would be
generated if using a pre-build toolchain.

This patch duplicate the definition of the CPE_ID variables, I didn't
put the definition in the 'package/go/go.mk' file to avoid generate a
CPE for the go virtual package.

Signed-off-by: Thomas Perale <thomas.perale@mind.be>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2025-08-29 20:45:53 +02:00
Peter Korsgaard 84276c0449 package/go: security bump to version 1.23.12
go1.23.11 (released 2025-07-08) includes security fixes to the go command,
as well as bug fixes to the compiler, the linker, and the runtime.
See:
- https://go.dev/doc/devel/release#go1.23.11
- https://github.com/golang/go/issues?q=milestone%3AGo1.23.11+label%3ACherryPickApproved
The 1.23.11 version fixes:
- https://www.cve.org/CVERecord?id=CVE-2025-4674

go1.23.12 (released 2025-08-06) includes security fixes to the database/sql
and os/exec packages, as well as bug fixes to the runtime.
See:
- https://go.dev/doc/devel/release#go1.23.12
- https://github.com/golang/go/issues?q=milestone%3AGo1.23.12+label%3ACherryPickApproved
The 1.23.12 version fixes:
- https://www.cve.org/CVERecord?id=CVE-2025-47907

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
[Julien: add links to release notes, fixed issues and CVEs]
Signed-off-by: Julien Olivain <ju.o@free.fr>
2025-08-20 17:08:27 +02:00
Florian Larysch 432cf9be9f package/go: make pre-built compiler provide target support too
All Go packages must depend on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS,
which ensures that we do have a Go compiler available for that target.

BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS is currently restricted to the
availability of a full host Go compiler bootstrap. However, there are
architectures like AArch64 for which a full bootstrap is not supported.

Thus, currently, on an AArch64 host, we can't build Go packages (for
target or host), because we can't bootstrap a Go compiler.

However, note that a single Go compiler can generate code for all the
architectures supported by Go and for some host architectures, there are
pre-built toolchains available. When host-go-bin was added in commit
7b2a164b74 ("package/go/go-bin: new host-go provider"), the host
dependency was properly accounted for: It is already possible to build
host-go packages with go-bin. However, the fact that a Go compiler, in
addition to its native target, can also generate code for all supported
architectures, was missed at the time.

Thus, we can fix this problem by relaxing the condition under which
BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS is set to allowing go-bin
along with go-bootstrap. This allows a situation where the host can't
bootstrap, but for which there is a pre-built toolchain to build Go
packages for a supported target.

Signed-off-by: Florian Larysch <fl@n621.de>
Cc: Yann E. MORIN <yann.morin@orange.com>
Cc: Romain Naour <romain.naour@smile.fr>
Reviewed-by: Yann E. MORIN <yann.morin@orange.com>
Signed-off-by: Romain Naour <romain.naour@smile.fr>
2025-08-09 19:22:43 +02:00
Peter Korsgaard 00f0fca15a package/go: security bump to version 1.23.10
go1.23.9 (released 2025-05-06) includes fixes to the runtime and the linker.

go1.23.10 (released 2025-06-05) includes security fixes to the net/http and
os packages, as well as bug fixes to the linker.

Fixes the following security vulnerabilities:

- CVE-2025-4673: net/http: sensitive headers not cleared on cross-origin
  redirect

  Proxy-Authorization and Proxy-Authenticate headers persisted on
  cross-origin redirects potentially leaking sensitive information

- CVE-2025-0913: os: inconsistent handling of O_CREATE|O_EXCL on Unix and
  Windows

  os.OpenFile(path, os.O_CREATE|O_EXCL) behaved differently on Unix and
  Windows systems when the target path was a dangling symlink.  On Unix
  systems, OpenFile with O_CREATE and O_EXCL flags never follows symlinks.
  On Windows, when the target path was a symlink to a nonexistent location,
  OpenFile would create a file in that location.

- CVE-2025-22874: crypto/x509: usage of ExtKeyUsageAny disables policy validation

  Calling Verify with a VerifyOptions.KeyUsages that contains ExtKeyUsageAny
  unintentionally disabled policy validation.  This only affected
  certificate chains which contain policy graphs, which are rather uncommon.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2025-06-07 17:32:49 +02:00
Felicitas Pojtinger a2356a9e0a package/go-bootstrap-stage1: fix builds on GCC 15
GCC 15 defaults to -std=gnu23, which adds the bool keyword, causing
conflicts with stage1:

https://gcc.gnu.org/gcc-15/porting_to.html#c23-new-keywords

As a workaround, force the build to use -std=gnu99 mode.

Signed-off-by: Felicitas Pojtinger <felicitas@pojtinger.com>
[Peter: extend commit message]
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2025-05-17 17:33:18 +02:00
Christian Stewart 5764773957 package/go: security bump to version 1.23.8
go1.23.8 (released 2025-04-01) includes security fixes to the net/http package,
as well as bug fixes to the runtime and the go command.

https://go.dev/doc/devel/release#go1.23.8
https://github.com/golang/go/issues?q=milestone%3AGo1.23.8+label%3ACherryPickApproved

Signed-off-by: Christian Stewart <christian@aperture.us>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2025-04-02 09:28:21 +02:00
Peter Korsgaard 77674c6cfb package/go: security bump to version 1.23.7
go1.23.7 (released 2025-03-04) includes security fixes to the net/http
package, as well as bug fixes to cgo, the compiler, and the reflect,
runtime, and syscall package.

https://github.com/golang/go/issues?q=milestone%3AGo1.23.7+label%3ACherryPickApproved

Fixes:
https://www.cve.org/CVERecord?id=CVE-2025-22870

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
[Julien: add candidate CVE link]
Signed-off-by: Julien Olivain <ju.o@free.fr>
2025-03-05 21:07:48 +01:00
Thomas Perale 8b79823577 package/go/go-bin: re-introduce go-src hash
The commit b4006287f8 "package/go: security bump to version 1.23.6"
removed the go source from the go-bin package `.hash` file.
Since that commit, a number of autobuild errors for the host-go-bin
package started spawning during the 'legal-info' step.
Because the package 'go-bin' defines the '_ACTUAL_SOURCE_TARBALL'
variable the source hash is still required for the legal-info.

Similarly to the 'nodejs' package, the hash files for both the `go-bin`
and `go-src` package are shared in the `package/go` directory with the
help of a symbolic link used to make the subdirectories point to that
common `.hash` file.

Fixes:
https://autobuild.buildroot.org/results/337/33763441a065ddb07e944e26ad8f1f6d43b68592

Signed-off-by: Thomas Perale <thomas.perale@mind.be>
Signed-off-by: Romain Naour <romain.naour@smile.fr>
2025-02-10 23:00:02 +01:00
Peter Korsgaard b4006287f8 package/go: security bump to version 1.23.6
go1.23.6 (released 2025-02-04) includes security fixes to the
crypto/elliptic package, as well as bug fixes to the compiler and the go
command.

https://go.dev/doc/devel/release#go1.23.6
https://github.com/golang/go/issues?q=milestone%3AGo1.23.6+label%3ACherryPickApproved

While we are at it, drop the unused source tarball hash from the go-bin
package.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2025-02-05 12:36:55 +01:00
Christian Stewart 6299f479d1 package/go: security bump to version 1.23.5
go1.23.5 (released 2025-01-16) includes security fixes to the crypto/x509 and
net/http packages, as well as bug fixes to the compiler, the runtime, and the
net package.

https://go.dev/doc/devel/release#go1.23.5
https://github.com/golang/go/issues?q=milestone%3AGo1.23.5+label%3ACherryPickApproved

Signed-off-by: Christian Stewart <christian@aperture.us>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2025-01-29 21:54:08 +01:00
Christian Stewart ef27358963 package/go: bump to version 1.23.4
go1.23.4 (released 2024-12-03) includes fixes to the compiler, the runtime, the trace command, and the syscall package.

https://go.dev/doc/devel/release#go1.23.4
https://github.com/golang/go/issues?q=milestone%3AGo1.23.4+label%3ACherryPickApproved

Signed-off-by: Christian Stewart <christian@aperture.us>
Signed-off-by: Julien Olivain <ju.o@free.fr>
2024-12-09 23:16:03 +01:00
Peter Korsgaard 6d81e32256 Merge branch 'next'
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2024-12-08 14:04:59 +01:00
Christian Stewart 47881d30db package/go: bump version to go1.23.3
go1.23.3 (released 2024-11-06) includes fixes to the linker, the runtime,
and the net/http, os, and syscall packages.

https://go.dev/doc/devel/release#go1.23.minor

Signed-off-by: Christian Stewart <christian@aperture.us>
Signed-off-by: Julien Olivain <ju.o@free.fr>
2024-12-01 11:57:43 +01:00
Yann E. MORIN 575d971820 package/go: ensure there is a host-go provider, take 2
Commit 7b2a164b74 (package/go/go-bin: new host-go provider) broke the
case for prompt-less, host-only go packages, as the main host-go symbol
would not be selected.

This very same use-case was initially broken when the first go-src
provider was introduced with fa2536ec94 (package/go: make host package
a virtual package), and subsequently fixed in 99a5d51c6e (package/go:
ensure there is a host-go provider), so 7b2a164b74 is causing a
regression of a fixed regression.

Fix that the very same way it was originally fixed.

Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
Cc: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Thomas Perale <thomas.perale@mind.be>
Signed-off-by: Julien Olivain <ju.o@free.fr>
2024-11-19 22:13:40 +01:00
Christian Stewart 33015ce954 package/go: bump version to go1.23.2
Go 1.23.0 is a major release of Go.

Most of its changes are in the implementation of the toolchain, runtime, and libraries.

https://go.dev/doc/go1.23
https://go.dev/doc/devel/release#go1.23.2

Signed-off-by: Christian Stewart <christian@aperture.us>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2024-10-26 15:33:31 +02:00
Christian Stewart 800ec5dd7f package/go: bump version to go1.22.8
go1.22.8 (released 2024-10-01) includes fixes to cgo, maps, and syscall.

https://go.dev/doc/devel/release#go1.22.8

Signed-off-by: Christian Stewart <christian@aperture.us>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2024-10-09 23:23:55 +02:00
Thomas Perale 7b2a164b74 package/go/go-bin: new host-go provider
This package provides a pre-built version for the host-go virtual
package introduced in the previous commits:

 - host-go-bin installs a pre-built version of the Go compiler.

By default, host-go remains built from sources to keep the same
behavior as the former version.

The menuconfig entry for host-go is updated to expose the host-go-bin
provider. The dependencies are set as such as if host-go-src does not
support the host architecture, it will automatically fall back to
host-go-bin and vice versa.

Signed-off-by: Thomas Perale <thomas.perale@mind.be>
[yann.morin.1998@free.fr:
  - update hashes for 1.22.7
  - add hash for the source tarball
  - set _DL_SUBDIR
  - don't set a prompt to BR2_PACKAGE_HOST_GO_BIN_HOST_ARCH
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2024-09-15 15:59:18 +02:00
Yann E. MORIN e9b0893a8e package/go/go-src: share download directory with go
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2024-09-15 15:58:09 +02:00
Athaariq Ardhiansyah 7cac7bc3c9 package/go: expose option to enable via configurator
Expose the host-go in the menuconfig, so that user can select what go
compiler to use, without having to first enable a go package, or to
have it in the SDK without having a go package enabled.

Signed-off-by: Athaariq Ardhiansyah <foss@athaariq.my.id>
[yann.morin.1998@free.fr: rewrite commit log]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2024-09-14 18:14:36 +02:00
Christian Stewart 8d371dbe55 package/go: security bump to version 1.22.7
Fixes the following CVEs:

CVE-2024-34155: go/parser: stack exhaustion in all Parse* functions
CVE-2024-34156: encoding/gob: stack exhaustion in Decoder.Decode
CVE-2024-34158: go/build/constraint: stack exhaustion in Parse

https://go.dev/doc/devel/release#go1.22.7

Signed-off-by: Christian Stewart <christian@aperture.us>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2024-09-14 10:57:46 +02:00
Peter Korsgaard 5aa9b105b9 package/go: fix convenience typo
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2024-09-10 22:50:00 +02:00
Peter Korsgaard c31189363b package/go-src: fix variable typo in patch description
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2024-09-10 22:49:59 +02:00
Yann E. MORIN 6016dad5cf package/go: expose host CGO linking support
Even when configured for cross-compilation, the go compiler is always
able to build natively as well, and this is was we use in Buildroot to
build host go packages. This implies that when the target has
limitations, those limitations thus also apply to the host builds.

This means that, when there is no CGO linking support for the target,
the compiler is built without CGO linking support, and thus CGO linking
is also not available for the host builds.

Of course, when there is no go support for the target, the CGO linking
support only depends on the host architecture.

Add a new Kconfig symbol that repesent whether CGO linking is available
for the host; host packages can then depend on that symbol, like the
target variants do on the corresponding target symbol.

The dependencies of this symbol are a bit complicated. Fortunately,
because it is a blind symbol, we can write it with a combination of
"default y" and "depends on" statements. As mentioned, CGO for the host
is available if CGO is available for the target, but also if Go is not
available for the target at all. In addition, Go must of course be
available for the host. There are also the toolchain constraints of CGO.
We exclude MIPS64 explicitly based on BR2_HOSTARCH. For the host, we
always assume that dynamic library and threads are available so we don't
have conditions for that.

Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
Cc: Thomas Perale <thomas.perale@mind.be>
Cc: Christian Stewart <christian@aperture.us>
Cc: Anisse Astier <anisse@astier.eu>
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
2024-09-03 23:14:06 +02:00
Anisse Astier 079f5ccdca package/go: disable cgo support with static libs
The go stdlib "plugin" package relies on dlfcn.h which isn't available
when we have BR2_STATIC_LIBS=y.

Concentrate all cgo decision (including the existing threads part)
under the config option BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS
that has the proper depends.

This should fix this build error from autobuilders:

/buildroot/build/host-go-1.19.3/src/plugin/plugin_dlopen.go:11:10: fatal error: dlfcn.h: No such file or directory
   11 | #include <dlfcn.h>

Fixes:
  http://autobuild.buildroot.net/results/1f4/1f4b9882986b9df723a1446493d270c29287b505
  http://autobuild.buildroot.net/results/a9d/a9de62374c948f773634c694a47abcaa2bc266d0

Signed-off-by: Anisse Astier <anisse@astier.eu>
Reviewed-by: Christian Stewart <christian@paral.in>
[Arnout: revert parts to v2, keeping most of the overall logic as it
was]
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
2024-07-13 09:56:16 +02:00
Christian Stewart 5d02277884 package/go: security bump version to go1.22.5
Fixes CVE:

CVE-2024-24791: net/http: denial of service due to improper 100-continue handling

https://go.dev/doc/devel/release#go1.22.5

Signed-off-by: Christian Stewart <christian@aperture.us>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2024-07-12 23:08:04 +02:00
Yann E. MORIN 60fc945734 package/go: ensure the toolchain is available
The toolchain is needed to build the final-stage go compiler, when it
should have CGO support.

However, in commit 0290c543de (package/go: new subdirectory for go
variants), the HOST_GO_DEPENDENCIES assignment was only partially split
off to the new location; part of it was left in the ole go.mk to act as
common variables. With that commit, the go package had not been renamed,
which meant that the dependencies were still correct.

But in commit fa2536ec94 (package/go: make host package a virtual
package), the 'go' package was renamed to 'go-src', and replaced by a
'go' virtual package.

The variables in the go-src package were properly renamed, and the
variables in the go virtual package were properly _not_ renamed. As a
consequence, the go-src package lost its dependency on the toolchain
when needed, while the go virtual package still had it.

However, that was not correct when CGO is enabled (i.e. when the target
has threads): go-src then fails to build:

    Building Go cmd/dist using [...]/host/lib/go-1.21.8. (go1.21.8 linux/amd64)
    go tool dist: cannot invoke C compiler ["[...]/host/bin/aarch64-linux-gcc"]:
    fork/exec [...]/host/bin/aarch64-linux-gcc: no such file or directory

    Go needs a system C compiler for use with cgo.
    To set a C compiler, set CC=the-compiler.
    To disable cgo, set CGO_ENABLED=0.

After some retro-thinking, the reasoning behind this was that the
toolchain would _also_ be needed when using the prebuilt go-bin, which
is indeed correct, so by having it as a dependency of the virtual
package, it would ensure the toolchain be present in both cases, when
building from scratch or when using a prebuilt go.

The oversight being that the toolchain is _also_ needed to actually
build go when CGO is enabled.

We fix this by handling the toolchain dependency for CGO by exposing it
in a variable, that can be used as a dependency in go-src, like is done
to actually enable or disable CGO support.

We still ensure that host-go still depends on it, for a future go-bin
provider.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2024-06-23 23:00:01 +02:00
Yann E. MORIN 99a5d51c6e package/go: ensure there is a host-go provider
Commit fa2536ec94 (package/go: make host package a virtual package)
introduced host-go as a host-only virtual package, which had a single
provider, the choice of which is only exposed when a (target or host)
package has selected BR2_PACKAGE_HOST_GO to indicate it needs host-go.

However, this forgot to account for prompt-less, host-only packages,
which have no way of selecting that symbol.

Having prompt-less, host-only packages is a totally unexceptional,
supported case; for example a host package can be depended upon by
another (target or host) package, or by a filesystem, and we do not
require Kconfig symbols to be exposed for those packages.

As a consequence, when not package is enabled, that can select that
symbol, we can't run 'make source' or 'make host-foo-source':

    make[1]: *** No rule to make target 'host-', needed by
    '[...]/build/host-go-1.22.4/.stamp_configured'. Stop.

Fix that by moving the provider symbol out of the if-block, so that
there is always a provider defined.

Now, we only have host-go-src as a provider, but the symbol is still
part of the choice that is conditional (and that _has_ to be
conditional), so the BR2_PACKAGE_HOST_GO_SRC can never be set unless
there is a package that explicitly select BR2_PACKAGE_HOST_GO.

So, drop the conditional on the default, so that there is always a
provider available.

This mirrors other similar situations, like the rust case.

Fixes: fa2536ec94

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
LGTM: Arnout Vandecappelle (Essensium/Mind) (on IRC) <arnout@mind.be>
2024-06-20 20:33:44 +02:00
Yann E. MORIN 7338e10389 package/go-bootstrap-stage3: move missing patch
The patch was added in commit 25991c843c (package/go-bootstrap-stage3:
fix go-bootstrap when parent dir contains invalid .git). Then all the
go-compiler packages were moved to a common sub-directory, in commit
0290c543de (package/go: new subdirectory for go variants).

However, the patch for commit 0290c543de was sent to the mailing list
before 25991c843c was applied, so it could not have moved a file that
was only added later.

Move that file, now.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Thomas Perale <thomas.perale@mind.be>
Cc: Romain Naour <romain.naour@smile.fr>
2024-06-20 20:31:55 +02:00
Peter Korsgaard 876d24578c Merge branch 'next' 2024-06-13 11:16:07 +02:00
Christian Stewart d6e0f1b622 package/go: security bump to go1.22.4
Fixes the following CVEs:

CVE-2024-24789: archive/zip: mishandling of corrupt central directory record
CVE-2024-24790: net/netip: unexpected behavior from Is methods for IPv4-mapped IPv6 addresses

View the release notes for more information:
https://go.dev/doc/devel/release#go1.22.4

Signed-off-by: Christian Stewart <christian@aperture.us>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2024-06-04 23:16:48 +02:00
Thomas Perale fa2536ec94 package/go: make host package a virtual package
Turns host-go into a virtual package, with a single providers:

 - host-go-src, which builds host-go from source based on the same logic
   that was previously used in package/go/go/go.mk, now moved to
   package/go/go-src/go-src.mk to remove any ambiguity on the role of
   the package.

In later commits, we'll add host-go-bin a prebuilt binary host go compiler
as another provider.

A similar solution is proposed for host-rust.

Signed-off-by: Thomas Perale <thomas.perale@mind.be>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2024-06-01 17:08:43 +02:00
Thomas Perale 58a291470a package/pkg-golang: select BR2_PACKAGE_HOST_GO
Makes every packages built by the Go compiler select a new variable
introduced in this patch: BR2_PACKAGE_HOST_GO.
In later commits Go compiler variant will be introduced (built from
source, pre-built binaries) and selecting BR2_PACKAGE_HOST_GO will
force to add host-go provider to the dependency list.

The same pattern is used for Rust packages.

Signed-off-by: Thomas Perale <thomas.perale@mind.be>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2024-06-01 17:08:22 +02:00
Thomas Perale 0290c543de package/go: new subdirectory for go variants
Move every go compiler-related packages into a newly created
package/go/ subdirectory.

This subdirectory structure moves the GO_VERSION variable into the
common package/go/go.mk file. In the next commits, host-go will be
turned into a virtual-package and the common GO_VERSION force the
providers to use the same Go compiler version.
Common variables to all providers are kept in package/go/go.mk and
package/go/Config.in.host.
Also, the subdirectory structure forces the evaluation of the common
GO_VERSION before the providers access it.

Signed-off-by: Thomas Perale <thomas.perale@mind.be>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2024-06-01 17:05:20 +02:00
Christian Stewart b74cb51c0f package/go: security bump version to go1.22.3
Fixes CVEs:

CVE-2024-24787: cmd/go: arbitrary code execution during build on darwin
CVE-2024-24788: net: malformed DNS message can cause infinite loop

https://go.dev/doc/devel/release#go1.22.3

Signed-off-by: Christian Stewart <christian@aperture.us>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2024-05-08 18:37:18 +02:00
Christian Stewart aef5490fab package/go: security bump to go1.22.2
CVE-2023-45288: http2: close connections when receiving too many headers

https://go.dev/doc/devel/release#go1.22.2

Signed-off-by: Christian Stewart <christian@aperture.us>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2024-04-04 16:20:30 +02:00
Christian Stewart 84caea5d58 package/go: bump to version go1.22.1
Upgrade Go to the latest v1.22.x point release, go1.22.1.

This requires go-bootstrap-stage3 at version go1.21.8:

See: https://go.dev/doc/go1.22#bootstrap

https://go.dev/doc/devel/release#go1.22.1

Signed-off-by: Christian Stewart <christian@aperture.us>
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
2024-03-25 23:27:45 +01:00
Christian Stewart a94f816e45 package/go: security bump to go1.21.8
Fixes the following CVEs:

CVE-2024-24783: crypto/x509: Verify panics on certificates with an unknown public key algorithm
CVE-2023-45290: net/http: memory exhaustion in Request.ParseMultipartForm
CVE-2023-45289: net/http, net/http/cookiejar: incorrect forwarding of sensitive headers and cookies on HTTP redirect
CVE-2024-24785: html/template: errors returned from MarshalJSON methods may break template escaping
CVE-2024-24784: net/mail: comments in display names are incorrectly handled

https://go.dev/doc/devel/release#go1.21.8

Signed-off-by: Christian Stewart <christian@aperture.us>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2024-03-06 08:23:51 +01:00
Christian Stewart 568bd6c39d package/go: bump version to go1.21.7
go1.21.7 (released 2024-02-06) includes fixes to the compiler, the go command,
the runtime, and the crypto/x509 package.

https://go.dev/doc/devel/release#go1.21.7

Signed-off-by: Christian Stewart <christian@aperture.us>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2024-02-06 23:29:14 +01:00
Christian Stewart 22393c9326 package/go: bump to version 1.21.6
go1.21.6 (released 2024-01-09) includes fixes to the compiler, the runtime, and
the crypto/tls, maps, and runtime/pprof packages.

https://go.dev/doc/devel/release#go1.21.6

Signed-off-by: Christian Stewart <christian@aperture.us>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2024-01-10 17:12:25 +01:00
Christian Stewart b81b82da3e package/go: security bump to v1.21.5
Fixes the following CVEs:

CVE-2023-39326: net/http: limit chunked data overhead
CVE-2023-45285: cmd/go: go get may unexpectedly fallback to insecure git

https://go.dev/doc/devel/release#go1.21.5

Signed-off-by: Christian Stewart <christian@aperture.us>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2023-12-07 10:47:02 +01:00
Christian Stewart bf1d1a9b7a package/go: security bump to go1.21.4
Go version 1.21.4 includes the following security fixes:

CVE-2023-45283: path/filepath: recognize \??\ as a Root Local Device path prefix.
CVE-2023-45284: path/filepath: recognize device names with trailing spaces and superscripts

https://go.dev/doc/devel/release#go1.21.4

Signed-off-by: Christian Stewart <christian@aperture.us>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2023-11-08 08:07:44 +01:00
Peter Korsgaard 9104583124 package/go: security bump to version 1.21.3
Fixes CVE-2023-39325: rapid stream resets can cause excessive work

A malicious HTTP/2 client which rapidly creates requests and immediately
resets them can cause excessive server resource consumption.  While the
total number of requests is bounded to the http2.Server.MaxConcurrentStreams
setting, resetting an in-progress request allows the attacker to create a
new request while the existing one is still executing.

go1.21.3 (released 2023-10-10) includes a security fix to the net/http
package.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Reviewed-by: Christian Stewart <christian@aperture.us>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2023-10-12 16:38:28 +02:00
Peter Korsgaard 1316b4ef31 package/go: security bump to version 1.21.2
Fixes CVE-2023-39323: Line directives ("//line") can be used to bypass the
restrictions on "//go:cgo_" directives, allowing blocked linker and compiler
flags to be passed during compilation.  This can result in unexpected
execution of arbitrary code when running "go build".

go1.21.2 (released 2023-10-05) includes one security fixes to the cmd/go
package, as well as bug fixes to the compiler, the go command, the linker,
the runtime, and the runtime/metrics package.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2023-10-08 18:00:13 +02:00
Yann E. MORIN 1db38d9282 package/go: fix installation
When building for a target architecture that go does not support, the
installation fails with:

    $ make host-go
    [...]
    ln -sf ../lib/go/bin/go /home/nyma7486/dev/work/5GCroCo/O/pouet/per-package/host-go/host/bin/
    ln: failed to create symbolic link '/home/nyma7486/dev/work/5GCroCo/O/pouet/per-package/host-go/host/bin/': No such file or directory

Indeed, the HOST_DIR/bin is not guaranteed to exist when we install a
host package, so it needs to be explicitly created before we can create
entries in there.

Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
Cc: Christian Stewart <christian@aperture.us>
Cc: Anisse Astier <anisse@astier.eu>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2023-10-01 16:35:55 +02:00