Skip to content

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

Merged
bors merged 8 commits into
rust-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 into
rust-lang:masterfrom
saethlin:mir-alignment-checks

Conversation

@saethlin

@saethlinsaethlin commented Jun 14, 2022

Copy link
Copy Markdown
Member

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

@rustbotrustbot 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
saethlinforce-pushed the mir-alignment-checks branch from f6d745b to b8965f5CompareJune 14, 2022 21:44
@rust-log-analyzer

This comment has been minimized.

@saethlin
saethlinforce-pushed the mir-alignment-checks branch from b8965f5 to 9f36630CompareJune 16, 2022 04:23
@rust-log-analyzer

This comment has been minimized.

@bors

bors commented Jun 30, 2022

Copy link
Copy Markdown
Collaborator

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

@borsbors 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
saethlinforce-pushed the mir-alignment-checks branch from 9f36630 to caf7082CompareJuly 3, 2022 04:01
@rustbot

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
MemberAuthor

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

@rust-log-analyzer

This comment has been minimized.

@bors

bors commented Jul 6, 2022

Copy link
Copy Markdown
Collaborator

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

@saethlin
saethlinforce-pushed the mir-alignment-checks branch from caf7082 to 54eb093CompareJuly 9, 2022 20:57
@rust-log-analyzer

This comment has been minimized.

@bors

bors commented Sep 15, 2022

Copy link
Copy Markdown
Collaborator

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

@rust-log-analyzer

This comment has been minimized.

@saethlin
saethlinforce-pushed the mir-alignment-checks branch from a878c4a to 6f8274cCompareNovember 9, 2022 15:30
@rust-log-analyzer

This comment has been minimized.

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

This comment has been minimized.

@oli-obk

Copy link
Copy Markdown
Contributor

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

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

bors commented Nov 10, 2022

Copy link
Copy Markdown
Collaborator

⌛ Trying commit be80cb2b565657734acfd69f75331a1d8200d517 with merge 64fdee20bfba2e2033f0df0374119c0461ae4d2e...

@bors

bors commented Nov 10, 2022

Copy link
Copy Markdown
Collaborator

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

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-borsThis PR was explicitly merged by bors.perf-regressionPerformance regression.perf-regression-triagedThe performance regression has been triaged.relnotesMarks issues that should be documented in the release notes of the next release.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-libsRelevant 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

14 participants

@saethlin@rust-log-analyzer@bors@rustbot@oli-obk@rust-timer@Mark-Simulacrum@the8472@RalfJung@ehuss@jyn514@thomcc@nbdd0121@scottmcm