-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed
Labels
-Zrandomize-layoutUnstable option: Randomize the layout of types.Unstable option: Randomize the layout of types.A-layoutArea: Memory layout of typesArea: Memory layout of typesC-feature-acceptedCategory: A feature request that has been accepted pending implementation.Category: A feature request that has been accepted pending implementation.C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.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
In order to better detect code that rely on unspecified behavior related to memory layout, it could be useful to have a -Zrandomize-layout flag that add some padding bytes at the start of all #[repr(rust)] structs and unions. It should also add different amounts of padding to different fields.
This should help detecting invalid transmutes, or invalid unions.
the8472, Aaron1011, jyn514 and Kobzol
Metadata
Metadata
Assignees
Labels
-Zrandomize-layoutUnstable option: Randomize the layout of types.Unstable option: Randomize the layout of types.A-layoutArea: Memory layout of typesArea: Memory layout of typesC-feature-acceptedCategory: A feature request that has been accepted pending implementation.Category: A feature request that has been accepted pending implementation.C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.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.