2023-03-14 14:25:56 -04:00
|
|
|
// Copyright 2023 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 godebugs provides a table of known GODEBUG settings,
|
|
|
|
|
// for use by a variety of other packages, including internal/godebug,
|
|
|
|
|
// runtime, runtime/metrics, and cmd/go/internal/load.
|
|
|
|
|
package godebugs
|
|
|
|
|
|
|
|
|
|
// An Info describes a single known GODEBUG setting.
|
|
|
|
|
type Info struct {
|
|
|
|
|
Name string // name of the setting ("panicnil")
|
|
|
|
|
Package string // package that uses the setting ("runtime")
|
|
|
|
|
Changed int // minor version when default changed, if any; 21 means Go 1.21
|
|
|
|
|
Old string // value that restores behavior prior to Changed
|
|
|
|
|
Opaque bool // setting does not export information to runtime/metrics using [internal/godebug.Setting.IncNonDefault]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// All is the table of known settings, sorted by Name.
|
|
|
|
|
//
|
|
|
|
|
// Note: After adding entries to this table, run 'go generate runtime/metrics'
|
|
|
|
|
// to update the runtime/metrics doc comment.
|
|
|
|
|
// (Otherwise the runtime/metrics test will fail.)
|
|
|
|
|
//
|
|
|
|
|
// Note: After adding entries to this table, update the list in doc/godebug.md as well.
|
|
|
|
|
// (Otherwise the test in this package will fail.)
|
|
|
|
|
var All = []Info{
|
2024-05-02 14:29:16 -04:00
|
|
|
{Name: "asynctimerchan", Package: "time", Changed: 23, Old: "1"},
|
crypto/subtle: add DIT closure
Add a new function, WithDataIndependentTiming, which takes a function as
an argument, and encloses it with calls to set/unset the DIT PSTATE bit
on Arm64.
Since DIT is OS thread-local, for the duration of the execution of
WithDataIndependentTiming, we lock the goroutine to the OS thread, using
LockOSThread. For long running operations, this is likely to not be
performant, but we expect this to be tightly scoped around cryptographic
operations that have bounded execution times.
If locking to the OS thread turns out to be too slow, another option is
to add a bit to the g state indicating if a goroutine has DIT enabled,
and then have the scheduler enable/disable DIT when scheduling a g.
Additionally, we add a new GODEBUG, dataindependenttiming, which allows
setting DIT for an entire program. Running a program with
dataindependenttiming=1 enables DIT for the program during
initialization. In an ideal world PSTATE.DIT would be inherited from
the parent thread, so we'd only need to set it in the main thread and
then all subsequent threads would inherit the value. While this does
happen in the Linux kernel [0], it is not the case for darwin [1].
Rather than add complex logic to only set it on darwin for each new
thread, we just unconditionally set it in mstart1 and cgocallbackg1
regardless of the OS. DIT will already impose some overhead, and the
cost of setting the bit is only ~two instructions (CALL, MSR), so it
should be cheap enough.
Fixes #66450
Updates #49702
[0] https://github.com/torvalds/linux/blob/e8bdb3c8be08c9a3edc0a373c0aa8729355a0705/arch/arm64/kernel/process.c#L373
[1] https://github.com/apple-oss-distributions/xnu/blob/8d741a5de7ff4191bf97d57b9f54c2f6d4a15585/osfmk/arm64/status.c#L1666
Change-Id: I78eda691ff9254b0415f2b54770e5850a0179749
Reviewed-on: https://go-review.googlesource.com/c/go/+/598336
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-15 10:05:37 -07:00
|
|
|
{Name: "dataindependenttiming", Package: "crypto/subtle", Opaque: true},
|
2023-03-14 14:25:56 -04:00
|
|
|
{Name: "execerrdot", Package: "os/exec"},
|
2023-04-21 19:55:43 -07:00
|
|
|
{Name: "gocachehash", Package: "cmd/go"},
|
|
|
|
|
{Name: "gocachetest", Package: "cmd/go"},
|
|
|
|
|
{Name: "gocacheverify", Package: "cmd/go"},
|
2024-11-18 14:56:43 -05:00
|
|
|
{Name: "gotestjsonbuildtext", Package: "cmd/go", Changed: 24, Old: "1"},
|
2024-04-17 18:40:27 -07:00
|
|
|
{Name: "gotypesalias", Package: "go/types", Changed: 23, Old: "0"},
|
2023-03-14 14:25:56 -04:00
|
|
|
{Name: "http2client", Package: "net/http"},
|
|
|
|
|
{Name: "http2debug", Package: "net/http", Opaque: true},
|
|
|
|
|
{Name: "http2server", Package: "net/http"},
|
2023-08-10 20:56:27 +00:00
|
|
|
{Name: "httplaxcontentlength", Package: "net/http", Changed: 22, Old: "1"},
|
2023-09-23 17:05:42 -04:00
|
|
|
{Name: "httpmuxgo121", Package: "net/http", Changed: 22, Old: "1"},
|
2024-06-20 10:23:42 -07:00
|
|
|
{Name: "httpservecontentkeepheaders", Package: "net/http", Changed: 23, Old: "1"},
|
2023-03-14 14:25:56 -04:00
|
|
|
{Name: "installgoroot", Package: "go/build"},
|
2024-03-08 21:01:17 -05:00
|
|
|
{Name: "jstmpllitinterp", Package: "html/template", Opaque: true}, // bug #66217: remove Opaque
|
2023-03-14 14:25:56 -04:00
|
|
|
//{Name: "multipartfiles", Package: "mime/multipart"},
|
|
|
|
|
{Name: "multipartmaxheaders", Package: "mime/multipart"},
|
|
|
|
|
{Name: "multipartmaxparts", Package: "mime/multipart"},
|
net: enable multipath TCP by default for listeners
A previous change [1] was introduced to enable MPTCP by default
for both the clients and servers, based on the discussions [2] in
golang#56539, where MPTCP would be an opt-in for a release or
two, and then would become an opt-out.
This change was not accepted at the time because the support for
a few socket options was missing [3]. Now that this support has been
added [4] and backported to stable versions not to block MPTCP
deployment with Go, it sounds like a good time to reconsider the use
of MPTCP by default.
Instead of enabling MPTCP on both ends by default, as a first step,
it seems safer to change the default behaviour only for the server
side (Listeners). On the server side, the impact is minimal: when
clients don't request to use MPTCP, server applications will create
"plain" TCP sockets within the kernel when connections are accepted,
making the performance impact minimal. This should also ease
experiments where MPTCP is enabled by default on the client side
(Dialer).
The changes in this patch consist of a duplication of the mptcpStatus
enumeration to have both a mptcpStatusDial and a mptcpStatusListen,
where MPTCP is enabled by default in mptcpStatusListen, but disabled
by default in mptcpStatusDial. It is still possible to turn MPTCP support
on and off by using GODEBUG=multipathtcp=1.
[1] https://go-review.googlesource.com/c/go/+/563575
[2] https://go.dev/issue/56539#issuecomment-1309294637
[3] https://github.com/multipath-tcp/mptcp_net-next/issues/383
[4] https://github.com/torvalds/linux/commit/bd11dc4fb969ec148e50cd87f88a78246dbc4d0b
[5] https://www.mptcp.dev/faq.html#why--when-should-mptcp-be-enabled-by-default
Updates #56539
Change-Id: I1ca0d6aaf74d3bda5468af135e29cdb405d3fd00
GitHub-Last-Rev: 5f9f29bfc13ad4ea6bfd1e0fc95a91bd824f4048
GitHub-Pull-Request: golang/go#69016
Reviewed-on: https://go-review.googlesource.com/c/go/+/607715
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Matthieu Baerts <matttbe@kernel.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-08-28 17:45:58 +00:00
|
|
|
{Name: "multipathtcp", Package: "net", Changed: 24, Old: "0"},
|
2023-03-14 14:25:56 -04:00
|
|
|
{Name: "netdns", Package: "net", Opaque: true},
|
2024-06-11 09:36:49 -07:00
|
|
|
{Name: "netedns0", Package: "net", Changed: 19, Old: "0"},
|
2023-03-14 14:25:56 -04:00
|
|
|
{Name: "panicnil", Package: "runtime", Changed: 21, Old: "1"},
|
|
|
|
|
{Name: "randautoseed", Package: "math/rand"},
|
2024-08-16 01:29:18 +03:00
|
|
|
{Name: "randseednop", Package: "math/rand", Changed: 24, Old: "0"},
|
2024-11-20 13:59:09 +01:00
|
|
|
{Name: "rsa1024min", Package: "crypto/rsa", Changed: 24, Old: "0"},
|
2023-03-14 14:25:56 -04:00
|
|
|
{Name: "tarinsecurepath", Package: "archive/tar"},
|
2023-11-10 10:12:48 -08:00
|
|
|
{Name: "tls10server", Package: "crypto/tls", Changed: 22, Old: "1"},
|
2024-05-22 11:39:41 +02:00
|
|
|
{Name: "tls3des", Package: "crypto/tls", Changed: 23, Old: "1"},
|
2024-05-18 20:15:38 +02:00
|
|
|
{Name: "tlskyber", Package: "crypto/tls", Changed: 23, Old: "0", Opaque: true},
|
2023-08-08 18:25:59 -07:00
|
|
|
{Name: "tlsmaxrsasize", Package: "crypto/tls"},
|
2023-11-10 10:42:42 -08:00
|
|
|
{Name: "tlsrsakex", Package: "crypto/tls", Changed: 22, Old: "1"},
|
2023-11-21 16:37:07 +01:00
|
|
|
{Name: "tlsunsafeekm", Package: "crypto/tls", Changed: 22, Old: "1"},
|
2024-03-11 18:16:16 +01:00
|
|
|
{Name: "winreadlinkvolume", Package: "os", Changed: 22, Old: "0"},
|
|
|
|
|
{Name: "winsymlink", Package: "os", Changed: 22, Old: "0"},
|
2024-05-15 13:46:38 -07:00
|
|
|
{Name: "x509keypairleaf", Package: "crypto/tls", Changed: 23, Old: "0"},
|
2024-02-07 12:22:48 -08:00
|
|
|
{Name: "x509negativeserial", Package: "crypto/x509", Changed: 23, Old: "1"},
|
2023-03-14 14:25:56 -04:00
|
|
|
{Name: "x509usefallbackroots", Package: "crypto/x509"},
|
2023-12-04 10:17:34 -08:00
|
|
|
{Name: "x509usepolicies", Package: "crypto/x509"},
|
2023-03-14 14:25:56 -04:00
|
|
|
{Name: "zipinsecurepath", Package: "archive/zip"},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Lookup returns the Info with the given name.
|
|
|
|
|
func Lookup(name string) *Info {
|
|
|
|
|
// binary search, avoiding import of sort.
|
|
|
|
|
lo := 0
|
|
|
|
|
hi := len(All)
|
|
|
|
|
for lo < hi {
|
2023-09-12 13:18:33 +00:00
|
|
|
m := int(uint(lo+hi) >> 1)
|
2023-03-14 14:25:56 -04:00
|
|
|
mid := All[m].Name
|
|
|
|
|
if name == mid {
|
|
|
|
|
return &All[m]
|
|
|
|
|
}
|
|
|
|
|
if name < mid {
|
|
|
|
|
hi = m
|
|
|
|
|
} else {
|
|
|
|
|
lo = m + 1
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|