当我们需要真正定义自己的checker,而不是简单地去测试能不能注册成功一个检查器时,我们需要清楚的知道,我们的checker到底要划分在Checkers.td中哪一个package下。下面我们用表格的形式整理罗列一下clang -cc1 -analyzer-checker-help命令后显示的内容。

OVERVIEW: Clang Static Analyzer Checkers List

Layer1

Layer2

Final layer ----class

说明

Alpha

34个

有较高误报率的checker

False positive rate

,因此属于实验阶段,experiment

Core

9个

alpha.core.BoolAssignment (ObjC)

alpha.core.CastSize (C)

alpha.core.CastToStruct (C, C++)

alpha.core.FixedAddr (C)

alpha.core.IdenticalExpr (C, C++)

alpha.core.IdenticalExpr (C, C++)

alpha.core.PointerArithm (C)

alpha.core.PointerSub (C)

alpha.core.SizeofPtr (C)

C++

2个

alpha.cplusplus.NewDeleteLeaks (C++)

alpha.cplusplus.VirtualCall (C++)

Variable Argument

3个

alpha.valist.CopyToSelf (C)

alpha.valist.Uninitialized (C)

alpha.valist.Unterminated (C)

Dead code

alpha.deadcode.UnreachableCode(C, C++, ObjC)

OS X

5个

alpha.osx.cocoa.Dealloc (ObjC)

alpha.osx.cocoa.DirectIvarAssignment (ObjC)

alpha.osx.cocoa.DirectIvarAssignmentForAnnotatedFunctions (ObjC)

alpha.osx.cocoa.InstanceVariableInvalidation (ObjC)

alpha.osx.cocoa.MissingInvalidationMethod (ObjC)

Security

5个

alpha.security.ArrayBound (C)

alpha.security.ArrayBoundV2 (C)

alpha.security.MallocOverflow (C)

alpha.security.ReturnPtrRange (C)

alpha.security.taint.TaintPropagation (C)

Unix

9个

alpha.unix.Chroot (C)

alpha.unix.MallocWithAnnotations (C)

alpha.unix.PthreadLock (C)

alpha.unix.SimpleStream (C)

alpha.unix.Stream (C)

alpha.unix.cstring.BufferOverlap (C)

alpha.unix.cstring.NotNullTerminated (C)

alpha.unix.cstring.OutOfBounds (C)

alpha.unix.cstring.BlockInCriticalSection (C)

Default

47

默认状态下是可以被利用的检查器

Core

12

core.CallAndMessage (C, C++, ObjC)

core.DivideZero (C, C++, ObjC)

core.NonNullParamChecker (C, C++, ObjC)

core.NullDereference (C, C++, ObjC)

core.StackAddressEscape (C)

core.UndefinedBinaryOperatorResult (C)

core.VLASize (C)

core.uninitialized.ArraySubscript (C)

core.uninitialized.Assign (C)

core.uninitialized.Branch (C)

core.uninitialized.CapturedBlockVariable (C)

core.uninitialized.UndefReturn (C)

C++

cplusplus.NewDelete (C++)

deadcode

deadcode.DeadStores (C)

OS X

18

osx.API (C)

osx.SecKeychainAPI (C)

osx.cocoa.AtSync (ObjC)

osx.cocoa.ClassRelease (ObjC)

osx.cocoa.IncompatibleMethodTypes (ObjC)

alpha.osx.cocoa.MissingSuperCall (ObjC)

osx.cocoa.NSAutoreleasePool (ObjC)

osx.cocoa.NSError (ObjC)

osx.cocoa.NilArg (ObjC)

osx.cocoa.RetainCount (ObjC)

osx.cocoa.SelfInit (ObjC)

osx.cocoa.UnusedIvars (ObjC)

osx.cocoa.VariadicMethodTypes (ObjC)

osx.coreFoundation.CFError (C)

osx.coreFoundation.CFNumber (C)

osx.coreFoundation.CFRetainRelease (C)

osx.coreFoundation.containers.OutOfBounds (C)

osx.coreFoundation.containers.PointerSizedValues (C)

Security

9

security.FloatLoopCounter (C)

security.insecureAPI.UncheckedReturn (C)

security.insecureAPI.getpw (C)

security.insecureAPI.gets (C)

security.insecureAPI.mkstemp (C)

security.insecureAPI.mktemp (C)

security.insecureAPI.rand (C)

security.insecureAPI.strcpy (C)

security.insecureAPI.vfork (C)

Unix

6

unix.API (C)

unix.Malloc (C)

unix.MallocSizeof (C)

unix.MismatchedDeallocator (C, C++, ObjC)

unix.cstring.BadSizeArg (C)

unix.cstring.NullArg (C)

Implicit

隐性检查器不产生警告,只是用来支持分析其内核和模型接口的。

Core

core.DynamicTypePropagation (C++, ObjC)

core.builtin.BuiltinFunctions (C)

core.builtin.NoReturnFunctions (C, ObjC)

OS X

osx.cocoa.Loops (ObjC)

osx.cocoa.NonNilReturnValue (ObjC)

Debug

http://clang-analyzer.llvm.org/checker_dev_manual.html#commands

--

debug.ViewCFG        View Control-Flow Graphs using GraphViz

--

debug.DumpCFG       Display Control-Flow Graphs

--

debug.ViewCallGraph    View Call Graph using GraphViz

--

debug.DumpCallGraph   Display Call Graph

--

debug.ViewExplodedGraph  View Exploded Graphs using GraphViz

--

debug.Stats            Emit warnings with analyzer statistics

--

debug.AnalysisOrder   Print callbacks that are called during analysis in order

--

debug.ConfigDumper              Dump config table

--

debug.DumpBugHash     Dump the bug hash for all statements

--

debug.DumpCalls   Print calls as they are traversed by the engine

--

debug.DumpDominators :Print the dominance tree for a given CFG

--

debug.DumpLiveVars      Print results of live variable analysis

--

debug.DumpTraversal   Print branch conditions as they are traversed by the engine

--

debug.TaintTest                 Mark tainted symbols as such

--

debug.ExprInspection    Check the analyzer's understanding of expressions

LLVM

llvm.Conventions    Check code for LLVM codebase conventions

其他

apiModeling.google.GTest        Model gtest assertion APIs

Optin

共5个类

nullability

共5个类

对照上面所有checker的简单描述,我们可以大致知道这些类所实现的功能,与内存相关的类都用黄色进行了标注。如果我们要写自己的检查器,应该放在Alpha下面的security package中。此外,在debug过程中我们常用的查看CFG和ExplodedGraph的checker类,用蓝色标注。

但是现在的问题是,我们并不知道clang对于内存检测实现到了哪个地步,所以接下来我们需要用CWE部分内存相关的测试集和几个开源软件来测试一下clang的功能和效果,直白地讲,就是看看clang覆盖了哪些缺陷检测,对特定缺陷检测的误报和漏报情况怎么样。

参考文献

http://clang-analyzer.llvm.org/alpha_checks.html

http://clang-analyzer.llvm.org/available_checks.html

http://clang-analyzer.llvm.org/implicit_checks.html

转载于:https://www.cnblogs.com/wangyuxia/p/6612065.html

Clang checker类总结相关推荐

  1. LLVM Clang前端编译与调试

    LLVM Clang前端编译与调试 iOS 关于编译 o 一.Objective-C 编译过程 o 为什么需要重新编译? o 编译步骤 o 二.编译步骤的详细说明 o 1.预处理 o 2.编译 o 词 ...

  2. 编译器 LLVM Clang原理与实战 制作自己的编译器 source-to-source 源代码转换 编译遍 compile pass 代码插桩

    编译器 LLVM Clang原理与实战 参考1 clang LLVM CMU 教案 深入剖析-iOS-编译-Clang-LLVM LLVM_proj LLVM编程索引 llvm源码浏览带跳转 llvm ...

  3. 彻底搞懂Python类属性和方法的调用

    Python从设计之初就已经是一门面向对象的语言,正因为如此,在Python中创建一个类和对象是很容易的. 一.类.对象概述 在面向对象程序设计中,把数据以及对数据的操作封装在一起,组成一个整体(对象 ...

  4. go语言任意代码执行漏洞 cve-2018-6574

    前不久,Go官方修复了CVE-2018-6574这个漏洞,这个漏洞又是涉及软件编译环节,和2015年Xcode被污染类似,攻击者可以通过在软件编译环节插入恶意数据从而执行任意代码,虽然原理并不复杂,但 ...

  5. ASP.NET Core 项目简单实现身份验证及鉴权

    环境 VS 2017 ASP.NET Core 2.2 目标 以相对简单优雅的方式实现用户身份验证和鉴权,解决以下两个问题: 无状态的身份验证服务,使用请求头附加访问令牌,几乎适用于手机.网页.桌面应 ...

  6. Python基础之函数,面向对象

    文章目录 1 函数 1.1 定义一个函数 1.2 函数调用 1.3 参数 1.3.1 必需参数 1.3.2 关键字参数 1.3.3 默认参数 1.3.4 不定长参数 1.3.4.1 不定长 *:元组 ...

  7. 基于LLVM的编译原理简明教程: 写一个自己的编译器​

    LLVM简介 进入21世纪,新的编程语言如雨后春笋一样不停地冒出来.需求当然是重要的驱动力量,但是在其中起了重要作用的就是工具链的改善. 2000年,UIUC的Chris Lattner主持开发了一套 ...

  8. [译]Cilium:BPF和XDP参考指南,一同认识eBPF【概念篇】

    当你真正认识一门科学时,你才会感受到它的魅力. eBPF技术已经不再小众.从Linux3.18的初次亮相,现在的生态算得上是"内核关联技术"里的翘楚.其中代表性的有BCC.libb ...

  9. 自己搜集编写的Delphi 通用函数

    { ********************************************************************** } { Currency Common Functio ...

  10. Clang Static Analyzer 系列(一)编译 Clang 及运行 Checker

    编译 Clang CSA (Clang Static Analyzer) 是 clang 的一部分.建议使用自行编译的 clang ,源码在 llvm/llvm-project (github.com ...

最新文章

  1. Vue 爬坑之路(六)—— 使用 Vuex + axios 发送请求
  2. 【实战经验分享】一劳永逸的解决网线随意热插拔问题
  3. python元组的概念_python元组的概念知识点
  4. C语言将两个数字相加,然后将和作为链接列表返回(附完整源码)
  5. ndows live id怎么登陆,手机如何注册和使用Windows Live ID帐号
  6. EasyUI----增删改查
  7. c语言整数转浮点数_浮点数的秘密
  8. http 传输原理及格式
  9. python生成泊松分布随机数_python-介绍泊松分布(poisson分布)
  10. 二硫化锡/纳米碳/MXene/PANI复合材料研究进展
  11. npm install很慢(奇葩)解决方法
  12. uniapp(H5) + signalr 制作的简单的卡牌游戏
  13. 康奈尔大学的计算机专业怎么样,美国名校康奈尔大学计算机专业介绍
  14. 6.计算机系统能力创新实践,计算机考核要重实践能力、培养创新精神
  15. redis缓存(redis缓存工具封装篇)
  16. 个人精心整理的前端学习开发实用的网站
  17. 解决线程安全问题的两种办法
  18. Androud7.0之IPC机制(多进程、及其通信)
  19. UIView 的部分圆角的设定
  20. Win7/Win8下双击运行jar程序的方法

热门文章

  1. 显卡测试软件 温度,显卡温度检测软件
  2. SHFileOperation 用法
  3. 计算机网络——常用的网络命令
  4. 变色龙引导安装黑苹果 遇到的问题的解决办法
  5. adobe flash java_Adobe 发布最后的 Flash 更新:官方强烈建议立即卸载
  6. 电商seo培训之卖家搜索优化步骤
  7. 再起风云的社交电商,到底是穷途末路还是柳暗花明?
  8. 入门单反相机最最基础知识新人详解
  9. 手把手教你清除WIN7的C盘垃圾
  10. mtk android 源代码下载,MTK手机开发之路--MTK源代码下载