arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2510.20688cs.PLcs.CR
收藏

SafeFFI:在Rust和混合语言应用程序的安全与不安全代码边界处进行高效消毒

SafeFFI: Efficient Sanitization at the Boundary Between Safe and Unsafe Code in Rust and Mixed-Language Applications

LMU Munich(慕尼黑大学);Fraunhofer AISEC(弗劳恩霍夫AISEC研究所)

Oliver Braunsdorf, Tim Lange, Konrad Hohentanner, Julian Horsch, Johannes Kinder

AI总结:

SafeFFI通过在Rust安全与不安全代码边界处优化插桩,将内存安全执行交由类型系统,减少98%消毒检查,编译开销仅2.64倍,优于现有方法。

摘要:

不安全的Rust代码对于与C/C++库的互操作以及实现底层数据结构是必要的,但它可能在原本内存安全的Rust程序中导致内存安全违规。消毒器可以在运行时捕获此类内存错误,但即使对于由Rust类型系统保证安全的内存访问,也会引入许多不必要的检查。我们介绍了SafeFFI,一个用于优化Rust二进制文件中内存安全插桩的系统,使得检查发生在不安全代码与安全代码之间的边界处,将内存安全的执行从消毒器移交给Rust类型系统。与以往的方法不同,我们的设计避免了昂贵的全程序分析,并大大减少了编译时开销(2.64倍,相比之下超过8.83倍)。在一系列流行的Rust crate和已知易受攻击的Rust代码上,SafeFFI与最先进的系统相比实现了优越的性能,将消毒器检查减少了高达98%,同时保持正确性并标记所有空间和时间内存安全违规。

英文摘要:

Unsafe Rust code is necessary for interoperability with C/C++ libraries and implementing low-level data structures, but it can cause memory safety violations in otherwise memory-safe Rust programs. Sanitizers can catch such memory errors at runtime, but introduce many unnecessary checks even for memory accesses guaranteed safe by the Rust type system. We introduce SafeFFI, a system for optimizing memory safety instrumentation in Rust binaries such that checks occur at the boundary between unsafe and safe code, handing over the enforcement of memory safety from the sanitizer to the Rust type system. Unlike previous approaches, our design avoids expensive whole-program analysis and adds much less compile-time overhead (2.64x compared to over 8.83x). On a collection of popular Rust crates and known vulnerable Rust code, SafeFFI achieves superior performance compared to state-of-the-art systems, reducing sanitizer checks by up to 98%, while maintaining correctness and flagging all spatial and temporal memory safety violations.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑