Verifying Correct Usage of Context-Free API Protocols (Extended Version)

10/19/2020
by   Kostas Ferles, et al.
0

Several real-world libraries (e.g., reentrant locks, GUI frameworks, serialization libraries) require their clients to use the provided API in a manner that conforms to a context-free specification. Motivated by this observation, this paper describes a new technique for verifying the correct usage of context-free API protocols. The key idea underlying our technique is to over-approximate the program's feasible API call sequences using a context-free grammar (CFG) and then check language inclusion between this grammar and the specification. However, since this inclusion check may fail due to imprecision in the program's CFG abstraction, we propose a novel refinement technique to progressively improve the CFG. In particular, our method obtains counterexamples from CFG inclusion queries and uses them to introduce new non-terminals and productions to the grammar while still over-approximating the program's relevant behavior. We have implemented the proposed algorithm in a tool called CFPChecker and evaluate it on 10 popular Java applications that use at least one API with a context-free specification. Our evaluation shows that CFPChecker is able to verify correct usage of the API in clients that use it correctly and produces counterexamples for those that do not. We also compare our method against three relevant baselines and demonstrate that CFPChecker enables verification of safety properties that are beyond the reach of existing tools.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
05/16/2019

Inferring Concise Specifications of APIs

Modern software relies on libraries and uses them via application progra...
research
05/11/2021

Dealing with Variability in API Misuse Specification

APIs are the primary mechanism for developers to gain access to external...
research
11/27/2018

Experience Report on Formally Verifying Parts of OpenJDK's API with KeY

Deductive verification of software has not yet found its way into indust...
research
09/07/2023

HOPPER: Interpretative Fuzzing for Libraries

Despite the fact that the state-of-the-art fuzzers can generate inputs e...
research
02/14/2020

Generating a Generic Fluent API in Java

Context: The algorithms for generating a safe fluent API are actively st...
research
03/02/2021

SLD-resolution without occur-check, an example

We prove that the occur-check is not needed for a certain definite claus...
research
09/08/2021

Study of the Subtyping Machine of Nominal Subtyping with Variance (full version)

This is a study of the computing power of the subtyping machine behind K...

Please sign up or login with your details

Forgot password? Click here to reset