[关键词]
[摘要]
随着技术的不断发展,软件系统的非确定性(uncertainty)不断增强,数据竞争是并发系统这一类典型的非确定性软件系统中常见的缺陷.尽管数据竞争静态检测近年来取得了巨大进展,但其面临的重要问题仍然存在.先前的静态技术要么以分析精度为代价达到高扩展性,要么由于高精度分析而导致可扩展性问题.提出一种解决上述矛盾的分段分析方法——GUARD.它首先基于程序值流进行轻量级上下文敏感的数据访问分析,以识别出候选的数据竞争子路径而非完整的程序路径.接下来,进行可能并行执行(may-happen-in-parallel,即MHP)分析来确定程序中的两个数据访问操作是否可能会同时执行.MHP分析基于线程流图(TFG)将线程信息进行编码以便于高效地查询各个子路径之间的并发关系.最后,对于每条存在MHP数据访问的子路径,进行重量级路径敏感分析以确定数据竞争路径的可行性.针对12个开源项目的实验评估显示,GUARD能够在1 870s内完成对130万行代码的工业规模项目的检测,且平均误报率为16.0%.此外,GUARD的分析速度更快,比现有的前沿技术平均快了6.08倍,并且显著降低了误报率.除此之外,GUARD在其中还发现了12个数据竞争漏洞.将它们全部报告给了开发者,其中8个已得到了确认.
[Key word]
[Abstract]
With the development of techniques, the uncertainty in software systems is continuously increasing. Data race is a typical bug in current programs, which is a classic type of uncertainty programs. Despite significant progress in recent years, the important problem of practical static race detection remains open. Previous static techniques either suffer from a high false positive rate due to the compromise of precision, or scalability issues caused by a highly precise analysis. This paper presents GUARD, a staged approach to resolve this paradox. First, it performs a lightweight context-sensitive data access analysis, based on the value flow of a program, to identify the candidate data race subpaths instead of the whole program paths. Second, may-happen-in-parallel (MHP) analysis is employedto identify whether two data accesses in a program may execute concurrently. This stage is scalable, due to the design of the thread flow graph (TFG), which encodes thread information to query MHP relationship of the subpaths. Finally, for each subpath whose two data accesses are MHP, the heavyweight path-sensitive analysis is appliedto verify the feasibility of the data races. The evaluation demonstrates that GUARD can finish checking industrial-sized projects, up to 1.3MLoC, in 1 870s with an average false positive rate of 16.0%. Moreover, GUARD is faster than the state-of-the-art techniques with the average speedup 6.08X and significantly fewer false positives. Besides, GUARD has found 12 new race bugs in real-world programs. All of them are reportedtothe developers and 8 of them have been confirmed.
[中图分类号]
[基金项目]
国家自然科学基金(62032010)