Safe Rust guarantees memory safety through strict compile-time constraints: ownership can be transferred, borrowing can temporarily guarantee either shared read-only or exclusive write access, and ownership and borrowing are scoped by lifetime. Automatically synthesizing correct and safe Rust code is challenging, as the generated code must not only satisfy ownership, borrowing, and lifetime constraints, but also meet type and interface requirements at compile time. This work proposes a synthesis method based on our newly defined Pushdown Colored Petri Net (PCPN) that models these compilation constraints directly from public API signatures to synthesize valid call sequences. Token colors encode dynamic resource states together with a scope level indicating the lifetime region in which a borrow is valid. The pushdown stack tracks the entering or leaving of lifetime parameter via pushing and popping tokens. A transition is enabled only when type matching and interface obligations both hold and the required resource states are available. Based on the bisimulation theory, we prove that the enabling and firing rules of PCPN are consistent with the compile-time check of these three constraints. We develop an automatic synthesis tool based on PCPN and the experimental results show that the synthesized codes are all correct.


翻译:安全Rust通过严格的编译时约束保证内存安全性:所有权可被转移,借用可临时保证只读共享或独占写访问,且所有权和借用由生命周期限定范围。自动合成正确且安全的Rust代码极具挑战性,因为生成的代码不仅必须满足所有权、借用和生命周期约束,还必须在编译时满足类型及接口要求。本文提出一种基于新定义的下推着色Petri网(PCPN)的合成方法,该方法直接从公共API签名对这些编译约束进行建模,以合成有效调用序列。令牌颜色编码动态资源状态,同时包含指示借用有效生命周期区域的层级范围。下推栈通过推入和弹出令牌来跟踪生命周期参数的进入或退出。仅当类型匹配与接口义务均满足且所需资源状态可用时,变迁才可被启用。基于互模拟理论,我们证明PCPN的启用与触发规则与这三类约束的编译时检查一致。我们开发了基于PCPN的自动合成工具,实验结果表明合成代码均正确无误。

0
下载
关闭预览

相关内容

美AI公司Anthropic推出网络安全模型“Mythos”
专知会员服务
11+阅读 · 4月18日
《信息安全技术边缘计算安全技术要求》国家标准意见稿
专知会员服务
16+阅读 · 2021年1月23日
社区分享 | 在 Windows 下编译和使用 TensorFlow Lite
最全推荐系统Embedding召回算法总结
凡人机器学习
30+阅读 · 2020年7月5日
微信小程序支持webP的WebAssembly方案
前端之巅
19+阅读 · 2019年8月14日
Fully-Convolutional Siamese Networks for Object Tracking论文笔记
统计学习与视觉计算组
10+阅读 · 2018年10月12日
推荐中的序列化建模:Session-based neural recommendation
机器学习研究会
18+阅读 · 2017年11月5日
网络安全态势感知浅析
计算机与网络安全
18+阅读 · 2017年10月13日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
19+阅读 · 2015年12月31日
国家自然科学基金
20+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
VIP会员
最新内容
ICML 2026 | CFPO:用反事实策略优化提升多模态推理
专知会员服务
1+阅读 · 今天14:45
综述 | 世界动作模型:少做梦,多行动
专知会员服务
1+阅读 · 今天14:43
美以伊冲突:无人机与人工智能的运用
专知会员服务
3+阅读 · 今天14:31
《特种部队在透明战场中的生存力》最新报告
专知会员服务
2+阅读 · 今天14:11
《人工智能生成的零日漏洞:对未来作战的影响》
综述 | 3D场景图:开放挑战与未来方向
专知会员服务
8+阅读 · 6月22日
21世纪的无人机战争
专知会员服务
4+阅读 · 6月22日
《量子技术的军事任务技术适配与利用》
专知会员服务
5+阅读 · 6月22日
相关VIP内容
美AI公司Anthropic推出网络安全模型“Mythos”
专知会员服务
11+阅读 · 4月18日
《信息安全技术边缘计算安全技术要求》国家标准意见稿
专知会员服务
16+阅读 · 2021年1月23日
相关资讯
社区分享 | 在 Windows 下编译和使用 TensorFlow Lite
最全推荐系统Embedding召回算法总结
凡人机器学习
30+阅读 · 2020年7月5日
微信小程序支持webP的WebAssembly方案
前端之巅
19+阅读 · 2019年8月14日
Fully-Convolutional Siamese Networks for Object Tracking论文笔记
统计学习与视觉计算组
10+阅读 · 2018年10月12日
推荐中的序列化建模:Session-based neural recommendation
机器学习研究会
18+阅读 · 2017年11月5日
网络安全态势感知浅析
计算机与网络安全
18+阅读 · 2017年10月13日
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
19+阅读 · 2015年12月31日
国家自然科学基金
20+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员