Proj THUDBFuzz Paper Reading: 南京大学软件分析课程2020, 07 Interprocedural Analysis

Motivation

目的:处理method calls
方法:沿着interprocedural control-flow edges将数据流信息传播过去(一般是call/return edges)

Call graph construction

Call graph construction in Java

  • Class hierarchy analysis(CHA)
  • Rapid type analysis(RTA)
  • Variable type analysis(VTA)
  • Pointer analysis(k-CFA)
    这些方法的精度依次上升,效率当然随之下降。
    java的函数调用有4种: invokestatic, invokepspecial, invokeinterface和invokevirtual。接口和虚函数都牵扯到无法确定具体调用的是哪个方法这一问题。

Class hierarchy analysis(CHA)

处理invokevirtual:virtual call调用哪个方法与当前变量的类别(the type of the receiver object)和invokevirtual后面跟的函数签名(method signature at the call site)有关。

  • Signature = class type+ method name + descriptor
  • Descriptor= return type+ parameter types

根据superclass的关系,从子类一路向父类找,直到找到name和descriptor相同的方法,此时就认为调用了该方法。

IDEA中有内嵌CHA算法。

Interprocedural Control Flow Graph


Interprocedural Data-flow Analysis

需要注意作用域的问题,有些变量不再可访问。

posted @ 2021-01-24 17:43  雪溯  阅读(128)  评论(0编辑  收藏  举报