-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate use of parameters in naked functions #79411
Conversation
* Reject use of parameters inside naked function body. * Reject use of patterns inside function parameters, to emphasize role of parameters a signature declaration (mirroring existing behaviour for function declarations) and avoid generating code introducing specified bindings.
r? @lcnr (rust-highfive has picked a reviewer for you, use r? to override) |
impl looks good, don't know enough about how maybe r? @bjorn3 as they get recommended by github? |
The overall direction of this changes is to constrain the use of naked functions towards cases that can be reliably supported. The next step would be to permit only assembly inside the naked functions. |
I probably got recommended as I recently changed
Maybe it should be allowed for
Makes sense. |
No, you're supposed to access parameters directly through registers or the stack based on the function ABI. |
Should we consider adding additional checks to this pass, such as the requirement that a naked function only contain a single |
Yes, I think we should have additional checks along those lines. I didn't think through all the details to propose one yet. There is also a question of compatibility with |
@bors r+ |
📌 Commit 22d3431 has been approved by |
☀️ Test successful - checks-actions |
Validate naked functions definitions Validate that naked functions are defined in terms of a single inline assembly block that uses only `const` and `sym` operands and has `noreturn` option. Implemented as future incompatibility lint with intention to migrate it into hard error. When it becomes a hard error it will ensure that naked functions are either unsafe or contain an unsafe block around the inline assembly. It will guarantee that naked functions do not reference functions parameters (obsoleting part of existing checks from rust-lang#79411). It will limit the definitions of naked functions to what can be reliably supported. It will also reject naked functions implemented using legacy LLVM style assembly since it cannot satisfy those conditions. rust-lang/rfcs#2774 rust-lang/rfcs#2972
of parameters a signature declaration (mirroring existing behaviour
for function declarations) and avoid generating code introducing
specified bindings.
Closes issues below by considering input to be ill-formed.
Closes #75922.
Closes #77848.
Closes #79350.