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

Restore aliasing rules in BPF loader. #27752

Conversation

Lichtso
Copy link
Contributor

@Lichtso Lichtso commented Sep 13, 2022

Problem

The refactoring in #24381 overlooked statements in which the keyed_account.try_account_ref_mut() expression stayed borrowed while another account is being accessed. This caused some aliasing restrictions to be effectively lifted and broke consensus.

Summary of Changes

Restores the following aliasing restrictions of as they were in 1.10.

  • UpgradableLoaderInstruction::DeployWithMaxDataLen: buffer != payer
  • UpgradableLoaderInstruction::Upgrade: buffer != spill, programdata != spill
  • UpgradableLoaderInstruction::Close: close != recipient

Fixes #27740

@Lichtso Lichtso added the v1.14 label Sep 13, 2022
@mvines
Copy link
Member

mvines commented Sep 13, 2022

The change as is runs the risk of breaking testnet consensus as nodes upgrade to the new v1.11/v1.14 version that contains this fix. I think this risk is ok and an opportunity to practice a testnet restart.

When this happens, we'll just need to get all testnet nodes not running this patch to upgrade as a part of their restart

@Lichtso Lichtso merged commit c9eac2e into solana-labs:master Sep 13, 2022
@Lichtso Lichtso deleted the fix/restore_aliasing_rules_of_keyed_account branch September 13, 2022 17:58
mergify bot pushed a commit that referenced this pull request Sep 13, 2022
mergify bot added a commit that referenced this pull request Sep 13, 2022
Restore aliasing rules in BPF loader. (#27752)

(cherry picked from commit c9eac2e)

Co-authored-by: Alexander Meißner <AlexanderMeissner@gmx.net>
Lichtso added a commit that referenced this pull request Sep 16, 2022
Adds tests for the two account aliasing restrictions of UpgradeableLoaderInstruction::Upgrade which can be triggered.
jeffwashington pushed a commit to jeffwashington/solana that referenced this pull request Sep 26, 2022
…olana-labs#27760)

Restore aliasing rules in BPF loader. (solana-labs#27752)

(cherry picked from commit c9eac2e)

Co-authored-by: Alexander Meißner <AlexanderMeissner@gmx.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consensus (bank hash) mismatch between v1.10 and v1.11/master (mainnet)
2 participants