Checking type safety of foreign function calls

Author:

Furr Michael1,Foster Jeffrey S.1

Affiliation:

1. University of Maryland, College Park, MD

Abstract

We present a multi-lingual type inference system for checking type safety across a foreign function interface. The goal of our system is to prevent foreign function calls from introducing type and memory safety violations into an otherwise safe language. Our system targets OCaml's FFI to C, which is relatively lightweight and illustrates some interesting challenges in multi-lingual type inference. The type language in our system embeds OCaml types in C types and vice-versa, which allows us to track type information accurately even through the foreign language, where the original types are lost. Our system uses representational types that can model multiple OCaml types, because C programs can observe that many OCaml types have the same physical representation. Furthermore, because C has a low-level view of OCaml data, our inference system includes a dataflow analysis to track memory offsets and tag information. Finally, our type system includes garbage collection information to ensure that pointers from the FFI to the OCaml heap are tracked properly. We have implemented our inference system and applied it to a small set of benchmarks. Our results show that programmers do misuse these interfaces, and our implementation has found several bugs and questionable coding practices in our benchmarks.

Publisher

Association for Computing Machinery (ACM)

Subject

Computer Graphics and Computer-Aided Design,Software

Reference20 articles.

1. ANSI. Programming languages -- C 1999. ISO/IEC 9899:1999.]] ANSI. Programming languages -- C 1999. ISO/IEC 9899:1999.]]

2. D. M. Beazley. SWIG: An easy to use tool for integrating scripting languages with C and C++ .]] D. M. Beazley. SWIG: An easy to use tool for integrating scripting languages with C and C++ .]]

3. M. Blume. No-Longer-Foreign: Teaching an ML compiler to speak C "natively". In Benton and Kennedy babel01. http://www.elsevier.nl/locate/entcs/volume59.html.]] M. Blume. No-Longer-Foreign: Teaching an ML compiler to speak C "natively". In Benton and Kennedy babel01. http://www.elsevier.nl/locate/entcs/volume59.html.]]

4. Physical type checking for C

Cited by 28 articles. 订阅此论文施引文献 订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献

1. Cross-Language Taint Analysis: Generating Caller-Sensitive Native Code Specification for Java;IEEE Transactions on Software Engineering;2024-06

2. Melocoton: A Program Logic for Verified Interoperability Between OCaml and C;Proceedings of the ACM on Programming Languages;2023-10-16

3. Semantic Encapsulation using Linking Types;Proceedings of the 8th ACM SIGPLAN International Workshop on Type-Driven Development;2023-08-30

4. On multi-language abstraction: Towards a static analysis of multi-language programs;Formal Methods in System Design;2023-03-28

5. Cross-Language Call Graph Construction Supporting Different Host Languages;2023 IEEE International Conference on Software Analysis, Evolution and Reengineering (SANER);2023-03

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.5亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2024 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3