DeepAI AI Chat
Log In Sign Up

Differential Cost Analysis with Simultaneous Potentials and Anti-potentials

04/02/2022
by   Đorđe Žikelić, et al.
0

We present a novel approach to differential cost analysis that, given a program revision, attempts to statically bound the difference in resource usage, or cost, between the two program versions. Differential cost analysis is particularly interesting because of the many compelling applications for it, such as detecting resource-use regressions at code-review time or proving the absence of certain side-channel vulnerabilities. One prior approach to differential cost analysis is to apply relational reasoning that conceptually constructs a product program on which one can over-approximate the difference in costs between the two program versions. However, a significant challenge in any relational approach is effectively aligning the program versions to get precise results. In this paper, our key insight is that we can avoid the need for and the limitations of program alignment if, instead, we bound the difference of two cost-bound summaries rather than directly bounding the concrete cost difference. In particular, our method computes a threshold value for the maximal difference in cost between two program versions simultaneously using two kinds of cost-bound summaries – a potential function that evaluates to an upper bound for the cost incurred in the first program and an anti-potential function that evaluates to a lower bound for the cost incurred in the second. Our method has a number of desirable properties: it can be fully automated, it allows optimizing the threshold value on relative cost, it is suitable for programs that are not syntactically similar, and it supports non-determinism. We have evaluated an implementation of our approach on a number of program pairs collected from the literature, and we find that our method computes tight threshold values on relative cost in most examples.

READ FULL TEXT

page 1

page 2

page 3

page 4

12/10/2018

Relational Cost Analysis for Functional-Imperative Programs

Relational cost analysis aims at formally establishing bounds on the dif...
08/18/2021

Selectively-Amortized Resource Bounding (Extended Version)

We consider the problem of automatically proving resource bounds. That i...
11/16/2018

DifFuzz: Differential Fuzzing for Side-Channel Analysis

Side-channel attacks allow an adversary to uncover secret program data b...
02/17/2020

Denotational semantics as a foundation for cost recurrence extraction for functional languages

A standard method for analyzing the asymptotic complexity of a program i...
01/05/2018

Verifying and Synthesizing Constant-Resource Implementations with Types

We propose a novel type system for verifying that programs correctly imp...
06/24/2019

Tight Polynomial Worst-Case Bounds for Loop Programs

In 2008, Ben-Amram, Jones and Kristiansen showed that for a simple progr...