Skip to content

Go 1.27.4 - #194

Merged
bradfitz merged 27 commits into
tailscale.go1.27from
bradfitz/go1.27.4
Nov 10, 2026
Merged

bradfitz merged 27 commits into
tailscale.go1.27from
bradfitz/go1.27.4

Conversation

@bradfitz

Copy link
Copy Markdown
Member

Go 1.27.4

  • [release-branch.go1.27] cmd/dist: fix GOFIPS140 toolchain compilation
  • [release-branch.go1.27] cmd/internal/obj/x86: clear forward-jump list on PCALIGN
  • [release-branch.go1.27] Revert "runtime: fix timespec definition on 32bits systems"
  • [release-branch.go1.27] cmd/compile: teach deadstore about CondSelect
  • [release-branch.go1.27] net: fix zero value address handling in Dialer.Dial{TCP,UDP,IP}
  • [release-branch.go1.27] crypto/internal/fips140: run CASTs when generating keys
  • [release-branch.go1.27] crypto/rsa: apply FIPS 140-3 approved checks to MGF hash in OAEP
  • [release-branch.go1.27] crypto/hkdf: remove unnecessary HMAC key length allowance for HKDF-Expand
  • [release-branch.go1.27] crypto/internal/fips140/tls12: record SHA-384 as approved in MasterSecret
  • [release-branch.go1.27] crypto/internal/fips140/sha3: record legacy Keccak as non-approved
  • [release-branch.go1.27] cmd/compile: record method indices before encoding a named type
  • [release-branch.go1.27] crypto/tls: omit ML-DSA from signature_algorithms_cert
  • [release-branch.go1.27] runtime: match deferring function when looking for linked defers in nextFrame
  • [release-branch.go1.27] cmd/go: disallow --sysroot and -target, validate -isysroot/-syslibroot, and restrict -x
  • [release-branch.go1.27] cmd/go: reject GCC spec files in linker search directories
  • [release-branch.go1.27] cmd/go: disallow -gen- and -gnat in flag allowlists**
  • [release-branch.go1.27] cmd/go: disallow separated -l flag followed by to_library
  • [release-branch.go1.27] cmd/go: validate split -Wl, next-arg flags and linker script targets
  • [release-branch.go1.27] cmd/go: validate .syso and linker input files against scripts and embedded options
  • [release-branch.go1.27] cmd/go: disallow pkg-config local .pc paths and inspect cgoCPPFLAGS
  • [release-branch.go1.27] cmd/go, cmd/link: reject .syso files with Go object or unrecognized formats
  • [release-branch.go1.27] cmd/compile, cmd/link: validate cgo symbol names and prevent export overwrite
  • [release-branch.go1.27] cmd/cgo, cmd/compile, cmd/link: validate cgo_import_dynamic library names
  • [release-branch.go1.27] cmd/go, cmd/compile: unquote //go:cgo_ldflag and bound slice removal
  • [release-branch.go1.27] net/http: prevent HTTP/1 server crash due to MaxBytesReader header race
  • [release-branch.go1.27] go1.27.4

Updates tailscale/tailscale#22325

FiloSottile and others added 27 commits October 27, 2026 12:25
Go 1.26 started rejecting purego+GOFIPS140 builds, so it won't build a
toolchain1 if GOFIPS140 is set (which is intended to apply only to the
final tools and as the default for builds produced with that toolchain).

Updates golang#81335
Fixes golang#82334

Change-Id: I27cf27848b7612d00ba3ade4c259acb46a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/827164
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Mark Freeman <mark@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
(cherry picked from commit 2e7619c)
Reviewed-on: https://go-review.googlesource.com/c/go/+/850645
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: David Chase <drchase@google.com>
… on PCALIGN

CL 696915 moved the PCALIGN case in span6 below forward-jump
processing but left it ahead of the p.Rel = nil reset. When a
short branch needs widening, span6 reassembles and pushes the
same jump onto the stale list again, making q.Forwd == q and
looping forever.

Clear p.Rel for every Prog right after its forward jumps are
patched.

For golang#81792
Fixes golang#81927

Change-Id: Ief88bc5350a95a71487a1dc51dc2309c6252336e
Reviewed-on: https://go-review.googlesource.com/c/go/+/839925
Reviewed-by: guangyuan zhou <zhouguangyuan@golangcn.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
(cherry picked from commit 27903a8)
Reviewed-on: https://go-review.googlesource.com/c/go/+/842345
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Liz Fong-Jones <lizf@honeycomb.io>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
…2bits systems"

This reverts commit ba402cd.

I was looking at the wrong linux timespec struct (internal vs UAPI).

Updates golang#82147
Fixes golang#82150

Change-Id: I773f7413d5b7a16fae707502409ea0e784c4e69d
Reviewed-on: https://go-review.googlesource.com/c/go/+/848207
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: David Chase <drchase@google.com>
DeadStore never used to have to think about CondSelect since
before CL 685676 and CL 715044 it were impossible for CondSelect
values to exists when deadstore ran.

Now it might so tell deadstore what to do about them.

Updates golang#81863
Fixes golang#81866

Change-Id: Id1c37da97137bd7091f169a9169ee04e7eb07f87
Reviewed-on: https://go-review.googlesource.com/c/go/+/841425
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: PJ Malloy <pjmalloy@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/845968
TryBot-Bypass: David Chase <drchase@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
…r.Dial{TCP,UDP,IP}

Fixes golang#82023

Change-Id: I4f1698fa924f71d791c842cfbad9915ad7c5932b
Reviewed-on: https://go-review.googlesource.com/c/go/+/835805
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
(cherry picked from commit 0b6b838)
Reviewed-on: https://go-review.googlesource.com/c/go/+/852025
Reviewed-by: David Chase <drchase@google.com>
TryBot-Bypass: David Chase <drchase@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
…ating keys

Arguably, the PCTs are sufficient on these paths, but be conservative.

It's free anyway, assuming the key will be used shortly after.

For golang#82625
For golang#82627

Change-Id: If19efa7d9d1beb0e49b6f6803a492ed06a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/855101
TryBot-Bypass: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: David Chase <drchase@google.com>
…to MGF hash in OAEP

For golang#82625
For golang#82627

Change-Id: I3dcbd54a4f2a360a4300f7e8cc31d9196a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/831726
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
(cherry picked from commit e9a2cef)
Reviewed-on: https://go-review.googlesource.com/c/go/+/855102
TryBot-Bypass: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: David Chase <drchase@google.com>
…th allowance for HKDF-Expand

For golang#82625
For golang#82627

Change-Id: I11c0ff2a8be4f88e59bf139c4bb42bec6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/855103
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
TryBot-Bypass: Junyang Shao <shaojunyang@google.com>
… as approved in MasterSecret

The SHA-384 output size is 48 bytes, not 46, so the extended master
secret derivation with SHA-384 was recorded as non-approved.

Updates golang#79228
For golang#82625
For golang#82627

Change-Id: I781be024b999fdc832a28d8964241b1d6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/855104
TryBot-Bypass: Junyang Shao <shaojunyang@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
…eccak as non-approved

The legacy Keccak hashes share the Digest type with SHA-3, and
Digest.Sum recorded them as approved. HMAC and RSA-PSS/OAEP accept any
*sha3.Digest and rely on the hash recording its own indicator, so they
were recorded as approved over Keccak, too.

NewLegacyKeccak256 and NewLegacyKeccak512 are not used outside of
tests, so no public API was affected.

For golang#82625
Fixes golang#82627

Change-Id: I34c2cf54ba12073a690b93012075c06e6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/855105
Reviewed-by: Junyang Shao <shaojunyang@google.com>
TryBot-Bypass: Junyang Shao <shaojunyang@google.com>
Reviewed-by: David Chase <drchase@google.com>
…oding a named type

CL 826105 added explicit method indices to unified export data (V5)
so that importers can restore a named type's source method order.
But the encoder only recorded a type's method indices after encoding
its underlying type, and encoding the underlying type can encode one
of the type's own generic methods first: if a field's type has a
method whose body calls the generic method, encoding that body
encodes the generic method object, which then looks up its index
before it was recorded and gets 0. Importers then sort it among the
type's first methods, so objectpath again attributes analysis facts
to the wrong methods (crashing staticcheck as in golang#81188).

Record the indices before encoding anything else.

[Note: I manually edited the cherrypick to avoid a dependency
on the too-new testimporter package. --adonovan.]

Updates golang#81188
Updates golang#82105
Fixes golang#82106

Change-Id: Icc8cfdd5620bb6d50b1c0b296f325c7d99ee9cc5
Reviewed-on: https://go-review.googlesource.com/c/go/+/847627
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/855582
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Auto-Submit: Junyang Shao <shaojunyang@google.com>
TryBot-Bypass: Junyang Shao <shaojunyang@google.com>
…thms_cert

Some non-compliant middleboxes reject ML-DSA in
signature_algorithms_cert due to rules targeting an old OpenSSL DoS
vulnerability, causing connection failures.

Restore the Go 1.26 contents of signature_algorithms_cert while
retaining ML-DSA in signature_algorithms.

Fixes golang#82536
Updates golang#81199

Change-Id: Ib0563c4925a913d7422ee1ad84ed25473ee1a4a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/854185
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Neal Patel <neal@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
TryBot-Bypass: Junyang Shao <shaojunyang@google.com>
…g for linked defers in nextFrame

In _panic.nextFrame, searching for the frame containing linked defers
(limit = gp._defer.sp) only compared u.frame.sp == limit. On
architectures where leaf calls do not adjust the stack pointer or in
the presence of frameless leaf wrappers, a callee wrapper shares the
exact same SP as its caller. When panicking inside such a wrapper,
nextFrame prematurely broke on the wrapper frame. Because the frameless
wrapper has no saved link register on the stack, subsequent traceback
initialization from p.pc failed with "fatal error: traceback did not
unwind completely".

Require u.frame.fn == findfunc(d.pc) in addition to u.frame.sp == limit
before stopping at a frame with linked defers. This ensures nextFrame
skips frameless wrappers and unwinds to the actual function that
registered the defer.

Updates golang#81959
Fixes golang#82657

Change-Id: Ic9c63b8133041968044062a5983f8519a94dafb1
GitHub-Last-Rev: e855c3a
GitHub-Pull-Request: golang#81989
Reviewed-on: https://go-review.googlesource.com/c/go/+/844565
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Carlos Amedee <carlos@golang.org>
(cherry picked from commit 02e6c32)
Reviewed-on: https://go-review.googlesource.com/c/go/+/854949
Reviewed-by: Junyang Shao <shaojunyang@google.com>
TryBot-Bypass: David Chase <drchase@google.com>
TryBot-Bypass: Junyang Shao <shaojunyang@google.com>
…ate -isysroot/-syslibroot, and restrict -x

Remove --sysroot and -target from the compiler and linker flag
allowlists, as GCC and Clang use --sysroot to relocate subprograms, spec
files, and CRT startup objects, and Clang's -target flag falls back to
executing target helper tools (such as orbis-ld, prospero-lld, xcc, or
llvm-spirv) from the current working directory when not found in PATH.

Keep -isysroot and -Wl,-syslibroot for SDK selection, but verify in
checkLinkerFlags that their target is not a regular file on disk (which
GNU ld.bfd treats as a positional linker script).

Also restrict -x to the C/C++/Objective-C/assembler languages supported
by cgo.

Fixes CVE-2026-97033
For golang#82577
Fixes golang#82600

Change-Id: I6e85fe46f26bb6366e03e17f8761e7c884694874
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/6080
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/6860
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/861484
TryBot-Bypass: Gopher Robot <gobot@golang.org>
Reviewed-by: Neal Patel <nealpatel@google.com>
…h directories

Keep -fsanitize=, -fopenmp, and -static-lib* in the compiler and linker
flag allowlists, and instead prevent GCC from loading untrusted specs or
*.spec files (such as libgomp.spec or libsanitizer.spec) from -L,
-isysroot, and -Wl,-syslibroot directories (including subdirectories,
symlinked subdirectories, sysroot-prefixed -L= and -L$SYSROOT paths, and
GCC multilib sibling directories ../lib, ../lib32, ../lib64, and
../libx32 both before and after resolving symlinks).

When linker flags that cause GCC's *link_command spec to evaluate
%:include(libgomp.spec) (-fopenmp or -fopenacc) or
%:include(libsanitizer.spec) (-fsanitize=* combined with -static or
-static-lib*) are present, also check the current working directory and
package directory for spec files, while allowing standalone -fsanitize=*,
-fno-openmp, -fopenmp-simd, and -static. Also tighten -fsanitize= in
validCompilerFlags to reject @ and - prefixes.

Fixes CVE-2026-97034
For golang#82576
Fixes golang#82598

Change-Id: I1878e1b9eae7c2dee4a6dbc96ff11e17c3dac527
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/6081
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/6880
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/861485
TryBot-Bypass: Gopher Robot <gobot@golang.org>
Reviewed-by: Neal Patel <nealpatel@google.com>
…lowlists

Exclude Clang's -gen-* (such as the 2-argument -gen-cdb-fragment-path
<dir> flag) and GCC's -gnat* (such as the 2-argument -gnatO <file> flag)
from matching the 1-argument -g* wildcard in validCompilerFlags and
validLinkerFlags. Allowing these flags permitted writing sidecar output
files and desynchronized flag arity between checkFlags and the compiler
driver, allowing subsequent arguments (such as a linker script after a
2-argument flag like -arch or -L) to be passed as positional inputs to
the linker and cause unexpected code execution at build time.

Fixes CVE-2026-97035
For golang#82575
Fixes golang#82596

Change-Id: I334aee8d66f96db3abe1dfb722cb69b5cb4585ae
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/6082
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/6881
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/861486
Reviewed-by: Neal Patel <nealpatel@google.com>
TryBot-Bypass: Gopher Robot <gobot@golang.org>
…y to_library

We included "-l" in validLinkerFlagsWithNextArg. On macOS passing "-l
to_library" would be recombined into "-lto_library" and interpreted with
the next argument, which we include in invalidLinkerFlags because it
could then cause arbitrary plugins to be loaded. Also exclude
-lazy_library, -lazy_framework, -load_hidden, -library, and
-library-path in invalidLinkerFlags, and check recombined "-l"
arguments against invalidLinkerFlags and disallow patterns.

Fixes CVE-2026-97036
For golang#82574
Fixes golang#82594

Change-Id: I6ccca7bc34f0a41c73a2774b53c00954da95ff91
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/6083
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/6841
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/861487
Reviewed-by: Neal Patel <nealpatel@google.com>
TryBot-Bypass: Gopher Robot <gobot@golang.org>
…d linker script targets

In checkFlags, check strings.HasPrefix(arg, "-Wl,") before the generic
load.SafeArg(list[i+1]) branch so split -Wl, flags in
validLinkerFlagsWithNextArg require a -Wl,<SafeArg> second token (while
continuing to allow bare <SafeArg> for "-Wl,-R" for backwards
compatibility), and exclude bare -Wl,--warn-backrefs-exclude in
invalidLinkerFlags so lld cannot consume the following linker token.

In checkLinkerFlags, validate 1-token, 2-token, and -Wl,--push-state
forms of -framework, -Wl,-framework, -Wl,-undefined, -Wl,--just-symbols,
-Wl,-R (including -Wl,-R=<path>), -Wl,-subsystem, and -Wl,-sectcreate so
they cannot pass linker script files to the external linker.

Fixes CVE-2026-97037
For golang#82573
Fixes golang#82592

Change-Id: I26f97c785ac420a999f77080b6c5e95268720a2e
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/6084
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/6882
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/861488
Reviewed-by: Neal Patel <nealpatel@google.com>
TryBot-Bypass: Gopher Robot <gobot@golang.org>
… against scripts and embedded options

Verify that .syso files, direct linker inputs (.a, .o, .obj, .dll,
.dylib, .lib, .so, .tbd), and libraries in -L directories (including
symlinked subdirectories and sysroot-prefixed -L= and -L$SYSROOT paths)
have valid binary object/archive headers rather than GNU ld implicit
linker scripts (such as INPUT, GROUP, OUTPUT, or PLUGIN directives), and
disallow -l:<filename> and :, =, or path separators (/ or \) in
-l<namespec> so -L directories cannot load arbitrary filenames or
unindexed subdirectories as scripts.

Also reject GCC spec files in -L search trees (including multilib
sibling directories before and after symlink resolution), recursively
inspect ar archive members and universal Mach-O slices (requiring symbol
table pseudo-members __.SYMDEF and __.SYMDEF SORTED at member index 0 and
/ at leading linker member indices with exact BSD #1/<len> name matching,
allowing PE short import members, and rejecting truncated archives), reject COFF objects containing unallowlisted
.drectve directives, reject Mach-O objects containing LC_LINKER_OPTION
load commands, and reject ELF, PE/COFF, and Mach-O objects containing
GCC or LLVM LTO IR sections (.gnu.lto_*, .gnu.debuglto_*, .llvm.lto*,
.llvmbc, .llvmcmd, SHT_LLVM_LTO).

Fixes CVE-2026-97038
For golang#82572
Fixes golang#82590

Change-Id: Ia1fe15d70114aa44dcf22948b60b7b8169c92a02
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/6085
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/6900
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/861489
TryBot-Bypass: Gopher Robot <gobot@golang.org>
Reviewed-by: Neal Patel <nealpatel@google.com>
…nd inspect cgoCPPFLAGS

Remove --with-path= and --personality= from validPkgConfigFlags while
preserving --define-variable= and --prefix-variable= (whose outputs are
validated by checkCompilerFlags and checkLinkerFlags), and disallow
leading '=' or '$' in --define-variable= values so system .pc files
cannot be rewritten to emit sysroot-prefixed -L= or -L$SYSROOT paths.

In getPkgConfigFlags, inspect comma- and whitespace-separated module
tokens in pkg-config package arguments and reject names ending in .pc
(with or without version comparison suffixes) or arguments containing
path separators, drive colons, or '..' so pkg-config cannot load
repo-local .pc files directly from p.Dir. Also include cgoCPPFLAGS
(which receives pkg-config --cflags) in
flagsNotCompatibleWithInternalLinking.

Fixes CVE-2026-97039
For golang#82571
Fixes golang#82588

Change-Id: I12739135c713a731fb8a96694227fe6709cfcd81
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/6086
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/6842
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/861490
TryBot-Bypass: Gopher Robot <gobot@golang.org>
Reviewed-by: Neal Patel <nealpatel@google.com>
…object or unrecognized formats

In ldobj, require .syso files to be recognized host object formats (ELF,
Mach-O, PE, or XCOFF), and preserve the .syso suffix in packInternal and
cmd/internal/archive.exactly16Bytes when truncating archive member names
longer than 16 bytes. Previously, a .syso file starting with a "go
object" header was parsed by ldpkg, allowing arbitrary $$ // cgo JSON
directives (such as cgo_ldflag or cgo_dynamic_linker) to be injected
without cgo or security.go validation, and unrecognized .syso formats
set unknownObjFormat to force external linking in pure-Go builds.

Fixes CVE-2026-97040
For golang#82570
Fixes golang#82586

Change-Id: Ib800ea94e9ee4227a68942c9237f7175bb21fd5a
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/6087
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/6901
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/861491
TryBot-Bypass: Gopher Robot <gobot@golang.org>
Reviewed-by: Neal Patel <nealpatel@google.com>
…mes and prevent export overwrite

Reject commas in //go:cgo_import_dynamic, //go:cgo_export_dynamic,
//go:cgo_export_static, //go:cgo_import_static, and
//go:cgo_dynamic_linker in both cmd/compile and cmd/link so they cannot
split -Wl,--export-dynamic-symbol= or -Wl,--dynamic-linker= into
arbitrary host linker flags, and pass -Wl,--dynamic-linker=%s rather
than -Wl,--dynamic-linker,%s so interpreter paths cannot be treated as
separate linker flags or @response files.

Also prevent cgo_import_dynamic from overwriting SymExtname on symbols
already marked for cgo export, and clear SDYNIMPORT when a cgo export
overrides a prior cgo_import_dynamic without a library.

Fixes CVE-2026-97041
For golang#82569
Fixes golang#82584

Change-Id: I27d0ec60c5cbe0d7a282bc1615628c3525f069df
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/6088
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/6902
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/861492
TryBot-Bypass: Gopher Robot <gobot@golang.org>
Reviewed-by: Neal Patel <nealpatel@google.com>
…import_dynamic library names

Fix safeArg in cmd/compile/internal/noder to inspect every character of
the library name (allowing '+' for C++ libraries like libstdc++.so.6)
and reject ".." path traversal, and enforce safeArg in cgo-generated
files on Windows. Also validate PE imported DLL names in cmd/cgo
dynimport and cmd/link peimporteddlls so crafted DLL names cannot emit
-l../../../../path/to/payload flags to the external linker.

Fixes CVE-2026-97042
For golang#82568
Fixes golang#82582

Change-Id: I25c1e8eeb3cd38864853a927ede3aaaaea8df67f
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/6089
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/6861
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/861493
TryBot-Bypass: Gopher Robot <gobot@golang.org>
Reviewed-by: Neal Patel <nealpatel@google.com>
…and bound slice removal

Handle backslash-escaped quotes in pragmaFields and unquote cgo pragma
strings with strconv.Unquote in both cmd/compile/internal/noder and
cmd/go/internal/work/exec.go so flags quoted with strconv.Quote in
_cgo_gotypes.go round-trip identically. Previously, the quoting mismatch
between cmd/cgo, cmd/go, and cmd/compile allowed crafted #cgo LDFLAGS
arguments containing escaped quotes to bypass checkLinkerFlags validation
in cmd/go and cause unexpected code execution at link time.

Also bound the outer loop in processCgoOutputs (i+len(LDFLAGS) <=
len(flags)) to prevent an out-of-range slice panic when a prefix of
runCgoProvider.LDFLAGS matches near the end of flags.

Fixes CVE-2026-97043
For golang#82567
Fixes golang#82580

Change-Id: If913a9257db2c82db4b5cdf1fc6aff2c943decb5
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/6090
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/6862
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/861494
TryBot-Bypass: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Neal Patel <nealpatel@google.com>
…MaxBytesReader header race

For HTTP/1 servers, when MaxBytesReader's limit is exceeded,
"Connection: close" header is automatically set without synchronization,
which might race with another header being set explicitly in the server
handler. As a result, an HTTP/1 server that utilizes MaxBytesReader or
MaxBytesHandler can crash due to runtime panic if its handler reads the
request body concurrently with writing the response header.

This affects use cases such as running httputil.ReverseProxy (which
forwards a request body while copying headers from an early upstream
response) with MaxBytesHandler.

Thank you to Jakub Ciolek (https://ciolek.dev) for reporting this issue.

Fixes CVE-2026-97054
For golang#82563
Fixes golang#82565

Change-Id: I66db78624184d4ea795acc7abf2d96026a6a6964
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/6480
Reviewed-by: Neal Patel <nealpatel@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/6820
Reviewed-on: https://go-review.googlesource.com/c/go/+/861495
TryBot-Bypass: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Change-Id: Ida742520c659821a11ea3ede01983feb265dec69
Reviewed-on: https://go-review.googlesource.com/c/go/+/861709
Auto-Submit: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Bypass: Gopher Robot <gobot@golang.org>
@bradfitz

Copy link
Copy Markdown
Member Author

(Various usual reviewers mostly as FYI)

@bradfitz
bradfitz merged commit 1635316 into tailscale.go1.27 Nov 10, 2026
5 checks passed
@bradfitz
bradfitz deleted the bradfitz/go1.27.4 branch November 10, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants