软件动态更新中对象转换函数的自动测试
TOAST: Automated Testing of Object Transformers in Dynamic Software Updates
-
摘要: 1、研究背景
软件动态更新可以在软件运行时对其状态进行更新,从而无需重新启动。其中一项关键任务,就是对象状态转换,也就是将旧版本软件已创建的对象转换为语义一致的新版本对象。该任务是通过调用相应的对象转换函数来完成的。一个对象转换函数如果不能保证转换后对象符合应用逻辑和新版本程序的期待,就会导致运行错误甚至崩溃。因此开发者需要确保对象转换函数不会导致“状态不一致”或“行为不一致”的问题。但这对开发者来说是繁琐易错的任务,因而需要自动化工具的有力支持。
2、目的(Objective)
本文研究重点,是通过自动模糊测试方法,检测对象转换函数是否会导致软件动态更新中的状态不一致和行为不一致错误。其中状态不一致是指,转换后的对象的状态与预期的新版本对象状态不一致,而行为不一致是指旧、新版本方法运行的返回值或抛出的异常不一致。这两种不一致问题,都可能导致软件不能正确地动态更新。
3、方法(Method)
我们的方法,TOAST,通过随机生成大量的输入来驱动新旧版本软件的运行,然后动态更新旧版本软件,最后对比更新后的对象状态与新版本对象状态,判断是否存在状态不一致问题。同时,TOAST也会对比方法返回值和抛出的异常是否一致,判断是否存在行为不一致问题。此外,我们设计的状态不一致引导策略,可以使TOAST更快的探索输入空间,检测出更多导致不一致的输入。
4、结果(Result & Findings)
我们在两个开源服务器程序的共130个更新上进行实验,验证TOAST能否检测出默认转换函数是否存在不一致问题。在状态不一致检测上,TOAST的准确率是96.0%,召回率是85.7%;在行为不一致检测上,TOAST的准确率是81.4%,召回率是94.6%。而我们的状态不一致引导策略,可以提升状态不一致检测的效率14.1%,提升行为不一致检测的效率40.5%。
5、结论(Conclusions)
当代软件系统亟需软件动态更新技术,但该技术具有很高的挑战性。软件动态更新的质量保障是一个关键但并未得到深入探索的研究问题。本文提出的TOAST方法,可以检测Java软件动态更新是否存在状态或行为的不一致问题。我们的实验评估表明,对于广泛应用的实际服务器系统的真实更新,TOAST可以有效检测出两种不一致问题,提示这种技术具有潜在的应用价值。Abstract: Dynamic software update (DSU) patches programs on the fly.It often involves the critical task of object transformation thatconverts live objects of the old-version program totheir semantically consistent counterparts under the new-version program.This task is accomplished by invoking an object transformer on each stale object.However, a defective transformer failing to maintain consistency would cause errors or even crash the program.We propose TOAST (Test Object trAnSformaTion), an automated approach to detecting potential inconsistency caused by object transformers.TOAST first analyzes an update to identify multiple target methodsand then adopts a fuzzer with specially designed inconsistency guidance to randomly generate object states to drive two versions of a target method.This creates two corresponding execution traces and a pair of old and new objects.TOAST finally performs object transformation to create a transformed objectand detects inconsistency between it and the corresponding new object produced from scratch by the new program.Moreover, TOAST checks behavior inconsistency by comparing the return variables and exceptions of the two executions.Experimental evaluation on 130 updates with default transformers shows that TOAST is promising: it got 96.0% precision and 85.7% recall in state inconsistency detection, and 81.4% precision and 94.6% recall inbehavior inconsistency detection.The inconsistency guidance improved the fuzzing efficiency by 14.1% for state inconsistency detection and 40.5% for behavior inconsistency detection.