bitcoin/src
fanquake 551dc7f664
Merge #18806: net: remove is{Empty,Full} flags from CBloomFilter, clarify CVE fix
1ad8ea2b73 net: remove is{Empty,Full} flags from CBloomFilter, clarify CVE fix (Sebastian Falbesoner)

Pull request description:

  The BIP37 bloom filter class `CBloomFilter` contains two flags `isEmpty`/`isFull` together with an update method with the purpose to, according to the comments, "avoid wasting cpu", i.e. the mechanism should serve as an optimization for the trivial cases of empty (all bits zero) or full (all bits one) filters.
  However, the real reason of adding those flags (introduced with commit 37c6389c5a by gmaxwell) was a _covert fix_ of [CVE-2013-5700](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-5700), a vulnerability that allowed a divide-by-zero remote node crash.
  According to gmaxwell himself (https://github.com/bitcoin/bitcoin/pull/9060#issuecomment-257749165):
  > the IsEmpty/IsFull optimizations were largely a pretextual optimization intended to make unexploitable a remote crash vulnerability (integer division by zero) that existed in the original bloom filtering code without disclosing it. I'm doubtful that they are all that useful. :)

  For more information on how to trigger this crash, see PR https://github.com/bitcoin/bitcoin/pull/18515 which contains a detailled description and a regression test. It has also been discussed on a [recent PR club meeting on fuzzing](https://bitcoincore.reviews/18521.html).

  The covert fix code already led to issues and PR based on the wrong assumption that the flags are there for optimization reasons (see #16886 and #16922). This PR gets rid of the flags and the update method and just focuses on the CVE fix itself, i.e. it can be seen as a revert of the covert fix commit modulo the actual fix.

ACKs for top commit:
  meshcollider:
    utACK 1ad8ea2b73
  laanwj:
    Concept and code review ACK 1ad8ea2b73
  jkczyz:
    ACK 1ad8ea2b73
  MarcoFalke:
    ACK 1ad8ea2b73
  fjahr:
    Code review ACK 1ad8ea2b73

Tree-SHA512: 29f7ff9faece0285e11e16c024851f5bcb772dec64118ccc3f9067ec256267ec8e1b1e3105c7de2a72fd122c3b085e8fc840ab8f4e49813f1cc7a444df1867f7
2020-05-06 15:40:06 +08:00
..
bench Remove CCoinsViewCache::GetValueIn(...) 2020-05-03 18:42:14 +00:00
compat scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
config
consensus scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
crc32c Import crc32c using subtree merge as as 'src/crc32c' 2020-01-28 17:00:01 +01:00
crypto Avoid non-trivial global constants in SHA-NI code 2020-04-07 13:57:34 -07:00
index scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
interfaces wallet: Avoid translating RPC errors when creating txs 2020-05-01 07:39:06 -04:00
leveldb Update to leveldb upstream using subtree merge 2020-01-28 16:59:07 +01:00
logging Remove use of non-standard zero variadic macros 2020-04-30 18:02:04 +08:00
node Merge #18038: P2P: Mempool tracks locally submitted transactions to improve wallet privacy 2020-04-29 16:32:37 +08:00
policy scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
primitives Remove CCoinsViewCache::GetValueIn(...) 2020-05-03 18:42:14 +00:00
qt Merge #18699: wallet: Avoid translating RPC errors 2020-05-04 16:29:22 +02:00
rpc Merge #18809: rpc: Do not advertise dumptxoutset as a way to flush the chainstate 2020-04-30 07:20:14 -04:00
script Merge #18413: script: prevent UB when computing abs value for num opcode serialize 2020-05-02 21:24:05 +08:00
secp256k1 Update the secp256k1 subtree to the latest upstream version 2019-03-31 11:41:05 -07:00
support Merge #18443: lockedpool: avoid sensitive data in core files (FreeBSD) 2020-05-04 16:31:07 +02:00
test Merge #18806: net: remove is{Empty,Full} flags from CBloomFilter, clarify CVE fix 2020-05-06 15:40:06 +08:00
univalue Update univalue subtree 2020-02-09 07:44:29 -08:00
util wallet: Avoid translating RPC errors when loading wallets 2020-05-01 07:39:00 -04:00
wallet Merge #9381: Remove CWalletTx merging logic from AddToWallet 2020-05-06 11:36:32 +12:00
zmq scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
.clang-format util: Add AllowShortCaseLabelsOnASingleLine option 2019-10-14 13:24:54 +03:00
addrdb.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
addrdb.h Convert addrdb/addrman to new serialization 2020-01-02 11:05:36 -08:00
addrman.cpp scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
addrman.h logging: asmap logging and #include fixups 2020-03-04 14:24:19 +01:00
amount.h Update copyright headers to 2018 2018-12-29 10:15:01 +01:00
arith_uint256.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
arith_uint256.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
attributes.h Add NODISCARD to all {Decode,Parse}[...](...) functions returning bool. Sort includes. 2018-11-05 17:03:11 +01:00
banman.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
banman.h refactor: move DUMP_BANS_INTERVAL to banman.h 2020-03-10 09:52:53 -04:00
base58.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
base58.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
bech32.cpp Add some general std::vector utility functions 2019-10-16 08:56:57 -07:00
bech32.h Assert that the HRP is lowercase in Bech32::Encode 2019-09-05 13:25:11 +12:00
bitcoin-cli-res.rc
bitcoin-cli.cpp build: fix ASLR for bitcoin-cli on Windows 2020-04-19 10:05:29 +08:00
bitcoin-tx-res.rc
bitcoin-tx.cpp scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
bitcoin-wallet-res.rc [tools] Add wallet inspection and modification tool 2019-01-30 16:26:52 -05:00
bitcoin-wallet.cpp scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
bitcoind-res.rc
bitcoind.cpp scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
blockencodings.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
blockencodings.h scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
blockfilter.cpp tests: Add fuzzing harness for Golomb-Rice coding (GolombRiceEncode/GolombRiceDecode) 2020-04-20 14:57:48 +00:00
blockfilter.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
bloom.cpp net: remove is{Empty,Full} flags from CBloomFilter, clarify CVE fix 2020-04-28 19:27:22 +02:00
bloom.h net: remove is{Empty,Full} flags from CBloomFilter, clarify CVE fix 2020-04-28 19:27:22 +02:00
chain.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
chain.h scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
chainparams.cpp scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
chainparams.h scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
chainparamsbase.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
chainparamsbase.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
chainparamsseeds.h net: Hardcoded seeds update for 0.20 2020-04-03 16:29:26 +02:00
checkqueue.h scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
clientversion.cpp
clientversion.h
coins.cpp Remove CCoinsViewCache::GetValueIn(...) 2020-05-03 18:42:14 +00:00
coins.h Remove CCoinsViewCache::GetValueIn(...) 2020-05-03 18:42:14 +00:00
compat.h windows: Set _WIN32_WINNT to 0x0601 (Windows 7) 2019-01-23 16:28:27 +08:00
compressor.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
compressor.h scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
core_io.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
core_memusage.h
core_read.cpp scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
core_write.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
cuckoocache.h tests: Add fuzzing harness for classes/functions in cuckoocache.h 2020-04-08 14:45:27 +00:00
dbwrapper.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
dbwrapper.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
dummywallet.cpp wallet: Avoid translating RPC errors when loading wallets 2020-05-01 07:39:00 -04:00
flatfile.cpp Style cleanup. 2019-02-22 17:38:45 -08:00
flatfile.h scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
fs.cpp scripted-diff: Add missed copyright headers 2020-01-04 20:18:28 +02:00
fs.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
hash.cpp Extract CSipHasher to it's own file in crypto/ directory. 2018-11-05 09:25:15 -08:00
hash.h Squashed 'src/secp256k1/' changes from 0b70241850..b19c000063 2019-03-31 11:41:05 -07:00
httprpc.cpp scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
httprpc.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
httpserver.cpp scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
httpserver.h scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
indirectmap.h scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
init.cpp init: Remove boost from ThreadImport 2020-04-27 15:35:26 -04:00
init.h scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
key.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
key.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
key_io.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
key_io.h
limitedmap.h
logging.cpp log: Use Join() helper when listing log categories 2020-04-16 11:08:46 -04:00
logging.h log: Use Join() helper when listing log categories 2020-04-16 11:08:46 -04:00
Makefile.am Merge #18190: tests: Add fuzzing harness for Golomb-Rice coding (GolombRiceEncode/GolombRiceDecode) 2020-04-20 15:32:41 -04:00
Makefile.bench.include bench: add CAddrMan benchmarks 2020-04-21 15:06:59 +02:00
Makefile.crc32c.include build: CRC32C build system integration 2020-01-28 17:01:48 +01:00
Makefile.leveldb.include build: CRC32C build system integration 2020-01-28 17:01:48 +01:00
Makefile.qt.include Revert "Merge #16367: Multiprocess build support" 2020-04-10 19:38:21 -04:00
Makefile.qt_locale.include qt: Translations update pre-branch 2020-04-01 12:49:15 +02:00
Makefile.qttest.include build: Create test utility library from src/test/util/ 2019-11-21 21:13:08 +01:00
Makefile.test.include Merge #18783: tests: Add fuzzing harness for MessageSign, MessageVerify and other functions in util/message.h 2020-05-04 09:02:21 -04:00
Makefile.test_fuzz.include build: create test_fuzz library from src/test/fuzz/fuzz.cpp 2020-04-05 01:01:13 +02:00
Makefile.test_util.include fuzz: Add process_messages harness 2020-04-05 10:46:24 +08:00
memusage.h scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
merkleblock.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
merkleblock.h
miner.cpp scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
miner.h scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
net.cpp net: Add missing cs_vNodes lock 2020-03-29 11:45:46 -04:00
net.h [net processing] Move net processing consts to net_processing.cpp 2020-04-23 12:54:03 -04:00
net_permissions.cpp net: Avoid using C-style NUL-terminated strings as arguments in the netbase interface 2020-01-08 12:35:59 +00:00
net_permissions.h scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
net_processing.cpp Merge #18806: net: remove is{Empty,Full} flags from CBloomFilter, clarify CVE fix 2020-05-06 15:40:06 +08:00
net_processing.h Merge #18038: P2P: Mempool tracks locally submitted transactions to improve wallet privacy 2020-04-29 16:32:37 +08:00
net_types.h refactor: Remove addrdb.h dependency from node.h 2019-10-29 11:30:12 +02:00
netaddress.cpp scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
netaddress.h scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
netbase.cpp Merge #17754: net: Don't allow resolving of std::string with embedded NUL characters. Add tests. 2020-01-22 20:20:45 +01:00
netbase.h net: Avoid using C-style NUL-terminated strings as arguments in the netbase interface 2020-01-08 12:35:59 +00:00
netmessagemaker.h
noui.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
noui.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
optional.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
outputtype.cpp scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
outputtype.h List output types in an array in order to be iterated over 2020-01-23 16:35:06 -05:00
pow.cpp
pow.h
prevector.h prevector: Avoid unnamed struct, which is a GNU extension 2020-04-30 18:02:03 +08:00
protocol.cpp scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
protocol.h net: Fail instead of truncate command name in CMessageHeader 2020-02-06 13:24:40 +01:00
psbt.cpp scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
psbt.h Merge #17509: gui: save and load PSBT 2020-04-23 13:16:23 +12:00
pubkey.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
pubkey.h Implement TopUp in DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
random.cpp Merge #18038: P2P: Mempool tracks locally submitted transactions to improve wallet privacy 2020-04-29 16:32:37 +08:00
random.h Merge #18038: P2P: Mempool tracks locally submitted transactions to improve wallet privacy 2020-04-29 16:32:37 +08:00
randomenv.cpp scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
randomenv.h [MOVEONLY] Move perfmon data gathering to new randomenv module 2019-11-12 14:50:44 -08:00
rest.cpp Merge #18810: doc: update rest info on block size and json 2020-04-30 11:45:06 +02:00
reverse_iterator.h
scheduler.cpp scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
scheduler.h scheduler: Make schedule* methods type safe 2020-03-10 09:47:32 -04:00
serialize.h scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
shutdown.cpp
shutdown.h
span.h Merge #18591: Add C++17 build to Travis 2020-04-30 11:16:56 +02:00
streams.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
sync.cpp util: Remove unused itostr 2020-03-27 08:59:06 -04:00
sync.h refactor: Add interfaces::FoundBlock class to selectively return block data 2020-03-31 08:36:02 -05:00
threadinterrupt.cpp Merge #11640: Make LOCK, LOCK2, TRY_LOCK work with CWaitableCriticalSection 2018-08-31 16:00:38 +02:00
threadinterrupt.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
threadsafety.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
timedata.cpp scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
timedata.h
tinyformat.h util: Update tinyformat to upstream 2019-12-06 10:02:08 +01:00
torcontrol.cpp net: Avoid using C-style NUL-terminated strings as arguments in the netbase interface 2020-01-08 12:35:59 +00:00
torcontrol.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
txdb.cpp scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
txdb.h scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
txmempool.cpp Merge #18038: P2P: Mempool tracks locally submitted transactions to improve wallet privacy 2020-04-29 16:32:37 +08:00
txmempool.h [mempool] Track "unbroadcast" transactions 2020-04-23 14:42:25 -07:00
ui_interface.cpp scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
ui_interface.h scripted-diff: Bump copyright of files changed in 2020 2020-01-15 02:18:00 +07:00
uint256.cpp refactor: define a UINT256_ONE global constant 2020-01-23 16:35:08 -05:00
uint256.h refactor: define a UINT256_ONE global constant 2020-01-23 16:35:08 -05:00
undo.h scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
validation.cpp Merge #18088: build: ensure we aren't using GNU extensions 2020-05-05 07:44:23 +08:00
validation.h Merge #18786: init: Remove boost from ThreadImport 2020-05-04 16:06:42 +02:00
validationinterface.cpp Do not clear validationinterface entries being executed 2020-04-07 12:53:40 -07:00
validationinterface.h refactor: drop boost::signals2 in validationinterface 2020-04-04 11:44:39 -04:00
version.h
versionbits.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
versionbits.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
versionbitsinfo.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
versionbitsinfo.h MOVEONLY: Move versionbits info out of versionbits.o 2018-09-23 22:55:11 +02:00
walletinitinterface.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
warnings.cpp scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
warnings.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00