Skip to content

[pull] master from golang:master - #163

Merged
pull[bot] merged 21 commits into
trailofbits:masterfrom
golang:master
Aug 4, 2026
Merged

[pull] master from golang:master#163
pull[bot] merged 21 commits into
trailofbits:masterfrom
golang:master

Conversation

@pull

@pull pull Bot commented Aug 4, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

matloob and others added 21 commits August 3, 2026 11:44
This will make it easier to move the Func type into a separate package
by removing the dependency from the Func onto the HTMLWriter. The HTMLWriter is just passed around by the ssagen/compile functions.

For #80409

Change-Id: I25e2227d197d4b192194ba12f5ac2e086a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/804260
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>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
This change adds a simple helper for running passes in a test without
doing a full compile. This will allow splitting ssa.Compile into a
separate package, ssacompile, in the next cl.

For #80409

Change-Id: I17b7be7cfb0502184c6a3636e52952c06a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/806161
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
In the x509-limbo path-building tests rather than checking
fips140.Version() directly, let's use
cryptotest.MustMinimumFIPS140ModuleVersion() with the module version
that added ML-DSA support.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Change-Id: I96b5b74b5c9a0a4b69ab2484a5a650aa5dc3a862
Reviewed-on: https://go-review.googlesource.com/c/go/+/808540
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
This commit updates the crypto/internal/cryptotest modules that generate
Go code from JSON schemas to use the latest atombender/go-jsonschema
release instead of a replace fork. Previously we had this pointed at
a PR branch with a bugfix that has since been merged.

The updated tooling handles time fields better so after regenerating the
x509-limbo schema we can simplify some TestX509Limbo logic. The
Wycheproof generated code is 1:1 across tooling updates.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Change-Id: I66d7a0dcb8b69ad8fac79648c4d2a78a0ddd4b97
Reviewed-on: https://go-review.googlesource.com/c/go/+/809460
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
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>
…pVerify

Fixes #80074

Change-Id: I5c619a090293a7668e26699c29b194a56a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/804200
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Mark Freeman <markfreeman@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>
The RPC debug handler now uses slices.SortFunc to sort services and
methods. The Len, Less, and Swap methods on serviceArray and methodArray
are no longer used.

Remove the obsolete sorting methods. This change does not affect the
sorting behavior.

Change-Id: I8293beb388efb24594d0baf2217fa0d58491112d
Reviewed-on: https://go-review.googlesource.com/c/go/+/806660
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Address.String uses MIME Q encoding for non-ASCII display names unless
the name contains a character that cannot appear unencoded in an
encoded-word in a phrase.

A backslash was missing from this set. mime.QEncoding leaves
backslashes unencoded, so Address.String could produce output that
ParseAddress could not parse. Select B encoding for display names
containing a backslash, and add a round-trip test.

Fixes #80592

Change-Id: I53f8fab709bace922914b579c283bb71877c6be7
Reviewed-on: https://go-review.googlesource.com/c/go/+/806681
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Cherry Mui <cherryyz@google.com>
The pkg-config --define-variable flag carries its value inside a
single argument. Its validator rejects '-' or '@' anywhere in that
value, so it also rejects valid values such as paths containing
hyphens, which worked before the pkg-config flag allowlist was
added.

Allow '-' and '@' after the first character, following the pattern
used for --with-path. A leading '-' or '@' is still rejected, since
a .pc file may pass the value on to another program, where it could
be read as a flag or as a response file.

Add direct validator coverage and a script test that exercises the
complete cgo build path with a fake pkg-config tool.

Fixes #79330

Change-Id: I64d9f5ca9104ee3da73848aa77f6e5d1d684ee1f
Reviewed-on: https://go-review.googlesource.com/c/go/+/806860
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
CL 699675 made utf8.DecodeRune and utf8.DecodeRuneInString
inlineable, including their ASCII fast paths. The manual ASCII decoding
fast paths added in CL 793620 are therefore redundant.

Call the UTF-8 decoding functions directly.

On linux/amd64, using benchstat over 10 runs:

goos: linux
goarch: amd64
pkg: bytes
cpu: Intel(R) Core(TM) i7-14700KF
                          │   old.txt   │              new.txt               │
                          │   sec/op    │   sec/op     vs base               │
TrimSpace/SomeNonASCII-20   22.44n ± 1%   22.38n ± 1%       ~ (p=0.171 n=10)
TrimSpace/JustNonASCII-20   28.37n ± 1%   28.39n ± 1%       ~ (p=0.839 n=10)
geomean                     25.23n        25.21n       -0.08%

pkg: strings
                          │   old.txt   │              new.txt               │
                          │   sec/op    │   sec/op     vs base               │
TrimSpace/SomeNonASCII-20   25.41n ± 1%   25.38n ± 1%       ~ (p=0.305 n=10)
TrimSpace/JustNonASCII-20   31.81n ± 1%   31.82n ± 0%       ~ (p=0.813 n=10)
geomean                     28.44n        28.42n       -0.05%

Change-Id: I317e5bd6d1dcf3a3aed58c8303d1002b71004507
Reviewed-on: https://go-review.googlesource.com/c/go/+/807060
Auto-Submit: Sean Liao <sean@liao.dev>
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>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Fix performance regression by restoring original behavior of
index function of selecting IndexString vs IndexRabinKarp by
introducing guard n>bytealg.MaxLen. At present, the condition
else if fails >= 4+i>>4 is reachable when n <= bytealg.MaxLen,
which was structurally impossible in 1.26.5, this ends up calling IndexRabinKarp almost all the time leading to slower performance.
Regression bisected to the following change
https://go-review.googlesource.com/c/go/+/741340 which tried to combine
two duplicate loops, adding the guard n > bytealg.MaxLen restores the original behavior while keeping the loops combined.
Multiple strings tests improve, none of them regress, pasting performance of a subset of tests that improve the maximum. The change should create similar improvements on other platforms too as it
increases the frequency of calling vectorized assembly for index
computation.

Fixes #80638

goos: linux
goarch: amd64
pkg: strings
cpu: 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
             │ baseline.txt  │               new.txt               │
             │    sec/op     │   sec/op     vs base                │
CountHard1-8   1157.30µ ± 1%   82.65µ ± 6%  -92.86% (p=0.000 n=10)
CountHard2-8    1159.5µ ± 2%   116.8µ ± 5%  -89.93% (p=0.000 n=10)
CountHard3-8    1172.3µ ± 2%   373.1µ ± 2%  -68.17% (p=0.000 n=10)
geomean          1.163m        153.3µ       -86.82%


Change-Id: Ia9d1b094273751e25bbd2e536ac169363228e7e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/807360
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
…iscv64

Note that ANDN is generated on all riscv64 profiles - the assembler synthesises
ANDN in the case the instruction cannot be used directly.

Change-Id: I8c6492a24eaa82b30cc631f0ef091fd4c794e774
Reviewed-on: https://go-review.googlesource.com/c/go/+/807900
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Auto-Submit: Joel Sing <joel@sing.id.au>
Reviewed-by: Julian Zhu <jz531210@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
This CL addresses two bugs related to moving goroutine stacks during
injected function calls. The runtime injects calls during asynchronous
preemption, when handling signals that get turned into panics
(sigpanic), and for calls injected by a debugger.

If a function triggers a sigpanic, and there is no way to resume
execution in the function (such as through a deferred function), then
that function's call frame is skipped during stack copying. The
reasoning is that its locals, arguments, etc are dead. However, the call
frame might contain a frame pointer. We can visit that frame pointer
with the execution tracer or block/mutex profilers. If we visit that
frame pointer after stack movement, it can point into the old stack.
Following it will crash. This CL fixes this by adjusting the frame
pointer if there is one. But it still skips the rest of the work, which
is unnecessary.

For arm64, there is an additonal frame pointer adjustment we're missing.
Injected call frames are placed 16 bytes below the stack pointer at the
point of call injection. This gap is needed both to avoid clobbering the
frame pointer saved below the original function's call frame, and to
have space to save the link register so it can be restored when the
injected call returns. Normally when function A calls function B, the
frame pointer saved below function A's frame is fixed when adjusting
function B's frame. But because of the gap in the case of injection, the
frame pointer saved by the original function isn't inside any call
frame. We need to fix it when visiting the injected call frame.

The regression test uses stackPoisonCopy so that the old stack is filled
with garbage and frame pointer unwinding will reliably crash. Otherwise
we'd only see a crash if something else happens to reuse the old stack
space.

Fixes #73664

Change-Id: I600d7942521e90852c67e379679b07e96a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/730200
Reviewed-by: Mark Freeman <markfreeman@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>
Fixes #79225

Change-Id: I51cf9587969af8273a6ebb479f7a0c7f6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/781844
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
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: Mark Freeman <markfreeman@google.com>
FormatMediaType lower-cases parameter names when serializing.
If the input map contains keys that differ only by case, it
can emit duplicate parameter names such as "name=foo; name=bar",
which ParseMediaType rejects. Return an empty string in this case,
matching FormatMediaType's documented behavior for invalid output.

Change-Id: I6d0890bf608da8c3a18af60a36b1825f8dc88ce9
Reviewed-on: https://go-review.googlesource.com/c/go/+/790400
Reviewed-by: shuang cui <imcusg@gmail.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
The stream decoder decoded each buffered chunk with a stateless call
to Decode, so validity and error offsets depended on how the
underlying reader happened to chunk the input. A padded group followed
by more input was accepted whenever a chunk boundary fell right after
the padding, even though decoding the same input as a whole rejects
it, and CorruptInputError offsets were relative to the current chunk
rather than the whole stream.

Track how much input has been consumed and whether a padded group has
been seen: reject any input that follows a padded group, and rebase
error offsets so they refer to positions in the whole input stream.

Fixes #31626

Change-Id: I2f8c19ac9796fb938430fbcb3df1123583be4a6b
GitHub-Last-Rev: a9acf71
GitHub-Pull-Request: #80245
Reviewed-on: https://go-review.googlesource.com/c/go/+/796680
Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Sean Liao <sean@liao.dev>
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: Mark Freeman <markfreeman@google.com>
When using a dictionary, fillWindow was not setting blockStart, which
caused a non-compressed block in first position to write the dictionary.
This mixup can happen because window stores both the look back window
and the block we are about to write. Set blockStart to skip over the
dictionary if we have to write the window.

Fixes #80538

Change-Id: I6e6784696f29591f2819fc3c9c461d73d3d6335b
GitHub-Last-Rev: 469f26b
GitHub-Pull-Request: #80539
Reviewed-on: https://go-review.googlesource.com/c/go/+/804680
Auto-Submit: Jorropo <jorropo.pgm@gmail.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>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
ZeroUpper32/48/56Bits kept a hand-maintained per-opcode fact — "this
op's result has the upper N bits zero" — in three parallel switches in
rewrite.go, far from the op definitions it describes. Every new op had
to be added to the right subset of the three lists by hand, which is
exactly how MOVBQZX and MOVWQZX ended up missing from the 32-bit list.

Declare the fact as a zeroUpperBits attribute on the op definition
instead, at the op's strongest valid level; the predicates keep only
the value-dependent cases. With the fact at the definition point, an
audit of the full op tables extends coverage well beyond the old
lists: the flags-to-bool pseudos, the atomics whose result register is
written only at load width or by CSET, and value-bounded ops such as
CLZ and POPCNT.

Codegen validated by diffing -S output of std against the previous
commit: on amd64 51 functions improve; on arm64 a net 285 instructions
(-848 bytes of text) of re-extensions of atomic results and CSET
booleans fold away.

Change-Id: I3f2c8b41d19a06f8e027325cc8d64d75e35f9427
Reviewed-on: https://go-review.googlesource.com/c/go/+/806140
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
…mory op on amd64

The amd64 backend rewrites a load, a constant modify and a store of the
same memory location into a single read-modify-write instruction, but
only for 32- and 64-bit values: ADDLconstmodify and friends have no 8-
or 16-bit counterpart. So

	var tab [256]byte
	tab[i&255]++

compiles to a MOVBLZX/INCL/MOVB triple, while the same code over a
[256]uint32 compiles to a single INCL.

Add {ADD,AND,OR,XOR}{B,W}constmodify, their indexed forms, and the
lowering rules that build them. Byte and word arithmetic is done in
32-bit registers, so the rule matches an ADDLconst (etc.) consumed by a
narrow store; the store keeps only the low 8 or 16 bits, which is what
ADDB/ADDW compute. The constant is restricted to values representable
as an 8-bit immediate, so every emitted form encodes as imm8 or as
INC/DEC; that also keeps out the 16-bit immediates that cause
length-changing-prefix stalls.

The store width is unchanged, so the fold never writes bytes the
original store did not.

For the example above:

	MOVBLZX AL, AX              MOVBLZX AL, AX
	LEAQ    tab(SB), CX         LEAQ    tab(SB), CX
	MOVBLZX (CX)(AX*1), DX  ->  INCB    (CX)(AX*1)
	INCL    DX
	MOVB    DL, (CX)(AX*1)

20 bytes of text become 14.

That is -52 B in runtime.mapassign_fast64, -38 B in mapassign_fast32,
-37 B in mapassign_faststr, -34 B in mapassign_fast64ptr, -32 B in
mapassign and -26 B in internal/runtime/maps.(*Map).Clear. The other
notable cluster is compress/flate, whose [...]uint8 code-length
histogram accounts for 11 of the 12 largest std deltas.

No significant performance difference observed.

386 has the same *Lconstmodify family and the same gap; this change
does not add it.

Updates #10432

Change-Id: I56a0e7cbffac975b253c52326b33fc0eba450e6c
Reviewed-on: https://go-review.googlesource.com/c/go/+/806300
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Put regular shifts last, so that they can be folded into address
calculations.

Update #80639

Change-Id: I0a07abbc7a29e1c0c5d6b5c7ed2ae2cffe43957c
Reviewed-on: https://go-review.googlesource.com/c/go/+/808200
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
When -buildmode=default is used, the link action ID hashed the
literal string "default", so building with -buildmode=default and
building with the buildmode it resolves to produced binaries that
were identical except for their build IDs. Hash the resolved
buildmode (ldBuildmode) instead, so that equivalent builds share a
build ID and cached link outputs.

Additionally, the build info stamped into binaries normalized
-buildmode=default to "exe" without accounting for platforms where
the default is PIE (android, ios, darwin, and windows without
-race), misreporting the buildmode actually given to the linker.
Record "pie" on those platforms instead.

Together these make it possible to reproduce a binary built with
-buildmode=default from its stamped build info alone.

Fixes #63559

Change-Id: If3ac6a6a84fbf20097ff3009e228ce07705d6835
GitHub-Last-Rev: 1ddf5bf
GitHub-Pull-Request: #80312
Reviewed-on: https://go-review.googlesource.com/c/go/+/798680
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Michael Pratt <mpratt@google.com>
NotExpr.String currently concatenates its leading "!" with the string
form of an inner NotExpr. This produces expressions such as "!!linux",
which Parse rejects as a double negation.

Elide pairs of nested negations while formatting. Account for the
effective operator when adding parentheses, so simplifying a negation
nested inside an AND or OR expression does not change its meaning.

Fixes #80593

Change-Id: Id15885c8b408f8cff143bd994b310523a5cb8452
Reviewed-on: https://go-review.googlesource.com/c/go/+/806682
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
@pull pull Bot locked and limited conversation to collaborators Aug 4, 2026
@pull pull Bot added the ⤵️ pull label Aug 4, 2026
@pull
pull Bot merged commit eec8066 into trailofbits:master Aug 4, 2026
8 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.