acme/autocert: fix data race in Manager.createCert Previously Manager.createCert() read state.locked without holding any lock, while the owner goroutine wrote state.locked = false under the state's write lock. Concurrent goroutines for the same domain raced on that field. We fix the issue by removing the certState.locked field and instead having Manager.certState() return an additional owner bool computed under the m.stateMu lock. This allows the Manager.createCert() caller to know whether it must block on the read lock and return the state handled by another goroutine, or instead do the work itself and release the write lock. A regression unit test is included that fails under -race without the fix, and passes with the fix in-place. Fixes golang/go#80119 Change-Id: I0f4c5c98f7e6bcf1ab71a3c0707bb0c7ce73415b Reviewed-on: https://go-review.googlesource.com/c/crypto/+/793840 Reviewed-by: Roland Shoemaker <roland@golang.org> LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Auto-Submit: Daniel McCarney <daniel@binaryparadox.net>
This repository holds supplementary Go cryptography packages.
This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://go.dev/doc/contribute.
The git repository is https://go.googlesource.com/crypto.
The main issue tracker for the crypto repository is located at https://go.dev/issues. Prefix your issue with “x/crypto:” in the subject line, so it is easy to find.
Note that contributions to the cryptography package receive additional scrutiny due to their sensitive nature. Patches may take longer than normal to receive feedback.