diff options
| author | Filippo Valsorda <filippo@golang.org> | 2024-10-17 12:48:11 +0200 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-10-28 14:55:26 +0000 |
| commit | f0b51a2099446d3835c8d54edef8300c0f081116 (patch) | |
| tree | b8af54d666529a34f7f44a2c15c29b17a1a8e6e6 /src/runtime | |
| parent | ba1caa8b3051bc13bc353840946b404a13575410 (diff) | |
| download | go-f0b51a2099446d3835c8d54edef8300c0f081116.tar.xz | |
crypto/internal/fips: add service indicator mechanism
Placed the fipsIndicator field in some 64-bit alignment padding in the g
struct to avoid growing per-goroutine memory requirements on 64-bit
targets.
Fixes #69911
Updates #69536
Change-Id: I176419d0e3814574758cb88a47340a944f405604
Reviewed-on: https://go-review.googlesource.com/c/go/+/620795
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Derek Parker <parkerderek86@gmail.com>
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/runtime1.go | 10 | ||||
| -rw-r--r-- | src/runtime/runtime2.go | 1 | ||||
| -rw-r--r-- | src/runtime/sizeof_test.go | 2 |
3 files changed, 12 insertions, 1 deletions
diff --git a/src/runtime/runtime1.go b/src/runtime/runtime1.go index 2f87b8b967..56886ea571 100644 --- a/src/runtime/runtime1.go +++ b/src/runtime/runtime1.go @@ -724,3 +724,13 @@ func reflect_addReflectOff(ptr unsafe.Pointer) int32 { reflectOffsUnlock() return id } + +//go:linkname fips_getIndicator crypto/internal/fips.getIndicator +func fips_getIndicator() uint8 { + return getg().fipsIndicator +} + +//go:linkname fips_setIndicator crypto/internal/fips.setIndicator +func fips_setIndicator(indicator uint8) { + getg().fipsIndicator = indicator +} diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index 68b0be48aa..34aefd4c47 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -466,6 +466,7 @@ type g struct { trackingStamp int64 // timestamp of when the G last started being tracked runnableTime int64 // the amount of time spent runnable, cleared when running, only used when tracking lockedm muintptr + fipsIndicator uint8 sig uint32 writebuf []byte sigcode0 uintptr diff --git a/src/runtime/sizeof_test.go b/src/runtime/sizeof_test.go index 43aba98dce..c1b201caf1 100644 --- a/src/runtime/sizeof_test.go +++ b/src/runtime/sizeof_test.go @@ -20,7 +20,7 @@ func TestSizeof(t *testing.T) { _32bit uintptr // size on 32bit platforms _64bit uintptr // size on 64bit platforms }{ - {runtime.G{}, 272, 432}, // g, but exported for testing + {runtime.G{}, 276, 432}, // g, but exported for testing {runtime.Sudog{}, 56, 88}, // sudog, but exported for testing } |
