rCanary: Detecting Memory Leaks Across Semi-automated Memory Management Boundary in Rust

08/09/2023
by   Mohan Cui, et al.
0

Rust is an effective system programming language that guarantees memory safety via compile-time verifications. It employs a novel ownership-based resource management model to facilitate automated resource deallocation. It is anticipated that this model will eliminate memory leaks. However, we observed that user intervention driving semi-automated management is prone to introducing leaks. In contrast to violating memory-safety guarantees via the unsafe keyword, the leak breached boundary is implicit with no compiler alerting. In this paper, we present rCanary, a static, non-intrusive, and fully automated model checker to detect leaks across the semi-automated boundary. It adopts a precise encoder to abstract data with heap allocation and formalizes a refined leak-free memory model based on Boolean satisfiability. rCanary is implemented as an external component of Cargo and can generate constraints via MIR data flow. We evaluate it using flawed package benchmarks collected from the pull requests of prominent Rust packages. The results indicate it is possible to recall all these defects with acceptable false positives. We also apply our tool to more than 1,200 real-world crates from crates.io and GitHub, identifying 19 crates with potentially vulnerable leaks in 8.4 seconds per package.

READ FULL TEXT

page 3

page 10

research
03/29/2021

SafeDrop: Detecting Memory Deallocation Bugs of Rust Programs via Static Data-Flow Analysis

Rust is an emerging programming language that aims to prevent memory-saf...
research
10/21/2020

Uncovering the Hidden Dangers: Finding Unsafe Go Code in the Wild

The Go programming language aims to provide memory and thread safety thr...
research
08/29/2023

A Closer Look at the Security Risks in the Rust Ecosystem

Rust is an emerging programming language designed for the development of...
research
05/05/2023

Descend: A Safe GPU Systems Programming Language

Graphics Processing Units (GPU) offer tremendous computational power by ...
research
06/23/2021

Fuel: A Compiler Framework for Safe Memory Management

Flow-sensitive type systems offer an elegant way to ensure memory-safety...
research
06/01/2023

UNGOML: Automated Classification of unsafe Usages in Go

The Go programming language offers strong protection from memory corrupt...
research
09/11/2019

Floorplan: Spatial Layout in Memory Management Systems

In modern runtime systems, memory layout calculations are hand-coded in ...

Please sign up or login with your details

Forgot password? Click here to reset