さくtwosmi1e

南大《软件分析》课程笔记——第一课

twosmi1e·2021-01-01 15:31·550 次阅读

南大《软件分析》课程笔记——第一课

前言#

课程网站:https://pascal-group.bitbucket.io/teaching.html
课程视频在B站有

感谢两位老师分享

概述#

课程介绍

Static Program Analysis#

PL(Programming Languages)

三类编程语言

  • 命令式
  • 函数式
  • 逻辑式

  • 程序可靠性
  • 程序安全性
  • 编译优化
  • 程序理解

PL(Program Language)

  • 理论:语言设计,类型系统,语义和逻辑
  • 环境:编译器,运行系统
  • 应用:程序分析,程序验证,程序合成
  • 技术:抽象解释(Abstract interpretation),数据流分析(Data-flow analysis, ),Hoare logic,Model checking,Symbolic execution等等

Static Analysis#

什么是静态分析?在程序运行前就进行分析以推断其行为并确定在运行之前是否满足某些属性。

Rice's Theorem#

“Any non-trivial property of the behavior of programs in a r.e. language is undecidable.”

r.e. (recursively enumerable) = recognizable by a Turing-machine

A property is trivial if either it is not satisfied by any r.e. language, or if it is satisfied by all r.e. languages; otherwise it is non-trivial.

non-trivial properties
~= interesting properties
~= the properties related with run-time behaviors of programs

不存在满足Sound&Complete的静态分析程序,理解翻译为全面性和完整性吧

即分别对应漏报率(false negatives)误报率(false positives),不存在完美的静态分析程序使漏报率与误报率为0。

  • Compromise soundness (false negatives) 妥协全面性,对程序进行了under-approximate欠拟合,不会误报但是有漏报
  • Compromise completeness (false positives) 妥协完整性,对程序进行了over-approximate过拟合,不会漏报但又误报

Mostly compromising completeness: Sound but not fully-precise static analysis
大部分静态分析程序要求做到sound即覆盖全面,优先追求漏报率低,再降低误报率。

Necessity of Soundness#

Static Analysis: ensure (or get close to) soundness, while making good trade-offs between analysis precision and analysis speed.
在精度和速度之间做平衡

Static Analysis = Abstraction + Over-approximation#

Abstraction#

抽象化,将具体值变为抽象值

Over-approximation#

Trsansfer Functions
在静态分析中,传递函数定义了如何评估关于抽象值的不同程序语句。

Over-approximation(翻成过于近似?)的静态分析会产生误报

Control Flows:

posted @   twosmi1e  阅读(550)  评论(1编辑  收藏  举报
编辑推荐:
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
点击右上角即可分享
微信分享提示
目录