第 40卷 第9期 计 算 机 科 学 Vo1.40No.9
2013年 9月 Computer Science Sep2013
一 个 C语言安全子集的可信编译器
王 蕾 石 刚 董 渊 白晓颖 王生原
(清华大学计算机科学与技术系 北京 100084)
摘 要 以安全关键领域的安全标准为依托、安全相关软件的语言编码和编译要求为指导,进行了以下几方面的研究
和探索:首先对形式化验证可信编译技术进行分析研究,特别着重当前广受关注的经过验证的CompCert编译器。然
后以我国安全领域C语言安全子集标准 《航天型号软件C语言安全子集》为依据构造测试用例、创新测试方法,并以
此对CompCert编译器进行测试评估。之后依据测试结果,为CompCert编译器增加未支持的C语言标准特性,裁剪
不符合C语言安全子集要求的特性,构建符合C语言安全子集标准的可信编译器。最后的实测结果表明,所 实现的
编译器符合 C语言安全子集标准的要求,且没有降低C代码的执行效率。
关键词 可信计算,CompCert,C安全子集,经过验证的编译器
中图法分类号 TP314 文献标识码 A
TrustedCompilerforSafeSubsetofC Language
W ANG Lei SHIGang DONG Yuan BAIXiao-ying W AN G Shengyuan
(DepartmentofComputerScienceandTechnology,TsinghuaUniversity,Beijing100084,China)
Abstract Usingthesafetystandardsofsafety-criticalareasasthebasis,safety-relatedsoftwarecodingandcompiling
requirementsastheguideline,thispaperintroducedthefollowingaspectsofresearchnadexploration:firstanalysedthe
formalverificationtechniquefortrustedcompiler,especiallyemphasizedtheCompCertverifiedcompilerwhichiswidely
concerned,thenconstructedtestcasesaccordingtosafesubsetofC languageforspacearmamentsoftwaretotestand
assesstheCompCertcompilerwiththenewmethod.Basedonthetestresults,theprojectaddedunsupportedfeaturesof
C languagetoCompCertandcutsoff thefeatureswhichdonotmeetthesafesubsetofClanguagerequirements,builta
verifiedcompilerforthesafesubsetofC languageatlast.Theexperimentalresultsshow thatthecompilerweimple—
mentedcomplieswithsafesubsetofC language,butitdonotincreasetheexecutiontimeofCcode.
Keywords Trustworthycomputing,CompCert,SafesubsetofC 1anguage,Verifiedcompilers
1 引言 2 高可信编译问题
编译可信一直是核工业、航空航天等关键领域关注的焦 安全可靠在核工业 、航空航天等领域的