Skip to content
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

Don't leak return value after panic in drop #78373

Merged
merged 3 commits into from
Dec 5, 2020

Conversation

matthewjasper
Copy link
Contributor

@matthewjasper matthewjasper commented Oct 25, 2020

Closes #47949

@rust-highfive
Copy link
Collaborator

r? @davidtwco

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 25, 2020
@matthewjasper
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Contributor

bors commented Oct 26, 2020

⌛ Trying commit 7acf3f1b0d7330edcc908662e170dd6182074f8f with merge d610dce8ea41761b41e03160a39fca995dea0df5...

@bors
Copy link
Contributor

bors commented Oct 26, 2020

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

@rust-timer
Copy link
Collaborator

Queued d610dce8ea41761b41e03160a39fca995dea0df5 with parent b9a94c9, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (d610dce8ea41761b41e03160a39fca995dea0df5): comparison url.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying rollup- to bors.

Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up.

@bors rollup=never

@Mark-Simulacrum
Copy link
Member

Since this adds code, I suspect it's always going to be a regression. I would ignore the incremental benchmarks here, which brings us down to roughly 5% regression on real world codebases. I think given this is a soundness fix (at least arguably) and certainly unintuitive behavior, we should land this (modulo review of the diff itself, which I have not done).

Copy link
Member

@davidtwco davidtwco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsure if this is still only intended for checking perf, but LGTM; someone else should also take a look though.

@davidtwco
Copy link
Member

r? @pnkfelix

@rust-highfive rust-highfive assigned pnkfelix and unassigned davidtwco Oct 29, 2020
@pnkfelix pnkfelix added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. I-nominated labels Nov 13, 2020
@pnkfelix
Copy link
Member

nominating for discussion at next T-compiler triage meeting.

I am inclined to swallow the compiler performance regression, but I figure we will be better off talking about it as a team. Also, I think it will be best to land this early in the release cycle, i.e. soon after the next beta is cut.

  • I know it is a soundness fix, which we would normally prioritize, but I would rather take a little bit more time landing this, and potentially beta-backporting it, than have to deal with reverting it from beta later.

@pnkfelix pnkfelix added S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 13, 2020
@pnkfelix
Copy link
Member

@bors r+ rollup=never

@bors
Copy link
Contributor

bors commented Nov 19, 2020

📌 Commit 7acf3f1b0d7330edcc908662e170dd6182074f8f has been approved by pnkfelix

@bors 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-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). labels Nov 19, 2020
@bors
Copy link
Contributor

bors commented Nov 20, 2020

🔒 Merge conflict

This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again.

How do I rebase?

Assuming self is your fork and upstream is this repository, you can resolve the conflict following these steps:

  1. git checkout drop-on-into (switch to your branch)
  2. git fetch upstream master (retrieve the latest master)
  3. git rebase upstream/master -p (rebase on top of it)
  4. Follow the on-screen instruction to resolve conflicts (check git status if you got lost).
  5. git push self drop-on-into --force-with-lease (update this PR)

You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial.

Please avoid the "Resolve conflicts" button on GitHub. It uses git merge instead of git rebase which makes the PR commit history more difficult to read.

Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Cargo.lock conflict is handled during merge and rebase. This is normal, and you should still perform step 5 to update this PR.

Error message
Auto-merging compiler/rustc_mir_build/src/build/scope.rs
CONFLICT (content): Merge conflict in compiler/rustc_mir_build/src/build/scope.rs
Auto-merging compiler/rustc_mir_build/src/build/mod.rs
Auto-merging compiler/rustc_mir_build/src/build/matches/mod.rs
CONFLICT (content): Merge conflict in compiler/rustc_mir_build/src/build/matches/mod.rs
Auto-merging compiler/rustc_mir_build/src/build/expr/into.rs
Auto-merging compiler/rustc_mir_build/src/build/expr/as_rvalue.rs
Automatic merge failed; fix conflicts and then commit the result.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 20, 2020
@matthewjasper matthewjasper force-pushed the drop-on-into branch 2 times, most recently from 27e434f to 5e71b80 Compare November 26, 2020 19:49
@matthewjasper
Copy link
Contributor Author

@bors r=pnkfelix

@matthewjasper
Copy link
Contributor Author

@bors r=pnkfelix

@bors
Copy link
Contributor

bors commented Dec 5, 2020

📌 Commit 4fef391 has been approved by pnkfelix

@bors
Copy link
Contributor

bors commented Dec 5, 2020

🌲 The tree is currently closed for pull requests below priority 100, this pull request will be tested once the tree is reopened

@bors 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 5, 2020
@bors
Copy link
Contributor

bors commented Dec 5, 2020

⌛ Testing commit 4fef391 with merge 9122b76...

@bors
Copy link
Contributor

bors commented Dec 5, 2020

☀️ Test successful - checks-actions
Approved by: pnkfelix
Pushing 9122b76 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 5, 2020
@bors bors merged commit 9122b76 into rust-lang:master Dec 5, 2020
@rustbot rustbot added this to the 1.50.0 milestone Dec 5, 2020
@bors bors mentioned this pull request Dec 5, 2020
3 tasks
@matthewjasper matthewjasper deleted the drop-on-into branch December 6, 2020 19:20
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 5, 2021
…ution-via-revert-of-pr-78373, r=matthewjasper

Revert 78373 ("dont leak return value after panic in drop")

Short term resolution for issue rust-lang#80949.

Reopen rust-lang#47949 after this lands.

(We plan to fine-tune PR rust-lang#78373 to not run into this problem.)
ehuss pushed a commit to ehuss/rust that referenced this pull request Feb 5, 2021
…ution-via-revert-of-pr-78373, r=matthewjasper

Revert 78373 ("dont leak return value after panic in drop")

Short term resolution for issue rust-lang#80949.

Reopen rust-lang#47949 after this lands.

(We plan to fine-tune PR rust-lang#78373 to not run into this problem.)
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 4, 2024
Fix leaks from panics in destructors

Resurrects rust-lang#78373.

This avoids the problem with rust-lang#80949 by not unscheduling drops of function arguments until after the call (so they still get a drop terminator on the function unwind path).

Closes rust-lang#47949

r? `@lcnr`
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 14, 2024
Fix leaks from panics in destructors

Resurrects rust-lang#78373.

This avoids the problem with rust-lang#80949 by not unscheduling drops of function arguments until after the call (so they still get a drop terminator on the function unwind path).

Closes rust-lang#47949

r? `@lcnr`
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 20, 2024
Fix leaks from panics in destructors

Resurrects rust-lang#78373.

This avoids the problem with rust-lang#80949 by not unscheduling drops of function arguments until after the call (so they still get a drop terminator on the function unwind path).

Closes rust-lang#47949

r? `@lcnr`
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 26, 2024
Fix leaks from panics in destructors

Resurrects rust-lang#78373.

This avoids the problem with rust-lang#80949 by not unscheduling drops of function arguments until after the call (so they still get a drop terminator on the function unwind path).

Closes rust-lang#47949

r? `@lcnr`
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 15, 2024
Fix leaks from panics in destructors

Resurrects rust-lang#78373.

This avoids the problem with rust-lang#80949 by not unscheduling drops of function arguments until after the call (so they still get a drop terminator on the function unwind path).

Closes rust-lang#47949

r? `@lcnr`
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. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panics in destructors can cause the return value to be leaked