ethereum / go-ethereum

Go implementation of the Ethereum protocol
https://geth.ethereum.org
GNU Lesser General Public License v3.0
47.56k stars 20.13k forks source link

miner: channel operations found blocking forever during fuzzing #23332

Open BurtonQin opened 3 years ago

BurtonQin commented 3 years ago

System information

Geth version: geth version OS & Version: Windows/Linux/OSX Commit hash : 56e9001a1a8ddecc478943170b00207ef46109b9

Expected behaviour

The channel sending/receiving/select operation shall not block forever whatever the order of the concurrent messages.

Actual behaviour

We found 13 blocking issues by fuzzing the code from

Entry point 6: https://github.com/ethereum/go-ethereum/blob/56e9001a1a8ddecc478943170b00207ef46109b9/core/bloombits/matcher_test.go#L68

  1. Blocked at the receiving operation at https://github.com/ethereum/go-ethereum/blob/56e9001a1a8ddecc478943170b00207ef46109b9/core/bloombits/matcher.go#L561 The channel is created at https://github.com/ethereum/go-ethereum/blob/56e9001a1a8ddecc478943170b00207ef46109b9/core/bloombits/matcher.go#L555-L556
  2. Blocked at the receiving operation at https://github.com/ethereum/go-ethereum/blob/56e9001a1a8ddecc478943170b00207ef46109b9/core/bloombits/matcher.go#L575 The channel is created at https://github.com/ethereum/go-ethereum/blob/56e9001a1a8ddecc478943170b00207ef46109b9/core/bloombits/matcher.go#L569-L570
  3. Blocked at the receiving operation https://github.com/ethereum/go-ethereum/blob/56e9001a1a8ddecc478943170b00207ef46109b9/les/utils/limiter.go#L319-L320 The channel is created at https://github.com/ethereum/go-ethereum/blob/56e9001a1a8ddecc478943170b00207ef46109b9/les/utils/limiter.go#L318
  4. Blocked at the select operation https://github.com/ethereum/go-ethereum/blob/56e9001a1a8ddecc478943170b00207ef46109b9/p2p/discover/v4_udp.go#L396-L402
  5. Blocked at the select operation https://github.com/ethereum/go-ethereum/blob/56e9001a1a8ddecc478943170b00207ef46109b9/p2p/message.go#L190-L193

    Steps to reproduce the behaviour

    We found the blocking issues through a WIP Fuzzing project by system-pclub, PSU.

Backtrace

charlesxsh commented 3 years ago

Hi there, kindly ask do we have any update on this PR?