检索规则说明:AND代表“并且”;OR代表“或者”;NOT代表“不包含”;(注意必须大写,运算符两边需空一格)
检 索 范 例 :范例一: (K=图书馆学 OR K=情报学) AND A=范并思 范例二:J=计算机应用与软件 AND (U=C++ OR U=Basic) NOT M=Visual
作 者:舒燕君[1] 郑翔宇 徐成华 黄沛 王永琪 周凡 张展[1] 左德承[1] Shu Yanjun;Zheng Xiangyu;Xu Chenghua;Huang Pei;Wang Yongqi;Zhou Fan;Zhang Zhan;Zuo Decheng(Faculty of Computing,Harbin Institute of Technology,Harbin 150001;Loongson Technology Corporation Limited,Beijing 100095;School of Computer Science and Technology,University of Science and Technology of China,Hefei 230026)
机构地区:[1]哈尔滨工业大学计算学部,哈尔滨150001 [2]龙芯中科技术股份有限公司,北京100095 [3]中国科学技术大学计算机科学与技术学院,合肥230026
出 处:《计算机研究与发展》2025年第5期1136-1150,共15页Journal of Computer Research and Development
基 金:国家自然科学基金项目(61202091,62171155)。
摘 要:为了减少内存安全检查的开销,LoongArch指令集架构引入了边界检查访存类指令.然而,作为一种新的内存访问指令,目前GCC(GNU compiler collection)编译器不支持该类指令,LoongArch硬件能力不能得到充分利用.针对此LoongArch边界检查访存指令改进了GCC编译器,实现利用该类指令优化程序的内存安全检查.具体而言,完成了3个方面的工作:1)设计实现了针对边界检查访存指令的内建函数;2)改进GCC RTL(register transfer language)阶段的优化器,使其能够识别无异常处理和带异常处理2种情况的边界检查访存语义,并自动优化;3)面向LoongArch边界检查访存指令触发的边界检查异常(bound check exception,BCE),设计了新的Linux内核异常信号SIGBCE和相应的运行时库glibc(GNU C library)的信号处理函数,实现了BCE处理.通过在GCC 12.2.0和龙芯3C5000L服务器进行实验,验证了改进后的编译器不仅能正确使用新引入的边界检查访存指令,而且在某些安全函数中带来接近20%的性能提升.完善了LoongArch生态,推进了LoongArch指令集发展,对此类特定指令编译器优化工作有一定的借鉴意义.LoongArch ISA(instruction set architecture)introduces new memory accessing instructions with boundchecking to decrease the overhead of memory security check.However,as a new type of memory accessing instruction,the existing GCC(GNU compiler collection)compiler tools cannot support it and thus LoongArch based hardware remains underutilized.Therefore,in this paper,we revise the GCC compiler with the LoongArch memory accessing instructions to optimize the memory security check.Specifically,our work is divided into three parts:1)designing built-in functions for the memory accessing instructions;2)improving the RTL(register transfer language)optimizer of GCC to recognize two kinds of semantic patterns of memory accessing instructions with boundchecking,which are non-exception handling and exception handling;3)implementing a new exception signal SIGBCE for the bound check exception BCE that is raised by CPU in Linux kernel,and implementing the corresponding signal handling function in glibc(GNU C library)to deal with the bound check exception.The experiments on GCC 12.2.0 and Loongson 3C5000L server show that the revised compiler is able to correctly employ the new memory accessing instructions and bring an acceleration of approximately 20%in some security routines.Our work improves the ecosystem of LoongArch and boosts the development of LoongArch ISA.It will also be referential to GCC optimization for the specialized instructions.
关 键 词:编译器优化 LoongArch GCC 边界检查访存 龙芯CPU 异常处理 内存安全
分 类 号:TP391[自动化与计算机技术—计算机应用技术]
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在链接到云南高校图书馆文献保障联盟下载...
云南高校图书馆联盟文献共享服务平台 版权所有©
您的IP:216.73.216.49