Info
南京大学「软件分析」课程 Soundness and Soundiness 部分的学习笔记。
Soundness and Soundiness 前面提到 static program analysis 追求的 goal 是 soundness,但是无论是在学术界还是在工业界,由于一些语言的 hard language features 的存在,对现实世界的大型 program 想要实现完全的 soundness 是(目前)做不到的。
Hard-to-analyze features: an aggressively conservative treatment to these features will likely make the analysis too imprecise to scale, rendering the analysis useless.
于是,为了避免 papers 中写 soundness 会误导读者,所以引入了 soundy 的概念:a soundy analysis typically means that the analysis is mostly sound, with well-identified unsound treatments to hard/specific language features.…
Info
南京大学「软件分析」课程 CFL-Reachability and IFDS 部分的学习笔记。
Feasible and Realizable Paths infeasible paths 指的是在 CFG 并不会实际执行到的路径,例如 if 语句中某些不可能到达的分支。由于 infeasible paths 的判定与程序的 semantics 相关,所以总体上是 undecidable 的。
realizable paths 指的是 “returns” 与 “call” 相对应的路径,例子参考 slides。realizable paths 不一定是 executable 的 (feasible paths),但是 unrealizable paths 一定不是 executable 的 (infeasible paths)。
CFL-Reachability 使用 context sensitive 的技术可以去除 unrealizable paths,但是这里要介绍的技术是 CFL-Reachability。
CFG-reachability: A path is considered to connect two nodes A and B, or B is reachable from A, only if the concatenation of the labels on the edges of the path is a word in a specified context-free language.…
新年第一天,从「恋×シンアイ彼女」开始!
新年第一天,从 Program Analysis 开始!
Info
南京大学「软件分析」课程 Datalog-Based Program Analysis 部分的学习笔记。
Motivation imperative: how to do (~implementation) E.g. C. 需要告诉机器要如何去实现 declarative: what to do (~specification) E.g. SQL. 仅仅需要指明你想要什么,如何实现则交给程序(DBMS)自行选择 在 program analysis 中,我们指明对于不同的 statement 对应不同的 rule,这就是一种 specification,而在 algorithm 中,我们则指明了每一步具体要怎么做,在实际的代码实现里更是要考虑更多的 implementation details。可以看出,前面所学的 program analysis 即是 declarative 也是 imperative 的。
在 tai-e assignments 中,我们使用 imperative 的方式实现 program analysis,同样的,我们也可以通过 declarative 的方式来实现。(via Datalog)
Introduction to Datalog datalog 最早是以 database language 的身份出现的1,现在有了更广泛的应用。
Datalog = Data + Logic (and, or, not) no side-effects no control flows no functions not turing-complete Predicates (Data) 在 datalog 中,一个 predicate (relation) 就是值一系列的 statemetns,本质上其实是 a table of data。而 fact 则是指这个 table 中某个 tuple。…
Info
南京大学「软件分析」课程 Static Analysis for Security 部分的学习笔记。
security 指的是在存在 adversaries 的情况下能够成功达到一些 goals。
computer security 中非常重要的一个 topic 就是 information flow。
Information Flow Security information flow security 的目的就是阻止通过阻止 unwanted information flow 来保护 information security。
保护 sensitive data 的方式主要有 access control 和 information flow security 两种。
access control: a standard way 检查程序是否有权利 access 某些 information how information is accessed 不关心程序是如何使用这些 information 的 information flow security: end-to-end 跟踪 information flow how information is propagated "A practical system needs both access and flow control to satisfy all security requirements"…
Info
南京大学「软件分析」课程 Pointer Analysis 部分的学习笔记。
Introduction Motivation CHA 只关注 class hierarchy 存在很大的局限性,在形如 Number n = new One() 的声明后调用 n 的某个 method 会得到多个 call target,实际其中只有一个 target 是真的,同时运用 constant propagation 会得到 NAC 的结果,是 inefficient 且 imprecise 的。
而 pointer analysis 是基于 point-to relation 的,不会出现上述情况。
Introduction to Pointer Analysis pointer analysis 是一个 fundamental 的 analysis,对于 OOPL,它需要解决的问题是一个指针可能指向哪些 object,同样也是为了 safety,使用的是一种 may-analysis (over-approximation)。
alias analysis 解决的问题是两个指针是否指向的是同一个 object,可以从 pointer analysis 中推导得出。
"Pointer analysis is one of the most fundamental static program analyses, on which virtually all others are built.…