Skip to content

Insert alignment checks for pointer dereferences when debug assertions are enabled#98112

Merged
bors merged 8 commits intorust-lang:masterfrom
saethlin:mir-alignment-checks
Mar 31, 2023
Merged

Insert alignment checks for pointer dereferences when debug assertions are enabled#98112
bors merged 8 commits intorust-lang:masterfrom
saethlin:mir-alignment-checks

Conversation

@saethlin
Copy link
Member

@saethlin saethlin commented Jun 14, 2022

Closes #54915

  • Jake tells me this sounds like a place to use MirPatch, but I can't figure out how to insert a new basic block with a new terminator in the middle of an existing basic block, using MirPatch. (if nobody else backs up this point I'm checking this as "not actually a good idea" because the code looks pretty clean to me after rearranging it a bit)
  • Using CastKind::PointerExposeAddress is definitely wrong, we don't want to expose. Calling a function to get the pointer address seems quite excessive. I'll see if I can add a new CastKind. CastKind::Transmute to the rescue!
  • Implement a more helpful panic message like slice bounds checking.

r? @oli-obk

@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jun 14, 2022
@saethlin saethlin force-pushed the mir-alignment-checks branch from f6d745b to b8965f5 Compare June 14, 2022 21:44
@rust-log-analyzer

This comment has been minimized.

@saethlin saethlin force-pushed the mir-alignment-checks branch from b8965f5 to 9f36630 Compare June 16, 2022 04:23
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Jun 30, 2022

☔ The latest upstream changes (presumably #98649) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 30, 2022
@saethlin saethlin force-pushed the mir-alignment-checks branch from 9f36630 to caf7082 Compare July 3, 2022 04:01
@rustbot
Copy link
Collaborator

rustbot commented Jul 3, 2022

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

This PR changes MIR

cc @oli-obk, @RalfJung, @JakobDegen, @davidtwco, @celinval

@saethlin
Copy link
Member Author

saethlin commented Jul 3, 2022

Oh heck I did not need everyone to be summoned like this

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Jul 6, 2022

☔ The latest upstream changes (presumably #98206) made this pull request unmergeable. Please resolve the merge conflicts.

@saethlin saethlin force-pushed the mir-alignment-checks branch from caf7082 to 54eb093 Compare July 9, 2022 20:57
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Sep 15, 2022

☔ The latest upstream changes (presumably #101858) made this pull request unmergeable. Please resolve the merge conflicts.

@saethlin saethlin force-pushed the mir-alignment-checks branch from 54eb093 to a878c4a Compare September 15, 2022 21:52
@rust-log-analyzer

This comment has been minimized.

@saethlin saethlin force-pushed the mir-alignment-checks branch from a878c4a to 6f8274c Compare November 9, 2022 15:30
@rust-log-analyzer

This comment has been minimized.

@saethlin saethlin force-pushed the mir-alignment-checks branch 2 times, most recently from f700f3b to be80cb2 Compare November 9, 2022 23:42
@rust-log-analyzer

This comment has been minimized.

@oli-obk
Copy link
Contributor

oli-obk commented Nov 10, 2022

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 10, 2022
@bors
Copy link
Collaborator

bors commented Nov 10, 2022

⌛ Trying commit be80cb2b565657734acfd69f75331a1d8200d517 with merge 64fdee20bfba2e2033f0df0374119c0461ae4d2e...

@bors
Copy link
Collaborator

bors commented Nov 10, 2022

☀️ Try build successful - checks-actions
Build commit: 64fdee20bfba2e2033f0df0374119c0461ae4d2e (64fdee20bfba2e2033f0df0374119c0461ae4d2e)

@saethlin saethlin mentioned this pull request May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. relnotes Marks issues that should be documented in the release notes of the next release. 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. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check alignment of raw pointers in debug mode