-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Fix misaligned loads when loading UEFI arg pointers #122164
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rustbot
added
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Mar 8, 2024
r? compiler |
@beetrees Thoughts on this versus simply making the ptr reads a |
@workingjubilee I did consider using |
sgtm. @Ayush1325 sorry for not catching this. @bors r+ rollup |
bors
added
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
Mar 8, 2024
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 8, 2024
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#121201 (align_offset, align_to: no longer allow implementations to spuriously fail to align) - rust-lang#122076 (Tweak the way we protect in-place function arguments in interpreters) - rust-lang#122100 (Better comment for implicit captures in RPITIT) - rust-lang#122157 (Add the new description field to Target::to_json, and add descriptions for some MSVC targets) - rust-lang#122164 (Fix misaligned loads when loading UEFI arg pointers) - rust-lang#122171 (Add some new solver tests) - rust-lang#122172 (Don't ICE if we collect no RPITITs unless there are no unification errors) - rust-lang#122197 (inspect formatter: add braces) - rust-lang#122198 (Remove handling for previously dropped LLVM version) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 8, 2024
Rollup merge of rust-lang#122164 - beetrees:uefi-argv-align, r=workingjubilee Fix misaligned loads when loading UEFI arg pointers Currently, the two UEFI argument pointers are stored in an `alloca` of alignment 1, a pointer to which is then passed as `argv`. However, [the library code](https://github.com/rust-lang/rust/blob/9c3ad802d9b9633d60d3a74668eb1be819212d34/library/std/src/sys/pal/uefi/mod.rs#L60-L61) treats `argv` as a pointer to an array of pointers and dereferences it as such, meaning that it presumes the `alloca` is aligned to at least the alignment of a pointer. This PR fixes this mismatch by aligning the `alloca` to the alignment of a pointer. This PR also changed the `gep` to use the new `inbounds_ptradd` method.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, the two UEFI argument pointers are stored in an
alloca
of alignment 1, a pointer to which is then passed asargv
. However, the library code treatsargv
as a pointer to an array of pointers and dereferences it as such, meaning that it presumes thealloca
is aligned to at least the alignment of a pointer. This PR fixes this mismatch by aligning thealloca
to the alignment of a pointer.This PR also changed the
gep
to use the newinbounds_ptradd
method.