Missing use of lock on CKeyStore::mapKeys? #433

issue xanatos openend this issue on July 26, 2011
  1. xanatos commented at 1:45 pm on July 26, 2011: none

    I think the use of the lock CKeyStore::cs_mapKeys on CKeyStore::mapKeys should be better documented and a little checked.

    CKeyStore::GetPrivKey and CKeyStore::HaveKey should have a comment “// requires cs_mapKeys lock” (and I would add it directly to the CKeyStore::mapKeys, because it’s used by CScript)

    And in general, should access to CKeyStore::mapKeys always be prodected by a lock to CKeyStore::cs_mapKeys? At this time CKeyStore::GetPrivKey and CKeyStore::HaveKey don’t use a lock, and the same happens with Wallet::LoadWallet, but CKeyStore::GetPrivKey is always called by methods that have the lock, and LoadWallet is called only during startup. So only CKeyStore::HaveKey seems to be “unprotected” (I’ve tried looking at the call stack and I wasn’t able to see the lock. For example (in reverse order): CKeyStore::HaveKey, ::ExtractPubKey, CWalletTx::GetAmounts, ::getbalance, ::ThreadRPCServer2)

  2. laanwj commented at 12:09 pm on December 11, 2011: member

    Has this issue ever been addressed?

    It sounds quite serious, forgetting to acquire locks at certain points.

  3. sipa commented at 6:49 pm on February 19, 2012: member
    This was fixed in 6cc4a62c (v0.4.0).
  4. sipa closed this on Feb 19, 2012

  5. sipa referenced this in commit 7b49f22bdb on Dec 12, 2016
  6. MarcoFalke referenced this in commit 64dfdde0aa on Dec 13, 2016
  7. deadalnix referenced this in commit 8225239f49 on Jan 19, 2017
  8. ptschip referenced this in commit 06f4e9c053 on Apr 11, 2017
  9. Losangelosgenetics referenced this in commit eeb3ad3e93 on Mar 12, 2020
  10. rajarshimaitra referenced this in commit 6e5818a36f on Aug 5, 2021
  11. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-27 18:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me