Two birds one stone: Effective static detection of resource and communication deadlocks in Rust programs
摘要
Although Rust claims to enable fearless concurrency, concurrency errors remain prevalent in practical applications, with deadlocks particularly prominent and harmful. Current static deadlock detection techniques either do not cater to Rust programs without incorporating Rust semantics or solely concentrate on resource deadlocks, disregarding communication deadlocks. In this paper, we present RcChecker, the first static detection method that simultaneously targets resource and communication deadlocks for Rust. At its core, RcChecker introduces the signal-lock graph to characterize the interactions between threads through lock variables and condition variables. The construction of the signal-lock graph involves utilizing flow-sensitive and context-sensitive analyses to track variable lifetime details and abstracting actions associated with condition variables into signal resource holdings and requests. By examining cycles within the signal-lock graph, we can effectively identify resource and communication deadlocks in a unified way. Compared to the existing Rust deadlock detection tool, RcChecker effectively eliminates eight resource deadlock false positives and detects seventeen errors that the existing tool fails to identify. Furthermore, RcChecker reports seven previously undiscovered issues in real-world Rust applications, including two resource deadlocks and five communication deadlocks.