Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: store per-goroutine FIPS service indicator #69911

Closed
FiloSottile opened this issue Oct 16, 2024 · 4 comments
Closed

runtime: store per-goroutine FIPS service indicator #69911

FiloSottile opened this issue Oct 16, 2024 · 4 comments
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@FiloSottile
Copy link
Contributor

As part of #69536 we have to store something called a "service indicator" which is annoyingly and somewhat rigidly regulated.

Essentially, we need to keep a bit of state that's per-goroutine so that the module consumer (the standard library) can theoretically access it. This will be used to record whether the cryptographic operations performed by a goroutine since the last check were approved or not. For now we don't need to make any external API for it.

@golang/runtime, is it ok to add a uint8 to the g and push setter and getter functions with linkname to crypto/internal/fips? I don't know how to assess the cost of an extra byte on the g. Should we build tag it out of non-FIPS builds?

/cc @cpu @rolandshoemaker

@FiloSottile FiloSottile added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Oct 16, 2024
@FiloSottile FiloSottile added this to the Go1.24 milestone Oct 16, 2024
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Oct 16, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/620795 mentions this issue: crypto/internal/fips: add service indicator mechanism

@FiloSottile
Copy link
Contributor Author

There's a concrete proposal at https://go.dev/cl/620795, but I'd like guidance from @golang/runtime if that's the right way to go about it. I found some padding in the g struct to store the value in.

@gabyhelp
Copy link

Related Issues and Documentation

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

@randall77
Copy link
Contributor

I think a uint8 in every G seems reasonable.
(Aside: we need to bundle booleans in the G into a bitset, so we would only need 1 bit, not 1 byte.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
Development

No branches or pull requests

4 participants