Declare "trivial ABI" arguments as entirely irrelevant for the ABI?
还没有人认领这个 Issue。
评估
调研方向
Read the ABI compatibility rules introduced by rust-lang/rust#157973, then trace how PassMode::Ignore appears in generated LLVM IR and how captureless closures become function pointers. Compare the proposed general trivial-ABI filtering with Miri's current special case and the stated CFI considerations. Done means the compatibility rule and its implications are agreed and documented.
由索引模型根据 Issue 内容生成。
描述
https://github.com/rust-lang/rust/pull/157973 will hopefully soon land, fixing our current ABI compatibility rules. As part of that we are introducing a new concept, that of types with "trivial ABI".
This provides a nice opportunity to go further: we could declare that arguments with "trivial ABI" can be entirely filtered out of the signature before comparing the caller and callee view of the call. So for instance, the caller could use signature fn(i32, ()) and the callee could use fn(MyZst, i32), and we'd still consider this to be ABI-compatible.
I think this has several benefits:
- It is already how the compiler works: arguments with
PassMode::Ignoreat not even present in the generated LLVM IR, and "trivial ABI" is pretty much the surface level term for "types that are guaranteed to usePassMode::Ignore". We are therefore not making any assumptions about what LLVM does here, or about any target-specific ABIs; we are only making promises about things that are fully under the contol of rustc. "Trivial ABI" is also carefully designed to only apply to types that are "owned" by Rust, i.e., we are fully in control of what we want their ABI to be. - The compiler in fact already internally relies on this when turning a captureless closure into a function pointer: the underlying function has type
fn(self, args...) -> retbut the function pointer has typefn(args...) -> ret. This works becauseselfof a captureless closure has trivial ABI. But because we don't have a general rule for this, we currently need awkward special reasoning in the compiler that relies on this, and awkward special treatment in Miri to allow this special case without allowing the general case. - It is something people already often assume to be true, and it's good to align reality with people's expectations if we can cheaply do so.
Given that these arguments are already not present in LLVM, I think this is also fine from a CFI perspective (Cc @Darksonn @rcvalle) -- the sanitizer already today doesn't even know that these arguments exist.
- 主要语言
- 没有语言数据
- 星标
- 760
- 派生
- 68
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
rust-lang/unsafe-code-guidelines 的其他 Issue
-
I-opsem-nominated
难度 4/5 3-5 天 新手友好度 35/100
rust-lang/unsafe-code-guidelines#634 · 5 条评论 ·
-
难度 5/5 一周以上 新手友好度 15/100
-
难度 5/5 一周以上 新手友好度 12/100
rust-lang/unsafe-code-guidelines#632 · 8 条评论 · 1 个 reaction ·
-
难度 5/5 一周以上 新手友好度 10/100
rust-lang/unsafe-code-guidelines#631 · 7 条评论 ·
-
I-opsem-nominated
难度 5/5 一周以上 新手友好度 20/100
rust-lang/unsafe-code-guidelines#630 · 1 个 reaction ·
查看 rust-lang/unsafe-code-guidelines 的全部 Issue
相似的 Issue
-
bug core-lang
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
Call-argument syntax diagnostic needs example spacing and removal of confusing trailing sentence未关闭
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
mw00/project-maya#1368 ·
维护者通常 2 天内回复
-
test(bind-json): legacy Solidity fixture requires an unavailable solc on Linux ARM64可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
foundry-rs/foundry#18828 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复