Skip to content

[AUTOMATED] Demote go.typedesc interface type-word parameters to the honest opaque type - #1543

Merged
mahaloz merged 1 commit into
mainfrom
multilang-any-guard
Nov 11, 2026
Merged

mahaloz merged 1 commit into
mainfrom
multilang-any-guard

Conversation

@mahaloz

@mahaloz mahaloz commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

The Go type-descriptor globals (#1540) and allocation typing (#1542) correctly name concrete types at allocation sites, but that concrete go.typedesc * type then propagated onto the interface type-word of shared any/interface{} parameters, mislabeling generic functions with a caller's specific type:

kuna decompile-all vet --json | grep 'func runtime.gopanic'
#   runtime.gopanic(go.typedesc *a0)         # wrong: gopanic takes any
# after:
#   runtime.gopanic(ulong a0)                # the honest opaque type-word

The fix:

  • go.typedesc is a synthesized descriptor shell — the harvester only ever names data globals with it, never a value or parameter. So a recovered go.typedesc * parameter is provably a mislabeled interface type-word, and FuncProto::updateInputTypes demotes it to a same-width opaque word (input_vote refuses it too). The real runtime type genuine descriptor-taking functions use — abi.Type — is a different interned type and is untouched.

Verified by independent adversarial review on vet.stripped (5,720 functions, three toolchains): 23 signatures change — 18 intended go.typedesc * demotions (gopanic, printany, atomic.(*Value).Store, …) plus 5 benign []any-pointer vague→vague cascades (fmt.Fprint/Sprint/doPrint, log.Fatal, go/build.importGo — no store/call/computation dropped). The genuine descriptor-pointer functions (getitab, reflect.New, typeAssert with abi.Type *) and concrete data-word params (main.Shape * beside a demoted type-word in atomic.Value.Store) are byte-identical off/on; /bin/tar byte-identical.

Strict bugfix — no option or count change, inert off-Go. Closes 18 of the 19 descriptor-leak signatures; the remaining non-go.typedesc concrete leak (json.Unmarshal(Config *)) needs cross-caller conflict detection and is a scoped follow-up.

Test: verify_gotypes::no_function_declares_a_go_typedesc_parameter, green under go1.22/1.25/1.27. Datatests 675/675 and stages unchanged.

🤖 Generated with Claude Code

A Go interface value is a (type, data) pair, and a &type:T descriptor global
(the type word) passed to any-taking runtime/stdlib functions
(runtime.gopanic(e any), fmt.(*pp).printArg, encoding/binary.Read,
sync/atomic.(*Value).Store, encoding/json.MarshalIndent) was committed onto the
callee's parameter as go.typedesc * -- a wrong concrete whole-binary signature
where the truth is a bare word. Two paths deliver it: local type inference
inside the callee, and the callee-vote plane.

A go.typedesc is the synthesized internal/abi.Type base shell, never a value
type anything is declared as, so it is provably never a real parameter type.
FuncProto::updateInputTypes demotes a recovered go.typedesc * parameter to the
honest untyped word of the same width, and the callee-vote plane refuses to
monomorphize a parameter to it. The body keeps its local descriptor typing
where it genuinely reads the word as a type; only the declaration is corrected.
The genuine runtime type abi.Type, which reflect/runtime functions legitimately
take by pointer, and real concrete-pointer params (syscall.Fstat(syscall.Stat_t
*), big.Int receivers) are untouched.

vet corpus: 18 functions declared a go.typedesc * parameter, every one the
interface-word mislabel, all demoted; zero genuine signatures changed, 2285
feature effects retained. Strict bugfix (no option/count change); inert off-Go.
Regression test green under go1.22/1.25/1.27.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mahaloz
mahaloz merged commit 101b80d into main Nov 11, 2026
9 checks passed
@mahaloz
mahaloz deleted the multilang-any-guard branch November 11, 2026 12:51
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.

1 participant