Skip to main content
QUICK REVIEW

[论文解读] MCPA: Program Analysis as Machine Learning

Marcel Böhme|arXiv (Cornell University)|Nov 12, 2019
Software Reliability and Analysis Research被引用 2
一句话总结

本文提出了蒙特卡洛程序分析(MCPA),这是一种新颖的方法,将程序分析建模为概率近似正确(PAC)学习问题,通过统计采样实现。通过将程序执行视为蒙特卡洛试验,MCPA 在用户定义的误差界限(ϵ)和置信水平(δ)下提供分析准确性的概率保证,从而以有原则的方式实现大规模软件系统中可扩展、有界误差的分析,且不牺牲精度。

ABSTRACT

Static program analysis today takes an analytical approach which is quite suitable for a well-scoped system. Data- and control-flow is taken into account. Special cases such as pointers, procedures, and undefined behavior must be handled. A program is analyzed precisely on the statement level. However, the analytical approach is ill-equiped to handle implementations of complex, large-scale, heterogeneous software systems we see in the real world. Existing static analysis techniques that scale, trade correctness (i.e., soundness or completeness) for scalability and build on strong assumptions (e.g., language-specificity). Scalable static analysis are well-known to report errors that do *not* exist (false positives) or fail to report errors that *do* exist (false negatives). Then, how do we know the degree to which the analysis outcome is correct? In this paper, we propose an approach to scale-oblivious greybox program analysis with bounded error which applies efficient approximation schemes (FPRAS) from the foundations of machine learning: PAC learnability. Given two parameters $\delta$ and $\epsilon$, with probability at least $(1-\delta)$, our Monte Carlo Program Analysis (MCPA) approach produces an outcome that has an average error at most $\epsilon$. The parameters $\delta>0$ and $\epsilon>0$ can be chosen arbitrarily close to zero (0) such that the program analysis outcome is said to be probably-approximately correct (PAC). We demonstrate the pertinent concepts of MCPA using three applications: $(\epsilon,\delta)$-approximate quantitative analysis, $(\epsilon,\delta)$-approximate software verification, and $(\epsilon,\delta)$-approximate patch verification.

研究动机与目标

  • 解决大规模、复杂软件系统中静态程序分析的可扩展性-精度权衡问题。
  • 提供一个正式且可量化的框架,用于衡量程序分析结果的正确性,超越传统的正确性或完备性概念。
  • 实现可扩展的程序分析,其本身对真实世界复杂性(如第三方库、未定义行为以及反射等动态特性)具有内在鲁棒性。
  • 为现有可扩展工具提供一种有原则的替代方案,这些工具在未量化权衡的情况下牺牲了正确性或完备性。
  • 通过严格的统计保证,证明 MCPA 在定量分析、软件验证和补丁验证中的适用性。

提出的方法

  • MCPA 将程序分析建模为 PAC 学习问题,其中假设是分析结果,蒙特卡洛试验是不同的程序执行。
  • 该方法使用 FPRAS(全多项式随机近似算法)以高概率和有界误差估计程序属性。
  • 分析结果在概率至少为 (1−δ) 的前提下,与真实值的偏差不超过 ϵ,其中 ϵ>0 和 δ>0 由用户定义。
  • 蒙特卡洛试验来自真实用户执行,使分析具有分布基础且可扩展。
  • 该框架支持二值属性(例如是否存在错误)和定量属性(例如内存使用量、能耗)。
  • 应用统计假设检验来验证补丁并比较软件版本,具有 (ϵ,δ) 保证,在模拟中优于标准的 A/B 测试方法。

实验结果

研究问题

  • RQ1程序分析能否被形式化为 PAC 学习问题,以提供正确性的有界概率保证?
  • RQ2如何在不依赖正确性或完备性的情况下,量化程序分析中可扩展性与准确性的权衡?
  • RQ3对真实用户执行进行蒙特卡洛采样,能否替代或增强大规模系统中的传统静态分析?
  • RQ4在补丁验证中,MCPA 与标准统计测试方法(如 Fisher 精确检验和 Mann-Whitney U 检验)相比表现如何?
  • RQ5MCPA 能否基于相同的理论基础,应用于二值和定量程序属性?

主要发现

  • MCPA 提供 (1−δ) 的概率保证,即分析结果的平均误差最多为 ϵ,从而实现概率近似正确(PAC)的程序分析。
  • 在模拟中,(ϵ,δ)-近似补丁验证在检测软件行为的显著差异方面优于 Fisher 精确检验和 Mann-Whitney U 检验。
  • 即使执行样本有限,该方法仍能实现高精度,例如在日均执行量超过 1000 亿次的系统中,误差界限低至 ϵ=3.6×10−11。
  • 对于 OSS-Fuzz、Netflix 和 YouTube 等系统,该方法提供的置信区间(99%-CIs)误差界限低于 10−10,表明其具有高度可靠性。
  • 该方法具有规模无关性且具有分布基础,依赖真实用户工作负载,而非合成或理想化输入。
  • 该框架可推广至多种应用:(ϵ,δ)-近似定量分析、软件验证和补丁验证,均基于统一的统计基础。

更好的研究,从现在开始

从论文设计到论文写作,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。