一句话:提出动态捷径,在 JavaScript 静态分析中可靠切换抽象与具体执行,用 JS 引擎加速并提升精度。
JavaScript 的函数式与动态特性会降低静态分析的性能和精度,且内置函数与宿主环境需要大量手工建模。已有结合动态分析的方法未能充分利用高性能 JS 引擎,并常牺牲可靠性。本文提出动态捷径(dynamic shortcuts),在 JavaScript 静态分析中可靠地在抽象执行与具体执行之间切换,借助高度优化的商业 JavaScript 引擎提升分析性能与精度,并减少对不透明代码的建模工作。作者将 SAFE 静态分析器与 Jalangi 动态分析器组合成 SAFEDS。在 Lodash 4 的 269 个官方测试上评估,SAFEDS 比基线静态分析器快 7.81 倍,并对 22 个不透明函数平均将失败断言减少 12.31%,说明精度得到提升。
JavaScript has become one of the most widely used programming languages for web development, server-side programming, and even micro-controllers for IoT. However, its extremely functional and dynamic features degrade the performance and precision of static analysis. Moreover, the variety of built-in functions and host environments requires excessive manual modeling of their behaviors. To alleviate these problems, researchers have proposed various ways to leverage dynamic analysis during JavaScript static analysis. However, they do not fully utilize the high performance of dynamic analysis and often sacrifice the soundness of static analysis. In this paper, we present dynamic shortcuts, a new technique to flexibly switch between abstract and concrete execution during JavaScript static analysis in a sound way. It can significantly improve the analysis performance and precision by using highly-optimized commercial JavaScript engines and lessen the modeling efforts for opaque code. We actualize the technique via SAFEDS, an extended combination of SAFE and Jalangi, a static analyzer and a dynamic analyzer, respectively. We evaluated SAFEDS using 269 official tests of Lodash 4 library. Our experiment shows that SAFEDS is 7.81x faster than the baseline static analyzer, and it improves the precision to reduce failed assertions by 12.31% on average for 22 opaque functions.