Proceedings of the Twenty-fourth ACM SIGACT-SIGMOD
Proceedings of the Twenty-fourth ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems Year 2005 Peer-reviewed
Programming Languages · Static Analysis

Context-Sensitive Program Analysis as Database Queries

Monica S. Lam John Whaley V.~Benjamin Livshits Michael C. Martin Dzintars Avots Michael Carbin
2005
Publication year
POPL
Venue
Peer-reviewed
Type

Problem

Program analysis has been increasingly used in software engineering tasks such as auditing programs for security vulnerabilities and finding errors in general. Such tools often require analyses much more sophisticated than those traditionally used in compiler optimizations. In particular, context-sensitive pointer alias information is a prerequisite for any sound and precise analysis that reasons about uses of heap objects in a program. Context-sensitive analysis is challenging because there are over 10^14 contexts in a typical large program, even after recursive cycles are collapsed.

Approach

Moreover, pointers cannot be resolved in general without analyzing the entire program. This paper presents a new framework, based on the concept of deductive databases, for context-sensitive program analysis. In this framework, all program information is stored as relations; data access and analyses are written as Datalog queries. To handle the large number of contexts in a program, the database represents relations with binary decision diagrams (BDDs).

Results

The system we have developed, called bddbddb, automatically translates database queries into highly optimized BDD programs. Our preliminary experiences suggest that a large class of analyses involving heap objects can be described succinctly in Datalog and implemented efficiently with BDDs. To make developing application-specific analyses easy for programmers, we have also created a language called PQL that makes a subset of Datalog queries more intuitive to define. We have used the language to find many security holes in Web applications.

Cite this paper — BibTeX
@InProceedings{lam05context,
  author = "Monica S. Lam and John Whaley and V.~Benjamin Livshits and Michael C. Martin and Dzintars Avots and Michael Carbin and Christopher Unkel",
  title = "Context-Sensitive Program Analysis as Database Queries",
  booktitle = "Proceedings of the Twenty-fourth ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems",
  month = jun,
  year = "2005",
  location = "Baltimore, Maryland",
  publisher = "ACM",
}
Copied