-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Closed
Copy link
Labels
A-ABIArea: Concerning the application binary interface (ABI)Area: Concerning the application binary interface (ABI)C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Consider the following code:
trait T {
extern "amdgpu-kernel" fn mu();
}
type TAU = extern "amdgpu-kernel" fn();
The check_abi
function…
rust/compiler/rustc_typeck/src/check/check.rs
Lines 37 to 59 in 0a8629b
pub(super) fn check_abi(tcx: TyCtxt<'_>, span: Span, abi: Abi) { | |
if !tcx.sess.target.is_abi_supported(abi) { | |
struct_span_err!( | |
tcx.sess, | |
span, | |
E0570, | |
"The ABI `{}` is not supported for the current target", | |
abi | |
) | |
.emit() | |
} | |
// This ABI is only allowed on function pointers | |
if abi == Abi::CCmseNonSecureCall { | |
struct_span_err!( | |
tcx.sess, | |
span, | |
E0781, | |
"the `\"C-cmse-nonsecure-call\"` ABI is only allowed on function pointers." | |
) | |
.emit() | |
} | |
} |
… is not called for the following two ABI lines, meaning that the checks present therein do not activate, potentially allowing circumvention of the checks this function implements. In particular one thing that is allowed is taking the TAU
function pointer as an argument and calling it on architectures where this ABI is unsupported.
This becomes especially relevant after #86231 lands.
Metadata
Metadata
Assignees
Labels
A-ABIArea: Concerning the application binary interface (ABI)Area: Concerning the application binary interface (ABI)C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.