Automatic Inference of Resource Leak Specifications

06/21/2023
by   Narges Shadab, et al.
0

A resource leak occurs when a program fails to free some finite resource after it is no longer needed. Such leaks are a significant cause of real-world crashes and performance problems. Recent work proposed an approach to prevent resource leaks based on checking resource management specifications. These specifications are written in the form of program annotations that track the ownership relationship between objects and resources. While this specify-and-check approach has several advantages compared to prior techniques, the need to manually write annotations presents a significant barrier to its practical adoption. This paper presents a novel technique to automatically infer a resource management specification for a program, broadening the applicability of specify-and-check verification for resource leaks. Inference in this domain poses significant challenges because resource management specifications differ significantly in nature from the types that most inference techniques target. Further, for practical effectiveness, we desire a technique that can infer the resource management specification intended by the developer, even in cases when the code does not fully adhere to this specification. We address these challenges through a set of inference rules carefully designed to capture real-world coding patterns, yielding an effective fixed-point-based inference algorithm. We have implemented our inference algorithm in two different systems, targeting programs in the Java and C# programming languages. An experimental evaluation showed that our technique could infer 87 manually for the benchmarks. Further, the true positive rate for resource leak bugs achieved by the verifier when run after our fully-automatic inference nearly matched the rate achieved after manual annotation of the code.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
04/25/2023

Resource Specifications for Resource-Manipulating Programs

Specifications for modular program verifiers are expressed as constraint...
research
03/12/2018

Interval-based Resource Usage Verification by Translation into Horn Clauses and an Application to Energy Consumption

Many applications require conformance with specifications that constrain...
research
02/14/2019

Sip4J: Statically inferring permission-based specifications for sequential Java programs

In mainstream programming languages such as Java, a common way to enable...
research
10/25/2019

Pointer Life Cycle Types for Lock-Free Data Structures with Memory Reclamation

We consider the verification of lock-free data structures that manually ...
research
02/15/2021

Finding Anomalies in Scratch Assignments

In programming education, teachers need to monitor and assess the progre...
research
07/11/2019

Provenance for Large-scale Datalog

Logic programming languages such as Datalog have become popular as Domai...
research
01/19/2022

Code Sophistication: From Code Recommendation to Logic Recommendation

A typical approach to programming is to first code the main execution sc...

Please sign up or login with your details

Forgot password? Click here to reset