0
0
mirror of https://github.com/XTLS/REALITY.git synced 2025-08-22 14:38:35 +00:00

all: add push linknames to allow legacy pull linknames

CL 585358 adds restrictions to disallow pull-only linknames
(currently off by default). Currently, there are quite some pull-
only linknames in user code in the wild. In order not to break
those, we add push linknames to allow them to be pulled. This CL
includes linknames found in a large code corpus (thanks Matthew
Dempsky and Michael Pratt for the analysis!), that are not
currently linknamed.

Updates #67401.

Change-Id: I32f5fc0c7a6abbd7a11359a025cfa2bf458fe767
Reviewed-on: https://go-review.googlesource.com/c/go/+/586137
Reviewed-by: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
yuhan6665 2024-08-18 20:17:15 -04:00
parent 7a94067d41
commit 194e5a43dc

27
badlinkname.go Normal file
View File

@ -0,0 +1,27 @@
// Copyright 2024 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package reality
import _ "unsafe"
// As of Go 1.22, the symbols below are found to be pulled via
// linkname in the wild. We provide a push linkname here, to
// keep them accessible with pull linknames.
// This may change in the future. Please do not depend on them
// in new code.
//go:linkname aeadAESGCMTLS13
//go:linkname cipherSuiteTLS13ByID
//go:linkname cipherSuitesTLS13
//go:linkname defaultCipherSuitesTLS13
//go:linkname defaultCipherSuitesTLS13NoAES
//go:linkname errShutdown
// The compiler doesn't allow linknames on methods, for good reasons.
// We use this trick to push linknames of the methods.
// Do not call them in this package.
//go:linkname badlinkname_halfConn_incSeq crypto/tls.(*halfConn).incSeq
func badlinkname_halfConn_incSeq(*halfConn)