elements/src
MarcoFalke dada92fed2
Merge bitcoin/bitcoin#22875: util: Fix Racy ParseOpCode function initialization
7b481f015a Fix Racy ParseOpCode function initialization (Jeremy Rubin)

Pull request description:

  If multiple callers call ParseOpCode concurrently it will cause a race condition. We can either move the static to it's own area and require init be called explicitly, or just allow concurrent first callers to race to fill in an atomic variable that never changes thereafter. The second approach is taken here.

  Static initialization *is* threadsafe, but only insofar as definining the variable being guaranteed to be called once. This is used incorrectly here.

  practicalswift --> are there tools we can deploy to catch usage like this?

ACKs for top commit:
  MarcoFalke:
    re-ACK 7b481f015a 🗣

Tree-SHA512: cbf9dc3af26d7335305026f32ce8472a018309b89b3d81a67357e59fbeed72c37b5b8a6e30325ea68145c3b2403867be82de01f22decefb6e6717cf0c0045633
2021-12-24 10:02:59 +01:00
..
bench scripted-diff: Rename touched member variables 2021-12-13 13:32:08 +01:00
common scripted-diff: Move bloom to src/common 2021-10-05 11:10:37 +02:00
compat compat: remove glibc_compat.cpp 2021-09-10 11:18:58 +08:00
config
consensus doc: Fix typos in endif header comments 2021-11-16 09:56:45 +01:00
crc32c Update crc32c subtree 2021-09-29 14:10:29 +02:00
crypto build: use __SIZEOF_INT128__ for checking __int128 availability 2021-12-13 21:25:05 +08:00
index Merge bitcoin/bitcoin#23785: refactor: Move stuff to ChainstateManager 2021-12-16 15:13:31 +01:00
init scripted-diff: Rename interfaces::WalletClient to interfaces::WalletLoader 2021-12-22 13:44:55 -05:00
interfaces scripted-diff: Rename interfaces::WalletClient to interfaces::WalletLoader 2021-12-22 13:44:55 -05:00
ipc refactor: Block unsafe fs::path std::string conversion calls 2021-10-05 11:10:47 -04:00
leveldb
logging log, timer: add LOG_TIME_MILLIS_WITH_CATEGORY_MSG_ONCE macro 2021-10-05 17:28:02 +02:00
minisketch Merge commit 'b6487dc4ef' as 'src/minisketch' 2021-10-21 09:36:07 +08:00
node scripted-diff: Rename interfaces::WalletClient to interfaces::WalletLoader 2021-12-22 13:44:55 -05:00
policy Merge bitcoin/bitcoin#22674: validation: mempool validation and submission for packages of 1 child + parents 2021-12-15 20:42:33 +01:00
primitives Make GenTxid boolean constructor private 2021-10-22 12:32:16 +02:00
qt scripted-diff: Rename interfaces::WalletClient to interfaces::WalletLoader 2021-12-22 13:44:55 -05:00
rpc Merge bitcoin/bitcoin#23721: wallet, refactor: Move restorewallet() logic to the wallet section 2021-12-16 08:42:44 +01:00
script Implement operator< for KeyOriginInfo and CExtPubKey 2021-12-10 08:29:47 -05:00
secp256k1 Update secp256k1 subtree to latest upstream master 2021-12-15 09:19:50 -05:00
support refactor: remove references to deprecated values under std::allocator 2021-10-20 18:36:40 -04:00
test Merge bitcoin/bitcoin#23736: test: call VerifyLoadedChainstate during ChainTestingSetup 2021-12-23 12:10:16 +08:00
univalue Update univalue subtree to latest upstream 2021-10-11 20:45:56 +08:00
util Reduce size of strencodings decode tables 2021-12-13 09:58:20 +01:00
wallet scripted-diff: Rename interfaces::WalletClient to interfaces::WalletLoader 2021-12-22 13:44:55 -05:00
zmq doc: Fix typos in endif header comments 2021-11-16 09:56:45 +01:00
.clang-format Use c++17 in clang-format 2021-11-12 11:46:34 +01:00
.clang-tidy Enable clang-tidy bugprone-argument-comment and fix violations 2021-09-07 09:11:10 +02:00
addrdb.cpp refactor: Block unsafe fs::path std::string conversion calls 2021-10-05 11:10:47 -04:00
addrdb.h scripted-diff: Rename CAddrMan to AddrMan 2021-09-28 22:21:10 -04:00
addrman.cpp refactor: make AddrMan::Good return bool 2021-12-14 17:50:24 +01:00
addrman.h refactor: make AddrMan::Good return bool 2021-12-14 17:50:24 +01:00
addrman_impl.h refactor: make AddrMan::Good return bool 2021-12-14 17:50:24 +01:00
arith_uint256.cpp
arith_uint256.h
attributes.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
banman.cpp Ignore banlist.dat 2021-07-30 11:21:51 +02:00
banman.h doc: Fix typos in endif header comments 2021-11-16 09:56:45 +01:00
base58.cpp Replace MakeSpan helper with Span deduction guide 2021-11-29 17:58:53 -05:00
base58.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
bech32.cpp Make Bech32 LocateErrors return error list rather than using out-arg 2021-12-06 14:17:41 +13:00
bech32.h Make Bech32 LocateErrors return error list rather than using out-arg 2021-12-06 14:17:41 +13:00
bitcoin-cli-res.rc windres: use PACKAGE_VERSION rather than building more version numbers 2021-08-17 16:54:47 +08:00
bitcoin-cli.cpp cli: hoist networks class data members to a constant 2021-11-11 13:14:01 +01:00
bitcoin-tx-res.rc windres: use PACKAGE_VERSION rather than building more version numbers 2021-08-17 16:54:47 +08:00
bitcoin-tx.cpp bitcoin-tx: Reject non-integral and out of range multisig numbers 2021-10-12 12:45:55 +02:00
bitcoin-util-res.rc windres: use PACKAGE_VERSION rather than building more version numbers 2021-08-17 16:54:47 +08:00
bitcoin-util.cpp refactor: Pass grind args vector as const reference 2021-06-18 20:10:07 +02:00
bitcoin-wallet-res.rc windres: use PACKAGE_VERSION rather than building more version numbers 2021-08-17 16:54:47 +08:00
bitcoin-wallet.cpp Merge bitcoin/bitcoin#23346: util, refactor: Improve headers for bitcoin-wallet tool 2021-12-09 13:44:24 +01:00
bitcoind-res.rc windres: use PACKAGE_VERSION rather than building more version numbers 2021-08-17 16:54:47 +08:00
bitcoind.cpp Add syscall sandboxing (seccomp-bpf) 2021-10-01 13:51:10 +00:00
blockencodings.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
blockencodings.h
blockfilter.cpp Remove unused (and broken) functionality in SpanReader 2021-12-06 16:18:14 -05:00
blockfilter.h
chain.cpp doc: Tidy up nMinDiskSpace comment 2021-11-26 11:17:43 +01:00
chain.h style: Use 4 spaces for indendation, not 5 2021-12-14 12:44:30 +01:00
chainparams.cpp Use absolute FQDN for DNS seed domains 2021-10-14 17:49:52 +05:30
chainparams.h net: distinguish default port per network 2021-07-09 11:19:36 +02:00
chainparamsbase.cpp scripted-diff: disable unimplemented ArgsManager BOOL/INT/STRING flags 2021-10-25 10:44:17 -04:00
chainparamsbase.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
chainparamsseeds.h contrib, p2p: update I2P hardcoded seeds 2021-07-30 11:03:44 +02:00
checkqueue.h Exit early for an empty vChecks in CCheckQueue::Add 2021-11-03 11:26:57 +02:00
clientversion.cpp wallet: use FormatFullVersion instead of CLIENT_BUILD in rpcdump 2021-08-16 16:04:47 +08:00
clientversion.h wallet: use FormatFullVersion instead of CLIENT_BUILD in rpcdump 2021-08-16 16:04:47 +08:00
coins.cpp [tracing] tracepoints to utxocache add, spent and uncache 2021-11-28 11:51:21 +05:30
coins.h refactor: wrap CCoinsViewCursor in unique_ptr 2021-06-17 09:47:08 -04:00
compat.h net: extend Sock with methods for robust send & read until terminator 2021-03-01 17:36:16 +01:00
compressor.cpp refactor: Use CPubKey vector constructor where possible 2021-05-04 06:53:32 +02:00
compressor.h Replace MakeSpan helper with Span deduction guide 2021-11-29 17:58:53 -05:00
core_io.h rpc: Add level 3 verbosity to getblock RPC call. 2021-10-05 10:42:34 +02:00
core_memusage.h
core_read.cpp Fix Racy ParseOpCode function initialization 2021-12-23 15:53:36 -08:00
core_write.cpp core_write: Rename calculate_fee to have_undo for clarity 2021-10-05 10:42:34 +02:00
cuckoocache.h refactor: Fix implicit-signed-integer-truncation in cuckoocache.h 2021-11-29 14:32:51 +01:00
dbwrapper.cpp Improve fs::PathToString documentation 2021-11-15 12:08:49 -05:00
dbwrapper.h Merge #20464: refactor: Treat CDataStream bytes as uint8_t 2021-02-01 15:17:28 +01:00
deploymentinfo.cpp deploymentinfo: Add DeploymentName() 2021-06-30 08:19:12 +10:00
deploymentinfo.h deploymentinfo: Add DeploymentName() 2021-06-30 08:19:12 +10:00
deploymentstatus.cpp consensus/params: simplify ValidDeployment check to avoid gcc warning 2021-08-02 23:48:32 +10:00
deploymentstatus.h Use DeploymentEnabled to hide VB deployments 2021-07-01 20:20:52 +02:00
dummywallet.cpp scripted-diff: Rename interfaces::WalletClient to interfaces::WalletLoader 2021-12-22 13:44:55 -05:00
external_signer.cpp external_signer: improve fingerprint matching logic (stop on first match) 2021-08-24 11:30:09 +02:00
external_signer.h refactor: make ExternalSigner NetworkArg() and m_chain private 2021-06-16 10:48:58 +02:00
flatfile.cpp refactor: Block unsafe fs::path std::string conversion calls 2021-10-05 11:10:47 -04:00
flatfile.h
fs.cpp refactor: include a missing <limits> header in fs.cpp 2021-10-22 04:03:45 +03:00
fs.h Improve fs::PathToString documentation 2021-11-15 12:08:49 -05:00
hash.cpp refactor: use {Read,Write}BE32 helpers for BIP32 nChild (de)serialization 2021-10-05 23:53:33 +02:00
hash.h Squashed 'src/secp256k1/' changes from 3967d96bf1..efad3506a8 2021-04-23 11:35:15 -07:00
httprpc.cpp Replace use of boost::trim use with locale-independent TrimString 2021-09-02 13:17:46 +08:00
httprpc.h doc: Fix typos in endif header comments 2021-11-16 09:56:45 +01:00
httpserver.cpp Merge bitcoin/bitcoin#20487: Add syscall sandboxing using seccomp-bpf (Linux secure computing mode) 2021-10-04 22:45:43 +02:00
httpserver.h
i2p.cpp refactor: Block unsafe fs::path std::string conversion calls 2021-10-05 11:10:47 -04:00
i2p.h doc: Fix typos in endif header comments 2021-11-16 09:56:45 +01:00
indirectmap.h
init.cpp Remove all #include // for * comments 2021-12-07 14:48:49 -05:00
init.h init: remove straggling boost thread_group code 2021-07-12 21:46:59 +08:00
key.cpp Remove unnecessary cast in CKey::SignSchnorr 2021-12-15 09:20:26 -05:00
key.h Make signing follow BIP340 exactly w.r.t. aux randomness 2021-11-12 12:04:20 -05:00
key_io.cpp Make Bech32 LocateErrors return error list rather than using out-arg 2021-12-06 14:17:41 +13:00
key_io.h Add Bech32 error location function 2021-10-12 12:03:14 +13:00
logging.cpp blockstorage: use debug log category 2021-10-11 21:45:49 +10:00
logging.h blockstorage: use debug log category 2021-10-11 21:45:49 +10:00
Makefile.am Merge bitcoin/bitcoin#23280: init: Coalesce Chainstate loading sequence between {,non-}unittest codepaths 2021-12-10 17:17:43 +01:00
Makefile.bench.include bench: add peer eviction protection benchmarks 2021-07-08 12:28:23 +02:00
Makefile.crc32c.include build: remove support for weak linking getauxval() 2021-09-24 15:40:04 +08:00
Makefile.leveldb.include build: remove build stubs for external leveldb 2021-10-15 01:02:45 +00:00
Makefile.minisketch.include build: add minisketch build file and include it 2021-10-21 09:37:30 +08:00
Makefile.qt.include build, android: Fix Android GUI not loading on Qt 5.15 2021-12-13 19:27:46 +01:00
Makefile.qt_locale.include qt: Pre-splitoff translations update 2020-10-27 19:40:44 +01:00
Makefile.qttest.include build, qt: use static QAndroidPlatformIntegrationPlugin 2021-12-13 19:24:33 +01:00
Makefile.test.include Merge bitcoin/bitcoin#22704: fuzz: Differential fuzzing to compare Bitcoin Core's and D. J. Bernstein's implementation of ChaCha20 2021-12-17 16:56:05 +01:00
Makefile.test_fuzz.include build: compile libnatpmp with -DNATPMP_STATICLIB on Windows 2021-03-04 12:34:46 +08:00
Makefile.test_util.include move-only: unittest: add test/util/chainstate.h 2021-09-15 15:46:48 -04:00
Makefile.univalue.include Integrate univalue into our buildsystem 2021-10-11 20:46:25 +08:00
mapport.cpp Add syscall sandboxing (seccomp-bpf) 2021-10-01 13:51:10 +00:00
mapport.h net: Add -natpmp command line option 2021-01-07 18:07:09 +02:00
memusage.h
merkleblock.cpp doc: fix various typos 2021-01-04 12:31:31 +08:00
merkleblock.h style: Sort 2021-10-05 11:11:18 +02:00
net.cpp Merge bitcoin/bitcoin#23758: net: Use type-safe mockable time for peer connection time 2021-12-15 13:07:34 +01:00
net.h Merge bitcoin/bitcoin#23758: net: Use type-safe mockable time for peer connection time 2021-12-15 13:07:34 +01:00
net_permissions.cpp p2p: pass strings to NetPermissions::TryParse functions by const ref 2021-05-19 19:41:05 +02:00
net_permissions.h Rate limit the processing of incoming addr messages 2021-07-15 12:52:38 -07:00
net_processing.cpp Merge bitcoin/bitcoin#23801: Refactor: Change time variable type from int64_t to std::chrono::seconds in net_processing.cpp 2021-12-20 11:48:54 +01:00
net_processing.h rpc: getblockfrompeer 2021-12-02 13:16:18 +07:00
net_types.cpp net: Drop only invalid entries when reading banlist.json 2021-12-14 18:58:45 +01:00
net_types.h MOVEONLY: Expose BanMapToJson / BanMapFromJson 2021-09-03 05:21:58 -04:00
netaddress.cpp More Span simplifications 2021-11-29 17:59:44 -05:00
netaddress.h Replace MakeSpan helper with Span deduction guide 2021-11-29 17:58:53 -05:00
netbase.cpp p2p, refactor: drop unused DNSLookupFn param in LookupSubnet() 2021-12-07 13:13:18 +01:00
netbase.h p2p, refactor: drop unused DNSLookupFn param in LookupSubnet() 2021-12-07 13:13:18 +01:00
netmessagemaker.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
noui.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
noui.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
outputtype.cpp make ParseOutputType return a std::optional<OutputType> 2021-08-04 19:20:32 +08:00
outputtype.h make ParseOutputType return a std::optional<OutputType> 2021-08-04 19:20:32 +08:00
pow.cpp
pow.h
prevector.h
protocol.cpp Make GenTxid boolean constructor private 2021-10-22 12:32:16 +02:00
protocol.h doc: Remove incorrect INIT_PROTO_VERSION from nTime comment 2021-08-23 18:53:34 +02:00
psbt.cpp psbt: implement hash preimages fields 2021-12-11 18:32:17 +01:00
psbt.h psbt: implement hash preimages fields 2021-12-11 18:32:17 +01:00
pubkey.cpp Store version bytes and be able to serialize them in CExtPubKey 2021-12-10 08:29:47 -05:00
pubkey.h Implement operator< for KeyOriginInfo and CExtPubKey 2021-12-10 08:29:47 -05:00
random.cpp refactor: Replace &foo[0] with foo.data() 2021-05-04 06:55:31 +02:00
random.h
randomenv.cpp build: remove support for weak linking getauxval() 2021-09-24 15:40:04 +08:00
randomenv.h doc: Fix typos in endif header comments 2021-11-16 09:56:45 +01:00
rest.cpp Merge bitcoin/bitcoin#17631: Expose block filters over REST 2021-12-20 09:00:34 +01:00
reverse_iterator.h
scheduler.cpp Add syscall sandboxing (seccomp-bpf) 2021-10-01 13:51:10 +00:00
scheduler.h doc: Fix typos in endif header comments 2021-11-16 09:56:45 +01:00
serialize.h Types are compact size uints 2021-12-10 08:29:24 -05:00
shutdown.cpp move-only: Move AbortNode to shutdown 2021-04-04 18:08:36 +02:00
shutdown.h doc: Fix typos in endif header comments 2021-11-16 09:56:45 +01:00
signet.cpp Remove unused (and broken) functionality in SpanReader 2021-12-06 16:18:14 -05:00
signet.h scripted-diff: remove Optional & nullopt 2021-03-15 10:41:30 +08:00
span.h More Span simplifications 2021-11-29 17:59:44 -05:00
streams.h Remove unused (and broken) functionality in SpanReader 2021-12-06 16:18:14 -05:00
sync.cpp log: Avoid broken DEBUG_LOCKORDER log 2021-09-29 18:46:30 +02:00
sync.h sync: inline lock contention logging macro to fix time duration 2021-09-06 23:43:51 +02:00
threadinterrupt.cpp
threadinterrupt.h doc: Fix typos in endif header comments 2021-11-16 09:56:45 +01:00
threadsafety.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
timedata.cpp scripted-diff: Rename overloaded int GetArg to GetIntArg 2021-09-27 06:57:20 -04:00
timedata.h
tinyformat.h Use C++17 [[fallthrough]] attribute, and drop -Wno-implicit-fallthrough 2021-07-05 08:59:38 +03:00
torcontrol.cpp Remove strtol in torcontrol 2021-11-18 18:13:21 +01:00
torcontrol.h doc: Fix typos in endif header comments 2021-11-16 09:56:45 +01:00
txdb.cpp scripted-diff: Rename overloaded int GetArg to GetIntArg 2021-09-27 06:57:20 -04:00
txdb.h Remove txindex migration code 2021-08-20 16:59:41 +02:00
txmempool.cpp clean up txmempool includes 2021-12-02 14:49:19 +00:00
txmempool.h clean up txmempool includes 2021-12-02 14:49:19 +00:00
txorphanage.cpp scripted-diff: Update txorphanage naming convention 2021-02-27 01:08:09 +10:00
txorphanage.h [net processing] Add Orphanage empty consistency check 2021-07-20 13:12:42 +01:00
txrequest.cpp Make GenTxid boolean constructor private 2021-10-22 12:32:16 +02:00
txrequest.h Report and verify expirations 2020-10-12 12:14:53 -07:00
uint256.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
uint256.h Make XOnlyPubKey act like byte container 2021-05-24 12:14:16 -07:00
undo.h
validation.cpp Merge bitcoin/bitcoin#23785: refactor: Move stuff to ChainstateManager 2021-12-16 15:13:31 +01:00
validation.h Merge bitcoin/bitcoin#23785: refactor: Move stuff to ChainstateManager 2021-12-16 15:13:31 +01:00
validationinterface.cpp Add 'sequence' zmq publisher to track all block (dis)connects, mempool deltas 2020-09-22 11:34:30 -04:00
validationinterface.h Add 'sequence' zmq publisher to track all block (dis)connects, mempool deltas 2020-09-22 11:34:30 -04:00
version.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
versionbits.cpp [refactor] Move ComputeBlockVersion into VersionBitsCache 2021-06-30 08:19:12 +10:00
versionbits.h [refactor] Move ComputeBlockVersion into VersionBitsCache 2021-06-30 08:19:12 +10:00
walletinitinterface.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
warnings.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
warnings.h doc: Fix typos in endif header comments 2021-11-16 09:56:45 +01:00