基于LLVM的C/C++隐式类型转换安全性检测  被引量:1

C/C++ IMPLICIT TYPE CONVERSION SECURITY DETECTION BASED ON LLVM

在线阅读下载全文

作  者:万明 刘嘉华 鄂龙慧 朱江 Wan Ming;Liu Jiahua;E Longhui;Zhu Jiang(NARI Information&Communication Technology Co.,Ltd.,Nanjing 210003,Jiangsu,China)

机构地区:[1]南京南瑞信息通信科技有限公司,江苏南京210003

出  处:《计算机应用与软件》2022年第4期21-26,45,共7页Computer Applications and Software

基  金:国家电网公司科技项目“开源软件安全监测关键技术研究与应用”(科计[2018]20号项目240号)。

摘  要:带有系统底层特性的高级语言(C、C++等)通常采用的是弱类型系统,允许不同类型变量之间的混合运算。因此,在涉及到赋值等操作时,如果源变量和目的变量类型不一致,则需要进行类型转换,而转换过程稍有疏忽就会引入安全性问题。现有的检测技术大多在程序运行时进行类型转换问题的检测,产生较大额外开销的同时,也会影响程序的执行速度。基于LLVM编译器提出一种针对C/C++隐式类型转换的安全性检测方法。该方法作用于LLVM中间代码,筛选出含有变量声明和引用的语句;对于声明变量的语句,提取其类型信息并按相应的数据结构存储;对于引用变量的语句,匹配定义的类型转换的不安全操作集和转换模式,以检测其中的类型转换操作是否安全。实验结果表明,该方法能够在编译阶段有效地检测出存在安全隐患的类型转换操作。High-level languages with the underlying features of the system(C, C++, etc.) usually use a weakly typed system and allow mixed operations between different types of variables. Therefore, when an operation such as assignment is involved, if the source variable and the destination variable type are inconsistent, type conversion is required, and security problem will be introduced if the conversion process is slightly neglected. Most of the existing detection technologies detect the type conversion problem when the program is running, which causes a large additional overhead and also affects the execution speed of the program. This paper proposes a security detection method for C/C++ implicit type conversion based on LLVM compiler. It acted on the LLVM intermediate code to filter out statements containing variable declarations and references. For statements that declare variables, the type information was extracted and stored according to the corresponding data structure. For statements that use variables, the unsafe operation set and conversion mode were checked to detect whether the type conversion operation is safe. The experimental results show that the proposed method can effectively detect type conversion operations with security risks during the compilation phase.

关 键 词:类型转换 静态检测 安全性 LLVM 

分 类 号:TP305[自动化与计算机技术—计算机系统结构]

 

参考文献:

正在载入数据...

 

二级参考文献:

正在载入数据...

 

耦合文献:

正在载入数据...

 

引证文献:

正在载入数据...

 

二级引证文献:

正在载入数据...

 

同被引文献:

正在载入数据...

 

相关期刊文献:

正在载入数据...

相关的主题
相关的作者对象
相关的机构对象