论文标题
带有同时潜力和反电位的差异成本分析
Differential Cost Analysis with Simultaneous Potentials and Anti-potentials
论文作者
论文摘要
我们提出了一种新颖的差异成本分析方法,鉴于程序修订,试图在两个程序版本之间静态地限制资源使用或成本的差异。差异成本分析特别有趣,因为它具有许多引人注目的应用程序,例如在代码评估时间检测资源使用回归或证明没有某些侧向通道漏洞。一种先前的差异成本分析方法是应用关系推理,从概念上构建了一个产品计划,在该计划上可以过度陈列于两个程序版本之间的成本差异。但是,在任何关系方法中,一个重大的挑战是有效地使程序版本保持一致,以获得精确的结果。在本文中,我们的关键见解是,如果我们绑定了两个成本结合的摘要的差异,而不是直接限制具体的成本差异,那么我们可以避免程序对齐的需求和局限性。特别是,我们的方法使用两种成本结合的摘要同时计算两个程序版本之间成本的最大成本差异的阈值值 - 该函数评估了第一个程序中产生的成本的上限,并评估了第二次触发成本的较低限制。我们的方法具有许多理想的属性:它可以完全自动化,它允许优化相对成本的阈值,它适用于句法上不相似的程序,并且支持非确定性。我们已经根据文献收集的许多程序对评估了我们的方法的实现,并且我们发现我们的方法在大多数示例中都计算相对成本的阈值较小。
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.