Possible Data Race in core.go #29703
Labels
bug
Used to indicate a potential bug
core
Issues and Pull-Requests specific to Vault Core
performance
Bug Description
In file:
core.go
, there is a possible case of data race. In line 2100, variablec.standby
is written to without any kind of locking mechanism. And in line 2088, function callc.postUnseal
starts a call chain that leads to starting a goroutine with functionCore.emitMetricsActiveNode
. The new goroutine eventually invokes the functionCore.Standby
which reads the same variablec.standby
using a read lockc.stateLock.RLock()
.Since two separate goroutines access the same memory location without proper synchronization, it will cause a data race condition.
To Reproduce
The bug was detected using static analysis. We did not reproduce the bug by executing source code.
Expected behavior
The bug was detected using static analysis, Here expected behavior would be accessing the shared variable with proper locking mechanism.
Sponsorship and Support:
This work is done by the security researchers from OpenRefactory under the Project Clean Beach initiative. The researchers are proactively scanning critical open source projects and finding previously undetected bugs in them.
The bug is found by running the iCR tool by OpenRefactory and then manually triaging the results.
The text was updated successfully, but these errors were encountered: